Browse Source

[카테고리][New] 필터 다이얼로그 중복 호출 방지

hyodong.min 7 years ago
parent
commit
f4859d9016

+ 37 - 28
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/category/type1/FirstCategoryMainPresenter.java

@@ -50,40 +50,49 @@ public class FirstCategoryMainPresenter extends CategoryMainPresenter<FirstCateg
   protected void onCategoryEvent(Event event) {
     switch (event.getEventId()) {
       case Event.FILTER:
-        filterDialog = new DialogBuilder<CategoryFirstMainFilterDialog, ICustomFilterListener>(getFragmentManager(), DialogID.MAIN_FIRST_FILTER)
-          .listener(new ICustomFilterListener<CategoryFirstMainFilterDialog>() {
-            @Override
-            public void onDialogResult(CategoryFirstMainFilterDialog dialog, Event event) {
-              switch (event.getEventId()) {
-                case Event.CLOSE:
-                  dialog.dispose();
-                  break;
-                case Event.CONFIRM:
-                  dialog.dispose();
-                  break;
-                default:
-                  break;
-              }
-            }
-
-            @Override
-            public void onDialogCanceled(CategoryFirstMainFilterDialog dialog) {
-              dialog.dispose();
-            }
-
-            @Override
-            public void onFilterResult(ArrayList<FilterBean> list) {
-              Log.w("APP# FirstCategoryMainPresenter | onFilterResult", "|" + list.size());
-            }
-          })
-          .attribute((IAttribute<CategoryFirstMainFilterDialog>) dialog -> {})
-          .show();
+        showFilterDialog();
         break;
       default:
         break;
     }
   }
 
+  private void showFilterDialog() {
+    if(null == filterDialog) {
+      filterDialog = new DialogBuilder<CategoryFirstMainFilterDialog, ICustomFilterListener>(getFragmentManager(), DialogID.MAIN_FIRST_FILTER)
+        .listener(new ICustomFilterListener<CategoryFirstMainFilterDialog>() {
+          @Override
+          public void onDialogResult(CategoryFirstMainFilterDialog dialog, Event event) {
+            filterDialog = null;
+            switch (event.getEventId()) {
+              case Event.CLOSE:
+                dialog.dispose();
+                break;
+              case Event.CONFIRM:
+                dialog.dispose();
+                break;
+              default:
+                break;
+            }
+          }
+
+          @Override
+          public void onDialogCanceled(CategoryFirstMainFilterDialog dialog) {
+            filterDialog = null;
+            dialog.dispose();
+          }
+
+          @Override
+          public void onFilterResult(ArrayList<FilterBean> list) {
+            filterDialog = null;
+            Log.w("APP# FirstCategoryMainPresenter | onFilterResult", "|" + list.size());
+          }
+        })
+        .attribute((IAttribute<CategoryFirstMainFilterDialog>) dialog -> {})
+        .show();
+    }
+  }
+
   @Override
   protected void onResultInternal(Event event) {
 

+ 37 - 28
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/category/type2/SecondCategoryMainPresenter.java

@@ -49,40 +49,49 @@ public class SecondCategoryMainPresenter extends CategoryMainPresenter<SecondCat
   protected void onCategoryEvent(Event event) {
     switch (event.getEventId()) {
       case Event.FILTER:
-        filterDialog = new DialogBuilder<CategorySecondMainFilterDialog, ICustomFilterListener>(getFragmentManager(), DialogID.MAIN_SECOND_FILTER)
-          .listener(new ICustomFilterListener<CategorySecondMainFilterDialog>() {
-            @Override
-            public void onDialogResult(CategorySecondMainFilterDialog dialog, Event event) {
-              switch (event.getEventId()) {
-                case Event.CLOSE:
-                  dialog.dispose();
-                  break;
-                case Event.CONFIRM:
-                  dialog.dispose();
-                  break;
-                default:
-                  break;
-              }
-            }
-
-            @Override
-            public void onDialogCanceled(CategorySecondMainFilterDialog dialog) {
-              dialog.dispose();
-            }
-
-            @Override
-            public void onFilterResult(ArrayList<FilterBean> list) {
-              Log.w("APP# SecondCategoryMainPresenter | onFilterResult", "|" + list.size());
-            }
-          })
-          .attribute((IAttribute<CategorySecondMainFilterDialog>) dialog -> {})
-          .show();
+        showFilterDialog();
         break;
       default:
         break;
     }
   }
 
+  private void showFilterDialog() {
+    if (null == filterDialog) {
+      filterDialog = new DialogBuilder<CategorySecondMainFilterDialog, ICustomFilterListener>(getFragmentManager(), DialogID.MAIN_SECOND_FILTER)
+        .listener(new ICustomFilterListener<CategorySecondMainFilterDialog>() {
+          @Override
+          public void onDialogResult(CategorySecondMainFilterDialog dialog, Event event) {
+            filterDialog = null;
+            switch (event.getEventId()) {
+              case Event.CLOSE:
+                dialog.dispose();
+                break;
+              case Event.CONFIRM:
+                dialog.dispose();
+                break;
+              default:
+                break;
+            }
+          }
+
+          @Override
+          public void onDialogCanceled(CategorySecondMainFilterDialog dialog) {
+            filterDialog = null;
+            dialog.dispose();
+          }
+
+          @Override
+          public void onFilterResult(ArrayList<FilterBean> list) {
+            filterDialog = null;
+            Log.w("APP# SecondCategoryMainPresenter | onFilterResult", "|" + list.size());
+          }
+        })
+        .attribute((IAttribute<CategorySecondMainFilterDialog>) dialog -> {})
+        .show();
+    }
+  }
+
   @Override
   protected void onResultInternal(Event event) {
 

+ 0 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/contents/ContentsDetailCardListicleCoverViewHolder.java

@@ -35,7 +35,6 @@ public class ContentsDetailCardListicleCoverViewHolder extends ContentsDetailVie
   @Override
   public void detach() {
     Glide.with(imageViewCardListicleCover).clear(imageViewCardListicleCover);
-
   }
 
 }