|
|
@@ -8,9 +8,13 @@ import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
import android.view.Window;
|
|
|
import android.view.WindowManager;
|
|
|
-import android.widget.ImageView;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+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.custom.CustomSquareCheckBox;
|
|
|
|
|
|
/**
|
|
|
* FirstCategoryFilterDialog
|
|
|
@@ -25,8 +29,13 @@ import kr.co.zumo.app.R;
|
|
|
|
|
|
public class CategoryFirstMainFilterDialog extends DialogBase {
|
|
|
|
|
|
- private ImageView imageViewCancel;
|
|
|
+ private static final int CATEGORY_FIRST_ID = 0;
|
|
|
+ private static final int CATEGORY_SECOND_ID = 1;
|
|
|
+ private static final int CATEGORY_THIRD_ID = 2;
|
|
|
+ private static final int CATEGORY_FOURTH_ID = 3;
|
|
|
+ private static final int CATEGORY_FIFTH_ID = 4;
|
|
|
|
|
|
+ private List<FilterBean> data;
|
|
|
|
|
|
@Nullable
|
|
|
@Override
|
|
|
@@ -34,21 +43,107 @@ 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);
|
|
|
|
|
|
|
|
|
- imageViewCancel = getView().findViewById(R.id.image_view_cancel_main);
|
|
|
- imageViewCancel.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_show_contents).setOnClickListener(view -> {
|
|
|
+ if (null != getResultListener()) {
|
|
|
+ init();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 선택된 필터 value 값을 가지고 온다.
|
|
|
+ */
|
|
|
+ private void init() {
|
|
|
+
|
|
|
+ data = new ArrayList<>();
|
|
|
+ ArrayList<CustomSquareCheckBox> 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.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.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.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)));
|
|
|
+ fourthCategoryCheckBoxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_fourth_check_4)));
|
|
|
+ fourthCategoryCheckBoxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_fourth_check_5)));
|
|
|
+ fourthCategoryCheckBoxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_fourth_check_6)));
|
|
|
+ fourthCategoryCheckBoxList.add(((CustomSquareCheckBox) getView().findViewById(R.id.filter_fourth_check_7)));
|
|
|
+
|
|
|
+ for (int i = 0; i < fourthCategoryCheckBoxList.size(); ++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()){
|
|
|
+ data.add(new FilterBean(CATEGORY_FIFTH_ID, 0));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|