From 1981dee5aec45793d3c4ebdbc4e637528c71b3c5 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 03 二月 2021 19:20:47 +0800
Subject: [PATCH] 'PPTV'

---
 BuWanVideo/src/com/weikou/beibeivideo/ui/login/LoginActivity.java |   46 ++++++++++++++++++++++++++++++----------------
 1 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/BuWanVideo/src/com/weikou/beibeivideo/ui/login/LoginActivity.java b/BuWanVideo/src/com/weikou/beibeivideo/ui/login/LoginActivity.java
index b06c4a2..0f6937f 100644
--- a/BuWanVideo/src/com/weikou/beibeivideo/ui/login/LoginActivity.java
+++ b/BuWanVideo/src/com/weikou/beibeivideo/ui/login/LoginActivity.java
@@ -12,19 +12,16 @@
 import android.os.Handler;
 import android.os.Message;
 import android.util.Log;
-import android.view.Gravity;
 import android.view.KeyEvent;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.CheckBox;
 import android.widget.EditText;
-import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.LinearLayout.LayoutParams;
 import android.widget.TextView;
 import android.widget.Toast;
 
-import com.google.gson.Gson;
 import com.lcjian.library.util.SingleToast;
 import com.lcjian.library.util.common.StringUtils;
 import com.tencent.mm.opensdk.modelmsg.SendAuth;
@@ -32,16 +29,14 @@
 import com.umeng.socialize.UMAuthListener;
 import com.umeng.socialize.UMShareAPI;
 import com.umeng.socialize.bean.SHARE_MEDIA;
-import com.umeng.socialize.utils.SocializeUtils;
 import com.weikou.beibeivideo.BasicTextHttpResponseHandler;
 import com.weikou.beibeivideo.BeibeiVideoAPI;
 import com.weikou.beibeivideo.BeibeiVideoApplication;
+import com.weikou.beibeivideo.R;
 import com.weikou.beibeivideo.ui.BaseActivity;
 import com.weikou.beibeivideo.ui.mine.BrowserActivity;
 import com.weikou.beibeivideo.util.BeibeiConstant;
 import com.weikou.beibeivideo.util.XGPush;
-import com.weikou.beibeivideo.R;
-import com.weikou.beibeivideo.util.novel.NovelJNZUtil;
 
 import org.apache.http.Header;
 import org.json.JSONException;
@@ -97,7 +92,7 @@
         findViewById(R.id.login_tv_cancel).setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                finish();
+                onResult(RESULT_CANCELED);
             }
         });
 
@@ -125,9 +120,13 @@
     public void onClick(View v) {
         switch (v.getId()) {
             case R.id.login_tv_cancel:// 鍙栨秷
-                finish();
+                onResult(RESULT_CANCELED);
                 break;
             case R.id.ll_login_qq:// QQ鐧诲綍
+                if (!cb_user_agreement.isChecked()) {
+                    SingleToast.showToast(LoginActivity.this, "閫夋嫨鍚屾剰鐢ㄦ埛鍗忚鍚庢柟鍙櫥褰�");
+                    break;
+                }
                 if (isQQClientAvailable()) {
                     loginType = "1";
                     // qq鐧诲綍閫昏緫澶勭悊 鐐瑰嚮鐧诲綍鍚庨渶瑕佹殏鏃堕攣瀹氳繑鍥為敭鍜岃繑鍥炲姛鑳� 涓嶇劧浼氭姤閿�
@@ -139,6 +138,10 @@
                 break;
 
             case R.id.ll_login_wx://寰俊鐧诲綍
+                if (!cb_user_agreement.isChecked()) {
+                    SingleToast.showToast(LoginActivity.this, "閫夋嫨鍚屾剰鐢ㄦ埛鍗忚鍚庢柟鍙櫥褰�");
+                    break;
+                }
                 if (isWXClientAvailable()) {
                     loginType = "2";
                     SendAuth.Req req = new SendAuth.Req();
@@ -241,12 +244,10 @@
                                     data.get("gender"));
                             edit.commit();
 
-                            NovelJNZUtil.setUid(getApplicationContext());
-
                             SingleToast.showToast(LoginActivity.this,
                                     "鐧诲綍鎴愬姛");
                             XGPush.registerPush(LoginActivity.this);
-                            finish();
+                            onResult(RESULT_OK);
                         }
 
                         @Override
@@ -312,7 +313,7 @@
                             jsonObject.optJSONObject("Data").optString("Nickname"));
                     edit.commit();
                     SingleToast.showToast(LoginActivity.this, "鐧诲綍鎴愬姛" + "鏄电О涓�:" + jsonObject.optJSONObject("Data").optString("Nickname"));
-                    finish();
+                    onResult(RESULT_OK);
                 } else {
                     SingleToast.showToast(LoginActivity.this, "鐧诲綍澶辫触");
                 }
@@ -331,7 +332,7 @@
     public void onResume() {
         super.onResume();
         if (!StringUtils.isEmpty(getSharedPreferences("user", Context.MODE_PRIVATE).getString("LoginUid", ""))) {
-            finish();
+            onResult(RESULT_OK);
         }
         MobclickAgent.onPageStart("鐧诲綍椤�");
     }
@@ -398,12 +399,10 @@
                                             response.getString("gender"));
                                     edit.commit();
 
-                                    NovelJNZUtil.setUid(getApplicationContext());
-
                                     SingleToast.showToast(LoginActivity.this,
                                             "鐧诲綍鎴愬姛");
                                     XGPush.registerPush(LoginActivity.this);
-                                    finish();
+                                    onResult(RESULT_OK);
                                 }
 
                                 @Override
@@ -430,4 +429,19 @@
             }
         }
     };
+
+
+    private void onResult(int resultCode) {
+        boolean result = getIntent().getBooleanExtra("result", false);
+        if (result) {
+            Intent intent = new Intent();
+            //鎶婅繑鍥炴暟鎹瓨鍏ntent
+            setResult(resultCode, intent);
+            //鍏抽棴Activity
+            finish();
+        } else {
+            //鍏抽棴Activity
+            finish();
+        }
+    }
 }

--
Gitblit v1.8.0