Browse Source

收藏浏览 屏蔽已下架的商品和已失效的商品

kaijia 6 months ago
parent
commit
e90e6f955c

+ 2 - 2
app/build.gradle

@@ -17,8 +17,8 @@ android {
17 17
         applicationId "com.kx.liedouYX"
18 18
         minSdkVersion 19
19 19
         targetSdkVersion 30
20
-        versionCode 114
21
-        versionName "1.0.14"
20
+        versionCode 115
21
+        versionName "1.0.15"
22 22
 
23 23
         ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
24 24
         multiDexEnabled true

+ 7 - 0
app/src/main/java/com/kx/liedouYX/entity/StockBean.java

@@ -428,6 +428,13 @@ public class StockBean implements Serializable {
428 428
         public void setUrl(String url) {
429 429
             this.url = url;
430 430
         }
431
+
432
+        @Override
433
+        public String toString() {
434
+            return "ImgListBean{" +
435
+                    "url='" + url + '\'' +
436
+                    '}';
437
+        }
431 438
     }
432 439
 
433 440
     public static class VideoListBean {

+ 1 - 1
app/src/main/java/com/kx/liedouYX/ui/activity/welcome/WelcomeActivity.java

@@ -96,7 +96,7 @@ public class WelcomeActivity extends AppCompatActivity implements IHomePageSubVi
96 96
         LogUtil.e("程序启动 " + activitySize);
97 97
         MyCrashHandler.getInstance().init(this);
98 98
         //是不是华为的设备
99
-        Constants.isHuaWeiPhone = false;
99
+        Constants.isHuaWeiPhone = true;
100 100
 
101 101
         boolean initSDK = SPUtils.getInstance().getBoolean("initSDK", false);
102 102
         if (initSDK) {

+ 15 - 9
app/src/main/java/com/kx/liedouYX/ui/adapter/MyScAdpter.java

@@ -3,6 +3,7 @@ package com.kx.liedouYX.ui.adapter;
3 3
 import android.content.Context;
4 4
 import android.graphics.Paint;
5 5
 import android.graphics.drawable.Drawable;
6
+import android.text.TextUtils;
6 7
 import android.view.LayoutInflater;
7 8
 import android.view.View;
8 9
 import android.view.ViewGroup;
@@ -25,6 +26,7 @@ import com.kx.liedouYX.ui.activity.detail.DetailsActivity;
25 26
 import com.kx.liedouYX.utils.IntentUtils;
26 27
 import com.kx.liedouYX.utils.NumberUtils;
27 28
 import com.kx.liedouYX.utils.Textutils;
29
+import com.kx.liedouYX.utils.ToastUtils;
28 30
 
29 31
 import java.util.List;
30 32
 
@@ -95,15 +97,19 @@ public class MyScAdpter extends RecyclerView.Adapter<MyScAdpter.MyViewHolder> {
95 97
         holder.itemView.setOnClickListener(new View.OnClickListener() {
96 98
             @Override
97 99
             public void onClick(View v) {
98
-                StockBean stockBean = new StockBean();
99
-                stockBean.setGoods_id(dataBean.getGoods_id());
100
-                stockBean.setCoupon_price(dataBean.getCoupon_price());
101
-                stockBean.setDiscount_price(dataBean.getDiscount_price() + "");
102
-                stockBean.setPrice(dataBean.getPrice() + "");
103
-                stockBean.setIs_coupon((int) dataBean.getIs_coupon());
104
-                stockBean.setCommission_price(dataBean.getCommission_rate() + "");
105
-                stockBean.setShop_type(dataBean.getShop_type());
106
-                IntentUtils.getInstance().toJumpDetailsUI(context, DetailsActivity.class, stockBean, Constants.collectAction, dataBean.getId() + "");
100
+                if (!TextUtils.isEmpty(dataBean.getFull_goods_id())) {
101
+                    StockBean stockBean = new StockBean();
102
+                    stockBean.setGoods_id(dataBean.getGoods_id());
103
+                    stockBean.setCoupon_price(dataBean.getCoupon_price());
104
+                    stockBean.setDiscount_price(dataBean.getDiscount_price() + "");
105
+                    stockBean.setPrice(dataBean.getPrice() + "");
106
+                    stockBean.setIs_coupon((int) dataBean.getIs_coupon());
107
+                    stockBean.setCommission_price(dataBean.getCommission_rate() + "");
108
+                    stockBean.setShop_type(dataBean.getShop_type());
109
+                    IntentUtils.getInstance().toJumpDetailsUI(context, DetailsActivity.class, stockBean, Constants.collectAction, dataBean.getId() + "");
110
+                } else {
111
+                    ToastUtils.showToast(context, "该商品已下架!");
112
+                }
107 113
             }
108 114
         });
109 115
     }

+ 8 - 0
app/src/main/java/com/kx/liedouYX/ui/adapter/RecordDateAdapter.java

@@ -1,6 +1,7 @@
1 1
 package com.kx.liedouYX.ui.adapter;
2 2
 
3 3
 import android.content.Context;
4
+import android.text.TextUtils;
4 5
 import android.view.LayoutInflater;
5 6
 import android.view.View;
6 7
 import android.view.ViewGroup;
@@ -10,6 +11,7 @@ import androidx.annotation.NonNull;
10 11
 import androidx.recyclerview.widget.LinearLayoutManager;
11 12
 import androidx.recyclerview.widget.RecyclerView;
12 13
 
14
+import com.kx.lib_core.utils.LogUtil;
13 15
 import com.kx.liedouYX.R;
14 16
 import com.kx.liedouYX.entity.StockBean;
15 17
 import com.kx.liedouYX.utils.RecycleViewUtils;
@@ -46,6 +48,12 @@ public class RecordDateAdapter extends RecyclerView.Adapter<RecordDateAdapter.My
46 48
     public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
47 49
         RecycleViewUtils.setListRecycleGood(context, holder.recordList);
48 50
         List<StockBean> stockBeans = data.get(position);
51
+        for (StockBean stockBean : stockBeans) {
52
+            if (TextUtils.isEmpty(stockBean.getGoods_id())) {
53
+//                stockBeans.remove(stockBean);
54
+                LogUtil.e("失效的商品:" + stockBean.toString());
55
+            }
56
+        }
49 57
         holder.recordDate.setText(stockBeans.get(0).getAdd_time());
50 58
         LinearLayoutManager manager = new LinearLayoutManager(context);
51 59
         manager.setOrientation(RecyclerView.VERTICAL);

+ 12 - 7
app/src/main/java/com/kx/liedouYX/ui/adapter/RecordListAdapter.java

@@ -24,6 +24,7 @@ import com.kx.liedouYX.ui.activity.detail.DetailsActivity;
24 24
 import com.kx.liedouYX.utils.IntentUtils;
25 25
 import com.kx.liedouYX.utils.NumberUtils;
26 26
 import com.kx.liedouYX.utils.Textutils;
27
+import com.kx.liedouYX.utils.ToastUtils;
27 28
 
28 29
 import java.util.List;
29 30
 
@@ -80,7 +81,7 @@ public class RecordListAdapter extends RecyclerView.Adapter<RecordListAdapter.My
80 81
                 Drawable drawable = context.getResources().getDrawable(R.mipmap.wph_icon);
81 82
                 Textutils.setDrawableText(holder.shopTitle, " " + goods.getTitle(), drawable);
82 83
             }
83
-            holder.discountPrice.setText("¥" +NumberUtils.formatStringNumber( goods.getDiscount_price()));
84
+            holder.discountPrice.setText("¥" + NumberUtils.formatStringNumber(goods.getDiscount_price()));
84 85
             //给文字中间画条横线
85 86
             holder.price.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
86 87
             holder.price.setText("¥" + NumberUtils.formatStringNumber(goods.getPrice()));
@@ -93,13 +94,17 @@ public class RecordListAdapter extends RecyclerView.Adapter<RecordListAdapter.My
93 94
             holder.itemView.setOnClickListener(new View.OnClickListener() {
94 95
                 @Override
95 96
                 public void onClick(View v) {
97
+                    if (goods.getShop_type() == 0 || goods.getShop_type() == 1 || goods.getShop_type() == 6) {
96 98
 //                    goods_id, coupon_price, discount_price, price, is_coupon, commission_rate
97
-                    /**
98
-                     * @auth lkj
99
-                     * @Date 2023/7/20 14:06
100
-                     * @Describe 跳转到商品详情界面
101
-                     */
102
-                    IntentUtils.getInstance().toJumpDetailsUI(context, DetailsActivity.class, goods, Constants.HistoryAction, goods.getId() + "");
99
+                        /**
100
+                         * @auth lkj
101
+                         * @Date 2023/7/20 14:06
102
+                         * @Describe 跳转到商品详情界面
103
+                         */
104
+                        IntentUtils.getInstance().toJumpDetailsUI(context, DetailsActivity.class, goods, Constants.HistoryAction, goods.getId() + "");
105
+                    } else {
106
+                        ToastUtils.showToast(context, "该商品已下架!");
107
+                    }
103 108
                 }
104 109
             });
105 110
         } else {

+ 14 - 1
app/src/main/java/com/kx/liedouYX/ui/fragment/mine/scll/LljlFragment.java

@@ -2,6 +2,7 @@ package com.kx.liedouYX.ui.fragment.mine.scll;
2 2
 
3 3
 import android.content.Context;
4 4
 import android.os.Bundle;
5
+import android.text.TextUtils;
5 6
 import android.view.View;
6 7
 
7 8
 import androidx.recyclerview.widget.LinearLayoutManager;
@@ -24,6 +25,8 @@ import com.kx.liedouYX.ui.fragment.mine.yhfk.YhfkPresenter;
24 25
 import com.kx.liedouYX.utils.FloatBtnCtrlUtil;
25 26
 import com.kx.liedouYX.utils.RecycleViewUtils;
26 27
 
28
+import java.util.ArrayList;
29
+import java.util.Iterator;
27 30
 import java.util.List;
28 31
 
29 32
 import butterknife.BindView;
@@ -99,8 +102,18 @@ public class LljlFragment extends LazyFragment implements IYhfkView {
99 102
                 if (recordListBean.getErrno().equals("0") && recordListBean.getErr().equals("成功")) {
100 103
                     RecordListBean.RstBean rst = recordListBean.getRst();
101 104
                     if (rst != null) {
105
+                        List<List<StockBean>> beanList1 = new ArrayList<>();
106
+                        List<StockBean> beanList2 = new ArrayList<>();
102 107
                         List<List<StockBean>> data = rst.getData();
103
-                        initAdapter(data);
108
+                        for (List<StockBean> datum : data) {
109
+                            for (StockBean stockBean : datum) {
110
+                                if (!TextUtils.isEmpty(stockBean.getGoods_id())) {
111
+                                    beanList2.add(stockBean);
112
+                                }
113
+                            }
114
+                            beanList1.add(beanList2);
115
+                        }
116
+                        initAdapter(beanList1);
104 117
                     }
105 118
                 }
106 119
             }