Browse Source

[공통][New] 다이얼로그 리택토링

hyodong.min 6 years ago
parent
commit
6bea7405e0

+ 49 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/dialog/DialogProvider.java

@@ -192,6 +192,13 @@ public class DialogProvider {
       .show();
   }
 
+  /**
+   * 휴면 회원 확인
+   *
+   * @param positive
+   * @param negative
+   * @return
+   */
   public ConfirmDialog showRestDialog(Runnable positive, Runnable negative) {
     return new DialogBuilder<ConfirmDialog, ICustomConfirmListener>(manager, DialogID.CONFIRM)
       .listener(new ICustomConfirmListener<ConfirmDialog>() {
@@ -223,4 +230,46 @@ public class DialogProvider {
       .show();
 
   }
+
+  /**
+   * 권환 안내 팝업
+   *
+   * @param runnableConfirm
+   * @param runnableNext
+   * @param titleId
+   * @param contentsId
+   * @param negativeId
+   * @param positiveId
+   * @return
+   */
+  public ConfirmDialog showPermissionDialog(Runnable runnableConfirm, Runnable runnableNext, int titleId, int contentsId, int negativeId, int positiveId) {
+    return new DialogBuilder<ConfirmDialog, ICustomConfirmListener>(manager, DialogID.CONFIRM)
+      .listener(new ICustomConfirmListener<ConfirmDialog>() {
+        @Override
+        public void onPositiveResult(ConfirmDialog dialog, Event event) {
+          dialog.dispose();
+          runnableConfirm.run();
+        }
+
+        @Override
+        public void onNegativeResult(ConfirmDialog dialog, Event event) {
+          dialog.dispose();
+          runnableNext.run();
+        }
+
+        @Override
+        public void onDialogCanceled(ConfirmDialog dialog) {
+          dialog.dispose();
+          runnableNext.run();
+        }
+      })
+      .attribute(dialog -> {
+        dialog.setCancelable(false);
+        dialog.setTitleId(titleId);
+        dialog.setText(contentsId);
+        dialog.setNegativeButtonLabelId(negativeId);
+        dialog.setPositiveButtonLabelId(positiveId);
+      })
+      .show();
+  }
 }

+ 2 - 33
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/splash/SplashPresenter.java

@@ -25,10 +25,7 @@ import kr.co.zumo.app.lifeplus.model.SuperModelInit;
 import kr.co.zumo.app.lifeplus.model.module.APIModuleHelper;
 import kr.co.zumo.app.lifeplus.supervisor.ScreenID;
 import kr.co.zumo.app.lifeplus.view.Event;
-import kr.co.zumo.app.lifeplus.view.dialog.ConfirmDialog;
-import kr.co.zumo.app.lifeplus.view.dialog.DialogBuilder;
-import kr.co.zumo.app.lifeplus.view.dialog.DialogID;
-import kr.co.zumo.app.lifeplus.view.dialog.ICustomConfirmListener;
+import kr.co.zumo.app.lifeplus.view.dialog.DialogProvider;
 import kr.co.zumo.app.lifeplus.view.screen.setting.MemberInfoModelHelper;
 import kr.co.zumo.app.lifeplus.zumo.bean.api.MemberInfoBean;
 
@@ -225,35 +222,7 @@ public class SplashPresenter extends ScreenStarterPresenter<SplashModel, ISplash
   }
 
   private void launchInternal(Runnable runnableConfirm, Runnable runnableNext, int titleId, int contentsId, int negativeId, int positiveId) {
-    // todo dialogProvider 로 이동
-    new DialogBuilder<ConfirmDialog, ICustomConfirmListener>(view.getActivity().getSupportFragmentManager(), DialogID.CONFIRM)
-      .listener(new ICustomConfirmListener<ConfirmDialog>() {
-        @Override
-        public void onPositiveResult(ConfirmDialog dialog, Event event) {
-          dialog.dispose();
-          runnableConfirm.run();
-        }
-
-        @Override
-        public void onNegativeResult(ConfirmDialog dialog, Event event) {
-          dialog.dispose();
-          runnableNext.run();
-        }
-
-        @Override
-        public void onDialogCanceled(ConfirmDialog dialog) {
-          dialog.dispose();
-          runnableNext.run();
-        }
-      })
-      .attribute(dialog -> {
-        dialog.setCancelable(false);
-        dialog.setTitleId(titleId);
-        dialog.setText(contentsId);
-        dialog.setNegativeButtonLabelId(negativeId);
-        dialog.setPositiveButtonLabelId(positiveId);
-      })
-      .show();
+    DialogProvider.of(view.getActivity().getSupportFragmentManager()).showPermissionDialog(runnableConfirm, runnableNext, titleId, contentsId, negativeId, positiveId);
   }
 
   private void onPermissionCompleted() {