|
|
@@ -20,6 +20,12 @@ import kr.co.zumo.app.lifeplus.view.Event;
|
|
|
import kr.co.zumo.app.lifeplus.view.command.AppUpdateCommand;
|
|
|
import kr.co.zumo.app.lifeplus.view.command.FragmentBackStackChangeCommand;
|
|
|
import kr.co.zumo.app.lifeplus.view.command.TextShareCommand;
|
|
|
+import kr.co.zumo.app.lifeplus.view.dialog.DialogBase;
|
|
|
+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.IAttribute;
|
|
|
+import kr.co.zumo.app.lifeplus.view.dialog.IDialogResultListener;
|
|
|
+import kr.co.zumo.app.lifeplus.view.dialog.TextDialog;
|
|
|
import kr.co.zumo.app.lifeplus.view.presenter.Presenter;
|
|
|
|
|
|
/**
|
|
|
@@ -40,10 +46,11 @@ public class SettingPresenter extends Presenter<SettingModel, ISettingView> {
|
|
|
public static final int SETTING_INFO = 3;
|
|
|
public static final int SETTING_UPDATE = 4;
|
|
|
|
|
|
+ private boolean isEnabled = false;
|
|
|
+
|
|
|
public SettingPresenter(SettingModel model, ISettingView view) {
|
|
|
super(model, view);
|
|
|
|
|
|
- this.model.loadSettingInfo();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -53,7 +60,8 @@ public class SettingPresenter extends Presenter<SettingModel, ISettingView> {
|
|
|
|
|
|
@Override
|
|
|
protected void startInternal() {
|
|
|
-
|
|
|
+ this.model.loadSettingInfo();
|
|
|
+ isEnabled = false;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -89,7 +97,7 @@ public class SettingPresenter extends Presenter<SettingModel, ISettingView> {
|
|
|
|
|
|
@Override
|
|
|
protected void pauseInternal() {
|
|
|
-
|
|
|
+ isEnabled = false;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -100,12 +108,19 @@ public class SettingPresenter extends Presenter<SettingModel, ISettingView> {
|
|
|
|
|
|
@Override
|
|
|
protected void onEventInternal(Event event) {
|
|
|
+ if (false == isEnabled) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
Log.i("APP# SettingPresenter | onEventInternal", "|" + event.toString());
|
|
|
int index = event.getInteger();
|
|
|
int id = event.getEventId();
|
|
|
String str = event.getString();
|
|
|
boolean bool = event.getBool();
|
|
|
switch (event.getEventId()) {
|
|
|
+ case Event.TOGGLE:
|
|
|
+ view.click(index);
|
|
|
+ break;
|
|
|
case Event.SWITCH:
|
|
|
if (index == SettingPresenter.SETTING_COMMON) {
|
|
|
// 기본 설정
|
|
|
@@ -132,7 +147,7 @@ public class SettingPresenter extends Presenter<SettingModel, ISettingView> {
|
|
|
break;
|
|
|
case Event.CLICK:
|
|
|
if (index == SettingPresenter.SETTING_COMMON) {
|
|
|
- if(str.equals(SettingViewHolder.MEMBER_CONFIRM)) {
|
|
|
+ if (str.equals(SettingViewHolder.MEMBER_CONFIRM)) {
|
|
|
// 회원 관리/확인
|
|
|
// todo 회원 비회원 구분
|
|
|
}
|
|
|
@@ -191,13 +206,42 @@ public class SettingPresenter extends Presenter<SettingModel, ISettingView> {
|
|
|
if (Event.SETTING_LOAD == event.getInteger()) {
|
|
|
// 세팅 로딩 완료
|
|
|
render();
|
|
|
+ isEnabled = true;
|
|
|
}
|
|
|
break;
|
|
|
+ case Event.ERROR:
|
|
|
+ showErrorDialog(event.getString());
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void showErrorDialog(String string) {
|
|
|
+ DialogBuilder.create(DialogID.CONFIRM)
|
|
|
+ .listener(new IDialogResultListener() {
|
|
|
+ @Override
|
|
|
+ public void onDialogResult(DialogBase dialog, Event event) {
|
|
|
+ if (event.getEventId() == Event.CONFIRM) {
|
|
|
+ dialog.dispose();
|
|
|
+
|
|
|
+ onBackPressed();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onDialogCanceled(DialogBase dialog) {
|
|
|
+ dialog.dispose();
|
|
|
+
|
|
|
+ onBackPressed();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .attribute((IAttribute<TextDialog>) dialog -> {
|
|
|
+ dialog.setText(string);
|
|
|
+ })
|
|
|
+ .show();
|
|
|
+ }
|
|
|
+
|
|
|
private void render() {
|
|
|
SettingBean settingBean = model.getSettingBean();
|
|
|
|