From 3595485efbfeb0db8c0e719e34aac022af284754 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 22 五月 2021 18:14:40 +0800
Subject: [PATCH] 特价完善

---
 app/src/main/java/com/tejia/lijin/app/ui/mine/LoginSelectActivity.java |   70 +++++++++++++++++++++--------------
 1 files changed, 42 insertions(+), 28 deletions(-)

diff --git a/app/src/main/java/com/tejia/lijin/app/ui/mine/LoginSelectActivity.java b/app/src/main/java/com/tejia/lijin/app/ui/mine/LoginSelectActivity.java
index 79420de..fe5c002 100644
--- a/app/src/main/java/com/tejia/lijin/app/ui/mine/LoginSelectActivity.java
+++ b/app/src/main/java/com/tejia/lijin/app/ui/mine/LoginSelectActivity.java
@@ -71,6 +71,8 @@
 
     private AliyunSmsOneKeyLoginManager aliyunSmsOneKeyLoginManager;
 
+    private boolean showOnkeyLoginToast = false;
+
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -82,22 +84,27 @@
         String from = getIntent().getStringExtra("from");
         UserCustomEvent.userLogin(this, StringUtils.isEmpty(from) ? "鍏跺畠" : from);
         EventBus.getDefault().register(this);
-        aliyunSmsOneKeyLoginManager = new AliyunSmsOneKeyLoginManager(this, null);
+        aliyunSmsOneKeyLoginManager = new AliyunSmsOneKeyLoginManager(this, "zTsQ9uC74C7EsD4h1II3+0CsxtXbz8VikP//49QvybqgZLOsv4pCQ4yW5fz1Ogt4QFuTqHdictmxHm7KvMAd+dl8peJL+xpGFZjjAMcqNkqcSLptS358E+EpbITK4yYjDS1gbQQKuPiODw88UUWlhcCMye7gm3eF9AWNuZ7fQKVONWl/0wube5iXegJ6ZOfhJiYQDZqsKzgmxU/MdPKWOlKCS9NtefDmgCYMM9S6GQODkxPZm+wDqJ89dXMtU5ejBhMMv63t7eug9SfEGfmEnG31JXD9MCQ00t7e8VLeCfanFoZTquLD5w==");
         aliyunSmsOneKeyLoginManager.init(new AliyunSmsOneKeyLoginManager.IOneKeyLoginListener() {
 
             @Override
             public void onFail(String st) {
-                
+                if (showOnkeyLoginToast) {
+                    showOnkeyLoginToast = false;
+                    android.widget.Toast.makeText(LoginSelectActivity.this, st, Toast.LENGTH_SHORT).show();
+                }
             }
 
             @Override
             public void onCancel() {
-
+                showOnkeyLoginToast = true;
             }
 
             @Override
             public void onEnvCheckSuccess() {
-
+                showOnkeyLoginToast = false;
+                //鎺夎捣鎺堟潈妗�
+                aliyunSmsOneKeyLoginManager.startGetLoginToken();
             }
 
             @Override
@@ -107,35 +114,40 @@
 
             @Override
             public void onToken(String token) {
-
+                //鑾峰彇鍒癟oken
             }
         });
+        openOneKeyLogin(showOnkeyLoginToast);
     }
 
     private synchronized void openOneKeyLogin(final boolean notify) {
-        ShoppingApi.allowOneKeyLogin(this, UserUtil.getLoginUid(this), new BasicTextHttpResponseHandler() {
+        aliyunSmsOneKeyLoginManager.checkEnv();
 
-            @Override
-            public void onStart() {
-                DialogUtil.show(loadingDialog);
-            }
+        //TODO 涓�閿櫥褰曟潈闄愯姹�
 
-            @Override
-            public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception {
-                if (jsonObject.optBoolean("IsPost")) {
-                    aliyunSmsOneKeyLoginManager.checkEnv();
-                } else {
-                    if (notify) {
-                        Toast.makeText(PhoneLoginActivity.this, jsonObject.optString("Error"), Toast.LENGTH_SHORT).show();
-                    }
-                }
-            }
-
-            @Override
-            public void onFinish() {
-                DialogUtil.dismiss(loadingDialog);
-            }
-        });
+//        ShoppingApi.allowOneKeyLogin(this, UserUtil.getLoginUid(this), new BasicTextHttpResponseHandler() {
+//
+//            @Override
+//            public void onStart() {
+//                DialogUtil.show(loadingDialog);
+//            }
+//
+//            @Override
+//            public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception {
+//                if (jsonObject.optBoolean("IsPost")) {
+//                    aliyunSmsOneKeyLoginManager.checkEnv();
+//                } else {
+//                    if (notify) {
+//                        Toast.makeText(PhoneLoginActivity.this, jsonObject.optString("Error"), Toast.LENGTH_SHORT).show();
+//                    }
+//                }
+//            }
+//
+//            @Override
+//            public void onFinish() {
+//                DialogUtil.dismiss(loadingDialog);
+//            }
+//        });
 
 
     }
@@ -177,6 +189,7 @@
      *娣诲姞鐩戝惉
      */
     private void addListener() {
+        tv_login_gain_sms.setOnClickListener(this);
         tv_user_agreement.setOnClickListener(this);
         tv_other_login.setOnClickListener(this);
         tv_privacy_policies.setOnClickListener(this);
@@ -199,8 +212,8 @@
 
             @Override
             public void afterTextChanged(Editable editable) {
-//                fl_login_gain_sms.setEnabled(editable.length() == 13 ? true : false);
-//                fl_login_gain_sms.setBackgroundResource(editable.length() == 13 ?
+                tv_login_gain_sms.setEnabled(editable.length() == 13 ? true : false);
+//                tv_login_gain_sms.setBackgroundResource(editable.length() == 13 ?
 //                        R.drawable.shape_mobile_login_light : R.drawable.shape_login_gain_sms);
             }
         });
@@ -301,6 +314,7 @@
 
             case R.id.tv_login_onekey:
                 //TODO 涓�閿櫥褰�
+                openOneKeyLogin(true);
                 break;
         }
     }

--
Gitblit v1.8.0