Sfoglia il codice sorgente

[최진오]
로그인 unbind 추가.

jinochoi 8 anni fa
parent
commit
06224e28f0

+ 8 - 2
onecable/src/main/java/com/ntels/onecable/common/handler/BackPressCloseHandler.java

@@ -51,9 +51,15 @@ public class BackPressCloseHandler {
         mToast= mUtil.setShowToast(mActivity, mUtil.getString(mActivity, R.string.MSG823), Toast.LENGTH_SHORT);
     }
 
-    private void runMethod(String methodName) {
+    private void runMethod(String callMethodName) {
         try {
-            Method method = mActivity.getClass().getMethod(methodName);
+            Method method;
+            try {
+                method = mActivity.getClass().getMethod(callMethodName);
+            } catch (NoSuchMethodException e) {
+                method = mActivity.getClass().getDeclaredMethod(callMethodName);
+                method.setAccessible(true);
+            }
             method.invoke(mActivity);
         } catch (NoSuchMethodException e) {
             e.printStackTrace();

+ 0 - 34
onecable/src/main/java/com/ntels/onecable/common/handler/CallWithDelayHandler.java

@@ -1,6 +1,5 @@
 package com.ntels.onecable.common.handler;
 
-import com.ntels.onecable.R;
 import com.ntels.onecable.common.Constants;
 import com.ntels.onecable.common.util.Dlog;
 import com.ntels.onecable.common.util.Util;
@@ -13,8 +12,6 @@ import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
-import static com.ntels.onecable.common.handler.BackPressCloseHandler.BACK_PRESS_VALID_TIME;
-
 /**
  * Created by jinochoi on 2017. 3. 31..
  */
@@ -31,17 +28,6 @@ public class CallWithDelayHandler {
     }
 
 
-    public void callWithDelay() {
-        if (System.currentTimeMillis() > mBackKeyPressedTime + BACK_PRESS_VALID_TIME) {
-            mBackKeyPressedTime = System.currentTimeMillis();
-            showGuide();
-            return;
-        }
-
-        if (System.currentTimeMillis() <= mBackKeyPressedTime + BACK_PRESS_VALID_TIME) {
-            mActivity.finish();
-        }
-    }
 
     public void callFinishWithDelay(String isMethodName) {
 
@@ -207,10 +193,6 @@ public class CallWithDelayHandler {
                             method.invoke(mActivity);
                         }
                     } else {
-//                        ActivityManager.RunningTaskInfo running = info.get(0);
-//                        ComponentName componentName = running.topActivity;
-//                        return cls.getName().equals(componentName.getClassName());
-//
                         if (!mActivity.isFinishing()) {
                             callWithDelayField(isFieldName, equalValue, callMethodName, delayTime);
                         }
@@ -238,20 +220,4 @@ public class CallWithDelayHandler {
         return isReturn;
     }
 
-    private void showGuide() {
-        mToast = mUtil.setShowToast(mActivity, mUtil.getString(mActivity, R.string.MSG823), Toast.LENGTH_SHORT);
-    }
-
-    private void runMethod(String methodName) {
-        try {
-            Method method = mActivity.getClass().getMethod(methodName);
-            method.invoke(mActivity);
-        } catch (NoSuchMethodException e) {
-            e.printStackTrace();
-        } catch (InvocationTargetException e) {
-            e.printStackTrace();
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        }
-    }
 }

+ 14 - 0
onecable/src/main/java/com/ntels/onecable/view/Login.java

@@ -221,6 +221,20 @@ public class Login extends CustomActivity implements View.OnClickListener, Custo
             }
         }
     }
+    @Override
+    protected void onDestroy() {
+
+        super.onDestroy();
+        Dlog.v("onDestroy()");
+
+        if (mIsBound) {
+            Dlog.v("onDestroy()11");
+            mWebSocketService.removeWebSocketResponse(webSocketResponse);
+            mWebSocketService.webSocketClose();
+            mActivity.unbindService(serviceConnection);
+            mIsBound = false;
+        }
+    }
 
     @Override
     public void onCreate(Bundle savedInstanceState) {