|
|
@@ -4,9 +4,10 @@
|
|
|
package kr.co.zumo.app.lifeplus.view.presenter;
|
|
|
|
|
|
import android.support.annotation.Nullable;
|
|
|
+import android.util.Log;
|
|
|
|
|
|
-import kr.co.zumo.app.lifeplus.view.IExit;
|
|
|
import kr.co.zumo.app.lifeplus.supervisor.ScreenChanger;
|
|
|
+import kr.co.zumo.app.lifeplus.view.IExit;
|
|
|
|
|
|
/**
|
|
|
* 모든 Presenter 들이 상속받는 Presenter base
|
|
|
@@ -24,8 +25,8 @@ public abstract class Presenter implements IExit {
|
|
|
|
|
|
protected ScreenChanger screenChanger;
|
|
|
|
|
|
- public static final int INT_NONE = -232748271; /// onEvent 로 intValue 가 전달되지 않으면 맵핑되는 값
|
|
|
- public static final String STRING_NONE = null; /// onEvent 로 stringValue 가 전달되지 않으면 맵핑되는 값
|
|
|
+ public static final int INT_NONE = -232748271; /// performOnEvent 로 intValue 가 전달되지 않으면 맵핑되는 값
|
|
|
+ public static final String STRING_NONE = ""; /// performOnEvent 로 stringValue 가 전달되지 않으면 맵핑되는 값
|
|
|
|
|
|
public Presenter(ScreenChanger screenChanger) {
|
|
|
this.screenChanger = screenChanger;
|
|
|
@@ -41,6 +42,8 @@ public abstract class Presenter implements IExit {
|
|
|
*/
|
|
|
public abstract void dispose();
|
|
|
|
|
|
+ protected abstract void performOnEvent(int eventId, int intValue, @Nullable String stringValue);
|
|
|
+
|
|
|
/**
|
|
|
* View 로 부터 전달되는 이벤트 처리
|
|
|
*
|
|
|
@@ -48,7 +51,9 @@ public abstract class Presenter implements IExit {
|
|
|
* @param intValue int 데이터
|
|
|
* @param stringValue string 데이터
|
|
|
*/
|
|
|
- protected abstract void onEvent(int eventId, int intValue, @Nullable String stringValue);
|
|
|
+ public void onEvent(int eventId, int intValue, @Nullable String stringValue) {
|
|
|
+ performOnEvent(eventId, intValue, stringValue);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* View 로 부터 전달되는 이벤트 처리
|
|
|
@@ -57,7 +62,7 @@ public abstract class Presenter implements IExit {
|
|
|
* @param intValue int 데이터
|
|
|
*/
|
|
|
public void onEvent(int eventId, int intValue) {
|
|
|
- onEvent(eventId, intValue, STRING_NONE);
|
|
|
+ performOnEvent(eventId, intValue, STRING_NONE);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -67,7 +72,7 @@ public abstract class Presenter implements IExit {
|
|
|
* @param stringValue string 데이터
|
|
|
*/
|
|
|
public void onEvent(int eventId, String stringValue) {
|
|
|
- onEvent(eventId, INT_NONE, stringValue);
|
|
|
+ performOnEvent(eventId, INT_NONE, stringValue);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -76,7 +81,18 @@ public abstract class Presenter implements IExit {
|
|
|
* @param eventId Event.CLICK
|
|
|
*/
|
|
|
public void onEvent(int eventId) {
|
|
|
- onEvent(eventId, INT_NONE, STRING_NONE);
|
|
|
+ performOnEvent(eventId, INT_NONE, STRING_NONE);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 네트워크 상태 변경 시 SuperModel 으로 부터 이벤트가 전달된다.
|
|
|
+ *
|
|
|
+ * @param isConnected true|false
|
|
|
+ * @param connectType disconnected = NetworkStatus.DISCONNECTED
|
|
|
+ */
|
|
|
+ public void onNetworkStatusChanged(boolean isConnected, int connectType) {
|
|
|
+ //todo 네트워크 연결 해제 시 처리 필요;
|
|
|
+ Log.w("APP# Presenter | onNetworkStatusChanged", "|" + "isConnected: " + isConnected + ", type: " + connectType);
|
|
|
}
|
|
|
|
|
|
/**
|