From 01e23be6118d68d38a71d186296d440eadcaa197 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期一, 07 六月 2021 18:23:41 +0800
Subject: [PATCH] 特价bug修复

---
 app/src/main/java/com/tejia/lijin/app/ui/main/MainActivity.java |   44 +++++++++++++++++++-------------------------
 1 files changed, 19 insertions(+), 25 deletions(-)

diff --git a/app/src/main/java/com/tejia/lijin/app/ui/main/MainActivity.java b/app/src/main/java/com/tejia/lijin/app/ui/main/MainActivity.java
index f854955..fab2a16 100644
--- a/app/src/main/java/com/tejia/lijin/app/ui/main/MainActivity.java
+++ b/app/src/main/java/com/tejia/lijin/app/ui/main/MainActivity.java
@@ -27,6 +27,7 @@
 import android.widget.LinearLayout;
 import android.widget.RadioButton;
 import android.widget.RadioGroup;
+import android.widget.TextView;
 import android.widget.Toast;
 
 import com.app.hubert.guide.util.ScreenUtils;
@@ -34,8 +35,10 @@
 import com.huawei.android.hms.agent.HMSAgent;
 import com.huawei.android.hms.agent.push.handler.GetTokenHandler;
 import com.tejia.lijin.app.entity.TrendsCategory;
+import com.tejia.lijin.app.ui.dialog.GoodsDetailJumpLoaingDialog;
 import com.tejia.lijin.app.ui.recommend.GoodsDetailActivity;
 import com.tejia.lijin.app.ui.trends.SendCircleFragmet;
+import com.tejia.lijin.app.util.Constant;
 import com.tejia.lijin.app.util.TopStatusSettings;
 import com.tejia.lijin.app.util.ui.HomeUIUtil;
 import com.umeng.analytics.MobclickAgent;
@@ -104,7 +107,8 @@
 
 
     private SharedPreferences spkefu;
-    private ImageView img, tv_msg_num2;
+    private ImageView img;
+    private TextView tv_msg_count;
     private DragFloatActionButton acbutton;
 
     String tag1 = "systemclient/getsystemclientparams";
@@ -183,7 +187,7 @@
             LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                     result);
             findViewById(R.id.v_status_bar).setLayoutParams(params);
-            findViewById(R.id.v_status_bar).setBackground(HomeUIUtil.getHomeTopBg("#FF227B", "#FF2A3E"));
+            findViewById(R.id.v_status_bar).setBackground(HomeUIUtil.getHomeTopBg(getApplicationContext()));
         } else {
             findViewById(R.id.v_status_bar).setVisibility(View.GONE);
         }
@@ -231,12 +235,12 @@
         getSystemParams();
         v_no_login = findViewById(R.id.v_no_login);
         acbutton = findViewById(R.id.actionButton);
-        tv_msg_num2 = findViewById(R.id.tv_msg_num2);//鎴戠殑绾㈢偣
+        tv_msg_count = findViewById(R.id.tv_msg_count);//娑堟伅鏁伴噺
         acbutton.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 //鐧婚檰
-                if (getSharedPreferences("user", MODE_PRIVATE).getBoolean("isLogin", false)) {
+                if (UserUtil.isLogin(getApplicationContext())) {
                     LoginTaobao.getLoginTaobao(MainActivity.this, new LonginTaobaoCallback() {
                         @Override
                         public void onSuccess() {
@@ -283,20 +287,6 @@
         registeredOPPOId();//涓婁紶OPPO_RegId
 //        onPush_OFF_NO();//妫�娴嬫槸鍚︽墦寮�鎺ㄩ��
         registeredVIVOId();//涓婁紶VIVO_RegId
-
-
-        tv_msg_num2.postDelayed(new Runnable() {
-            @Override
-            public void run() {
-                //娴嬭瘯
-                Bundle bundle = new Bundle();
-                bundle.putString("goodsId", "19711731038");
-                bundle.putString("goodsType", 1+"");
-                startActivity(new Intent(getApplicationContext(), GoodsDetailActivity.class).putExtras(bundle));
-            }
-        },5000);
-
-
     }
 
     private void choiceTab(Integer tab, Integer subTab) {
@@ -375,7 +365,7 @@
                     JSONArray array = jsonObject.optJSONObject("data").optJSONArray("systemClientParamsList");
                     SystemParamsUtil.saveParams(getApplicationContext(), array);
                     boolean input = sp.getBoolean("isFirstInput", true);
-                    boolean isLogin = sp.getBoolean("isLogin", false);
+                    boolean isLogin = UserUtil.isLogin(getApplicationContext());
                     //鏂颁汉濂界ぜ1鍏冪孩鍖�
                     if (input && !isLogin && sp.getString("newuser", "1").equalsIgnoreCase("0")) {
                         isFirstInput();
@@ -385,7 +375,7 @@
                     textVideo.isRecord(jsonObject);
                     //鏈嶅姟鍣ㄨ鏄剧ず 璐墿杞�&&鏈湴涔熻鏄剧ず
                     if (textVideo.getCart_float().equals("1") && textVideo.getLocalCart_float() != 1
-                            && getSharedPreferences("user", MODE_PRIVATE).getBoolean("isLogin", false)) {
+                            && UserUtil.isLogin(getApplicationContext())) {
                         acbutton.setVisibility(View.VISIBLE);
                     } else {//闅愯棌璐墿杞�
                         acbutton.setVisibility(View.GONE);
@@ -420,7 +410,7 @@
             BuXinConstant.GO_SCAN = false;
             ((RadioButton) findViewById(R.id.rb_nav_recommend)).setChecked(true);
         }
-        boolean isLogin = sp.getBoolean("isLogin", false);
+        boolean isLogin = UserUtil.isLogin(getApplicationContext());
         v_no_login.setVisibility(isLogin ? View.INVISIBLE : View.VISIBLE);
         getUnReadMsgCount(UserUtil.getUid(ShoppingApplication.application));//娑堟伅 鏈鏁伴噺
 
@@ -448,7 +438,7 @@
             RecordImageTextVideo textVideo = new RecordImageTextVideo(MainActivity.this);
             //鏈嶅姟鍣ㄨ鏄剧ず 璐墿杞�&&鏈湴涔熻鏄剧ず涓嶄负1
             if (textVideo.getCart_float().equals("1") && textVideo.getLocalCart_float() != 1 &&
-                    getSharedPreferences("user", MODE_PRIVATE).getBoolean("isLogin", false)) {
+                    UserUtil.isLogin(getApplicationContext())) {
                 acbutton.setVisibility(View.VISIBLE);
                 //鐐瑰嚮杩� 鍐嶆樉绀猴紙璁╂寜閽浣嶏級
                 if (textVideo.getLocalCart_float() == 2) {
@@ -511,11 +501,15 @@
                     } else {
                         totalCount = 0;
                     }
-                    totalCount = 0;
                 } else {
                     totalCount = 0;
-                    tv_msg_num2.setVisibility(View.INVISIBLE);//闅愯棌鎴戠殑绾㈢偣
                 }
+
+                tv_msg_count.setVisibility(totalCount > 0 ? View.VISIBLE : View.INVISIBLE);
+                if (totalCount > 0) {
+                    tv_msg_count.setText(totalCount >= 100 ? "99+" : (totalCount + ""));
+                }
+
                 setUnReadMsgCount(jsonObject);
                 getgetHomeMsgList();//鑾峰彇鏈娑堟伅鏉℃暟
             }
@@ -543,7 +537,7 @@
             }
         }
         //灞曠ず鎴戠殑 绾㈢偣
-        tv_msg_num2.setVisibility(jsonObject.optJSONObject("data").optInt("mineCount") > 0 ? View.VISIBLE : View.INVISIBLE);
+//        int msgCount = jsonObject.optJSONObject("data").optInt("mineCount");
     }
 
     private void isFirstInput() {

--
Gitblit v1.8.0