hanjing 6 lat temu
rodzic
commit
456b4b8461

+ 6 - 12
app/src/developSheeptest/java/com/sheep/jiuyan/samllsheep/wxapi/WXEntryActivity.java

@@ -1,31 +1,25 @@
 package com.sheep.jiuyan.samllsheep.wxapi;
 
-import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
 import android.util.Log;
 
 import com.sheep.gamegroup.event.WXLoginAuthEvent;
-import com.sheep.gamegroup.util.LogUtil;
 import com.sheep.jiuyan.samllsheep.Config;
-import com.sheep.jiuyan.samllsheep.wxutil.WXAPIUtil;
 import com.tencent.mm.opensdk.modelbase.BaseReq;
 import com.tencent.mm.opensdk.modelbase.BaseResp;
 import com.tencent.mm.opensdk.modelmsg.SendAuth;
 import com.tencent.mm.opensdk.openapi.IWXAPI;
-import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
 import com.tencent.mm.opensdk.openapi.WXAPIFactory;
 import com.umeng.socialize.weixin.view.WXCallbackActivity;
 
 import org.greenrobot.eventbus.EventBus;
 
-public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
+public class WXEntryActivity extends WXCallbackActivity {//implements IWXAPIEventHandler
 
     @Override
     public void onCreate(Bundle bundle) {
         super.onCreate(bundle);
-        Log.i("wx auth", "wx auth intent");
-//        WXAPIUtil.handle(this, getIntent());
         IWXAPI wxapi = WXAPIFactory.createWXAPI(this, Config.WX_AUTH_APP_ID, true);
         wxapi.registerApp(Config.WX_AUTH_APP_ID);
         wxapi.handleIntent(getIntent(), this);
@@ -34,8 +28,6 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
 
     @Override
     public void onNewIntent(Intent newIntent) {
-        Log.i("wx auth", "wx auth new intent");
-//        WXAPIUtil.handle(this, newIntent);
         IWXAPI wxapi = WXAPIFactory.createWXAPI(this, Config.WX_AUTH_APP_ID, true);
         wxapi.registerApp(Config.WX_AUTH_APP_ID);
         wxapi.handleIntent(getIntent(), this);
@@ -44,20 +36,22 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
 
     @Override
     public void onReq(BaseReq baseReq) {
-
+        if(!(baseReq instanceof SendAuth.Req)){
+            super.onReq(baseReq);
+        }
     }
 
     @Override
     public void onResp(BaseResp resp) {
         if (resp instanceof SendAuth.Resp) {
             if (resp.errCode == BaseResp.ErrCode.ERR_OK) {
-                Log.i("wx auth", "wx auth ok");
                 String code = ((SendAuth.Resp) resp).code;
                 EventBus.getDefault().post(new WXLoginAuthEvent(code));
             } else{
-                Log.i("wx auth", "wx auth error");
                 EventBus.getDefault().post(new WXLoginAuthEvent(null));
             }
+        } else {
+            super.onResp(resp);
         }
     }
 

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/absBase/BaseActivity.java

@@ -61,7 +61,7 @@ public abstract class BaseActivity extends RxAppCompatActivity implements BackHa
     public static boolean isFastDoubleClick() {
         long time = System.currentTimeMillis();
         long timeD = time - lastClickTime;
-        if (0 < timeD && timeD < 1000) {
+        if (0 < timeD && timeD < 500) {
             return true;
         }
         lastClickTime = time;

+ 19 - 4
app/src/sheep/java/com/sheep/jiuyan/samllsheep/wxapi/WXEntryActivity.java

@@ -2,31 +2,46 @@ package com.sheep.jiuyan.samllsheep.wxapi;
 
 import android.content.Intent;
 import android.os.Bundle;
+import android.util.Log;
 
 import com.sheep.gamegroup.event.WXLoginAuthEvent;
-import com.sheep.jiuyan.samllsheep.wxutil.WXAPIUtil;
+import com.sheep.jiuyan.samllsheep.Config;
+import com.tencent.mm.opensdk.modelbase.BaseReq;
 import com.tencent.mm.opensdk.modelbase.BaseResp;
 import com.tencent.mm.opensdk.modelmsg.SendAuth;
+import com.tencent.mm.opensdk.openapi.IWXAPI;
+import com.tencent.mm.opensdk.openapi.WXAPIFactory;
 import com.umeng.socialize.weixin.view.WXCallbackActivity;
 
 import org.greenrobot.eventbus.EventBus;
 
-public class WXEntryActivity extends WXCallbackActivity {
+public class WXEntryActivity extends WXCallbackActivity {//implements IWXAPIEventHandler
 
     @Override
     public void onCreate(Bundle bundle) {
         super.onCreate(bundle);
-        WXAPIUtil.handle(this, getIntent());
+        IWXAPI wxapi = WXAPIFactory.createWXAPI(this, Config.WX_AUTH_APP_ID, true);
+        wxapi.registerApp(Config.WX_AUTH_APP_ID);
+        wxapi.handleIntent(getIntent(), this);
         finish();
     }
 
     @Override
     public void onNewIntent(Intent newIntent) {
-        WXAPIUtil.handle(this, newIntent);
+        IWXAPI wxapi = WXAPIFactory.createWXAPI(this, Config.WX_AUTH_APP_ID, true);
+        wxapi.registerApp(Config.WX_AUTH_APP_ID);
+        wxapi.handleIntent(getIntent(), this);
         finish();
     }
 
     @Override
+    public void onReq(BaseReq baseReq) {
+        if(!(baseReq instanceof SendAuth.Req)){
+            super.onReq(baseReq);
+        }
+    }
+
+    @Override
     public void onResp(BaseResp resp) {
         if (resp instanceof SendAuth.Resp) {
             if (resp.errCode == BaseResp.ErrCode.ERR_OK) {