|
|
@@ -14,6 +14,7 @@ import java.util.List;
|
|
|
|
|
|
import kr.co.zumo.app.R;
|
|
|
import kr.co.zumo.app.lifeplus.bean.FilterBean;
|
|
|
+import kr.co.zumo.app.lifeplus.view.Event;
|
|
|
import kr.co.zumo.app.lifeplus.view.custom.CustomSquareCheckBox;
|
|
|
|
|
|
/**
|
|
|
@@ -35,6 +36,12 @@ public class CategoryFirstMainFilterDialog extends DialogBase {
|
|
|
private static final int CATEGORY_FOURTH_ID = 3;
|
|
|
private static final int CATEGORY_FIFTH_ID = 4;
|
|
|
|
|
|
+ private ArrayList<CustomSquareCheckBox> firstCategoryCheckboxList;
|
|
|
+ private ArrayList<CustomSquareCheckBox> secondCategoryCheckboxList;
|
|
|
+ private ArrayList<CustomSquareCheckBox> thirdCategoryCheckBoxList;
|
|
|
+ private ArrayList<CustomSquareCheckBox> fourthCategoryCheckBoxList;
|
|
|
+ private CustomSquareCheckBox fifthCategoryCheckBox;
|
|
|
+
|
|
|
private List<FilterBean> data;
|
|
|
|
|
|
@Nullable
|
|
|
@@ -43,86 +50,67 @@ public class CategoryFirstMainFilterDialog extends DialogBase {
|
|
|
return inflater.inflate(R.layout.dialog_category_first_main, container, false);
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void onActivityCreated(Bundle savedInstanceState) {
|
|
|
- super.onActivityCreated(savedInstanceState);
|
|
|
- //Full Screen dialog
|
|
|
- Window window = getDialog().getWindow();
|
|
|
- window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
|
|
+ @Override
|
|
|
+ public void onActivityCreated(Bundle savedInstanceState) {
|
|
|
+ super.onActivityCreated(savedInstanceState);
|
|
|
+ //Full Screen dialog
|
|
|
+ Window window = getDialog().getWindow();
|
|
|
+ window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
|
|
|
|
|
+ init();
|
|
|
|
|
|
- getView().findViewById(R.id.image_view_cancel_main).setOnClickListener(view -> {
|
|
|
+ getView().findViewById(R.id.image_view_cancel_main).setOnClickListener(view -> {
|
|
|
if (null != getResultListener()) {
|
|
|
getResultListener().onDialogCanceled(CategoryFirstMainFilterDialog.this);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ getView().findViewById(R.id.text_view_reset).setOnClickListener(view -> {
|
|
|
+ if (null != getResultListener()) {
|
|
|
+ reset();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
getView().findViewById(R.id.text_view_show_contents).setOnClickListener(view -> {
|
|
|
if (null != getResultListener()) {
|
|
|
- init();
|
|
|
+ // TODO: data 생성
|
|
|
+ loadData();
|
|
|
+ getResultListener().onDialogResult(this, new Event.Builder(Event.CONFIRM).build());
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 선택된 필터 value 값을 가지고 온다.
|
|
|
- */
|
|
|
- private void init() {
|
|
|
-
|
|
|
- data = new ArrayList<>();
|
|
|
- ArrayList<CustomSquareCheckBox> firstCategoryCheckboxList = new ArrayList<>();
|
|
|
|
|
|
+ private void init() {
|
|
|
//주말 활동
|
|
|
+ firstCategoryCheckboxList = new ArrayList<>();
|
|
|
firstCategoryCheckboxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_first_check_1)));
|
|
|
firstCategoryCheckboxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_first_check_2)));
|
|
|
firstCategoryCheckboxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_first_check_3)));
|
|
|
firstCategoryCheckboxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_first_check_4)));
|
|
|
firstCategoryCheckboxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_first_check_5)));
|
|
|
|
|
|
- for (int i = 0; i < firstCategoryCheckboxList.size(); ++i) {
|
|
|
- CustomSquareCheckBox firstCategoryCheckBox = firstCategoryCheckboxList.get(i);
|
|
|
- if (firstCategoryCheckBox.isChecked()) {
|
|
|
- data.add(new FilterBean(CATEGORY_FIRST_ID, i));
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
//동반 유형
|
|
|
- ArrayList<CustomSquareCheckBox> secondCategoryCheckboxList = new ArrayList<>();
|
|
|
+ secondCategoryCheckboxList = new ArrayList<>();
|
|
|
secondCategoryCheckboxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_second_check_1)));
|
|
|
secondCategoryCheckboxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_second_check_2)));
|
|
|
secondCategoryCheckboxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_second_check_3)));
|
|
|
secondCategoryCheckboxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_second_check_4)));
|
|
|
|
|
|
- for (int i = 0; i < secondCategoryCheckboxList.size(); ++i) {
|
|
|
- CustomSquareCheckBox secondCategoryCheckBox = secondCategoryCheckboxList.get(i);
|
|
|
- if (secondCategoryCheckBox.isChecked()) {
|
|
|
- data.add(new FilterBean(CATEGORY_SECOND_ID, i));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
//지역
|
|
|
- ArrayList<CustomSquareCheckBox> thirdCategoryCheckBoxList= new ArrayList<>();
|
|
|
+ thirdCategoryCheckBoxList = new ArrayList<>();
|
|
|
thirdCategoryCheckBoxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_third_check_1)));
|
|
|
thirdCategoryCheckBoxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_third_check_2)));
|
|
|
thirdCategoryCheckBoxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_third_check_3)));
|
|
|
thirdCategoryCheckBoxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_third_check_4)));
|
|
|
thirdCategoryCheckBoxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_third_check_5)));
|
|
|
thirdCategoryCheckBoxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_third_check_6)));
|
|
|
- for(int i = 0; i<thirdCategoryCheckBoxList.size(); ++i){
|
|
|
- CustomSquareCheckBox thirdCategoryCheckBox = thirdCategoryCheckBoxList.get(i);
|
|
|
- if(thirdCategoryCheckBox.isChecked()){
|
|
|
- data.add(new FilterBean(CATEGORY_THIRD_ID, i));
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
//활동상황
|
|
|
-
|
|
|
- ArrayList<CustomSquareCheckBox> fourthCategoryCheckBoxList = new ArrayList<>();
|
|
|
+ fourthCategoryCheckBoxList = new ArrayList<>();
|
|
|
fourthCategoryCheckBoxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_fourth_check_1)));
|
|
|
fourthCategoryCheckBoxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_fourth_check_2)));
|
|
|
fourthCategoryCheckBoxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_fourth_check_3)));
|
|
|
@@ -131,21 +119,65 @@ public class CategoryFirstMainFilterDialog extends DialogBase {
|
|
|
fourthCategoryCheckBoxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_fourth_check_6)));
|
|
|
fourthCategoryCheckBoxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_fourth_check_7)));
|
|
|
|
|
|
+ //주차여부
|
|
|
+ fifthCategoryCheckBox = ((CustomSquareCheckBox) getView().findViewById(R.id.filter_fifth_check_1));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 선택된 필터 value 값을 가지고 온다.
|
|
|
+ */
|
|
|
+ private void loadData() {
|
|
|
+
|
|
|
+ data = new ArrayList<>();
|
|
|
+ for (int i = 0; i < firstCategoryCheckboxList.size(); ++i) {
|
|
|
+ CustomSquareCheckBox firstCategoryCheckBox = firstCategoryCheckboxList.get(i);
|
|
|
+ if (firstCategoryCheckBox.isChecked()) {
|
|
|
+ data.add(new FilterBean(CATEGORY_FIRST_ID, i));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < secondCategoryCheckboxList.size(); ++i) {
|
|
|
+ CustomSquareCheckBox secondCategoryCheckBox = secondCategoryCheckboxList.get(i);
|
|
|
+ if (secondCategoryCheckBox.isChecked()) {
|
|
|
+ data.add(new FilterBean(CATEGORY_SECOND_ID, i));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < thirdCategoryCheckBoxList.size(); ++i) {
|
|
|
+ CustomSquareCheckBox thirdCategoryCheckBox = thirdCategoryCheckBoxList.get(i);
|
|
|
+ if (thirdCategoryCheckBox.isChecked()) {
|
|
|
+ data.add(new FilterBean(CATEGORY_THIRD_ID, i));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
for (int i = 0; i < fourthCategoryCheckBoxList.size(); ++i) {
|
|
|
- CustomSquareCheckBox fourthCategoryCheckBox = fourthCategoryCheckBoxList.get(i);
|
|
|
+ CustomSquareCheckBox fourthCategoryCheckBox = fourthCategoryCheckBoxList.get(i);
|
|
|
if (fourthCategoryCheckBox.isChecked()) {
|
|
|
data.add(new FilterBean(CATEGORY_FOURTH_ID, i));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//주차여부
|
|
|
- CustomSquareCheckBox fifthCategoryCheckBox = ((CustomSquareCheckBox) getView().findViewById(R.id.filter_fifth_check_1));
|
|
|
- if(fifthCategoryCheckBox.isChecked()){
|
|
|
+ if (fifthCategoryCheckBox.isChecked()) {
|
|
|
data.add(new FilterBean(CATEGORY_FIFTH_ID, 0));
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
+ private void reset() {
|
|
|
+ for (int i = 0; i < firstCategoryCheckboxList.size(); i++) {
|
|
|
+ firstCategoryCheckboxList.get(i).setChecked(false);
|
|
|
+ }
|
|
|
+ for (int i = 0; i < secondCategoryCheckboxList.size(); i++) {
|
|
|
+ secondCategoryCheckboxList.get(i).setChecked(false);
|
|
|
+ }
|
|
|
+ for (int i = 0; i < thirdCategoryCheckBoxList.size(); i++) {
|
|
|
+ thirdCategoryCheckBoxList.get(i).setChecked(false);
|
|
|
+ }
|
|
|
+ for (int i = 0; i < fourthCategoryCheckBoxList.size(); i++) {
|
|
|
+ fourthCategoryCheckBoxList.get(i).setChecked(false);
|
|
|
+ }
|
|
|
+ fifthCategoryCheckBox.setChecked(false);
|
|
|
+ }
|
|
|
|
|
|
}
|