|
|
@@ -3,13 +3,7 @@
|
|
|
*/
|
|
|
package kr.co.zumo.app.lifeplus.view.custom.pin;
|
|
|
|
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
-
|
|
|
-import io.reactivex.Completable;
|
|
|
-import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
-import io.reactivex.disposables.CompositeDisposable;
|
|
|
import kr.co.zumo.app.R;
|
|
|
-import kr.co.zumo.app.lifeplus.util.ResourceUtil;
|
|
|
|
|
|
/**
|
|
|
* CustomPinConfirmPresenter
|
|
|
@@ -21,105 +15,74 @@ import kr.co.zumo.app.lifeplus.util.ResourceUtil;
|
|
|
* @history 민효동 [2018-10-04] [최초 작성]
|
|
|
* @since 2018-10-04
|
|
|
*/
|
|
|
-public class CustomPinConfirmPresenter implements IPinContract.Presenter {
|
|
|
-
|
|
|
- protected IPinContract.View view;
|
|
|
- protected IPinContract.Listener listener;
|
|
|
+public class CustomPinConfirmPresenter extends CustomPinPresenter {
|
|
|
|
|
|
- protected String pin;
|
|
|
- protected int matchCount;
|
|
|
- protected CompositeDisposable disposable = new CompositeDisposable();
|
|
|
|
|
|
public CustomPinConfirmPresenter(IPinContract.View view, IPinContract.Listener listener) {
|
|
|
- this.view = view;
|
|
|
- this.listener = listener;
|
|
|
- }
|
|
|
-
|
|
|
- protected boolean isResetButtonVisible() {
|
|
|
- return true;
|
|
|
+ super(view, listener);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 닫기 버튼 보이기 설정
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
protected boolean isCloseButtonVisible() {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 문의 버튼 보이기 설정
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
protected boolean isHelpButtonVisible() {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void start() {
|
|
|
- this.view.setPresenter(this);
|
|
|
- this.view.setResetButtonVisible(isResetButtonVisible());
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onPinStart() {
|
|
|
- view.setCloseButtonVisible(isCloseButtonVisible());
|
|
|
- view.setHelpButtonVisible(isHelpButtonVisible());
|
|
|
- view.setResetButtonVisible(isResetButtonVisible());
|
|
|
- view.updateGuideTextColor(ResourceUtil.getColor(R.color.C999999));
|
|
|
- view.updateGuideText(R.string.login_input_pin);
|
|
|
- view.updateTitleText(R.string.login_input_pin_title);
|
|
|
- view.restart();
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onPinResult(String result) {
|
|
|
- view.setDisabled();
|
|
|
- listener.onPinResult(result);
|
|
|
+ /**
|
|
|
+ * 재설정 버튼 보이기 설정
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ protected boolean isResetButtonVisible() {
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void onClickPinReset() {
|
|
|
- listener.onClickPinReset();
|
|
|
+ /**
|
|
|
+ * 5회 입력 후 표시 문구 설정
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ protected int getFailGuideStringId() {
|
|
|
+ return R.string.pin_miss_match_error;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void onClickClose() {
|
|
|
- listener.onClickClose();
|
|
|
+ /**
|
|
|
+ * Guide 문구 설정
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ protected int getGuideStringId() {
|
|
|
+ return R.string.login_input_pin;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void retry() {
|
|
|
- // 일치 하지 않으면 5회 재시도 후
|
|
|
- if (++matchCount < 5) {
|
|
|
- view.updateGuideTextColor(ResourceUtil.getColor(R.color.CF12815));
|
|
|
- view.updateGuideText(String.format(ResourceUtil.getString(R.string.pin_miss_match_error_repeat), matchCount));
|
|
|
- view.restart();
|
|
|
- }
|
|
|
- else {
|
|
|
- /*
|
|
|
- 5회 이상 불일치 시 ‘간편암호가 5회이상 일치하지 않아, 입력값이 초기화됩니다.’ 밸리데이션 문구 1초간 노출
|
|
|
- - 입력값 초기화된 상태로 STEP1로 변경
|
|
|
- */
|
|
|
- view.updateGuideTextColor(ResourceUtil.getColor(R.color.CF12815));
|
|
|
- view.updateGuideText(R.string.pin_miss_match_error);
|
|
|
-
|
|
|
- view.setDisabled();
|
|
|
- disposable.add(
|
|
|
- Completable.timer(1000, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread())
|
|
|
- .subscribe(() -> {
|
|
|
-
|
|
|
- pin = null;
|
|
|
- listener.onPinFail();
|
|
|
-
|
|
|
- }, Throwable::printStackTrace)
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
+ /**
|
|
|
+ * Title 문구 설정
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ protected int getTitleStringId() {
|
|
|
+ return R.string.login_input_pin_title;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void onClickHelp() {
|
|
|
- listener.onPinHelp();
|
|
|
+ /**
|
|
|
+ * 가이드 텍스트 기본 컬러
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ protected int getGuideTextColorId() {
|
|
|
+ return R.color.C999999;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void dispose() {
|
|
|
- if (null != disposable) {
|
|
|
- disposable.dispose();
|
|
|
- disposable = null;
|
|
|
- }
|
|
|
- }
|
|
|
}
|