Kaynağa Gözat

2024-1-29 代码备份
首页基本完成,秒杀数据未调试
登录接口已调试,邀请人绑定逻辑未做
首页搜索已完成
消息页面UI已做,数据有问题

zhangbing 2 yıl önce
ebeveyn
işleme
3a93cece53
56 değiştirilmiş dosya ile 3022 ekleme ve 1299 silme
  1. 17 0
      .idea/deploymentTargetDropDown.xml
  2. 2 2
      app/build.gradle
  3. 19 8
      app/src/main/AndroidManifest.xml
  4. 2 1
      app/src/main/java/com/yihucha/hbyhc/config/Constants.java
  5. 10 0
      app/src/main/java/com/yihucha/hbyhc/network/service/ProductService.java
  6. 8 5
      app/src/main/java/com/yihucha/hbyhc/network/service/StoreService.java
  7. 1 1
      app/src/main/java/com/yihucha/hbyhc/presentation/MainActivityViewModel.java
  8. 3 3
      app/src/main/java/com/yihucha/hbyhc/presentation/big_storehouse/adapter/HomeMSAdapter.kt
  9. 68 0
      app/src/main/java/com/yihucha/hbyhc/presentation/big_storehouse/adapter/HomeVipAdapter.kt
  10. 5 5
      app/src/main/java/com/yihucha/hbyhc/presentation/big_storehouse/model/DcSeckillBean.java
  11. 175 311
      app/src/main/java/com/yihucha/hbyhc/presentation/home/HomeFragment.java
  12. 102 140
      app/src/main/java/com/yihucha/hbyhc/presentation/home/SearchActivity2.java
  13. 451 0
      app/src/main/java/com/yihucha/hbyhc/presentation/home/YHCHomeSearchActivity.kt
  14. 24 55
      app/src/main/java/com/yihucha/hbyhc/presentation/home/adapter/HomeProductListAdapter.java
  15. 78 0
      app/src/main/java/com/yihucha/hbyhc/presentation/home/adapter/ItemMessageAdapter.java
  16. 389 0
      app/src/main/java/com/yihucha/hbyhc/presentation/home/model/HomeProductBean.java
  17. 53 5
      app/src/main/java/com/yihucha/hbyhc/presentation/home/view_model/HomeViewModel.java
  18. 28 29
      app/src/main/java/com/yihucha/hbyhc/presentation/login/LoginActivity.java
  19. 113 1
      app/src/main/java/com/yihucha/hbyhc/presentation/login/model/LoginModel.java
  20. 2 0
      app/src/main/java/com/yihucha/hbyhc/presentation/login/view_model/LoginViewModel.java
  21. 10 18
      app/src/main/java/com/yihucha/hbyhc/presentation/message/MessageActivity.java
  22. 12 15
      app/src/main/java/com/yihucha/hbyhc/presentation/shop/VipAreaActivity.java
  23. 5 5
      app/src/main/java/com/yihucha/hbyhc/presentation/shop/adapter/VipAreaAdapter.java
  24. 244 280
      app/src/main/java/com/yihucha/hbyhc/presentation/shop/model/VipAreaBean.java
  25. 34 33
      app/src/main/java/com/yihucha/hbyhc/presentation/shop/view_model/VipAreaViewModel.java
  26. 29 0
      app/src/main/java/com/yihucha/hbyhc/utils/EmptyCheckUtils.kt
  27. 209 0
      app/src/main/java/com/yihucha/hbyhc/utils/StringUtils.kt
  28. 63 31
      app/src/main/java/com/yihucha/hbyhc/view/CustomDialog.java
  29. 15 0
      app/src/main/res/drawable/shape_jiantou_right_red.xml
  30. 13 0
      app/src/main/res/drawable/shape_line_white_50dp.xml
  31. 13 0
      app/src/main/res/drawable/shape_white_50dp.xml
  32. 2 2
      app/src/main/res/drawable/shape_white_with_line_color_8dp.xml
  33. 1 8
      app/src/main/res/layout/activity_login_phone.xml
  34. 216 0
      app/src/main/res/layout/activity_yhchome_search.xml
  35. 5 4
      app/src/main/res/layout/dialog_confirm.xml
  36. 2 1
      app/src/main/res/layout/dialog_enter_the_invitation_code.xml
  37. 384 172
      app/src/main/res/layout/fragment_home.xml
  38. 19 52
      app/src/main/res/layout/home_head.xml
  39. 44 44
      app/src/main/res/layout/item_home_miaosha.xml
  40. 99 0
      app/src/main/res/layout/item_home_vip.xml
  41. 46 0
      app/src/main/res/layout/item_message.xml
  42. BIN
      app/src/main/res/mipmap-xxxhdpi/bg_ms_home.png
  43. BIN
      app/src/main/res/mipmap-xxxhdpi/bg_vip_home.png
  44. BIN
      app/src/main/res/mipmap-xxxhdpi/home_top_bg.png
  45. BIN
      app/src/main/res/mipmap-xxxhdpi/home_top_bg_scroll.png
  46. BIN
      app/src/main/res/mipmap-xxxhdpi/icon_cxb.png
  47. BIN
      app/src/main/res/mipmap-xxxhdpi/icon_home_msg.png
  48. BIN
      app/src/main/res/mipmap-xxxhdpi/icon_ms.png
  49. BIN
      app/src/main/res/mipmap-xxxhdpi/icon_vip.png
  50. BIN
      app/src/main/res/mipmap-xxxhdpi/img_ms_qiang.png
  51. BIN
      app/src/main/res/mipmap-xxxhdpi/img_msg.png
  52. 1 0
      app/src/main/res/values/colors.xml
  53. BIN
      jd_sdk_lib/build/intermediates/compiled_local_resources/debug/out/layout_web_bottom_layout.xml.flat
  54. 2 2
      jd_sdk_lib/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties
  55. 0 65
      jd_sdk_lib/build/intermediates/incremental/debug/packageDebugResources/merged.dir/values/values.xml
  56. 4 1
      jd_sdk_lib/build/intermediates/packaged_res/debug/layout/web_bottom_layout.xml

+ 17 - 0
.idea/deploymentTargetDropDown.xml

@@ -0,0 +1,17 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="deploymentTargetDropDown">
4
+    <runningDeviceTargetSelectedWithDropDown>
5
+      <Target>
6
+        <type value="RUNNING_DEVICE_TARGET" />
7
+        <deviceKey>
8
+          <Key>
9
+            <type value="SERIAL_NUMBER" />
10
+            <value value="192.168.56.103:5555" />
11
+          </Key>
12
+        </deviceKey>
13
+      </Target>
14
+    </runningDeviceTargetSelectedWithDropDown>
15
+    <timeTargetWasSelectedWithDropDown value="2024-01-29T06:30:08.135441500Z" />
16
+  </component>
17
+</project>

+ 2 - 2
app/build.gradle

@@ -11,8 +11,8 @@ android {
11 11
         applicationId "com.yihucha.hbyhc"
12 12
         minSdk 21
13 13
         targetSdk 33
14
-        versionCode 2364
15
-        versionName "3.3.2"
14
+        versionCode 1
15
+        versionName "1.0"
16 16
 
17 17
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
18 18
         //必须要保证所有的flavor 都属于同一个维度

+ 19 - 8
app/src/main/AndroidManifest.xml

@@ -9,8 +9,12 @@
9 9
 
10 10
     <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- 网络权限 -->
11 11
     <uses-permission android:name="android.permission.INTERNET" />
12
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="32"/>
13
-    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32"/>
12
+    <uses-permission
13
+        android:name="android.permission.WRITE_EXTERNAL_STORAGE"
14
+        android:maxSdkVersion="32" />
15
+    <uses-permission
16
+        android:name="android.permission.READ_EXTERNAL_STORAGE"
17
+        android:maxSdkVersion="32" />
14 18
     <uses-permission android:name="android.permission.CAMERA" />
15 19
     <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" /> <!-- <uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/> -->
16 20
     <!-- <uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/> -->
@@ -49,9 +53,12 @@
49 53
     <uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
50 54
     <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
51 55
     <uses-permission android:name="android.permission.EXPAND_STATUS_BAR" /> <!-- 穿山甲3400版本新增:建议添加“query_all_package”权限,穿山甲将通过此权限在Android R系统上判定广告对应的应用是否在用户的app上安装,避免投放错误的广告,以此提高用户的广告体验。若添加此权限,需要在您的用户隐私文档中声明! -->
52
-    <!--<uses-permission
56
+    <!--
57
+<uses-permission
53 58
         android:name="android.permission.QUERY_ALL_PACKAGES"
54
-        tools:ignore="QueryAllPackagesPermission" /> --> <!--处理android 11 验证微信是否安装  一直返回false问题-->
59
+        tools:ignore="QueryAllPackagesPermission" />
60
+    -->
61
+    <!-- 处理android 11 验证微信是否安装  一直返回false问题 -->
55 62
     <queries>
56 63
         <package android:name="com.tencent.mm" />
57 64
     </queries>
@@ -70,16 +77,20 @@
70 77
         android:usesCleartextTraffic="true"
71 78
         tools:replace="android:theme"
72 79
         tools:targetApi="31">
73
-        <activity android:name=".utils.explainpermissions.ExplainPermissionsUtil"
80
+        <activity
81
+            android:name=".presentation.home.YHCHomeSearchActivity"
74 82
             android:exported="false"
75
-            android:theme="@style/Transparent"
76 83
             android:screenOrientation="portrait"
77 84
             />
78 85
         <activity
79
-            android:name=".presentation.order.SelectMailCompanyActivity"
86
+            android:name=".utils.explainpermissions.ExplainPermissionsUtil"
80 87
             android:exported="false"
81 88
             android:screenOrientation="portrait"
82
-            />
89
+            android:theme="@style/Transparent" />
90
+        <activity
91
+            android:name=".presentation.order.SelectMailCompanyActivity"
92
+            android:exported="false"
93
+            android:screenOrientation="portrait" />
83 94
         <activity
84 95
             android:name=".presentation.order.CustomCaptureActivity"
85 96
             android:exported="false"

+ 2 - 1
app/src/main/java/com/yihucha/hbyhc/config/Constants.java

@@ -68,7 +68,8 @@ public class Constants {
68 68
     /**
69 69
      * 友盟
70 70
      */
71
-    public static final String UM_KEY = "624559086adb343c47e9e623";
71
+//    public static final String UM_KEY = "624559086adb343c47e9e623";
72
+    public static final String UM_KEY = "65b31bcaa7208a5af1a39ae5";
72 73
     /**
73 74
      * token
74 75
      */

+ 10 - 0
app/src/main/java/com/yihucha/hbyhc/network/service/ProductService.java

@@ -5,6 +5,7 @@ import com.yihucha.hbyhc.network.DataResponse;
5 5
 import com.yihucha.hbyhc.network.request_bean.IdRequest;
6 6
 import com.yihucha.hbyhc.network.request_bean.TaobaoGoodsListRequest;
7 7
 import com.yihucha.hbyhc.network.request_bean.TaobaoLinkRequest;
8
+import com.yihucha.hbyhc.presentation.home.model.HomeProductBean;
8 9
 import com.yihucha.hbyhc.presentation.home.model.HomeProductListBean;
9 10
 import com.yihucha.hbyhc.presentation.home.model.ProductListBean;
10 11
 import com.yihucha.hbyhc.presentation.home.model.SearchGoodsListBean;
@@ -52,6 +53,15 @@ public interface ProductService {
52 53
     Observable<DataResponse<List<HomeProductListBean>>> homeProductList(@QueryMap Map<String, Object> request);
53 54
 
54 55
     /**
56
+     * 一壶茶首页商品列表、搜索接口
57
+     * @param request
58
+     * @return
59
+     */
60
+    @GET("gateway/wares_service/waresService/selectProductList")
61
+    Observable<DataResponse<HomeProductBean>> homeProductListYHC(@QueryMap Map<String, Object> request);
62
+
63
+
64
+    /**
55 65
      * 商品搜索
56 66
      *
57 67
      * @param

+ 8 - 5
app/src/main/java/com/yihucha/hbyhc/network/service/StoreService.java

@@ -29,22 +29,25 @@ public interface StoreService {
29 29
      */
30 30
 
31 31
     @GET("api/store/merchant/product/type_lst")
32
-    Call<VipAreaBean> getGongchangAreanList(@Query("page") int page,
32
+    Observable<DataJavaResponse<VipAreaBean>> getGongchangAreanList(@Query("page") int page,
33 33
                                             @Query("limit") int limit,
34 34
                                             @Query("type") String type,
35 35
                                             @Query("keyword") String keyword);
36 36
 
37 37
     /**
38 38
      * 会员专区
39
+     *
39 40
      * @param page
40 41
      * @param limit
41 42
      * @param keyword
42 43
      * @return
43 44
      */
44
-    @GET("api/store/merchant/product/lst/324")
45
-    Call<VipAreaBean> getVipAreanList(@Query("page") int page,@Query("limit") int limit,@Query("keyword") String keyword);
45
+    @GET("api/store/merchant/product/lst/496")
46
+    Observable<DataJavaResponse<VipAreaBean>> getVipAreanList(@Query("page") int page, @Query("limit") int limit, @Query("keyword") String keyword);
47
+
46 48
     /**
47 49
      * 店铺搜索
50
+     *
48 51
      * @param
49 52
      * @return
50 53
      */
@@ -53,6 +56,7 @@ public interface StoreService {
53 56
 
54 57
     /**
55 58
      * 附近分类
59
+     *
56 60
      * @param
57 61
      * @return
58 62
      */
@@ -60,12 +64,11 @@ public interface StoreService {
60 64
     Observable<DataJavaResponse<ClassifyBean>> getClassify();
61 65
 
62 66
 
63
-
64 67
     /**
65 68
      * 店铺信息
66 69
      */
67 70
     @GET("api/store/merchant/detail/{id}")
68
-    Observable<DataResponse<ShopInfoBean>> getShopInfo(@Path("id") String id,@QueryMap Map<String, Object> request);
71
+    Observable<DataResponse<ShopInfoBean>> getShopInfo(@Path("id") String id, @QueryMap Map<String, Object> request);
69 72
 
70 73
     /**
71 74
      * 店铺分类

+ 1 - 1
app/src/main/java/com/yihucha/hbyhc/presentation/MainActivityViewModel.java

@@ -38,7 +38,7 @@ public class MainActivityViewModel extends BaseViewModel {
38 38
         UserRepository.getCheckupdates(map, new NormalListener<CheckUpdatesBean>() {
39 39
             @Override
40 40
             public void success(CheckUpdatesBean checkUpdatesBean) {
41
-                mCheckUpdatesData.postValue(checkUpdatesBean);
41
+//                mCheckUpdatesData.postValue(checkUpdatesBean);
42 42
             }
43 43
 
44 44
             @Override

+ 3 - 3
app/src/main/java/com/yihucha/hbyhc/presentation/big_storehouse/adapter/HomeMSAdapter.kt

@@ -28,9 +28,7 @@ class HomeMSAdapter(private var dataList: List<DcSeckillBean.Product_data>?,var
28 28
     }
29 29
 
30 30
     override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MsViewHolder {
31
-        return MsViewHolder(
32
-            LayoutInflater.from(context).inflate(R.layout.item_home_miaosha, parent, false)
33
-        )
31
+        return MsViewHolder(LayoutInflater.from(context).inflate(R.layout.item_home_miaosha, parent, false))
34 32
     }
35 33
 
36 34
     override fun getItemCount(): Int {
@@ -41,7 +39,9 @@ class HomeMSAdapter(private var dataList: List<DcSeckillBean.Product_data>?,var
41 39
         var pBean = dataList!![position]
42 40
         holder.binding?.apply {
43 41
             tvNameItem.text = pBean.store_name
42
+            priceLayout.visibility =View.VISIBLE
44 43
             tvPriceItem.text = "${pBean.seckill_price}"
44
+
45 45
             tvYanglaojin.text = "养老金 ${pBean.yanglao}"
46 46
             Glide.with(context).load(pBean.image).into(imgvItem)
47 47
             layoutParent.setOnClickListener{

+ 68 - 0
app/src/main/java/com/yihucha/hbyhc/presentation/big_storehouse/adapter/HomeVipAdapter.kt

@@ -0,0 +1,68 @@
1
+package com.yihucha.hbyhc.presentation.big_storehouse.adapter
2
+
3
+import android.content.Context
4
+import android.view.LayoutInflater
5
+import android.view.View
6
+import android.view.ViewGroup
7
+import android.view.WindowManager
8
+import androidx.recyclerview.widget.RecyclerView.Adapter
9
+import androidx.recyclerview.widget.RecyclerView.ViewHolder
10
+import com.bumptech.glide.Glide
11
+import com.yihucha.hbyhc.R
12
+import com.yihucha.hbyhc.databinding.ItemHomeMiaoshaBinding
13
+import com.yihucha.hbyhc.databinding.ItemHomeVipBinding
14
+import com.yihucha.hbyhc.presentation.big_storehouse.model.DcSeckillBean
15
+import com.yihucha.hbyhc.presentation.product.ProductDetailsActivity
16
+import com.yihucha.hbyhc.presentation.shop.model.VipAreaBean
17
+import com.yihucha.hbyhc.utils.DensityUtils
18
+
19
+/**
20
+ *  author : zhangbing
21
+ *  time   : 2023/10/29 15:19
22
+ *  com.laolaixiang.bjtdba.presentation.big_storehouse.adapter
23
+ */
24
+class HomeVipAdapter(private var dataList: List<VipAreaBean.ListDTO>?, var context: Context) :
25
+    Adapter<HomeVipAdapter.VipViewHolder>() {
26
+
27
+    fun setDatas(dataList: List<VipAreaBean.ListDTO>){
28
+        this.dataList = dataList
29
+        notifyDataSetChanged()
30
+    }
31
+
32
+    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VipViewHolder {
33
+        return VipViewHolder(LayoutInflater.from(context).inflate(R.layout.item_home_vip, parent, false))
34
+    }
35
+
36
+    override fun getItemCount(): Int {
37
+        return if (dataList == null) 0 else dataList!!.size
38
+    }
39
+
40
+    override fun onBindViewHolder(holder: VipViewHolder, position: Int) {
41
+        var pBean = dataList!![position]
42
+        holder.binding?.apply {
43
+            tvNameItem.text = pBean.store_name
44
+            tvPriceItemVip.text = "${pBean.price}"
45
+
46
+            tvYanglaojin.text = "养老金 ${pBean.yanglao}"
47
+            Glide.with(context).load(pBean.image).into(imgvItem)
48
+            layoutParent.setOnClickListener{
49
+                ProductDetailsActivity.launch(context, pBean.product_id)
50
+            }
51
+        }
52
+    }
53
+
54
+    class VipViewHolder(val itemView: View) : ViewHolder(itemView) {
55
+
56
+        var binding:ItemHomeVipBinding?=null
57
+        init {
58
+            binding = ItemHomeVipBinding.bind(itemView)
59
+            val windowManager = itemView.context
60
+                .getSystemService(Context.WINDOW_SERVICE) as WindowManager
61
+            val display = windowManager.defaultDisplay
62
+            val layoutParams = itemView.layoutParams
63
+            layoutParams.width = (display.width
64
+                    - DensityUtils.dip2px(19f) * 2) / 3
65
+            itemView.layoutParams = layoutParams
66
+        }
67
+    }
68
+}

+ 5 - 5
app/src/main/java/com/yihucha/hbyhc/presentation/big_storehouse/model/DcSeckillBean.java

@@ -59,6 +59,7 @@ public class DcSeckillBean {
59 59
     }
60 60
 
61 61
     public class Product_data {
62
+        private String mer_id;
62 63
         private String product_id;//商品id
63 64
 
64 65
         private String store_name;
@@ -66,7 +67,6 @@ public class DcSeckillBean {
66 67
         private String ot_price;
67 68
         private String seckill_price;
68 69
         private String yanglao;
69
-        private String img;
70 70
         private String img_text;
71 71
         private String status;//1-抢购中。2-即将开始。3-已结速
72 72
 
@@ -134,12 +134,12 @@ public class DcSeckillBean {
134 134
             this.yanglao = yanglao;
135 135
         }
136 136
 
137
-        public String getImg() {
138
-            return img == null ? "" : img;
137
+        public String getMer_id() {
138
+            return mer_id;
139 139
         }
140 140
 
141
-        public void setImg(String img) {
142
-            this.img = img;
141
+        public void setMer_id(String mer_id) {
142
+            this.mer_id = mer_id;
143 143
         }
144 144
     }
145 145
 }

+ 175 - 311
app/src/main/java/com/yihucha/hbyhc/presentation/home/HomeFragment.java

@@ -12,7 +12,6 @@ import android.view.GestureDetector;
12 12
 import android.view.LayoutInflater;
13 13
 import android.view.View;
14 14
 import android.view.ViewGroup;
15
-import android.widget.TextView;
16 15
 import android.widget.Toast;
17 16
 
18 17
 import androidx.annotation.NonNull;
@@ -21,6 +20,7 @@ import androidx.core.content.ContextCompat;
21 20
 import androidx.core.widget.NestedScrollView;
22 21
 import androidx.lifecycle.Observer;
23 22
 import androidx.lifecycle.ViewModelProvider;
23
+import androidx.recyclerview.widget.DividerItemDecoration;
24 24
 import androidx.recyclerview.widget.GridLayoutManager;
25 25
 import androidx.recyclerview.widget.LinearLayoutManager;
26 26
 import androidx.recyclerview.widget.RecyclerView;
@@ -35,25 +35,25 @@ import com.yihucha.hbyhc.presentation.MainActivity;
35 35
 import com.yihucha.hbyhc.presentation.annuity.AnnuityActivity;
36 36
 import com.yihucha.hbyhc.presentation.big_storehouse.DacangSeckillActivity;
37 37
 import com.yihucha.hbyhc.presentation.big_storehouse.adapter.HomeMSAdapter;
38
+import com.yihucha.hbyhc.presentation.big_storehouse.adapter.HomeVipAdapter;
38 39
 import com.yihucha.hbyhc.presentation.big_storehouse.model.DcSeckillBean;
39 40
 import com.yihucha.hbyhc.presentation.big_storehouse.view_model.BigWarehouseViewModel;
40 41
 import com.yihucha.hbyhc.presentation.home.adapter.HomeImageAdapter;
41 42
 import com.yihucha.hbyhc.presentation.home.adapter.HomeProductListAdapter;
42 43
 import com.yihucha.hbyhc.presentation.home.model.BannerDataBean;
44
+import com.yihucha.hbyhc.presentation.home.model.HomeProductBean;
43 45
 import com.yihucha.hbyhc.presentation.home.model.HomeProductListBean;
44
-import com.yihucha.hbyhc.presentation.home.model.HomeQuickLink;
45 46
 import com.yihucha.hbyhc.presentation.home.view_model.HomeViewModel;
46
-import com.yihucha.hbyhc.presentation.home.zibubaojian.ZibubaojianActivity;
47 47
 import com.yihucha.hbyhc.presentation.members.AGuestMemberActivity;
48 48
 import com.yihucha.hbyhc.presentation.message.MessageActivity;
49
-import com.yihucha.hbyhc.presentation.message.TheAnnouncementActivity;
50 49
 import com.yihucha.hbyhc.presentation.message.model.TheAnnouncementBean;
51 50
 import com.yihucha.hbyhc.presentation.mine.model.UserInfoModel;
52
-import com.yihucha.hbyhc.presentation.mine.model.YanglaojinBean;
53 51
 import com.yihucha.hbyhc.presentation.product.OtherItemsListActivity;
54 52
 import com.yihucha.hbyhc.presentation.product.OtherMerchandiseDetailsActivity;
55 53
 import com.yihucha.hbyhc.presentation.product.ProductDetailsActivity;
56 54
 import com.yihucha.hbyhc.presentation.shop.VipAreaActivity;
55
+import com.yihucha.hbyhc.presentation.shop.model.VipAreaBean;
56
+import com.yihucha.hbyhc.presentation.shop.view_model.VipAreaViewModel;
57 57
 import com.yihucha.hbyhc.utils.GlideUtils;
58 58
 import com.yihucha.hbyhc.utils.ImmersedStatusbarUtils;
59 59
 import com.yihucha.hbyhc.utils.LogUtil;
@@ -64,7 +64,6 @@ import com.yihucha.hbyhc.utils.TimeUtils;
64 64
 import com.yihucha.hbyhc.view.MyToast;
65 65
 import com.lcodecore.tkrefreshlayout.RefreshListenerAdapter;
66 66
 import com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout;
67
-import com.sunfusheng.marqueeview.MarqueeView;
68 67
 import com.youth.banner.indicator.CircleIndicator;
69 68
 import com.youth.banner.listener.OnBannerListener;
70 69
 
@@ -75,41 +74,30 @@ import qiu.niorgai.StatusBarCompat;
75 74
 
76 75
 public class
77 76
 HomeFragment extends BaseFragment implements View.OnClickListener {
78
-
79
-    private MainActivity mActivity;
80 77
     private FragmentHomeBinding binding;
81 78
 
82 79
     private HomeViewModel homeViewModel;
83 80
     private BigWarehouseViewModel seckillViewModel;
84
-    private GestureDetector mDetector;//手势探测器
85
-//    private MyGestureListener mMyGestureListener;
81
+    private VipAreaViewModel vipAreaViewModel;
86 82
 
87
-    private List<HomeProductListBean> homeProductListBeans = new ArrayList<>();
83
+    private List<HomeProductBean.PageInfoDTO.ListDTO> homeProductListBeans = new ArrayList<>();
88 84
     private HomeProductListAdapter homeProductListAdapter;
89 85
 
90 86
     //秒杀商品
91 87
     private HomeMSAdapter adapter;
88
+    private HomeVipAdapter adapterVip;
92 89
     private List<DcSeckillBean.Product_data> seckillBeans = new ArrayList<>();
90
+    private List<VipAreaBean.ListDTO> vipBeans = new ArrayList<>();
93 91
     private int mPage = 1;
92
+    private String mer_keyword = "1";
93
+    private String isNew = "0";
94
+    private String priceType = "1";
95
+    private String sales = "0";
94 96
 
95
-    /**
96
-     * 公告
97
-     */
98
-    private List<TheAnnouncementBean.TheAnnouncementList> mTheAnnouncementBean = new ArrayList<>();
99
-
100
-    /**
101
-     * 接收MainActivity的Touch回调的对象,重写其中的onTouchEvent函数
102
-     */
103
-//    MainActivity.MyTouchListener myTouchListener = new MainActivity.MyTouchListener() {
104
-//        @Override
105
-//        public boolean onTouchEvent(MotionEvent event) {
106
-//            //处理手势事件(根据个人需要去返回和逻辑的处理)
107
-//            return mDetector.onTouchEvent(event);
108
-//        }
109
-//    };
97
+    private boolean isPriceUp = false;
98
+    private boolean isSalesUp = false;
110 99
 
111
-
112
-//正在滚动
100
+    //正在滚动
113 101
     public static final int SCROLL_STATE_IDLE = 0;
114 102
 
115 103
     //正在被外部拖拽,一般为用户正在用手指滚动
@@ -123,7 +111,7 @@ HomeFragment extends BaseFragment implements View.OnClickListener {
123 111
     public void onCreate(@Nullable Bundle savedInstanceState) {
124 112
         super.onCreate(savedInstanceState);
125 113
         //状态栏深色模式
126
-        StatusBarCompat.cancelLightStatusBar(getActivity());
114
+        StatusBarCompat.changeToLightStatusBar(getActivity());
127 115
     }
128 116
 
129 117
     public View onCreateView(@NonNull LayoutInflater inflater,
@@ -133,6 +121,9 @@ HomeFragment extends BaseFragment implements View.OnClickListener {
133 121
                 new ViewModelProvider(this).get(HomeViewModel.class);
134 122
         seckillViewModel =
135 123
                 new ViewModelProvider(this).get(BigWarehouseViewModel.class);
124
+        vipAreaViewModel =
125
+                new ViewModelProvider(this).get(VipAreaViewModel.class);
126
+
136 127
 
137 128
         binding = FragmentHomeBinding.inflate(inflater, container, false);
138 129
         View root = binding.getRoot();
@@ -156,87 +147,38 @@ HomeFragment extends BaseFragment implements View.OnClickListener {
156 147
         binding.headView.ivMessage.setOnClickListener(this);
157 148
         binding.headView.tvMessage.setOnClickListener(this);
158 149
         binding.tvGetMore.setOnClickListener(this);
159
-        homeProductListAdapter.setOnClickListener(new HomeProductListAdapter.OnClickListener() {
160
-            @Override
161
-            public void onItemClick(int position) {
162
-                if (!homeProductListBeans.get(position).getType().equals("6")) {
163
-                    //单击事件 跳进商品详情
164
-                    ProductDetailsActivity.launch(getActivity(), homeProductListBeans.get(position).getProduct_id());
165
-                } else {
166
-                    if (LoginUtils.isLogin(getActivity())) {
167
-                        OtherMerchandiseDetailsActivity.launch(getActivity(), Constants.JINGDONG, homeProductListBeans.get(position).getSkuId(),
168
-                                homeProductListBeans.get(position).getCoupon_money().get(0).getGetStartTime(),
169
-                                homeProductListBeans.get(position).getCoupon_money().get(0).getGetEndTime());
170
-                    }
171
-                }
172
-            }
173
-        });
174
-
175
-        binding.viewJingangqu.llSeckill.setOnClickListener(this);
176
-        binding.viewJingangqu.llDacang.setOnClickListener(this);
177
-        binding.viewJingangqu.llJingdong.setOnClickListener(this);
178
-        binding.viewJingangqu.llWeipinhui.setOnClickListener(this);
179
-        binding.viewJingangqu.llTaobao.setOnClickListener(this);
180
-        binding.viewJingangqu.llPinduoduo.setOnClickListener(this);
181
-        binding.viewJingangqu.llSuning.setOnClickListener(this);
182
-
183
-        binding.viewJingangqu.llGengduo.setOnClickListener(this);
184
-        binding.viewJingangqu.llJifentongdui.setOnClickListener(this);
185
-        binding.ivHuiyuan.setOnClickListener(this);
186
-        binding.viewJingangqu.llDouyin.setOnClickListener(this);
187
-        binding.viewJingangqu.llElderlyZone.setOnClickListener(this);
188
-        binding.viewJingangqu.llTheStudentZone.setOnClickListener(this);
189
-        binding.viewJingangqu.llNewZone.setOnClickListener(this);
190
-        binding.viewJingangqu.llGongchang.setOnClickListener(this);
191
-        binding.viewJingangqu.llSection.setOnClickListener(this);
192
-        binding.viewJingangqu.llZibubaojian.setOnClickListener(this);
193
-        binding.viewJingangqu.llDslm.setOnClickListener(this);
150
+        binding.tvBuyNow.setOnClickListener(this);
151
+        homeProductListAdapter.setOnClickListener(position -> ProductDetailsActivity.launch(getActivity(),
152
+                homeProductListBeans.get(position).getProduct_id() + ""));
194 153
         binding.tvScrollTop.setOnClickListener(this);
195
-        binding.marqueeView.setOnItemClickListener(new MarqueeView.OnItemClickListener() {
196
-            @Override
197
-            public void onItemClick(int position, TextView textView) {
198
-                //跳进页面
199
-                TheAnnouncementActivity.launch(getActivity(), mTheAnnouncementBean.get(position).getTitle(),
200
-                        mTheAnnouncementBean.get(position).getContent(), mTheAnnouncementBean.get(position).getCreate_time());
201 154
 
202
-            }
203
-        });
155
+        binding.llRecommend.setOnClickListener(this);
156
+        binding.llSearchUpdate.setOnClickListener(this);
157
+        binding.llSearchSales.setOnClickListener(this);
158
+        binding.llSearchPrice.setOnClickListener(this);
159
+        binding.headView.ivMessage.setOnClickListener(this);
160
+        binding.headView.tvMessage.setOnClickListener(this);
161
+
204 162
     }
205 163
 
206 164
     private void initApi() {
207
-        //金刚区
208
-        homeViewModel.getHomeQuickLink();
209
-        homeViewModel.mHomeQuickLink.observe(getActivity(), new Observer<HomeQuickLink>() {
210
-            @Override
211
-            public void onChanged(HomeQuickLink homeQuickLink) {
212
-
213
-//                GlideUtils.loadImage(getActivity(),homeQuickLink.getImage(), binding.viewJingangqu.ivImage);
214
-                Glide.with(getActivity())
215
-                        .load(homeQuickLink.getImage())
216
-                        .error(R.mipmap.in_figure_220907)
217
-                        .placeholder(R.mipmap.in_figure_220907)
218
-                        .into(binding.viewJingangqu.ivImage);
219
-//                System.out.println("滋补保健图片--->"+homeQuickLink.getImage());
220
-                binding.viewJingangqu.tvTitle.setText(homeQuickLink.getTitle());
221
-            }
222
-        });
223 165
         //商品列表
224
-        homeViewModel.getHomeProductListData(mPage + "");
166
+        homeViewModel.getHomeProductListData(mPage, mer_keyword, isNew, priceType, sales);
225 167
         //网络发生错误
226
-        homeViewModel.failed.observe(getActivity(), new Observer<String>() {
227
-            @Override
228
-            public void onChanged(String s) {
229
-                MyToast.makeText(getContext(), s, Toast.LENGTH_LONG).show();
230
-            }
231
-        });
168
+        homeViewModel.failed.observe(getActivity(), s -> MyToast.makeText(getContext(), s, Toast.LENGTH_LONG).show());
232 169
         //商品列表请求成功
233
-        homeViewModel.homeProductListData.observe(getActivity(), new Observer<List<HomeProductListBean>>() {
234
-            @Override
235
-            public void onChanged(List<HomeProductListBean> data) {
236
-                homeProductListBeans = data;
237
-//                homeProductListAdapter.addData(homeProductListBeans);
238
-                homeProductListAdapter.updateData(homeProductListBeans);
170
+        homeViewModel.homeProductListDataYHC.observe(getActivity(), data -> {
171
+            if (data == null || data.size() == 0) {
172
+                if (mPage > 1) {
173
+                    mPage -= 1;
174
+                }
175
+                return;
239 176
             }
177
+            if (mPage == 1) {
178
+                homeProductListBeans.clear();
179
+            }
180
+            homeProductListBeans.addAll(data);
181
+            homeProductListAdapter.setData(homeProductListBeans);
240 182
         });
241 183
         //用户信息
242 184
         homeViewModel.userModel.observe(getActivity(), new Observer<UserInfoModel>() {
@@ -245,39 +187,23 @@ HomeFragment extends BaseFragment implements View.OnClickListener {
245 187
                 Log.i("qmz", "235");
246 188
                 GlideUtils.loadCircleImage(getActivity(), uesrInfoMpdel.getAvatar(), binding.headView.ivHead, R.mipmap.home_default_avatar_220614);
247 189
                 binding.headView.btvName.setText(uesrInfoMpdel.getNickname());
248
-//                binding.headView.tvAnnuity.setText(uesrInfoMpdel.getAnnuity() + "元养老金");
249 190
             }
250 191
         });
251
-        homeViewModel.yanglaojinBeanMutableLiveData.observe(getActivity(), new Observer<YanglaojinBean>() {
252
-            @Override
253
-            public void onChanged(YanglaojinBean yanglaojinBean) {
254 192
 
255
-                binding.headView.tvAnnuity.setText(yanglaojinBean.getAll_yanglao() + "元养老金");
256
-            }
257
-        });
193
+        homeViewModel.getBannerData();
194
+        getBanner();
258 195
 
259
-        //公告
260
-        homeViewModel.getNoticeList();
261
-        homeViewModel.mTheAnnouncementData.observe(getActivity(), new Observer<List<TheAnnouncementBean.TheAnnouncementList>>() {
262
-            @Override
263
-            public void onChanged(List<TheAnnouncementBean.TheAnnouncementList> theAnnouncementBeans) {
264
-                if (!theAnnouncementBeans.isEmpty() && theAnnouncementBeans.size() > 0) {
265
-                    mTheAnnouncementBean = theAnnouncementBeans;
266
-                    List<String> info = new ArrayList<>();
267
-                    for (int i = 0; i < mTheAnnouncementBean.size(); i++) {
268
-                        info.add(mTheAnnouncementBean.get(i).getTitle());
269
-                    }
270
-                    binding.marqueeView.startWithList(info);
271
-                    binding.llTheAnnouncement.setVisibility(View.GONE);
272
-                } else {
273
-                    binding.llTheAnnouncement.setVisibility(View.GONE);
274
-                }
196
+        vipAreaViewModel.requestData(1, 10, "");
197
+        vipAreaViewModel.vipAreaData.observe(getViewLifecycleOwner(), data -> {
198
+            if (data == null || data.size() == 0) {
199
+                binding.layoutVip.setVisibility(View.GONE);
200
+                return;
201
+            }else {
202
+                binding.layoutVip.setVisibility(View.VISIBLE);
275 203
             }
204
+            adapterVip.setDatas(data);
276 205
         });
277 206
 
278
-        homeViewModel.getBannerData();
279
-        getBanner();
280
-
281 207
         seckillViewModel.getDcSeckill();
282 208
         seckillViewModel.mDcSeckillBean.observe(getViewLifecycleOwner(), dcSeckillBeans -> {
283 209
             if (dcSeckillBeans == null || dcSeckillBeans.size() == 0) {
@@ -293,8 +219,9 @@ HomeFragment extends BaseFragment implements View.OnClickListener {
293 219
             }
294 220
         });
295 221
     }
222
+
296 223
     //设置秒杀的显示状态
297
-    private void setMS(List<DcSeckillBean> dcSeckillBeans){
224
+    private void setMS(List<DcSeckillBean> dcSeckillBeans) {
298 225
         int usePos = -1;
299 226
         for (int i = 0; i < dcSeckillBeans.size(); i++) {
300 227
             //找秒杀中或者下一场秒杀的数据
@@ -303,14 +230,16 @@ HomeFragment extends BaseFragment implements View.OnClickListener {
303 230
                 break;
304 231
             }
305 232
         }
306
-        if (usePos==-1) {
233
+        if (usePos == -1) {
307 234
             binding.layoutSeckill.setVisibility(View.GONE);
308 235
             return;
236
+        }else {
237
+            binding.layoutSeckill.setVisibility(View.VISIBLE);
309 238
         }
310 239
         //数据
311 240
         DcSeckillBean dcSeckillBean = dcSeckillBeans.get(usePos);
312 241
         List<DcSeckillBean.Product_data> product_data = dcSeckillBean.getProduct_data();
313
-        if (product_data == null||product_data.size()<1) {
242
+        if (product_data == null || product_data.size() < 1) {
314 243
             binding.layoutSeckill.setVisibility(View.GONE);
315 244
             return;
316 245
         }
@@ -318,7 +247,7 @@ HomeFragment extends BaseFragment implements View.OnClickListener {
318 247
         seckillBeans.clear();
319 248
         seckillBeans.addAll(product_data);
320 249
         adapter.setDatas(seckillBeans);
321
-        if (dcSeckillBean.getStatus()==1){
250
+        if (dcSeckillBean.getStatus() == 1) {
322 251
             //正在秒杀
323 252
             binding.layoutTime.setVisibility(View.VISIBLE);
324 253
             if (TimeUtils.init(dcSeckillBean.getSeckill_date())) {
@@ -327,12 +256,13 @@ HomeFragment extends BaseFragment implements View.OnClickListener {
327 256
                     @Override
328 257
                     public void onTick(long l) {
329 258
                         long timeHour = StringsUtil.getHour(l);
330
-                        binding.tvHours.setText(timeHour>=10?timeHour+"":"0"+timeHour);
259
+                        binding.tvHours.setText(timeHour >= 10 ? timeHour + "" : "0" + timeHour);
331 260
                         long timeMinute = StringsUtil.getMinute(l);
332
-                        binding.tvMinute.setText(timeMinute>=10?timeMinute+"":"0"+timeMinute);
261
+                        binding.tvMinute.setText(timeMinute >= 10 ? timeMinute + "" : "0" + timeMinute);
333 262
                         long timeSecond = StringsUtil.getSecond(l);
334
-                        binding.tvSencond.setText(timeSecond>=10?timeSecond+"":"0"+timeSecond);
263
+                        binding.tvSencond.setText(timeSecond >= 10 ? timeSecond + "" : "0" + timeSecond);
335 264
                     }
265
+
336 266
                     @Override
337 267
                     public void onFinish() {
338 268
                         timer.cancel();
@@ -342,11 +272,12 @@ HomeFragment extends BaseFragment implements View.OnClickListener {
342 272
                 };
343 273
                 timer.start();
344 274
             }
345
-        }else {
275
+        } else {
346 276
             //即将开始
347 277
             binding.layoutTime.setVisibility(View.GONE);
348 278
         }
349 279
     }
280
+
350 281
     private void initData() {
351 282
 
352 283
         if (!"".equals(MVUtils.getString(Constants.TOKEN))) {
@@ -355,15 +286,12 @@ HomeFragment extends BaseFragment implements View.OnClickListener {
355 286
         }
356 287
 
357 288
 //养老金
358
-        if (!"".equals(MVUtils.getString(Constants.TOKEN))) {
289
+        /*if (!"".equals(MVUtils.getString(Constants.TOKEN))) {
359 290
             homeViewModel.getYanglaojin();
360
-        }
291
+        }*/
361 292
     }
362 293
 
363 294
     private void initView() {
364
-        /** 触摸事件的注册 */
365
-//        ((MainActivity)this.getActivity()).registerMyTouchListener(myTouchListener);
366
-
367 295
         binding.scrollview.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
368 296
             @Override
369 297
             public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
@@ -371,34 +299,24 @@ HomeFragment extends BaseFragment implements View.OnClickListener {
371 299
                 showHeaderAlphaAction(scrollY);
372 300
             }
373 301
         });
374
-        //实例化SimpleOnGestureListener与GestureDetector对象
375
-//        mMyGestureListener=new MyGestureListener();
376
-//        mDetector=new GestureDetector(getActivity(),mMyGestureListener);
377
-
378
-
379
-//        //建立布局管理
380
-//        StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL) {
381
-//            @Override
382
-//            public boolean canScrollVertically() {
383
-//                return false;
384
-//            }
385
-//        };
386
-//        //布局
387
-////        LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
388
-//        binding.rvHomeList.setLayoutManager(layoutManager);
302
+        //会员专区
303
+        LinearLayoutManager layoutManagerVip = new LinearLayoutManager(getActivity()
304
+                , LinearLayoutManager.HORIZONTAL, false);
305
+        binding.rvVip.setLayoutManager(layoutManagerVip);
306
+        binding.rvVip.addItemDecoration(new DividerItemDecoration(getContext(), LinearLayoutManager.HORIZONTAL));
307
+        adapterVip = new HomeVipAdapter(vipBeans, getActivity());
308
+        binding.rvVip.setAdapter(adapterVip);
309
+
310
+//        //布局 秒杀
389 311
         LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()
390 312
                 , LinearLayoutManager.HORIZONTAL, false);
391 313
         binding.rvMiaosha.setLayoutManager(layoutManager);
392
-        adapter = new HomeMSAdapter(seckillBeans,getActivity());
314
+        binding.rvMiaosha.addItemDecoration(new DividerItemDecoration(getContext(), LinearLayoutManager.HORIZONTAL));
315
+        adapter = new HomeMSAdapter(seckillBeans, getActivity());
393 316
         binding.rvMiaosha.setAdapter(adapter);
394 317
 
395 318
         GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 2);
396 319
         binding.rvHomeList.setLayoutManager(gridLayoutManager);
397
-//        binding.rvHomeList.addItemDecoration(new GridSpacingItemDecoration(2, 16, false));
398
-        //设置item间距,30dp
399
-//        binding.rvHomeList.addItemDecoration(new SpaceItemDecoration(26));
400
-        //建立适配器
401
-//        homeProductListAdapter = new HomeProductListAdapter(getActivity(),R.layout.item_home_productlist, homeProductListBeans);
402 320
         homeProductListAdapter = new HomeProductListAdapter(getActivity(), homeProductListBeans);
403 321
         //给RecyclerView设置适配器
404 322
         binding.rvHomeList.setAdapter(homeProductListAdapter);
@@ -416,11 +334,8 @@ HomeFragment extends BaseFragment implements View.OnClickListener {
416 334
                     new Handler().postDelayed(new Runnable() {
417 335
                         @Override
418 336
                         public void run() {
419
-
420 337
                             mPage++;
421
-                            homeViewModel.getHomeProductListData(mPage + "");
422
-
423
-
338
+                            homeViewModel.getHomeProductListData(mPage, mer_keyword, isNew, priceType, sales);
424 339
                         }
425 340
                     }, 1000);
426 341
                 }
@@ -429,63 +344,19 @@ HomeFragment extends BaseFragment implements View.OnClickListener {
429 344
             @Override
430 345
             public void onPullDownReleasing(TwinklingRefreshLayout refreshLayout, float fraction) {
431 346
                 super.onPullDownReleasing(refreshLayout, fraction);
432
-                if (fraction == 0.0){
347
+                if (fraction == 0.0) {
433 348
                     seckillViewModel.getDcSeckill();
434 349
                 }
435
-//                if (fraction == 0.0) {
436
-//                    new Handler().postDelayed(new Runnable() {
437
-//                        @Override
438
-//                        public void run() {//刷新
439
-//                            refreshLayout.finishRefreshing();
440
-//
441
-//                            homeViewModel.getBannerData();
442
-//                            mPage = 1;
443
-//                            homeProductListBeans.clear();
444
-//                            homeViewModel.getHomeProductListData(mPage + "");
445
-//
446
-//                            if (!"".equals(MVUtils.getString(Constants.TOKEN))) {
447
-//                                //用户信息
448
-//                                homeViewModel.getUserInfo();
449
-//                            }
450
-//                        }
451
-//                    }, 250);
452
-//                }
453 350
             }
454 351
 
455 352
             @Override
456 353
             public void onRefresh(final TwinklingRefreshLayout refreshLayout) {
457
-//                new Handler().postDelayed(new Runnable() {
458
-//                    @Override
459
-//                    public void run() {//刷新
460
-//                        refreshLayout.finishRefreshing();
461
-//
462
-//                        homeViewModel.getBannerData();
463
-//                        mPage = 1;
464
-//                        homeProductListBeans.clear();
465
-//                        homeViewModel.getHomeProductListData(mPage + "");
466
-//
467
-//                        if (!"".equals(MVUtils.getString(Constants.TOKEN))) {
468
-//                            //用户信息
469
-//                            homeViewModel.getUserInfo();
470
-//                        }
471
-//                    }
472
-//                }, 250);
473
-
474 354
 
475 355
 
476 356
             }
477 357
 
478 358
             @Override
479 359
             public void onLoadMore(final TwinklingRefreshLayout refreshLayout) {
480
-//                new Handler().postDelayed(new Runnable() {
481
-//                    @Override
482
-//                    public void run() {
483
-//                        //加载
484
-//                        refreshLayout.finishLoadmore();
485
-//                        mPage++;
486
-//                        homeViewModel.getHomeProductListData(mPage + "");
487
-//                    }
488
-//                }, 0);
489 360
             }
490 361
         });
491 362
 
@@ -560,7 +431,7 @@ HomeFragment extends BaseFragment implements View.OnClickListener {
560 431
                                 } else if (listDataResponse.getData().get(position).getUrl().equals("rich")) {
561 432
                                     //VIP专区
562 433
                                     VipAreaActivity.lanuch(getActivity());
563
-                                }else if (listDataResponse.getData().get(position).getUrl().equals(Constants.SHOP)){
434
+                                } else if (listDataResponse.getData().get(position).getUrl().equals(Constants.SHOP)) {
564 435
                                     //精品商城
565 436
                                     DingShengLianMengActivity.lanunch(getActivity(), 1);
566 437
                                 }
@@ -579,33 +450,12 @@ HomeFragment extends BaseFragment implements View.OnClickListener {
579 450
     private void showHeaderAlphaAction(int y) {
580 451
         final int rootPicHeight = binding.headView.viewTop.getHeight();
581 452
         if (y <= rootPicHeight) {
582
-            float scale = (float) y / rootPicHeight;
583
-            binding.headView.viewHeaderBg.setAlpha(scale);
453
+            binding.headView.viewHeaderBg.setBackgroundResource(R.mipmap.home_top_bg_scroll);
584 454
             //状态栏深色模式
585
-            StatusBarCompat.cancelLightStatusBar(getActivity());
586
-
587
-            binding.headView.btvName.setTextColor(ContextCompat.getColor(getActivity(), R.color.white));
588
-            binding.headView.tvAnnuity.setTextColor(ContextCompat.getColor(getActivity(), R.color.white));
589
-            binding.headView.tvSendAnnuity.setTextColor(ContextCompat.getColor(getActivity(), R.color.white));
590
-            binding.headView.tvMessage.setTextColor(ContextCompat.getColor(getActivity(), R.color.white));
591
-
592
-            binding.headView.ivMessage.setImageResource(R.mipmap.home_message_220614);
593
-            binding.headView.llSearch.setBackgroundResource(R.drawable.shape_ffffff_15dp);
594 455
             binding.tvScrollTop.setVisibility(View.GONE);
595 456
         } else {
596 457
             binding.tvScrollTop.setVisibility(View.VISIBLE);
597
-            //上划之后的效果
598
-            binding.headView.viewHeaderBg.setAlpha(1);
599
-            //状态栏浅色模式
600
-            StatusBarCompat.changeToLightStatusBar(getActivity());
601
-
602
-            binding.headView.btvName.setTextColor(ContextCompat.getColor(getActivity(), R.color.black_333333));
603
-            binding.headView.tvAnnuity.setTextColor(ContextCompat.getColor(getActivity(), R.color.black_333333));
604
-            binding.headView.tvSendAnnuity.setTextColor(ContextCompat.getColor(getActivity(), R.color.black_333333));
605
-            binding.headView.tvMessage.setTextColor(ContextCompat.getColor(getActivity(), R.color.black_333333));
606
-
607
-            binding.headView.ivMessage.setImageResource(R.mipmap.home_black_message_220614);
608
-            binding.headView.llSearch.setBackgroundResource(R.drawable.shape_line_fe0032_15dp);
458
+            binding.headView.viewHeaderBg.setBackgroundResource(R.mipmap.home_top_bg);
609 459
         }
610 460
     }
611 461
 
@@ -616,18 +466,6 @@ HomeFragment extends BaseFragment implements View.OnClickListener {
616 466
     }
617 467
 
618 468
     @Override
619
-    public void onStart() {
620
-        super.onStart();
621
-        binding.marqueeView.startFlipping();
622
-    }
623
-
624
-    @Override
625
-    public void onStop() {
626
-        super.onStop();
627
-        binding.marqueeView.stopFlipping();
628
-    }
629
-
630
-    @Override
631 469
     public void onDestroyView() {
632 470
         super.onDestroyView();
633 471
         binding = null;
@@ -642,84 +480,110 @@ HomeFragment extends BaseFragment implements View.OnClickListener {
642 480
             binding.scrollview.scrollTo(0, 0);
643 481
             binding.rvHomeList.scrollToPosition(0);
644 482
         } else if (view == binding.headView.rlTop) {
645
-            //判断登录
646 483
             //养老金
647 484
             if (LoginUtils.isLogin(getActivity())) {
648 485
                 AnnuityActivity.launch(getActivity());
649 486
             }
650 487
         } else if (view == binding.headView.llSearch) {
651 488
             //搜索
652
-            //京东
653
-            OtherItemsListActivity.launch(getActivity(), Constants.JINGDONG);
654
-        } else if (view == binding.viewJingangqu.llSeckill) {
655
-            //秒杀
656
-            if (LoginUtils.isLogin(getActivity())) {
657
-                DacangSeckillActivity.launch(getActivity());
658
-            }
659
-        } else if (view == binding.viewJingangqu.llDacang) {
660
-            //大仓
661
-//            MainActivity.launch(getActivity(), "3");
662
-            DingShengLianMengActivity.lanunch(getActivity(), 1);
663
-        } else if (view == binding.viewJingangqu.llJingdong) {
664
-            //京东
665
-            OtherItemsListActivity.launch(getActivity(), Constants.JINGDONG);
666
-        } else if (view == binding.viewJingangqu.llWeipinhui) {
667
-            //唯品会
668
-            OtherItemsListActivity.launch(getActivity(), Constants.WEIPINGHUI);
669
-        } else if (view == binding.viewJingangqu.llTaobao) {
670
-            //淘宝
671
-            OtherItemsListActivity.launch(getActivity(), Constants.TAOBAO);
672
-        } else if (view == binding.viewJingangqu.llPinduoduo) {
673
-            //拼多多
674
-            OtherItemsListActivity.launch(getActivity(), Constants.PINDUODUO);
675
-        } else if (view == binding.viewJingangqu.llSuning) {
676
-            //苏宁
677
-            OtherItemsListActivity.launch(getActivity(), Constants.SUNING);
678
-        } else if (view == binding.viewJingangqu.llJifentongdui) {
679
-            if (LoginUtils.isLogin(getActivity())) {
680
-                //积分通兑
681
-                IntegralarActivity.launch(getActivity());
682
-            }
683
-        } else if (view == binding.headView.ivMessage||view == binding.headView.tvMessage) {
684
-            //消息
685
-            MessageActivity.launch(getActivity());
686
-        } else if (view == binding.ivHuiyuan) {
687
-            if (LoginUtils.isLogin(getActivity())) {
688
-                AGuestMemberActivity.launch(getActivity());
689
-            }
690
-        } else if (view == binding.viewJingangqu.llDouyin) {
691
-            //抖音
692
-            OtherItemsListActivity.launch(getActivity(), Constants.DOUYIN);
693
-        } else if (view == binding.viewJingangqu.llElderlyZone) {
694
-            //老年专区
695
-//            getActivity().finish();
696
-            MainActivity.launch(getActivity(), "3", "571");
697
-        } else if (view == binding.viewJingangqu.llTheStudentZone) {
698
-            //学生专区
699
-//            getActivity().finish();
700
-            MainActivity.launch(getActivity(), "3", "576");
701
-        } else if (view == binding.viewJingangqu.llNewZone) {
489
+//            SearchActivity2.launch(getActivity());
490
+            YHCHomeSearchActivity.launch(getActivity());
491
+        } else if (view == binding.tvBuyNow) {
702 492
             //新人专区
703 493
             VipAreaActivity.lanuch(getActivity());
704
-        } else if (view == binding.viewJingangqu.llGongchang) {
705
-            VipAreaActivity.lanuch(getActivity(),1);
706
-        } else if (view == binding.viewJingangqu.llSection) {
707
-            //9.9
708
-//            getActivity().finish();
709
-            MainActivity.launch(getActivity(), "3", "567");
710
-        } else if (view == binding.viewJingangqu.llGengduo) {
711
-//            getActivity().finish();
712
-            MainActivity.launch(getActivity(), "2");
713
-        } else if (view == binding.viewJingangqu.llZibubaojian) {
714
-            ZibubaojianActivity.launch(getActivity(), "430");
715
-        } else if (view == binding.viewJingangqu.llDslm) {
716
-            //精品商城
717
-            DingShengLianMengActivity.lanunch(getActivity());
718 494
         } else if (view == binding.tvGetMore) {
719 495
             DacangSeckillActivity.launch(getActivity());
496
+        }else if (view == binding.headView.ivMessage || view == binding.headView.tvMessage){
497
+            MessageActivity.launch(getActivity());
498
+        }else if (view == binding.llRecommend){
499
+            //推荐,默认选项
500
+            isPriceUp = false;
501
+            isSalesUp = false;
502
+            mPage =1;
503
+            isNew = "0";
504
+            priceType = "1";
505
+            sales = "0";
506
+            setSelectButton(0);
507
+        } else if (view == binding.llSearchUpdate){
508
+            //上新
509
+            isPriceUp = false;
510
+            isSalesUp = false;
511
+            mPage =1;
512
+            isNew = "1";
513
+            priceType = "1";
514
+            sales = "0";
515
+            setSelectButton(1);
516
+        } else if (view == binding.llSearchSales){
517
+            //销量
518
+            isPriceUp = false;
519
+            isSalesUp = !isSalesUp;
520
+            mPage =1;
521
+            isNew = "0";
522
+            priceType = "1";
523
+            sales = isSalesUp?"1":"0";
524
+            setSelectButton(2);
525
+        } else if (view == binding.llSearchPrice){
526
+            //价格
527
+            isSalesUp = false;
528
+            isPriceUp = !isPriceUp;
529
+            mPage =1;
530
+            isNew = "0";
531
+            priceType = isPriceUp?"1":"0";
532
+            sales = "1";
533
+            setSelectButton(3);
720 534
         }
721 535
     }
536
+    private int currentPos = 0;
537
+    private void setSelectButton(int pos){
538
+        if (currentPos == pos && (pos==0||pos==1)) return;  //重复点击 推荐 和 上新选项是无意义的,直接返回
539
+
540
+        binding.btvRecommend.setTextColor(ContextCompat.getColor(getContext(), R.color.black_333333));
541
+        binding.btvSearchUpdate.setTextColor(ContextCompat.getColor(getContext(), R.color.black_333333));
542
+        binding.btvSearchSales.setTextColor(ContextCompat.getColor(getContext(), R.color.black_333333));
543
+        binding.btvSearchPrice.setTextColor(ContextCompat.getColor(getContext(), R.color.black_333333));
544
+        if (pos != 2){
545
+            binding.ivShengxuSales.setImageResource(R.mipmap.tuijian_shangla);
546
+            binding.ivJiangxuSale.setImageResource(R.mipmap.tuijian_xiala);
547
+        }
548
+        if (pos != 3){
549
+            binding.ivShengxu.setImageResource(R.mipmap.tuijian_shangla);
550
+            binding.ivJiangxu.setImageResource(R.mipmap.tuijian_xiala);
551
+        }
552
+        switch (pos) {
553
+            case 0:
554
+                binding.btvRecommend.setTextColor(ContextCompat.getColor(getContext(), R.color.red_fe0032));
555
+                homeViewModel.getHomeProductListData(mPage, mer_keyword, null, null, null);
556
+                break;
557
+            case 1:
558
+                binding.btvSearchUpdate.setTextColor(ContextCompat.getColor(getContext(), R.color.red_fe0032));
559
+                homeViewModel.getHomeProductListData(mPage, mer_keyword, isNew, null, null);
560
+                break;
561
+            case 2:
562
+                binding.btvSearchSales.setTextColor(ContextCompat.getColor(getContext(), R.color.red_fe0032));
563
+                homeViewModel.getHomeProductListData(mPage, mer_keyword, null, null, sales);
564
+                if (isSalesUp){
565
+                    binding.ivShengxuSales.setImageResource(R.mipmap.search_red_shangla_220617);
566
+                    binding.ivJiangxuSale.setImageResource(R.mipmap.tuijian_xiala);
567
+                }else {
568
+                    binding.ivShengxuSales.setImageResource(R.mipmap.tuijian_shangla);
569
+                    binding.ivJiangxuSale.setImageResource(R.mipmap.search_red_xiala_220617);
570
+                }
571
+                break;
572
+            case 3:
573
+                binding.btvSearchPrice.setTextColor(ContextCompat.getColor(getContext(), R.color.red_fe0032));
574
+                homeViewModel.getHomeProductListData(mPage, mer_keyword, null, priceType, null);
575
+                if (isPriceUp){
576
+                    binding.ivShengxu.setImageResource(R.mipmap.search_red_shangla_220617);
577
+                    binding.ivJiangxu.setImageResource(R.mipmap.tuijian_xiala);
578
+                }else {
579
+                    binding.ivShengxu.setImageResource(R.mipmap.tuijian_shangla);
580
+                    binding.ivJiangxu.setImageResource(R.mipmap.search_red_xiala_220617);
581
+                }
582
+                break;
583
+        }
584
+        currentPos = pos;
722 585
 
586
+    }
723 587
     @Override
724 588
     public void onDestroy() {
725 589
         super.onDestroy();

+ 102 - 140
app/src/main/java/com/yihucha/hbyhc/presentation/home/SearchActivity2.java

@@ -69,7 +69,7 @@ public class SearchActivity2 extends ViewBindingBaseActivity<ActivitySearch2Bind
69 69
     private RecordsDao mRecordsDao;//搜索db
70 70
     //默然展示词条个数
71 71
     private final int DEFAULT_RECORD_NUMBER = 30;
72
-    private List<String> listOne = new ArrayList<String>();
72
+    private List<String> listOne = new ArrayList();
73 73
     private TagAdapter hotTagAdapter;//热门关键字
74 74
 
75 75
     private SearchViewModel searchViewModel;
@@ -332,17 +332,14 @@ public class SearchActivity2 extends ViewBindingBaseActivity<ActivitySearch2Bind
332 332
             }
333 333
         });
334 334
         //热门关键字
335
-        searchViewModel.hotkeyData.observe(this, new Observer<List<HotKetWordBean>>() {
336
-            @Override
337
-            public void onChanged(List<HotKetWordBean> hotKetWordBeans) {
338
-                for (int i = 0; i < hotKetWordBeans.size(); i++) {
339
-                    listOne.add(hotKetWordBeans.get(i).getKeyword());
340
-                }
341
-                Log.i("num", JSON.toJSONString(listOne));
342
-                if (hotTagAdapter != null) {
343
-                    hotTagAdapter.setData(listOne);
344
-                    hotTagAdapter.notifyDataChanged();
345
-                }
335
+        searchViewModel.hotkeyData.observe(this, hotKetWordBeans -> {
336
+            for (int i = 0; i < hotKetWordBeans.size(); i++) {
337
+                listOne.add(hotKetWordBeans.get(i).getKeyword());
338
+            }
339
+            Log.i("num", JSON.toJSONString(listOne));
340
+            if (hotTagAdapter != null) {
341
+                hotTagAdapter.setData(listOne);
342
+                hotTagAdapter.notifyDataChanged();
346 343
             }
347 344
         });
348 345
         //商品搜索结果
@@ -355,7 +352,7 @@ public class SearchActivity2 extends ViewBindingBaseActivity<ActivitySearch2Bind
355 352
                     mViewBinding.searchRecords.llSearchHistoryIsRecommended.setVisibility(View.GONE);
356 353
                     mViewBinding.searchList.noSearch.llNotFound.setVisibility(View.VISIBLE);
357 354
                     mViewBinding.searchList.llContent.setVisibility(View.GONE);
358
-                }else if (mPage == 1 && productLists.size() > 0) {
355
+                } else if (mPage == 1 && productLists.size() > 0) {
359 356
                     //第一次搜索数据没有清空干净
360 357
 //                    mViewBinding.searchList.llTabList.setVisibility(View.GONE);
361 358
                     mViewBinding.searchRecords.llSearchHistoryIsRecommended.setVisibility(View.GONE);
@@ -399,31 +396,23 @@ public class SearchActivity2 extends ViewBindingBaseActivity<ActivitySearch2Bind
399 396
 
400 397
     @SuppressLint("CheckResult")
401 398
     private void setRecordsDao() {
402
-        Observable.create(new ObservableOnSubscribe<List<String>>() {
403
-                    @Override
404
-                    public void subscribe(ObservableEmitter<List<String>> emitter) throws Exception {
405
-                        emitter.onNext(mRecordsDao.getRecordsByNumber(DEFAULT_RECORD_NUMBER));
406
-                    }
407
-                }).subscribeOn(Schedulers.io())
399
+        Observable.create((ObservableOnSubscribe<List<String>>) emitter -> emitter.onNext(mRecordsDao.getRecordsByNumber(DEFAULT_RECORD_NUMBER))).subscribeOn(Schedulers.io())
408 400
                 .observeOn(AndroidSchedulers.mainThread())
409
-                .subscribe(new Consumer<List<String>>() {
410
-                    @Override
411
-                    public void accept(List<String> s) throws Exception {
412
-                        recordList.clear();
413
-                        recordList = s;
414
-//                        if (null == recordList || recordList.size() == 0) {
415
-//                            mHistoryContent.setVisibility(View.GONE);
416
-//                        } else {
417
-//                            mHistoryContent.setVisibility(View.VISIBLE);
418
-//                        }
419
-                        if (mRecordsAdapter != null) {
420
-                            mRecordsAdapter.setData(recordList);
421
-                            mRecordsAdapter.notifyDataChanged();
422
-                        }
423
-                        if (mDeleteRecordsAdapter != null) {
424
-                            mDeleteRecordsAdapter.setData(recordList);
425
-                            mDeleteRecordsAdapter.notifyDataChanged();
426
-                        }
401
+                .subscribe(s -> {
402
+                    recordList.clear();
403
+                    recordList = s;
404
+                    if (null == recordList || recordList.size() == 0) {
405
+                        mViewBinding.searchRecords.llHistoryContent.setVisibility(View.GONE);
406
+                    } else {
407
+                        mViewBinding.searchRecords.llHistoryContent.setVisibility(View.VISIBLE);
408
+                    }
409
+                    if (mRecordsAdapter != null) {
410
+                        mRecordsAdapter.setData(recordList);
411
+                        mRecordsAdapter.notifyDataChanged();
412
+                    }
413
+                    if (mDeleteRecordsAdapter != null) {
414
+                        mDeleteRecordsAdapter.setData(recordList);
415
+                        mDeleteRecordsAdapter.notifyDataChanged();
427 416
                     }
428 417
                 });
429 418
     }
@@ -445,115 +434,88 @@ public class SearchActivity2 extends ViewBindingBaseActivity<ActivitySearch2Bind
445 434
         mViewBinding.searchList.tvSearchNewest.setOnClickListener(this);
446 435
 
447 436
         //热门点击
448
-        mViewBinding.searchRecords.flSearchHot.setOnTagClickListener(new TagFlowLayout.OnTagClickListener() {
449
-            @Override
450
-            public void onTagClick(View view, int position, FlowLayout parent) {
451
-                //清空editText之前的数据
452
-                mViewBinding.etSearch.setText("");
453
-                //将获取到的字符串传到搜索结果界面,点击后搜索对应条目内容
454
-                mViewBinding.etSearch.setText(listOne.get(position));
455
-                //输入焦点位置
456
-                mViewBinding.etSearch.setSelection(mViewBinding.etSearch.length());
437
+        mViewBinding.searchRecords.flSearchHot.setOnTagClickListener((view, position, parent) -> {
438
+            //清空editText之前的数据
439
+            mViewBinding.etSearch.setText("");
440
+            //将获取到的字符串传到搜索结果界面,点击后搜索对应条目内容
441
+            mViewBinding.etSearch.setText(listOne.get(position));
442
+            //输入焦点位置
443
+            mViewBinding.etSearch.setSelection(mViewBinding.etSearch.length());
444
+
445
+            //搜索记录
446
+            searchStr = mViewBinding.etSearch.getText().toString();
447
+            if (!TextUtils.isEmpty(searchStr)) {
448
+                //清空店铺和商品数据
449
+                productListsData.clear();
450
+                storeListData.clear();
451
+                mPage = 1;
452
+
453
+                //添加数据
454
+                mRecordsDao.addRecords(searchStr);
455
+                //调用接口
456
+                //搜索商品
457
+                searchViewModel.getSearchProduct(mPage, "", searchStr);
458
+                //如果没有开启gps或者网络定位
459
+                if (location == null) {
460
+                    ToastUtils.showLong("定位权限不可用,请检查gps或者网络定位是否开启");
461
+                    finish();
462
+                    MainActivity.launch(context, "1");
463
+                    return;
464
+                }
465
+                //搜索店铺
466
+                searchViewModel.getSearchStore(mShopPage, location.getLatitude(), location.getLongitude(), searchStr, mCareCount, mIsNew, mDistanceAsc);
467
+                //隐藏与显示
468
+//                    mViewBinding.searchList.llTabList.setVisibility(View.VISIBLE);
469
+                mViewBinding.searchRecords.llSearchHistoryIsRecommended.setVisibility(View.GONE);
470
+                mViewBinding.searchList.noSearch.llNotFound.setVisibility(View.GONE);
457 471
 
458
-                //搜索记录
459
-                searchStr = mViewBinding.etSearch.getText().toString();
460
-                if (!TextUtils.isEmpty(searchStr)) {
461
-                    //清空店铺和商品数据
462
-                    productListsData.clear();
463
-                    storeListData.clear();
464
-                    mPage = 1;
472
+            }
465 473
 
466
-                    //添加数据
467
-                    mRecordsDao.addRecords(searchStr);
468
-                    //调用接口
474
+        });
475
+        //搜索历史点击
476
+        mViewBinding.searchRecords.flSearchRecords.setOnTagClickListener((view, position, parent) -> {
477
+            //清空editText之前的数据
478
+            mViewBinding.etSearch.setText("");
479
+            //将获取到的字符串传到搜索结果界面,点击后搜索对应条目内容
480
+            mViewBinding.etSearch.setText(recordList.get(position));
481
+            //输入焦点位置
482
+            mViewBinding.etSearch.setSelection(mViewBinding.etSearch.length());
483
+
484
+            //搜索记录
485
+            searchStr = mViewBinding.etSearch.getText().toString();
486
+            if (!TextUtils.isEmpty(searchStr)) {
487
+                //清空店铺和商品数据
488
+                productListsData.clear();
489
+                storeListData.clear();
490
+                mPage = 1;
491
+                mShopPage = 1;
492
+                //添加数据
493
+                mRecordsDao.addRecords(searchStr);
494
+                //调用接口
495
+                if (type == 1) {
469 496
                     //搜索商品
470 497
                     searchViewModel.getSearchProduct(mPage, "", searchStr);
471
-                    //如果没有开启gps或者网络定位
472
-                    if (location==null){
473
-                        ToastUtils.showLong("定位权限不可用,请检查gps或者网络定位是否开启");
474
-                        finish();
475
-                        MainActivity.launch(context,"1");
476
-                        return;
477
-                    }
498
+                } else {
478 499
                     //搜索店铺
479 500
                     searchViewModel.getSearchStore(mShopPage, location.getLatitude(), location.getLongitude(), searchStr, mCareCount, mIsNew, mDistanceAsc);
480
-                    //隐藏与显示
481
-//                    mViewBinding.searchList.llTabList.setVisibility(View.VISIBLE);
482
-                    mViewBinding.searchRecords.llSearchHistoryIsRecommended.setVisibility(View.GONE);
483
-                    mViewBinding.searchList.noSearch.llNotFound.setVisibility(View.GONE);
484
-
485 501
                 }
502
+                //隐藏与显示
503
+                mViewBinding.searchList.llTabList.setVisibility(View.VISIBLE);
504
+                mViewBinding.searchRecords.llSearchHistoryIsRecommended.setVisibility(View.GONE);
505
+                mViewBinding.searchList.noSearch.llNotFound.setVisibility(View.GONE);
486 506
 
487 507
             }
488 508
         });
489
-        //搜索历史点击
490
-        mViewBinding.searchRecords.flSearchRecords.setOnTagClickListener(new TagFlowLayout.OnTagClickListener() {
491
-            @Override
492
-            public void onTagClick(View view, int position, FlowLayout parent) {
493
-                //清空editText之前的数据
494
-                mViewBinding.etSearch.setText("");
495
-                //将获取到的字符串传到搜索结果界面,点击后搜索对应条目内容
496
-                mViewBinding.etSearch.setText(recordList.get(position));
497
-                //输入焦点位置
498
-                mViewBinding.etSearch.setSelection(mViewBinding.etSearch.length());
499
-
500
-                //搜索记录
501
-                searchStr = mViewBinding.etSearch.getText().toString();
502
-                if (!TextUtils.isEmpty(searchStr)) {
503
-                    //清空店铺和商品数据
504
-                    productListsData.clear();
505
-                    storeListData.clear();
506
-                    mPage = 1;
507
-                    mShopPage = 1;
508
-                    //添加数据
509
-                    mRecordsDao.addRecords(searchStr);
510
-                    //调用接口
511
-                    if (type == 1) {
512
-                        //搜索商品
513
-                        searchViewModel.getSearchProduct(mPage, "", searchStr);
514
-                    } else {
515
-                        //搜索店铺
516
-                        searchViewModel.getSearchStore(mShopPage, location.getLatitude(), location.getLongitude(), searchStr, mCareCount, mIsNew, mDistanceAsc);
517
-                    }
518
-                    //隐藏与显示
519
-                    mViewBinding.searchList.llTabList.setVisibility(View.VISIBLE);
520
-                    mViewBinding.searchRecords.llSearchHistoryIsRecommended.setVisibility(View.GONE);
521
-                    mViewBinding.searchList.noSearch.llNotFound.setVisibility(View.GONE);
522
-
523
-                }
524
-            }
525
-        });
526 509
         //删除某一条
527
-        mViewBinding.searchRecords.flSearchRecordsDelete.setOnTagClickListener(new TagFlowLayout.OnTagClickListener() {
528
-            @Override
529
-            public void onTagClick(View view, int position, FlowLayout parent) {
510
+        mViewBinding.searchRecords.flSearchRecordsDelete.setOnTagClickListener((view, position, parent) -> {
530 511
 
531
-                mRecordsDao.deleteRecord(recordList.get(position));
512
+            mRecordsDao.deleteRecord(recordList.get(position));
532 513
 
533
-                mViewBinding.searchRecords.clearAllRecords.setVisibility(View.VISIBLE);
534
-                mViewBinding.searchRecords.llDeleteLayout.setVisibility(View.GONE);
535
-                mViewBinding.searchRecords.flSearchRecords.setVisibility(View.VISIBLE);
536
-                mViewBinding.searchRecords.flSearchRecordsDelete.setVisibility(View.GONE);
537
-            }
514
+            mViewBinding.searchRecords.clearAllRecords.setVisibility(View.VISIBLE);
515
+            mViewBinding.searchRecords.llDeleteLayout.setVisibility(View.GONE);
516
+            mViewBinding.searchRecords.flSearchRecords.setVisibility(View.VISIBLE);
517
+            mViewBinding.searchRecords.flSearchRecordsDelete.setVisibility(View.GONE);
538 518
         });
539
-//        mViewBinding.etSearch.setOnEditorActionListener(new TextView.OnEditorActionListener() {
540
-//            @Override
541
-//            public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
542
-//                if (i == EditorInfo.IME_ACTION_SEARCH) {
543
-//                    //点击搜索的时候隐藏软键盘
544
-//                    hideKeyboard(mViewBinding.etSearch);
545
-//                    // 在这里写搜索的操作,一般都是网络请求数据
546
-//                    //搜索记录
547
-//                    if (!TextUtils.isEmpty( mViewBinding.etSearch.getText().toString().trim())) {
548
-//                        //添加数据
549
-//                        mRecordsDao.addRecords(mViewBinding.etSearch.getText().toString().trim());
550
-//
551
-//                    }
552
-//                    return true;
553
-//                }
554
-//                return false;
555
-//            }
556
-//        });
557 519
         searchShopAdapter.setOnClickListener(new SearchShopAdapter.OnClickListener() {
558 520
             @Override
559 521
             public void onItemClick(int position) {
@@ -587,7 +549,7 @@ public class SearchActivity2 extends ViewBindingBaseActivity<ActivitySearch2Bind
587 549
         if (view == mViewBinding.ivGoback) {
588 550
             finish();
589 551
         } else if (view == mViewBinding.tvClickSearch) {
590
-            if (!isFastClick()){
552
+            if (!isFastClick()) {
591 553
                 //点击搜索的时候隐藏软键盘
592 554
                 hideKeyboard(mViewBinding.etSearch);
593 555
                 // 在这里写搜索的操作,一般都是网络请求数据
@@ -612,10 +574,10 @@ public class SearchActivity2 extends ViewBindingBaseActivity<ActivitySearch2Bind
612 574
                     }
613 575
                     //搜索商品
614 576
                     searchViewModel.getSearchProduct(mPage, "", searchStr);
615
-                    if (location==null){
577
+                    if (location == null) {
616 578
                         ToastUtils.showLong("定位权限不可用,请检查gps或者网络定位是否开启");
617 579
                         finish();
618
-                        MainActivity.launch(context,"1");
580
+                        MainActivity.launch(context, "1");
619 581
                         return;
620 582
                     }
621 583
                     //搜索店铺
@@ -658,7 +620,7 @@ public class SearchActivity2 extends ViewBindingBaseActivity<ActivitySearch2Bind
658 620
             mViewBinding.searchList.ivXiala.setImageResource(R.mipmap.tuijian_xiala);
659 621
 
660 622
 
661
-            mPage=1;
623
+            mPage = 1;
662 624
             // 清空数据
663 625
             productListsData.clear();
664 626
             //请求接口
@@ -674,7 +636,7 @@ public class SearchActivity2 extends ViewBindingBaseActivity<ActivitySearch2Bind
674 636
             mViewBinding.searchList.ivShangla.setImageResource(R.mipmap.tuijian_shangla);
675 637
             mViewBinding.searchList.ivXiala.setImageResource(R.mipmap.tuijian_xiala);
676 638
 
677
-            mPage=1;
639
+            mPage = 1;
678 640
             // 清空数据
679 641
             productListsData.clear();
680 642
             //请求接口
@@ -690,7 +652,7 @@ public class SearchActivity2 extends ViewBindingBaseActivity<ActivitySearch2Bind
690 652
             mViewBinding.searchList.ivShangla.setImageResource(R.mipmap.tuijian_shangla);
691 653
             mViewBinding.searchList.ivXiala.setImageResource(R.mipmap.tuijian_xiala);
692 654
 
693
-            mPage=1;
655
+            mPage = 1;
694 656
             // 清空数据
695 657
             productListsData.clear();
696 658
             //请求接口
@@ -714,7 +676,7 @@ public class SearchActivity2 extends ViewBindingBaseActivity<ActivitySearch2Bind
714 676
                 mViewBinding.searchList.ivXiala.setImageResource(R.mipmap.search_red_xiala_220617);
715 677
                 mPriceRank = 1;
716 678
             }
717
-            mPage=1;
679
+            mPage = 1;
718 680
             // 清空数据
719 681
             productListsData.clear();
720 682
             //请求接口
@@ -731,7 +693,7 @@ public class SearchActivity2 extends ViewBindingBaseActivity<ActivitySearch2Bind
731 693
             mViewBinding.searchList.refreshLayout2.setVisibility(View.GONE);
732 694
             mViewBinding.searchList.llShop.setVisibility(View.GONE);
733 695
             type = 1;
734
-            mPage=1;
696
+            mPage = 1;
735 697
             // 清空数据
736 698
             productListsData.clear();
737 699
             //搜索商品

+ 451 - 0
app/src/main/java/com/yihucha/hbyhc/presentation/home/YHCHomeSearchActivity.kt

@@ -0,0 +1,451 @@
1
+package com.yihucha.hbyhc.presentation.home
2
+
3
+import android.annotation.SuppressLint
4
+import android.content.Context
5
+import android.content.Intent
6
+import android.graphics.Color
7
+import android.os.Bundle
8
+import android.os.Handler
9
+import android.text.TextUtils
10
+import android.util.Log
11
+import android.view.LayoutInflater
12
+import android.view.View
13
+import android.view.inputmethod.InputMethodManager
14
+import android.widget.TextView
15
+import android.widget.Toast
16
+import androidx.lifecycle.ViewModelProvider
17
+import androidx.recyclerview.widget.GridLayoutManager
18
+import com.alibaba.fastjson.JSON
19
+import com.lcodecore.tkrefreshlayout.RefreshListenerAdapter
20
+import com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout
21
+import com.yihucha.hbyhc.R
22
+import com.yihucha.hbyhc.base.ViewBindingBaseActivity
23
+import com.yihucha.hbyhc.config.Constants
24
+import com.yihucha.hbyhc.databinding.ActivityYhchomeSearchBinding
25
+import com.yihucha.hbyhc.presentation.home.adapter.HomeProductListAdapter
26
+import com.yihucha.hbyhc.presentation.home.model.HomeProductBean.PageInfoDTO
27
+import com.yihucha.hbyhc.presentation.home.model.HotKetWordBean
28
+import com.yihucha.hbyhc.presentation.home.view_model.HomeViewModel
29
+import com.yihucha.hbyhc.presentation.home.view_model.SearchViewModel
30
+import com.yihucha.hbyhc.utils.EmptyCheckUtils
31
+import com.yihucha.hbyhc.utils.GridSpacingItemDecoration
32
+import com.yihucha.hbyhc.utils.MVUtils
33
+import com.yihucha.hbyhc.utils.StringsUtil
34
+import com.yihucha.hbyhc.utils.search_db.RecordsDao
35
+import com.yihucha.hbyhc.view.CustomDialog
36
+import com.zhy.view.flowlayout.FlowLayout
37
+import com.zhy.view.flowlayout.TagAdapter
38
+import io.reactivex.Observable
39
+import io.reactivex.android.schedulers.AndroidSchedulers
40
+import io.reactivex.schedulers.Schedulers
41
+
42
+class YHCHomeSearchActivity : ViewBindingBaseActivity<ActivityYhchomeSearchBinding>(),
43
+    View.OnClickListener {
44
+    private lateinit var mRecordsDao: RecordsDao
45
+    private var recordList = mutableListOf<String>()
46
+    private var productListsData = mutableListOf<PageInfoDTO.ListDTO>()
47
+    private lateinit var mRecordsAdapter: TagAdapter<String>//初始化搜索历史
48
+    private lateinit var mDeleteRecordsAdapter: TagAdapter<String> //带删除的搜索历史
49
+    private var homeProductListAdapter: HomeProductListAdapter? = null
50
+
51
+    //默然展示词条个数
52
+    private val DEFAULT_RECORD_NUMBER = 30
53
+    private val listOne = ArrayList<String>()
54
+    private lateinit var hotTagAdapter: TagAdapter<String>//热门关键字
55
+
56
+    private var mPage = 1
57
+    private var mer_keyword = "1"
58
+    private var isNew = "0"
59
+    private var priceType = "1"
60
+    private var sales = "0"
61
+    private var isPriceUp = false
62
+    private var isSalesUp = false
63
+
64
+    private val searchViewModel by lazy {
65
+        ViewModelProvider(this)[SearchViewModel::class.java]
66
+    }
67
+    private val homeViewModel by lazy {
68
+        ViewModelProvider(this)[HomeViewModel::class.java]
69
+    }
70
+
71
+    override fun onCreate(savedInstanceState: Bundle?) {
72
+        super.onCreate(savedInstanceState)
73
+        initView()
74
+        initData()
75
+        initListener()
76
+    }
77
+
78
+    private fun initListener() {
79
+        mViewBinding.ivGoback.setOnClickListener(this)
80
+        mViewBinding.tvClickSearch.setOnClickListener(this)
81
+        mViewBinding.searchRecords.clearAllRecords.setOnClickListener(this)
82
+        mViewBinding.searchRecords.tvAlldelete.setOnClickListener(this)
83
+        mViewBinding.searchRecords.tvComplete.setOnClickListener(this)
84
+        mViewBinding.llRecommend.setOnClickListener(this)
85
+        mViewBinding.llSearchSales.setOnClickListener(this)
86
+        mViewBinding.llSearchPrice.setOnClickListener(this)
87
+
88
+        //热门点击
89
+        mViewBinding.searchRecords.flSearchHot.setOnTagClickListener { view, position, parent ->
90
+            //清空editText之前的数据
91
+            mViewBinding.etSearch.setText("")
92
+            //将获取到的字符串传到搜索结果界面,点击后搜索对应条目内容
93
+            mViewBinding.etSearch.setText(listOne[position])
94
+            //输入焦点位置
95
+            mViewBinding.etSearch.setSelection(mViewBinding.etSearch.length())
96
+
97
+            //搜索记录
98
+            mer_keyword = mViewBinding.etSearch.text.toString()
99
+            if (!TextUtils.isEmpty(mer_keyword)) {
100
+                //清空店铺和商品数据
101
+                productListsData.clear()
102
+                mPage = 1
103
+                //添加数据
104
+                mRecordsDao.addRecords(mer_keyword)
105
+                //调用接口
106
+                homeViewModel.getHomeProductListData(mPage, mer_keyword, null, null, null)
107
+                //隐藏与显示
108
+                mViewBinding.searchRecords.llSearchHistoryIsRecommended.visibility = View.GONE
109
+            }
110
+        }
111
+        //搜索历史点击
112
+        mViewBinding.searchRecords.flSearchRecords.setOnTagClickListener { _, position, _ ->
113
+            //清空editText之前的数据
114
+            mViewBinding.etSearch.setText("")
115
+            //将获取到的字符串传到搜索结果界面,点击后搜索对应条目内容
116
+            mViewBinding.etSearch.setText(recordList[position])
117
+            //输入焦点位置
118
+            mViewBinding.etSearch.setSelection(mViewBinding.etSearch.length())
119
+            //搜索记录
120
+            mer_keyword = mViewBinding.etSearch.text.toString()
121
+            if (!TextUtils.isEmpty(mer_keyword)) {
122
+                //清空店铺和商品数据
123
+                mPage = 1
124
+                //添加数据
125
+                mRecordsDao.addRecords(mer_keyword)
126
+                //调用接口
127
+                homeViewModel.getHomeProductListData(mPage, mer_keyword, null, null, null)
128
+                //隐藏与显示
129
+                mViewBinding.searchRecords.llSearchHistoryIsRecommended.visibility = View.GONE
130
+            }
131
+        }
132
+        //删除某一条
133
+        mViewBinding.searchRecords.flSearchRecordsDelete.setOnTagClickListener { view, position, parent ->
134
+            mRecordsDao.deleteRecord(recordList[position])
135
+            mViewBinding.searchRecords.clearAllRecords.visibility = View.VISIBLE
136
+            mViewBinding.searchRecords.llDeleteLayout.visibility = View.GONE
137
+            mViewBinding.searchRecords.flSearchRecords.visibility = View.VISIBLE
138
+            mViewBinding.searchRecords.flSearchRecordsDelete.visibility = View.GONE
139
+        }
140
+    }
141
+
142
+    private fun initData() {
143
+        //商品列表请求成功
144
+        homeViewModel.homeProductListDataYHC.observe(
145
+            this
146
+        ) { data ->
147
+            mViewBinding.refreshLayout?.apply {
148
+                finishRefreshing()
149
+                finishLoadmore()
150
+            }
151
+            if (EmptyCheckUtils.isEmpty(data) && mPage > 1) {
152
+                mPage -= 1
153
+                return@observe
154
+            }
155
+            if (mPage == 1) {
156
+                productListsData.clear()
157
+            }
158
+            productListsData.addAll(data)
159
+            if (EmptyCheckUtils.isEmpty(productListsData)) {
160
+                mViewBinding.noSearch.llNotFound.visibility = View.VISIBLE
161
+                mViewBinding.rvProductSearch.visibility = View.GONE
162
+                mViewBinding.layoutSelect.visibility = View.GONE
163
+            } else {
164
+                mViewBinding.noSearch.llNotFound.visibility = View.GONE
165
+                mViewBinding.rvProductSearch.visibility = View.VISIBLE
166
+                mViewBinding.layoutSelect.visibility = View.VISIBLE
167
+            }
168
+            homeProductListAdapter!!.setData(productListsData)
169
+
170
+
171
+        }
172
+        //热门关键字
173
+        searchViewModel.getHotKeyWordData()
174
+        searchViewModel.hotkeyData.observe(this) { hotKetWordBeans: List<HotKetWordBean> ->
175
+            for (i in hotKetWordBeans.indices) {
176
+                listOne.add(hotKetWordBeans[i].keyword)
177
+            }
178
+            Log.i("num", JSON.toJSONString(listOne))
179
+            if (hotTagAdapter != null) {
180
+                hotTagAdapter.setData(listOne)
181
+                hotTagAdapter.notifyDataChanged()
182
+            }
183
+        }
184
+        setRecordsDao()
185
+    }
186
+
187
+    private fun initView() {
188
+        mRecordsDao = if (TextUtils.isEmpty(MVUtils.getString(Constants.TOKEN))) {
189
+            //初始化数据库
190
+            RecordsDao(this, MVUtils.getString(Constants.TOKEN))
191
+        } else {
192
+            RecordsDao(this, "0")
193
+        }
194
+
195
+        mRecordsAdapter = object : TagAdapter<String>(recordList) {
196
+            override fun getView(parent: FlowLayout, position: Int, s: String): View {
197
+                val tv = LayoutInflater.from(this@YHCHomeSearchActivity).inflate(
198
+                    R.layout.item_history,
199
+                    mViewBinding.searchRecords.flSearchRecords, false
200
+                ) as TextView
201
+                //为标签设置对应的内容
202
+                tv.text = s
203
+                return tv
204
+            }
205
+        }
206
+        mViewBinding.searchRecords.flSearchRecords.adapter = mRecordsAdapter
207
+
208
+        //带删除的搜索历史
209
+        mDeleteRecordsAdapter = object : TagAdapter<String>(recordList) {
210
+            override fun getView(parent: FlowLayout, position: Int, s: String): View {
211
+                val tv = LayoutInflater.from(this@YHCHomeSearchActivity).inflate(
212
+                    R.layout.item_delete_history,
213
+                    mViewBinding.searchRecords.flSearchRecords, false
214
+                ) as TextView
215
+                //为标签设置对应的内容
216
+                tv.text = s
217
+                return tv
218
+            }
219
+        }
220
+        mViewBinding.searchRecords.flSearchRecordsDelete.adapter = mDeleteRecordsAdapter
221
+
222
+        //热门初始化
223
+        hotTagAdapter = object : TagAdapter<String>(listOne) {
224
+            override fun getView(parent: FlowLayout, position: Int, s: String): View {
225
+                val tv = LayoutInflater.from(this@YHCHomeSearchActivity).inflate(
226
+                    R.layout.item_history,
227
+                    mViewBinding.searchRecords.flSearchHot, false
228
+                ) as TextView
229
+                //为标签设置对应的内容
230
+                tv.text = s
231
+                return tv
232
+            }
233
+        }
234
+        mViewBinding.searchRecords.flSearchHot.adapter = hotTagAdapter
235
+
236
+        //db更新
237
+        mRecordsDao.setNotifyDataChanged { setRecordsDao() }
238
+
239
+        //商品搜索布局
240
+        val gridLayoutManager = GridLayoutManager(context, 2)
241
+        mViewBinding.rvProductSearch.layoutManager = gridLayoutManager
242
+        mViewBinding.rvProductSearch.addItemDecoration(
243
+            GridSpacingItemDecoration(
244
+                2,
245
+                50,
246
+                false
247
+            )
248
+        )
249
+        homeProductListAdapter = HomeProductListAdapter(context, productListsData)
250
+        mViewBinding.rvProductSearch.adapter = homeProductListAdapter
251
+        mViewBinding.refreshLayout.setEnableRefresh(true)
252
+        mViewBinding.refreshLayout.setEnableLoadmore(true)
253
+        //商品刷新
254
+        mViewBinding.refreshLayout.setOnRefreshListener(object : RefreshListenerAdapter() {
255
+            override fun onRefresh(refreshLayout: TwinklingRefreshLayout) {
256
+                Handler().postDelayed({ //刷新
257
+                    refreshLayout.finishRefreshing()
258
+                    mPage = 1
259
+                    productListsData.clear()
260
+                    homeViewModel.getHomeProductListData(mPage, mer_keyword, null, null, null)
261
+                }, 2000)
262
+            }
263
+
264
+            override fun onLoadMore(refreshLayout: TwinklingRefreshLayout) {
265
+                Handler().postDelayed({ //加载
266
+                    refreshLayout.finishLoadmore()
267
+                    mPage++
268
+                    homeViewModel.getHomeProductListData(mPage, mer_keyword, null, null, null)
269
+                }, 2000)
270
+            }
271
+        })
272
+        //是否自动加载更多, 滑到底部默认加载更多,默认false
273
+//        mViewBinding.refreshLayout.setAutoLoadMore(true)
274
+
275
+    }
276
+
277
+    @SuppressLint("CheckResult")
278
+    private fun setRecordsDao() {
279
+        Observable.create { emitter ->
280
+            emitter.onNext(
281
+                mRecordsDao.getRecordsByNumber(DEFAULT_RECORD_NUMBER)
282
+            )
283
+        }.subscribeOn(Schedulers.io())
284
+            .observeOn(AndroidSchedulers.mainThread())
285
+            .subscribe { s ->
286
+                recordList.clear()
287
+                recordList.addAll(s)
288
+                if (null == recordList || recordList.size == 0) {
289
+                    mViewBinding.searchRecords.llHistoryContent.visibility = View.GONE
290
+                } else {
291
+                    mViewBinding.searchRecords.llHistoryContent.visibility = View.VISIBLE
292
+                }
293
+                if (mRecordsAdapter != null) {
294
+                    mRecordsAdapter.setData(recordList)
295
+                    mRecordsAdapter.notifyDataChanged()
296
+                }
297
+                if (mDeleteRecordsAdapter != null) {
298
+                    mDeleteRecordsAdapter.setData(recordList)
299
+                    mDeleteRecordsAdapter.notifyDataChanged()
300
+                }
301
+            }
302
+    }
303
+
304
+
305
+    override fun onClick(v: View?) {
306
+        v?.apply {
307
+            when (this) {
308
+                mViewBinding.ivGoback -> finish()
309
+                mViewBinding.tvClickSearch -> {
310
+                    //搜索记录
311
+                    mer_keyword = mViewBinding.etSearch.text.toString().trim()
312
+                    if (StringsUtil.isEmpty(mer_keyword)) {
313
+                        Toast.makeText(this@YHCHomeSearchActivity, "请输入搜索关键字", Toast.LENGTH_LONG)
314
+                        return
315
+                    }
316
+                    hideKeyboard(mViewBinding.etSearch)
317
+                    mPage = 1
318
+                    //添加数据
319
+                    mRecordsDao.addRecords(mer_keyword)
320
+                    mViewBinding.searchRecords.llSearchHistoryIsRecommended.visibility = View.GONE
321
+                    homeViewModel.getHomeProductListData(
322
+                        mPage,
323
+                        mer_keyword,
324
+                        null,
325
+                        null,
326
+                        null
327
+                    )
328
+                }
329
+                mViewBinding.searchRecords.clearAllRecords -> {
330
+                    //点击删除按钮
331
+                    mViewBinding.searchRecords.clearAllRecords.visibility = View.GONE
332
+                    mViewBinding.searchRecords.llDeleteLayout.visibility = View.VISIBLE
333
+                    mViewBinding.searchRecords.flSearchRecords.visibility = View.GONE
334
+                    mViewBinding.searchRecords.flSearchRecordsDelete.visibility = View.VISIBLE
335
+                }
336
+                mViewBinding.searchRecords.tvAlldelete -> {
337
+                    CustomDialog.showConfirmDialog(
338
+                        this@YHCHomeSearchActivity,
339
+                        null,
340
+                        "确定要删除全部搜索记录?",
341
+                        "取消",
342
+                        "确认",
343
+                    ) {
344
+                        mViewBinding.apply {
345
+                            //点击全部删除
346
+                            searchRecords.clearAllRecords.visibility = View.VISIBLE
347
+                            searchRecords.llDeleteLayout.visibility = View.GONE
348
+                            searchRecords.flSearchRecords.visibility = View.VISIBLE
349
+                            searchRecords.flSearchRecordsDelete.visibility = View.GONE
350
+                            //数据清空
351
+                            mRecordsDao.deleteUsernameAllRecords()
352
+                        }
353
+                    }
354
+                }
355
+                mViewBinding.searchRecords.tvComplete -> {
356
+                    //点击完成
357
+                    mViewBinding.searchRecords.clearAllRecords.visibility = View.VISIBLE
358
+                    mViewBinding.searchRecords.llDeleteLayout.visibility = View.GONE
359
+                    mViewBinding.searchRecords.flSearchRecords.visibility = View.VISIBLE
360
+                    mViewBinding.searchRecords.flSearchRecordsDelete.visibility = View.GONE
361
+                }
362
+                mViewBinding.llRecommend -> {
363
+                    mViewBinding.apply {
364
+                        btvRecommend.setTextColor(Color.parseColor("#fe0032"))
365
+                        btvSearchSales.setTextColor(Color.parseColor("#333333"))
366
+                        btvSearchPrice.setTextColor(Color.parseColor("#333333"))
367
+                        ivJiangxuZonghe.setImageResource(R.mipmap.tuijian_xiala_red)
368
+                        ivJiangxu.setImageResource(R.mipmap.tuijian_xiala)
369
+                        ivShengxu.setImageResource(R.mipmap.tuijian_shangla)
370
+                        ivJiangxuSale.setImageResource(R.mipmap.tuijian_xiala)
371
+                        ivShengxuSales.setImageResource(R.mipmap.tuijian_shangla)
372
+                        mPage = 1
373
+                        isPriceUp = false
374
+                        isSalesUp = false
375
+                        homeViewModel.getHomeProductListData(mPage, mer_keyword, null, null, null)
376
+                    }
377
+                }
378
+                mViewBinding.llSearchSales -> {
379
+                    mViewBinding.apply {
380
+                        btvRecommend.setTextColor(Color.parseColor("#333333"))
381
+                        btvSearchSales.setTextColor(Color.parseColor("#fe0032"))
382
+                        btvSearchPrice.setTextColor(Color.parseColor("#333333"))
383
+                        ivJiangxuZonghe.setImageResource(R.mipmap.tuijian_xiala)
384
+                        ivJiangxu.setImageResource(R.mipmap.tuijian_xiala)
385
+                        ivShengxu.setImageResource(R.mipmap.tuijian_shangla)
386
+                        isPriceUp = false
387
+                        isSalesUp = !isSalesUp
388
+                        mPage = 1
389
+                        sales = if (isSalesUp) "1" else "0"
390
+                        if (isSalesUp) {
391
+                            ivJiangxuSale.setImageResource(R.mipmap.tuijian_xiala)
392
+                            ivShengxuSales.setImageResource(R.mipmap.search_red_shangla_220617)
393
+                        } else {
394
+                            ivJiangxuSale.setImageResource(R.mipmap.tuijian_xiala_red)
395
+                            ivShengxuSales.setImageResource(R.mipmap.tuijian_shangla)
396
+                        }
397
+                        homeViewModel.getHomeProductListData(mPage, mer_keyword, null, null, sales)
398
+                    }
399
+                }
400
+                mViewBinding.llSearchPrice -> {
401
+                    mViewBinding.apply {
402
+                        btvRecommend.setTextColor(Color.parseColor("#333333"))
403
+                        btvSearchSales.setTextColor(Color.parseColor("#333333"))
404
+                        btvSearchPrice.setTextColor(Color.parseColor("#fe0032"))
405
+                        ivJiangxuZonghe.setImageResource(R.mipmap.tuijian_xiala)
406
+                        ivJiangxuSale.setImageResource(R.mipmap.tuijian_xiala)
407
+                        ivShengxuSales.setImageResource(R.mipmap.tuijian_shangla)
408
+                        isSalesUp = false
409
+                        isPriceUp = !isPriceUp
410
+                        mPage = 1
411
+                        priceType = if (isPriceUp) "1" else "0"
412
+                        if (isPriceUp) {
413
+                            ivJiangxu.setImageResource(R.mipmap.tuijian_xiala)
414
+                            ivShengxu.setImageResource(R.mipmap.search_red_shangla_220617)
415
+                        } else {
416
+                            ivJiangxu.setImageResource(R.mipmap.tuijian_xiala_red)
417
+                            ivShengxu.setImageResource(R.mipmap.tuijian_shangla)
418
+                        }
419
+                        homeViewModel.getHomeProductListData(
420
+                            mPage,
421
+                            mer_keyword,
422
+                            null,
423
+                            priceType,
424
+                            null
425
+                        )
426
+                    }
427
+
428
+                }
429
+            }
430
+        }
431
+    }
432
+
433
+    /**
434
+     * 隐藏软键盘
435
+     *
436
+     * @param :上下文
437
+     * @param view :一般为EditText
438
+     */
439
+    private fun hideKeyboard(view: View) {
440
+        val manager = view.context
441
+            .getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
442
+        manager.hideSoftInputFromWindow(view.windowToken, 0)
443
+    }
444
+
445
+    companion object {
446
+        @JvmStatic
447
+        fun launch(context: Context) {
448
+            context.startActivity(Intent(context, YHCHomeSearchActivity::class.java))
449
+        }
450
+    }
451
+}

+ 24 - 55
app/src/main/java/com/yihucha/hbyhc/presentation/home/adapter/HomeProductListAdapter.java

@@ -12,7 +12,9 @@ import android.widget.TextView;
12 12
 import androidx.annotation.NonNull;
13 13
 import androidx.recyclerview.widget.RecyclerView;
14 14
 
15
+import com.bumptech.glide.Glide;
15 16
 import com.yihucha.hbyhc.R;
17
+import com.yihucha.hbyhc.presentation.home.model.HomeProductBean;
16 18
 import com.yihucha.hbyhc.presentation.home.model.HomeProductListBean;
17 19
 import com.yihucha.hbyhc.utils.GlideUtils;
18 20
 import com.yihucha.hbyhc.view.DrawLineTextView;
@@ -28,37 +30,20 @@ import java.util.List;
28 30
  */
29 31
 public class HomeProductListAdapter extends RecyclerView.Adapter<HomeProductListAdapter.ViewHolder> {
30 32
     private Context context;
31
-    private List<HomeProductListBean> goodsPageBeans;
32
-    private LayoutInflater inflater;
33
+    private List<HomeProductBean.PageInfoDTO.ListDTO> goodsPageBeans;
33 34
 
34 35
     private OnClickListener mClickListener;
35 36
 
36 37
     private int mAllNumber;
37 38
 
38
-    public HomeProductListAdapter(Context context, List<HomeProductListBean> goodsPageBeans) {
39
-        inflater = LayoutInflater.from(context);
39
+    public HomeProductListAdapter(Context context, List<HomeProductBean.PageInfoDTO.ListDTO> goodsPageBeans) {
40 40
         this.context = context;
41
-        this.setList(goodsPageBeans);
41
+        this.goodsPageBeans = goodsPageBeans;
42 42
     }
43 43
 
44
-    private void setList(List<HomeProductListBean> goodsPageBeans) {
45
-        if (goodsPageBeans != null) {
46
-            this.goodsPageBeans = goodsPageBeans;
47
-        } else {
48
-            this.goodsPageBeans = new ArrayList<>();
49
-        }
50
-    }
51
-
52
-    /**
53
-     * 更新数据
54
-     *
55
-     * @param goodsPageBeans
56
-     */
57
-    public void updateData(List<HomeProductListBean> goodsPageBeans) {
58
-        // TODO Auto-generated method stub
59
-        setList(goodsPageBeans);
60
-//        notifyDataSetChanged();
61
-        notifyItemChanged(goodsPageBeans.size()-1);
44
+    public void setData(List<HomeProductBean.PageInfoDTO.ListDTO> goodsPageBeans) {
45
+        this.goodsPageBeans = goodsPageBeans;
46
+        notifyDataSetChanged();
62 47
     }
63 48
 
64 49
     @NonNull
@@ -70,44 +55,28 @@ public class HomeProductListAdapter extends RecyclerView.Adapter<HomeProductList
70 55
 
71 56
     @Override
72 57
     public void onBindViewHolder(@NonNull ViewHolder holder, @SuppressLint("RecyclerView") int position) {
73
-        HomeProductListBean goodsPageBean = goodsPageBeans.get(position);
58
+        HomeProductBean.PageInfoDTO.ListDTO goodsPageBean = goodsPageBeans.get(position);
74 59
 
75 60
         holder.tv_sales.setVisibility(View.GONE);
76 61
         holder.tv_jingdong.setVisibility(View.GONE);
77 62
         holder.tv_dacang.setVisibility(View.GONE);
78 63
         holder.iv_dacang.setVisibility(View.GONE);
79
-
80
-        if (goodsPageBean.getType().equals("6")) {
81
-            //京东商品
82
-            holder.tv_jingdong.setVisibility(View.VISIBLE);
83
-//            holder.tv_lowestCouponPrice.setVisibility(View.GONE);
84
-            GlideUtils.loadImage(context, goodsPageBean.getThumb(), holder.card_image);
85
-            holder.card_title.setText(goodsPageBean.getName());//名称
86
-            holder.tv_yanglaojin.setText("养老金 ¥" + goodsPageBean.getCommission());//养老金
87
-            holder.tv_price.setText(goodsPageBean.getLowestCouponPrice());
88
-
89
-
90
-            holder.tv_lowestCouponPrice.setText("¥" + goodsPageBean.getPrice());
91
-        } else {
92
-            GlideUtils.loadImage(context, goodsPageBean.getImage(), holder.card_image);
93
-            holder.card_title.setText(goodsPageBean.getStore_name());//名称
94
-            holder.tv_yanglaojin.setText("养老金 ¥" + goodsPageBean.getYanglao());//养老金
64
+        String image = goodsPageBean.getImage();
65
+//        GlideUtils.loadImage(context,image, holder.card_image);
66
+        System.out.println(position+" : "+image);
67
+        Glide.with(context).load(image).into(holder.card_image);
68
+        holder.card_title.setText(goodsPageBean.getStore_name());//名称
69
+        holder.tv_yanglaojin.setText("养老金 ¥" + goodsPageBean.getYanglao_price());//养老金
70
+        holder.tv_price.setText(goodsPageBean.getPrice());//实际价格
71
+        holder.tv_lowestCouponPrice.setText("¥" + goodsPageBean.getOt_price());
72
+        if (goodsPageBean.getType() == 5) {
73
+            //大仓
74
+            holder.tv_dacang.setVisibility(View.VISIBLE);
95 75
             holder.tv_price.setText(goodsPageBean.getPrice());//实际价格
96
-            //if (goodsPageBean.getType().equals("1")||goodsPageBean.getType().equals("2")){
76
+            holder.iv_dacang.setVisibility(View.GONE);
77
+            //原价
97 78
             holder.tv_lowestCouponPrice.setText("¥" + goodsPageBean.getOt_price());
98
-            //  }
99
-
100
-
101
-            if (goodsPageBean.getType().equals("5")) {
102
-//大仓
103
-                holder.tv_dacang.setVisibility(View.VISIBLE);
104
-                holder.tv_price.setText(goodsPageBean.getPrice());//实际价格
105
-                holder.iv_dacang.setVisibility(View.GONE);
106
-                //原价
107
-                holder.tv_lowestCouponPrice.setText("¥" + goodsPageBean.getOt_price());
108
-                holder.tv_lowestCouponPrice.setVisibility(View.VISIBLE);
109
-            }
110
-
79
+            holder.tv_lowestCouponPrice.setVisibility(View.VISIBLE);
111 80
         }
112 81
 
113 82
 
@@ -121,7 +90,7 @@ public class HomeProductListAdapter extends RecyclerView.Adapter<HomeProductList
121 90
             }
122 91
         });
123 92
 
124
-        mAllNumber=position;
93
+        mAllNumber = position;
125 94
 
126 95
 
127 96
     }

+ 78 - 0
app/src/main/java/com/yihucha/hbyhc/presentation/home/adapter/ItemMessageAdapter.java

@@ -0,0 +1,78 @@
1
+package com.yihucha.hbyhc.presentation.home.adapter;
2
+
3
+import android.content.Context;
4
+import android.view.LayoutInflater;
5
+import android.view.View;
6
+import android.view.ViewGroup;
7
+import android.widget.BaseAdapter;
8
+import android.widget.TextView;
9
+
10
+import com.huantansheng.easyphotos.utils.String.StringUtils;
11
+import com.yihucha.hbyhc.R;
12
+import com.yihucha.hbyhc.databinding.ItemMessageBinding;
13
+import com.yihucha.hbyhc.presentation.message.model.TheAnnouncementBean;
14
+import com.yihucha.hbyhc.utils.StringsUtil;
15
+
16
+import java.util.List;
17
+
18
+/**
19
+ * author : zhangbing
20
+ * time   : 2024/1/28 18:25
21
+ * com.yihucha.hbyhc.presentation.home.adapter
22
+ */
23
+public class ItemMessageAdapter extends BaseAdapter {
24
+    private List<TheAnnouncementBean.TheAnnouncementList> datas;
25
+    private Context context;
26
+
27
+    public ItemMessageAdapter(List<TheAnnouncementBean.TheAnnouncementList> datas, Context context) {
28
+        this.datas = datas;
29
+        this.context = context;
30
+    }
31
+
32
+    public void setDatas(List<TheAnnouncementBean.TheAnnouncementList> datas) {
33
+        this.datas = datas;
34
+        notifyDataSetChanged();
35
+    }
36
+
37
+    @Override
38
+    public int getCount() {
39
+        return datas==null?0:datas.size();
40
+    }
41
+
42
+    @Override
43
+    public TheAnnouncementBean.TheAnnouncementList getItem(int position) {
44
+        return datas.get(position);
45
+    }
46
+
47
+    @Override
48
+    public long getItemId(int position) {
49
+        return 0;
50
+    }
51
+
52
+    @Override
53
+    public View getView(int position, View convertView, ViewGroup parent) {
54
+        MsgViewHolder holder;
55
+        if (convertView == null){
56
+            convertView = LayoutInflater.from(context).inflate(R.layout.item_message, parent, false);
57
+            holder = new MsgViewHolder(convertView);
58
+            convertView.setTag(holder);
59
+        } else {
60
+            holder = (MsgViewHolder) convertView.getTag();
61
+        }
62
+        String time = "";
63
+        if (!StringsUtil.isEmpty(getItem(position).getCreate_time())){
64
+            time = getItem(position).getCreate_time().split(" ")[0];
65
+        }
66
+        holder.binding.tvContent.setText(getItem(position).getContent());
67
+        holder.binding.tvTime.setText(time+"");
68
+        holder.binding.tvTitle.setText(getItem(position).getTitle());
69
+        return convertView;
70
+    }
71
+
72
+    class MsgViewHolder{
73
+        ItemMessageBinding binding;
74
+        public MsgViewHolder(View view){
75
+            binding = ItemMessageBinding.bind(view);
76
+        }
77
+    }
78
+}

+ 389 - 0
app/src/main/java/com/yihucha/hbyhc/presentation/home/model/HomeProductBean.java

@@ -0,0 +1,389 @@
1
+package com.yihucha.hbyhc.presentation.home.model;
2
+
3
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4
+
5
+import java.util.List;
6
+
7
+/**
8
+ * author : zhangbing
9
+ * time   : 2024/1/28 16:04
10
+ * com.yihucha.hbyhc.presentation.home.model
11
+ */
12
+public class HomeProductBean {
13
+
14
+    private PageInfoDTO pageInfo;
15
+
16
+    public PageInfoDTO getPageInfo() {
17
+        return pageInfo;
18
+    }
19
+
20
+    public void setPageInfo(PageInfoDTO pageInfo) {
21
+        this.pageInfo = pageInfo;
22
+    }
23
+
24
+    public static class PageInfoDTO {
25
+        private int total;
26
+        private int pageNum;
27
+        private int pageSize;
28
+        private int size;
29
+        private int startRow;
30
+        private int endRow;
31
+        private int pages;
32
+        private int prePage;
33
+        private int nextPage;
34
+        private boolean isFirstPage;
35
+        private boolean isLastPage;
36
+        private boolean hasPreviousPage;
37
+        private boolean hasNextPage;
38
+        private int navigatePages;
39
+        private int navigateFirstPage;
40
+        private int navigateLastPage;
41
+        private List<ListDTO> list;
42
+        private List<Integer> navigatepageNums;
43
+
44
+        public int getTotal() {
45
+            return total;
46
+        }
47
+
48
+        public void setTotal(int total) {
49
+            this.total = total;
50
+        }
51
+
52
+        public int getPageNum() {
53
+            return pageNum;
54
+        }
55
+
56
+        public void setPageNum(int pageNum) {
57
+            this.pageNum = pageNum;
58
+        }
59
+
60
+        public int getPageSize() {
61
+            return pageSize;
62
+        }
63
+
64
+        public void setPageSize(int pageSize) {
65
+            this.pageSize = pageSize;
66
+        }
67
+
68
+        public int getSize() {
69
+            return size;
70
+        }
71
+
72
+        public void setSize(int size) {
73
+            this.size = size;
74
+        }
75
+
76
+        public int getStartRow() {
77
+            return startRow;
78
+        }
79
+
80
+        public void setStartRow(int startRow) {
81
+            this.startRow = startRow;
82
+        }
83
+
84
+        public int getEndRow() {
85
+            return endRow;
86
+        }
87
+
88
+        public void setEndRow(int endRow) {
89
+            this.endRow = endRow;
90
+        }
91
+
92
+        public int getPages() {
93
+            return pages;
94
+        }
95
+
96
+        public void setPages(int pages) {
97
+            this.pages = pages;
98
+        }
99
+
100
+        public int getPrePage() {
101
+            return prePage;
102
+        }
103
+
104
+        public void setPrePage(int prePage) {
105
+            this.prePage = prePage;
106
+        }
107
+
108
+        public int getNextPage() {
109
+            return nextPage;
110
+        }
111
+
112
+        public void setNextPage(int nextPage) {
113
+            this.nextPage = nextPage;
114
+        }
115
+
116
+        public boolean isIsFirstPage() {
117
+            return isFirstPage;
118
+        }
119
+
120
+        public void setIsFirstPage(boolean isFirstPage) {
121
+            this.isFirstPage = isFirstPage;
122
+        }
123
+
124
+        public boolean isIsLastPage() {
125
+            return isLastPage;
126
+        }
127
+
128
+        public void setIsLastPage(boolean isLastPage) {
129
+            this.isLastPage = isLastPage;
130
+        }
131
+
132
+        public boolean isHasPreviousPage() {
133
+            return hasPreviousPage;
134
+        }
135
+
136
+        public void setHasPreviousPage(boolean hasPreviousPage) {
137
+            this.hasPreviousPage = hasPreviousPage;
138
+        }
139
+
140
+        public boolean isHasNextPage() {
141
+            return hasNextPage;
142
+        }
143
+
144
+        public void setHasNextPage(boolean hasNextPage) {
145
+            this.hasNextPage = hasNextPage;
146
+        }
147
+
148
+        public int getNavigatePages() {
149
+            return navigatePages;
150
+        }
151
+
152
+        public void setNavigatePages(int navigatePages) {
153
+            this.navigatePages = navigatePages;
154
+        }
155
+
156
+        public int getNavigateFirstPage() {
157
+            return navigateFirstPage;
158
+        }
159
+
160
+        public void setNavigateFirstPage(int navigateFirstPage) {
161
+            this.navigateFirstPage = navigateFirstPage;
162
+        }
163
+
164
+        public int getNavigateLastPage() {
165
+            return navigateLastPage;
166
+        }
167
+
168
+        public void setNavigateLastPage(int navigateLastPage) {
169
+            this.navigateLastPage = navigateLastPage;
170
+        }
171
+
172
+        public List<ListDTO> getList() {
173
+            return list;
174
+        }
175
+
176
+        public void setList(List<ListDTO> list) {
177
+            this.list = list;
178
+        }
179
+
180
+        public List<Integer> getNavigatepageNums() {
181
+            return navigatepageNums;
182
+        }
183
+
184
+        public void setNavigatepageNums(List<Integer> navigatepageNums) {
185
+            this.navigatepageNums = navigatepageNums;
186
+        }
187
+
188
+        public static class ListDTO {
189
+            private int product_id;
190
+            private int mer_id;
191
+            private String image;
192
+            private String slider_image;
193
+            private Object slider_image_list;
194
+            private String store_name;
195
+            private String store_info;
196
+            private String unit_name;
197
+            private String price;
198
+            private String cost;
199
+            private String ot_price;
200
+            private String stock;
201
+            private String sales;
202
+            private String ficti;
203
+            private String video_link;
204
+            private String product_type;
205
+            private int type;
206
+            private String dc_price;
207
+            private String seckill;
208
+            private int extension_type;
209
+            private String yanglao_price;
210
+            private Object spu_id;
211
+
212
+            public int getProduct_id() {
213
+                return product_id;
214
+            }
215
+
216
+            public void setProduct_id(int product_id) {
217
+                this.product_id = product_id;
218
+            }
219
+
220
+            public int getMer_id() {
221
+                return mer_id;
222
+            }
223
+
224
+            public void setMer_id(int mer_id) {
225
+                this.mer_id = mer_id;
226
+            }
227
+
228
+            public String getImage() {
229
+                return image;
230
+            }
231
+
232
+            public void setImage(String image) {
233
+                this.image = image;
234
+            }
235
+
236
+            public String getSlider_image() {
237
+                return slider_image;
238
+            }
239
+
240
+            public void setSlider_image(String slider_image) {
241
+                this.slider_image = slider_image;
242
+            }
243
+
244
+            public Object getSlider_image_list() {
245
+                return slider_image_list;
246
+            }
247
+
248
+            public void setSlider_image_list(Object slider_image_list) {
249
+                this.slider_image_list = slider_image_list;
250
+            }
251
+
252
+            public String getStore_name() {
253
+                return store_name;
254
+            }
255
+
256
+            public void setStore_name(String store_name) {
257
+                this.store_name = store_name;
258
+            }
259
+
260
+            public String getStore_info() {
261
+                return store_info;
262
+            }
263
+
264
+            public void setStore_info(String store_info) {
265
+                this.store_info = store_info;
266
+            }
267
+
268
+            public String getUnit_name() {
269
+                return unit_name;
270
+            }
271
+
272
+            public void setUnit_name(String unit_name) {
273
+                this.unit_name = unit_name;
274
+            }
275
+
276
+            public String getPrice() {
277
+                return price;
278
+            }
279
+
280
+            public void setPrice(String price) {
281
+                this.price = price;
282
+            }
283
+
284
+            public String getCost() {
285
+                return cost;
286
+            }
287
+
288
+            public void setCost(String cost) {
289
+                this.cost = cost;
290
+            }
291
+
292
+            public String getOt_price() {
293
+                return ot_price;
294
+            }
295
+
296
+            public void setOt_price(String ot_price) {
297
+                this.ot_price = ot_price;
298
+            }
299
+
300
+            public String getStock() {
301
+                return stock;
302
+            }
303
+
304
+            public void setStock(String stock) {
305
+                this.stock = stock;
306
+            }
307
+
308
+            public String getSales() {
309
+                return sales;
310
+            }
311
+
312
+            public void setSales(String sales) {
313
+                this.sales = sales;
314
+            }
315
+
316
+            public String getFicti() {
317
+                return ficti;
318
+            }
319
+
320
+            public void setFicti(String ficti) {
321
+                this.ficti = ficti;
322
+            }
323
+
324
+            public String getVideo_link() {
325
+                return video_link;
326
+            }
327
+
328
+            public void setVideo_link(String video_link) {
329
+                this.video_link = video_link;
330
+            }
331
+
332
+            public String getProduct_type() {
333
+                return product_type;
334
+            }
335
+
336
+            public void setProduct_type(String product_type) {
337
+                this.product_type = product_type;
338
+            }
339
+
340
+            public int getType() {
341
+                return type;
342
+            }
343
+
344
+            public void setType(int type) {
345
+                this.type = type;
346
+            }
347
+
348
+            public String getDc_price() {
349
+                return dc_price;
350
+            }
351
+
352
+            public void setDc_price(String dc_price) {
353
+                this.dc_price = dc_price;
354
+            }
355
+
356
+            public String getSeckill() {
357
+                return seckill;
358
+            }
359
+
360
+            public void setSeckill(String seckill) {
361
+                this.seckill = seckill;
362
+            }
363
+
364
+            public int getExtension_type() {
365
+                return extension_type;
366
+            }
367
+
368
+            public void setExtension_type(int extension_type) {
369
+                this.extension_type = extension_type;
370
+            }
371
+
372
+            public String getYanglao_price() {
373
+                return yanglao_price;
374
+            }
375
+
376
+            public void setYanglao_price(String yanglao_price) {
377
+                this.yanglao_price = yanglao_price;
378
+            }
379
+
380
+            public Object getSpu_id() {
381
+                return spu_id;
382
+            }
383
+
384
+            public void setSpu_id(Object spu_id) {
385
+                this.spu_id = spu_id;
386
+            }
387
+        }
388
+    }
389
+}

+ 53 - 5
app/src/main/java/com/yihucha/hbyhc/presentation/home/view_model/HomeViewModel.java

@@ -13,6 +13,7 @@ import com.yihucha.hbyhc.network.NetworkApi;
13 13
 import com.yihucha.hbyhc.network.service.ApiService;
14 14
 import com.yihucha.hbyhc.network.service.ProductService;
15 15
 import com.yihucha.hbyhc.presentation.home.model.BannerDataBean;
16
+import com.yihucha.hbyhc.presentation.home.model.HomeProductBean;
16 17
 import com.yihucha.hbyhc.presentation.home.model.HomeProductListBean;
17 18
 import com.yihucha.hbyhc.presentation.home.model.HomeQuickLink;
18 19
 import com.yihucha.hbyhc.presentation.message.model.TheAnnouncementBean;
@@ -31,6 +32,7 @@ public class HomeViewModel extends BaseViewModel {
31 32
 
32 33
     public MutableLiveData<DataResponse<List<BannerDataBean>>> bannerData = new MutableLiveData<>();//轮播图实体
33 34
     public MutableLiveData<List<HomeProductListBean>> homeProductListData = new MutableLiveData<>();//商品列表实体类
35
+    public MutableLiveData<List<HomeProductBean.PageInfoDTO.ListDTO>> homeProductListDataYHC = new MutableLiveData<>();//一壶茶首页商品列表实体类
34 36
     private List<HomeProductListBean> homeProductListBeans = new ArrayList<>();
35 37
 
36 38
     public MutableLiveData<UserInfoModel> userModel = new MutableLiveData<>();//用户资料
@@ -48,7 +50,7 @@ public class HomeViewModel extends BaseViewModel {
48 50
 //    public  MutableLiveData<CreateAnnualOrderBean> mCreateAnnualOrderData=new MutableLiveData<>();
49 51
 
50 52
 
51
-    public MutableLiveData<HomeQuickLink> mHomeQuickLink=new MutableLiveData<>();
53
+    public MutableLiveData<HomeQuickLink> mHomeQuickLink = new MutableLiveData<>();
52 54
 
53 55
     public void getUserInfo() {
54 56
         UserRepository.getUserInfo(new NormalListener<UserInfoModel>() {
@@ -66,7 +68,7 @@ public class HomeViewModel extends BaseViewModel {
66 68
 
67 69
     public MutableLiveData<YanglaojinBean> yanglaojinBeanMutableLiveData = new MutableLiveData<>();//养老金
68 70
 
69
-    public MutableLiveData<List<TheAnnouncementBean.TheAnnouncementList>> mTheAnnouncementData=new MutableLiveData<>();//公告列表
71
+    public MutableLiveData<List<TheAnnouncementBean.TheAnnouncementList>> mTheAnnouncementData = new MutableLiveData<>();//公告列表
70 72
 
71 73
     /**
72 74
      * 调用轮播图数据
@@ -92,13 +94,14 @@ public class HomeViewModel extends BaseViewModel {
92 94
             }
93 95
         }));
94 96
     }
97
+
95 98
     @SuppressLint("CheckResult")
96
-    public void getHomeQuickLink(){
99
+    public void getHomeQuickLink() {
97 100
         ApiService apiService = NetworkApi.createService(ApiService.class);
98 101
         apiService.getHomeQuickLink().compose(NetworkApi.applySchedulers(new BaseObserver<DataResponse<List<HomeQuickLink>>>() {
99 102
             @Override
100 103
             public void onSuccess(DataResponse<List<HomeQuickLink>> listDataResponse) {
101
-                if (listDataResponse.responseCode==200){
104
+                if (listDataResponse.responseCode == 200) {
102 105
                     mHomeQuickLink.postValue(listDataResponse.getData().get(0));
103 106
                 }
104 107
             }
@@ -109,6 +112,7 @@ public class HomeViewModel extends BaseViewModel {
109 112
             }
110 113
         }));
111 114
     }
115
+
112 116
     /**
113 117
      * 首页商品蕾列表
114 118
      *
@@ -140,6 +144,49 @@ public class HomeViewModel extends BaseViewModel {
140 144
         }));
141 145
     }
142 146
 
147
+    /**
148
+     * 首页商品列表---一壶茶
149
+     *
150
+     * @param page        当前页码
151
+     * @param mer_keyword 搜索关键字,没有就传 1
152
+     * @param isNew       0:排序上新
153
+     * @param priceType   排序 0-价格升序 1-价格降序
154
+     * @param sales       排序 销量 0-销量倒序 1-销量升序
155
+     */
156
+    @SuppressLint("CheckResult")
157
+    public void getHomeProductListData(int page, String mer_keyword, String isNew, String priceType, String sales) {
158
+        Map<String, Object> map = new HashMap<>();
159
+        map.put("mer_id", "496");
160
+        map.put("pageNum", page + "");
161
+        map.put("pageSize", "10");
162
+        map.put("mer_keyword", mer_keyword);
163
+        if (isNew != null)
164
+            map.put("is_new", isNew);
165
+        if (priceType != null)
166
+            map.put("priceType", priceType);
167
+        if (sales != null)
168
+            map.put("sales", sales);
169
+        ProductService productService = NetworkApi.createService(ProductService.class);
170
+        productService.homeProductListYHC(map).compose(NetworkApi.applySchedulers(new BaseObserver<DataResponse<HomeProductBean>>() {
171
+            @Override
172
+            public void onSuccess(DataResponse<HomeProductBean> listDataResponse) {
173
+                if (listDataResponse.responseCode == 200) {
174
+                    List<HomeProductBean.PageInfoDTO.ListDTO> list = listDataResponse.getData().getPageInfo().getList();
175
+                    homeProductListDataYHC.postValue(list);
176
+                } else {
177
+                    ToastUtils.showLong(listDataResponse.responseError);
178
+                }
179
+
180
+            }
181
+
182
+            @Override
183
+            public void onFailure(Throwable e) {
184
+                LogUtil.LogInfo("Throwable", e.getMessage());
185
+                //  failed.postValue(getString(R.string.failed_string));
186
+            }
187
+        }));
188
+    }
189
+
143 190
     @SuppressLint("CheckResult")
144 191
     public void getElemeUrl() {
145 192
         ApiService apiService = NetworkApi.createService(ApiService.class);
@@ -177,8 +224,9 @@ public class HomeViewModel extends BaseViewModel {
177 224
             }
178 225
         });
179 226
     }
227
+
180 228
     //公告
181
-    public void getNoticeList(){
229
+    public void getNoticeList() {
182 230
         MessageRepositoy.getNoticeList(new NormalListener<List<TheAnnouncementBean.TheAnnouncementList>>() {
183 231
             @Override
184 232
             public void success(List<TheAnnouncementBean.TheAnnouncementList> theAnnouncementBeans) {

+ 28 - 29
app/src/main/java/com/yihucha/hbyhc/presentation/login/LoginActivity.java

@@ -26,7 +26,10 @@ import com.yihucha.hbyhc.presentation.login.model.LoginModel;
26 26
 import com.yihucha.hbyhc.presentation.login.view_model.LoginViewModel;
27 27
 import com.yihucha.hbyhc.config.Constants;
28 28
 import com.yihucha.hbyhc.utils.CountDownTimeUtil;
29
+import com.yihucha.hbyhc.utils.EmptyCheckUtils;
29 30
 import com.yihucha.hbyhc.utils.MVUtils;
31
+import com.yihucha.hbyhc.utils.StringUtils;
32
+import com.yihucha.hbyhc.view.CustomDialog;
30 33
 import com.yihucha.hbyhc.view.MyToast;
31 34
 
32 35
 import java.util.ArrayList;
@@ -60,13 +63,9 @@ public class LoginActivity extends ViewBindingTitleBaseActivity<ActivityLoginPho
60 63
         mViewBinding.tvLogin.setOnClickListener(this);
61 64
         mViewBinding.tvRegistrationProtocol.setOnClickListener(this);
62 65
         mViewBinding.tvPrivacyAgreement.setOnClickListener(this);
63
-        mViewBinding.ivCxbName.setOnClickListener(this);
64 66
     }
65 67
 
66 68
     private void initView() {
67
-//        mViewBinding.cbSelector.setSelected(true);
68
-//        loginViewModel.mPwd.postValue(mViewBinding.etPwd.getText().toString().trim());
69
-//        loginViewModel.mPwd.postValue(mViewBinding.etPwd.getText().toString().trim());
70 69
     }
71 70
 
72 71
     private void initData() {
@@ -107,31 +106,36 @@ public class LoginActivity extends ViewBindingTitleBaseActivity<ActivityLoginPho
107 106
                 }
108 107
             }
109 108
         });
110
-        loginViewModel.loginModel.observe(LoginActivity.this, new Observer<DataResponse<LoginModel>>() {
111
-            @Override
112
-            public void onChanged(DataResponse<LoginModel> loginModelDataResponse) {
113
-                loginModel=  loginModelDataResponse.getData();
114
-                //保存token
115
-                MVUtils.put(Constants.TOKEN,loginModel.getToken());
116
-                MVUtils.put(Constants.PHONE,loginModel.getUser().getPhone());
117
-                MVUtils.put(Constants.USER_ID,loginModel.getUser().getUid());
118
-                MVUtils.put(Constants.AVATAR,loginModel.getUser().getAvatar());
119
-                MVUtils.put(Constants.NICK_NAME,loginModel.getUser().getNickname());
109
+        loginViewModel.loginModel.observe(LoginActivity.this, loginModelDataResponse -> {
110
+            loginModel=  loginModelDataResponse.getData();
111
+            //保存token
112
+            MVUtils.put(Constants.TOKEN,loginModel.getToken());
113
+            MVUtils.put(Constants.PHONE,loginModel.getUser().getPhone());
114
+            MVUtils.put(Constants.USER_ID,loginModel.getUser().getUid());
115
+            MVUtils.put(Constants.AVATAR,loginModel.getUser().getAvatar());
116
+            MVUtils.put(Constants.NICK_NAME,loginModel.getUser().getNickname());
120 117
 
121 118
 //                MainActivity.launch(LoginActivity.this);
122 119
 
123
-                List<String> activityList = new ArrayList<>();
124
-                activityList.add(LoginHomeActivity.class.getSimpleName());
125
-                ActivityStack.getScreenManager().finishArrayActivity(activityList);
126
-                finish();
120
+            List<String> activityList = new ArrayList<>();
121
+            activityList.add(LoginHomeActivity.class.getSimpleName());
122
+            ActivityStack.getScreenManager().finishArrayActivity(activityList);
123
+            finish();
124
+        });
125
+        loginViewModel.failed.observe(LoginActivity.this,msg->{
126
+            //如果返回了400 表示需要填写邀请人信息,弹窗进行绑定
127
+            if ("400".equals(msg)){
128
+                CustomDialog.getEnterCodeWithTitle(this,"请输入邀请人手机号",phone->{
129
+                    if (!StringUtils.isPhone(phone)) {
130
+                        Toast.makeText(context, "手机号码格式输入错误", Toast.LENGTH_SHORT).show();
131
+                        return;
132
+                    }
133
+                    /**
134
+                     * 下面做绑定手机号流程,暂时不做处理
135
+                     */
136
+                });
127 137
             }
128 138
         });
129
-//        loginViewModel.xieyi.observe(this, new Observer<DataResponse<LoginHomeXieyiModel>>() {
130
-//            @Override
131
-//            public void onChanged(DataResponse<LoginHomeXieyiModel> loginHomeXieyiModelDataResponse) {
132
-//                WebViewTitleBaseActivity.launch(LoginActivity.this,loginHomeXieyiModelDataResponse.getData().getTitle(),loginHomeXieyiModelDataResponse.getData().getContent());
133
-//            }
134
-//        });
135 139
     }
136 140
 
137 141
     @Override
@@ -230,17 +234,12 @@ public class LoginActivity extends ViewBindingTitleBaseActivity<ActivityLoginPho
230 234
 
231 235
         }else if (v == mViewBinding.tvRegistrationProtocol){
232 236
             //注册协议
233
-//            loginViewModel.getXieyi(context,"2");
234 237
             WebViewTitleBaseActivity.launch(LoginActivity.this,getString(R.string.registration_protocol),
235 238
                     Constants.PROTOCOL+Constants.SERVICE_AGREEMENT);
236 239
         }else if (v ==  mViewBinding.tvPrivacyAgreement){
237 240
             //隐私协议
238
-//            loginViewModel.getXieyi(context,"1");
239 241
             WebViewTitleBaseActivity.launch(LoginActivity.this,getString(R.string.privacy_agreement),
240 242
                     Constants.PROTOCOL+Constants.PRIVACY_AGREEMENT);
241
-        }else if (v == mViewBinding.ivCxbName){
242
-            //账号密码登录
243
-            loginViewModel.getPhonePasswordLogin("16600000118","123456");
244 243
         }
245 244
     }
246 245
 

+ 113 - 1
app/src/main/java/com/yihucha/hbyhc/presentation/login/model/LoginModel.java

@@ -30,7 +30,7 @@ public class LoginModel {
30 30
         this.user = user;
31 31
     }
32 32
 
33
-    public class User{
33
+    public class User {
34 34
         private String uid;//用户id
35 35
         private String wechat_user_id;//微信用户 id
36 36
         private String ali_user_id;//支付宝用户id
@@ -74,6 +74,118 @@ public class LoginModel {
74 74
         private String im_uuid;//环信UUID
75 75
         private String test_user;//是否是测试用户
76 76
         private String is_channel;//是否是渠道商
77
+        /**
78
+         *  以下部分为一壶茶新增字段
79
+         */
80
+        private String member_brokerage_price;
81
+        private String score;
82
+        private String annuity_once;
83
+        private String first_sign;
84
+        private String is_del;
85
+        private String first_shopping;
86
+        private String external;
87
+        private String external_id;
88
+        private String score_beishengtang;
89
+        private String level_id;
90
+        private String level;
91
+
92
+        public String getMember_brokerage_price() {
93
+            return member_brokerage_price;
94
+        }
95
+
96
+        public void setMember_brokerage_price(String member_brokerage_price) {
97
+            this.member_brokerage_price = member_brokerage_price;
98
+        }
99
+
100
+        public String getScore() {
101
+            return score;
102
+        }
103
+
104
+        public void setScore(String score) {
105
+            this.score = score;
106
+        }
107
+
108
+        public String getAnnuity_once() {
109
+            return annuity_once;
110
+        }
111
+
112
+        public void setAnnuity_once(String annuity_once) {
113
+            this.annuity_once = annuity_once;
114
+        }
115
+
116
+        public String getFirst_sign() {
117
+            return first_sign;
118
+        }
119
+
120
+        public void setFirst_sign(String first_sign) {
121
+            this.first_sign = first_sign;
122
+        }
123
+
124
+        public String getIs_del() {
125
+            return is_del;
126
+        }
127
+
128
+        public void setIs_del(String is_del) {
129
+            this.is_del = is_del;
130
+        }
131
+
132
+        public String getFirst_shopping() {
133
+            return first_shopping;
134
+        }
135
+
136
+        public void setFirst_shopping(String first_shopping) {
137
+            this.first_shopping = first_shopping;
138
+        }
139
+
140
+        public String getExternal() {
141
+            return external;
142
+        }
143
+
144
+        public void setExternal(String external) {
145
+            this.external = external;
146
+        }
147
+
148
+        public String getExternal_id() {
149
+            return external_id;
150
+        }
151
+
152
+        public void setExternal_id(String external_id) {
153
+            this.external_id = external_id;
154
+        }
155
+
156
+        public String getScore_beishengtang() {
157
+            return score_beishengtang;
158
+        }
159
+
160
+        public void setScore_beishengtang(String score_beishengtang) {
161
+            this.score_beishengtang = score_beishengtang;
162
+        }
163
+
164
+        public String getLevel_id() {
165
+            return level_id;
166
+        }
167
+
168
+        public void setLevel_id(String level_id) {
169
+            this.level_id = level_id;
170
+        }
171
+
172
+        public String getLevel() {
173
+            return level;
174
+        }
175
+
176
+        public void setLevel(String level) {
177
+            this.level = level;
178
+        }
179
+
180
+        public String getIs_show() {
181
+            return is_show;
182
+        }
183
+
184
+        public void setIs_show(String is_show) {
185
+            this.is_show = is_show;
186
+        }
187
+
188
+        private String is_show;
77 189
 
78 190
         public String getUid() {
79 191
             return uid == null ? "" : uid;

+ 2 - 0
app/src/main/java/com/yihucha/hbyhc/presentation/login/view_model/LoginViewModel.java

@@ -95,6 +95,8 @@ public class LoginViewModel extends BaseViewModel {
95 95
             public void onSuccess(DataResponse<LoginModel> loginModelDataResponse) {
96 96
                 if (loginModelDataResponse.responseCode==200){
97 97
                     loginModel.postValue(loginModelDataResponse);
98
+                }else if (loginModelDataResponse.responseCode == 400){
99
+                    failed.postValue("400");
98 100
                 }else {
99 101
                     MyToast.makeText(context, loginModelDataResponse.responseError, Toast.LENGTH_LONG).show();
100 102
                 }

+ 10 - 18
app/src/main/java/com/yihucha/hbyhc/presentation/message/MessageActivity.java

@@ -12,6 +12,7 @@ import androidx.lifecycle.ViewModelProvider;
12 12
 
13 13
 import com.yihucha.hbyhc.base.ViewBindingTitleBaseActivity;
14 14
 import com.yihucha.hbyhc.databinding.ActivityMessageBinding;
15
+import com.yihucha.hbyhc.presentation.home.adapter.ItemMessageAdapter;
15 16
 import com.yihucha.hbyhc.presentation.home.view_model.HomeViewModel;
16 17
 import com.yihucha.hbyhc.presentation.message.model.TheAnnouncementBean;
17 18
 import com.yihucha.hbyhc.utils.StringsUtil;
@@ -26,30 +27,21 @@ import java.util.List;
26 27
  */
27 28
 public class MessageActivity extends ViewBindingTitleBaseActivity<ActivityMessageBinding> implements View.OnClickListener{
28 29
     private HomeViewModel homeViewModel;
30
+    private ItemMessageAdapter adapter;
29 31
     private List<TheAnnouncementBean.TheAnnouncementList> mTheAnnouncementBean = new ArrayList<>();
30 32
     @Override
31 33
     protected void onCreate(Bundle savedInstanceState) {
32 34
         super.onCreate(savedInstanceState);
33 35
         homeViewModel = new ViewModelProvider(this).get(HomeViewModel.class);
34 36
         homeViewModel.getNoticeList();
35
-        homeViewModel.mTheAnnouncementData.observe(this, new Observer<List<TheAnnouncementBean.TheAnnouncementList>>() {
36
-            @Override
37
-            public void onChanged(List<TheAnnouncementBean.TheAnnouncementList> theAnnouncementBeans) {
38
-                if (!theAnnouncementBeans.isEmpty() && theAnnouncementBeans.size() > 0) {
39
-                    mTheAnnouncementBean = theAnnouncementBeans;
40
-                    List<String> info = new ArrayList<>();
41
-                    for (int i = 0; i < mTheAnnouncementBean.size(); i++) {
42
-                        info.add(mTheAnnouncementBean.get(i).getTitle());
43
-                    }
44
-                    if (StringsUtil.isEmpty(info)){
45
-                        mViewBinding.layoutNodata.setVisibility(View.VISIBLE);
46
-                    }else {
47
-                        mViewBinding.layoutNodata.setVisibility(View.GONE);
48
-                    }
49
-                    mViewBinding.rvMessage.setAdapter(new ArrayAdapter<>(MessageActivity.this, android.R.layout.simple_list_item_1,info));
50
-                } else {
51
-                    mViewBinding.layoutNodata.setVisibility(View.VISIBLE);
52
-                }
37
+        adapter = new ItemMessageAdapter(mTheAnnouncementBean,this);
38
+        mViewBinding.rvMessage.setAdapter(adapter);
39
+        homeViewModel.mTheAnnouncementData.observe(this, theAnnouncementBeans -> {
40
+            if (theAnnouncementBeans!=null&&theAnnouncementBeans.size()>0) {
41
+                mTheAnnouncementBean = theAnnouncementBeans;
42
+                adapter.setDatas(mTheAnnouncementBean);
43
+            } else {
44
+                mViewBinding.layoutNodata.setVisibility(View.VISIBLE);
53 45
             }
54 46
         });
55 47
         mViewBinding.rvMessage.setOnItemClickListener(new AdapterView.OnItemClickListener() {

+ 12 - 15
app/src/main/java/com/yihucha/hbyhc/presentation/shop/VipAreaActivity.java

@@ -43,7 +43,7 @@ public class VipAreaActivity extends BaseActivity implements View.OnClickListene
43 43
     private VipAreaAdapter adapter;
44 44
     private VipBannerAdapter bannerAdapter;
45 45
     private List<BannerDataBean> banner = new ArrayList<>();
46
-    private List<VipAreaBean.Data.ListDTO> beans = new ArrayList<>();
46
+    private List<VipAreaBean.ListDTO> beans = new ArrayList<>();
47 47
     private int page = 1;
48 48
     private VipAreaViewModel viewModel;
49 49
     private int flag = 0;  // 0 vip   1 gongchang
@@ -142,21 +142,18 @@ public class VipAreaActivity extends BaseActivity implements View.OnClickListene
142 142
             binding.titleVip.setText("工厂直供");
143 143
             viewModel.requestGongchang(page, 10, "");
144 144
         }
145
-        viewModel.vipAreaData.observe(this, new Observer<List<VipAreaBean.Data.ListDTO>>() {
146
-            @Override
147
-            public void onChanged(List<VipAreaBean.Data.ListDTO> listDTOS) {
148
-                if (page == 1) beans.clear();
149
-                if (listDTOS != null) {
150
-                    beans.addAll(listDTOS);
151
-                }
145
+        viewModel.vipAreaData.observe(this, listDTOS -> {
146
+            if (page == 1) beans.clear();
147
+            if (listDTOS != null) {
148
+                beans.addAll(listDTOS);
149
+            }
152 150
 //                beans.clear();
153
-                if (StringsUtil.isEmpty(beans)) {
154
-                    binding.layoutNoData.setVisibility(View.VISIBLE);
155
-                } else {
156
-                    binding.layoutNoData.setVisibility(View.GONE);
157
-                }
158
-                adapter.replaceData(beans);
151
+            if (StringsUtil.isEmpty(beans)) {
152
+                binding.layoutNoData.setVisibility(View.VISIBLE);
153
+            } else {
154
+                binding.layoutNoData.setVisibility(View.GONE);
159 155
             }
156
+            adapter.replaceData(beans);
160 157
         });
161 158
         viewModel.failed.observe(this, new Observer<String>() {
162 159
             @Override
@@ -179,7 +176,7 @@ public class VipAreaActivity extends BaseActivity implements View.OnClickListene
179 176
         adapter.setOnClickListener(new VipAreaAdapter.OnClickListener() {
180 177
             @Override
181 178
             public void onItemClick(int position) {
182
-                ProductDetailsActivity.launch(VipAreaActivity.this, beans.get(position).getProductId());
179
+                ProductDetailsActivity.launch(VipAreaActivity.this, beans.get(position).getProduct_id());
183 180
             }
184 181
         });
185 182
         binding.refreshlayout.setEnableRefresh(false);

+ 5 - 5
app/src/main/java/com/yihucha/hbyhc/presentation/shop/adapter/VipAreaAdapter.java

@@ -20,22 +20,22 @@ import java.util.List;
20 20
  * @date: 2023-06-17
21 21
  * @note:
22 22
  */
23
-public class VipAreaAdapter extends BaseQuickAdapter<VipAreaBean.Data.ListDTO, BaseViewHolder> {
23
+public class VipAreaAdapter extends BaseQuickAdapter<VipAreaBean.ListDTO, BaseViewHolder> {
24 24
     private Context context;
25 25
     private VipAreaAdapter.OnClickListener mClickListener;
26 26
 
27
-    public VipAreaAdapter(int layoutResId, @Nullable List<VipAreaBean.Data.ListDTO> data, Context context) {
27
+    public VipAreaAdapter(int layoutResId, @Nullable List<VipAreaBean.ListDTO> data, Context context) {
28 28
         super(layoutResId, data);
29 29
         this.context = context;
30 30
     }
31 31
 
32 32
     @Override
33
-    protected void convert(BaseViewHolder helper, VipAreaBean.Data.ListDTO item) {
33
+    protected void convert(BaseViewHolder helper, VipAreaBean.ListDTO item) {
34 34
         RoundCornerImageView card_image = helper.getView(R.id.card_image);
35 35
         GlideUtils.loadImage(context, item.getImage(), card_image);
36
-        helper.setText(R.id.card_title, item.getStoreName());
36
+        helper.setText(R.id.card_title, item.getStore_name());
37 37
         helper.setText(R.id.tv_price, item.getPrice());
38
-        helper.setText(R.id.tv_da_cang_price, "¥" + item.getOtPrice());
38
+        helper.setText(R.id.tv_da_cang_price, "¥" + item.getOt_price());
39 39
         helper.setText(R.id.tv_yanglaojin, "养老金 ¥" + item.getYanglao());
40 40
         if ("15".equals(item.getType())) {
41 41
             helper.setVisible(R.id.ll_yanglaojin, false);

+ 244 - 280
app/src/main/java/com/yihucha/hbyhc/presentation/shop/model/VipAreaBean.java

@@ -1,339 +1,303 @@
1 1
 package com.yihucha.hbyhc.presentation.shop.model;
2 2
 
3
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4
+
3 5
 import java.util.List;
4 6
 
5 7
 
8
+@JsonIgnoreProperties(ignoreUnknown = true)
6 9
 public class VipAreaBean {
7 10
 
11
+    private int count;
12
+    private List<ListDTO> list;
8 13
 
9
-    private int status;
10
-    private String message;
11
-    private Data data;
12
-
13
-    public Integer getStatus() {
14
-        return status;
14
+    public int getCount() {
15
+        return count;
15 16
     }
16 17
 
17
-    public void setStatus(Integer status) {
18
-        this.status = status;
18
+    public void setCount(int count) {
19
+        this.count = count;
19 20
     }
20 21
 
21
-    public String getMessage() {
22
-        return message;
22
+    public List<ListDTO> getList() {
23
+        return list;
23 24
     }
24 25
 
25
-    public void setMessage(String message) {
26
-        this.message = message;
26
+    public void setList(List<ListDTO> list) {
27
+        this.list = list;
27 28
     }
28 29
 
29
-    public Data getData() {
30
-        return data;
31
-    }
30
+    @JsonIgnoreProperties(ignoreUnknown = true)
31
+    public static class ListDTO {
32
+        private String product_id;
33
+        private String mer_id;
34
+        private String brand_id;
35
+        private String unit_name;
36
+        private String rate;
37
+        private String reply_count;
38
+        private String store_info;
39
+        private String cate_id;
40
+        private String image;
41
+        private String slider_image;
42
+        private String store_name;
43
+        private String keyword;
44
+        private String sort;
45
+        private String is_show;
46
+        private int sales;
47
+        private String price;
48
+        private Object refusal;
49
+        private String cost;
50
+        private String ot_price;
51
+        private String stock;
52
+        private String is_gift_bag;
53
+        private Object care_count;
54
+        private String status;
55
+        private String is_used;
56
+        private String create_time;
57
+        private String seckill;
58
+        private Object plate_mer_profit;
59
+        private String type;
60
+        private String yanglao;
61
+        private String special_merchant;
62
+
63
+        public String getProduct_id() {
64
+            return product_id;
65
+        }
32 66
 
33
-    public void setData(Data data) {
34
-        this.data = data;
35
-    }
67
+        public void setProduct_id(String product_id) {
68
+            this.product_id = product_id;
69
+        }
70
+
71
+        public String getMer_id() {
72
+            return mer_id;
73
+        }
74
+
75
+        public void setMer_id(String mer_id) {
76
+            this.mer_id = mer_id;
77
+        }
78
+
79
+        public String getBrand_id() {
80
+            return brand_id;
81
+        }
82
+
83
+        public void setBrand_id(String brand_id) {
84
+            this.brand_id = brand_id;
85
+        }
86
+
87
+        public String getUnit_name() {
88
+            return unit_name;
89
+        }
90
+
91
+        public void setUnit_name(String unit_name) {
92
+            this.unit_name = unit_name;
93
+        }
94
+
95
+        public String getRate() {
96
+            return rate;
97
+        }
98
+
99
+        public void setRate(String rate) {
100
+            this.rate = rate;
101
+        }
102
+
103
+        public String getReply_count() {
104
+            return reply_count;
105
+        }
106
+
107
+        public void setReply_count(String reply_count) {
108
+            this.reply_count = reply_count;
109
+        }
110
+
111
+        public String getStore_info() {
112
+            return store_info;
113
+        }
114
+
115
+        public void setStore_info(String store_info) {
116
+            this.store_info = store_info;
117
+        }
118
+
119
+        public String getCate_id() {
120
+            return cate_id;
121
+        }
122
+
123
+        public void setCate_id(String cate_id) {
124
+            this.cate_id = cate_id;
125
+        }
126
+
127
+        public String getImage() {
128
+            return image;
129
+        }
130
+
131
+        public void setImage(String image) {
132
+            this.image = image;
133
+        }
134
+
135
+        public String getSlider_image() {
136
+            return slider_image;
137
+        }
138
+
139
+        public void setSlider_image(String slider_image) {
140
+            this.slider_image = slider_image;
141
+        }
36 142
 
37
-    public static class Data {
38
-        private Integer count;
39
-        private List<ListDTO> list;
40
-
41
-        public Integer getCount() {
42
-            return count;
43
-        }
44
-
45
-        public void setCount(Integer count) {
46
-            this.count = count;
47
-        }
48
-
49
-        public List<ListDTO> getList() {
50
-            return list;
51
-        }
52
-
53
-        public void setList(List<ListDTO> list) {
54
-            this.list = list;
55
-        }
56
-
57
-        public static class ListDTO {
58
-            private String product_id;
59
-            private String mer_id;
60
-            private Object brand_id;
61
-            private String unit_name;
62
-            private String rate;
63
-            private String reply_count;
64
-            private String store_info;
65
-            private String cate_id;
66
-            private String image;
67
-            private String store_name;
68
-            private String keyword;
69
-            private String sort;
70
-            private String is_show;
71
-            private Integer sales;
72
-            private String price;
73
-            private Object refusal;
74
-            private String cost;
75
-            private String ot_price;
76
-            private String stock;
77
-            private String is_gift_bag;
78
-            private Object care_count;
79
-            private String status;
80
-            private String isUsed;
81
-            private String create_time;
82
-            private String seckill;
83
-            private String plate_mer_profit;
84
-            private String type;
85
-            private String yanglao;
86
-            private String special_merchant;
87
-            private Object issetCoupon;
88
-            private List<String> slider_image;
89
-
90
-            public String getProductId() {
91
-                return product_id;
92
-            }
93
-
94
-            public void setProductId(String product_id) {
95
-                this.product_id = product_id;
96
-            }
97
-
98
-            public String getMerId() {
99
-                return mer_id;
100
-            }
101
-
102
-            public void setMerId(String mer_id) {
103
-                this.mer_id = mer_id;
104
-            }
105
-
106
-            public Object getBrandId() {
107
-                return brand_id;
108
-            }
109
-
110
-            public void setBrandId(Object brand_id) {
111
-                this.brand_id = brand_id;
112
-            }
113
-
114
-            public String getUnitName() {
115
-                return unit_name;
116
-            }
117
-
118
-            public void setUnitName(String unit_name) {
119
-                this.unit_name = unit_name;
120
-            }
121
-
122
-            public String getRate() {
123
-                return rate;
124
-            }
125
-
126
-            public void setRate(String rate) {
127
-                this.rate = rate;
128
-            }
129
-
130
-            public String getReplyCount() {
131
-                return reply_count;
132
-            }
133
-
134
-            public void setReplyCount(String reply_count) {
135
-                this.reply_count = reply_count;
136
-            }
137
-
138
-            public String getStoreInfo() {
139
-                return store_info;
140
-            }
141
-
142
-            public void setStoreInfo(String store_info) {
143
-                this.store_info = store_info;
144
-            }
145
-
146
-            public String getCateId() {
147
-                return cate_id;
148
-            }
149
-
150
-            public void setCateId(String cate_id) {
151
-                this.cate_id = cate_id;
152
-            }
153
-
154
-            public String getImage() {
155
-                return image;
156
-            }
157
-
158
-            public void setImage(String image) {
159
-                this.image = image;
160
-            }
161
-
162
-            public String getStoreName() {
163
-                return store_name;
164
-            }
165
-
166
-            public void setStoreName(String store_name) {
167
-                this.store_name = store_name;
168
-            }
169
-
170
-            public String getKeyword() {
171
-                return keyword;
172
-            }
173
-
174
-            public void setKeyword(String keyword) {
175
-                this.keyword = keyword;
176
-            }
177
-
178
-            public String getSort() {
179
-                return sort;
180
-            }
181
-
182
-            public void setSort(String sort) {
183
-                this.sort = sort;
184
-            }
143
+        public String getStore_name() {
144
+            return store_name;
145
+        }
185 146
 
186
-            public String getIsShow() {
187
-                return is_show;
188
-            }
147
+        public void setStore_name(String store_name) {
148
+            this.store_name = store_name;
149
+        }
189 150
 
190
-            public void setIsShow(String is_show) {
191
-                this.is_show = is_show;
192
-            }
151
+        public String getKeyword() {
152
+            return keyword;
153
+        }
193 154
 
194
-            public Integer getSales() {
195
-                return sales;
196
-            }
155
+        public void setKeyword(String keyword) {
156
+            this.keyword = keyword;
157
+        }
197 158
 
198
-            public void setSales(Integer sales) {
199
-                this.sales = sales;
200
-            }
159
+        public String getSort() {
160
+            return sort;
161
+        }
201 162
 
202
-            public String getPrice() {
203
-                return price;
204
-            }
163
+        public void setSort(String sort) {
164
+            this.sort = sort;
165
+        }
205 166
 
206
-            public void setPrice(String price) {
207
-                this.price = price;
208
-            }
167
+        public String getIs_show() {
168
+            return is_show;
169
+        }
209 170
 
210
-            public Object getRefusal() {
211
-                return refusal;
212
-            }
171
+        public void setIs_show(String is_show) {
172
+            this.is_show = is_show;
173
+        }
213 174
 
214
-            public void setRefusal(Object refusal) {
215
-                this.refusal = refusal;
216
-            }
175
+        public int getSales() {
176
+            return sales;
177
+        }
217 178
 
218
-            public String getCost() {
219
-                return cost;
220
-            }
179
+        public void setSales(int sales) {
180
+            this.sales = sales;
181
+        }
221 182
 
222
-            public void setCost(String cost) {
223
-                this.cost = cost;
224
-            }
183
+        public String getPrice() {
184
+            return price;
185
+        }
225 186
 
226
-            public String getOtPrice() {
227
-                return ot_price;
228
-            }
187
+        public void setPrice(String price) {
188
+            this.price = price;
189
+        }
229 190
 
230
-            public void setOtPrice(String ot_price) {
231
-                this.ot_price = ot_price;
232
-            }
191
+        public Object getRefusal() {
192
+            return refusal;
193
+        }
233 194
 
234
-            public String getStock() {
235
-                return stock;
236
-            }
195
+        public void setRefusal(Object refusal) {
196
+            this.refusal = refusal;
197
+        }
237 198
 
238
-            public void setStock(String stock) {
239
-                this.stock = stock;
240
-            }
199
+        public String getCost() {
200
+            return cost;
201
+        }
241 202
 
242
-            public String getIsGiftBag() {
243
-                return is_gift_bag;
244
-            }
203
+        public void setCost(String cost) {
204
+            this.cost = cost;
205
+        }
245 206
 
246
-            public void setIsGiftBag(String is_gift_bag) {
247
-                this.is_gift_bag = is_gift_bag;
248
-            }
207
+        public String getOt_price() {
208
+            return ot_price;
209
+        }
249 210
 
250
-            public Object getCareCount() {
251
-                return care_count;
252
-            }
211
+        public void setOt_price(String ot_price) {
212
+            this.ot_price = ot_price;
213
+        }
253 214
 
254
-            public void setCareCount(Object care_count) {
255
-                this.care_count = care_count;
256
-            }
215
+        public String getStock() {
216
+            return stock;
217
+        }
257 218
 
258
-            public String getStatus() {
259
-                return status;
260
-            }
219
+        public void setStock(String stock) {
220
+            this.stock = stock;
221
+        }
261 222
 
262
-            public void setStatus(String status) {
263
-                this.status = status;
264
-            }
223
+        public String getIs_gift_bag() {
224
+            return is_gift_bag;
225
+        }
265 226
 
266
-            public String getIsUsed() {
267
-                return isUsed;
268
-            }
227
+        public void setIs_gift_bag(String is_gift_bag) {
228
+            this.is_gift_bag = is_gift_bag;
229
+        }
269 230
 
270
-            public void setIsUsed(String isUsed) {
271
-                this.isUsed = isUsed;
272
-            }
231
+        public Object getCare_count() {
232
+            return care_count;
233
+        }
234
+
235
+        public void setCare_count(Object care_count) {
236
+            this.care_count = care_count;
237
+        }
273 238
 
274
-            public String getCreateTime() {
275
-                return create_time;
276
-            }
239
+        public String getStatus() {
240
+            return status;
241
+        }
277 242
 
278
-            public void setCreateTime(String create_time) {
279
-                this.create_time = create_time;
280
-            }
243
+        public void setStatus(String status) {
244
+            this.status = status;
245
+        }
281 246
 
282
-            public String getSeckill() {
283
-                return seckill;
284
-            }
247
+        public String getIs_used() {
248
+            return is_used;
249
+        }
285 250
 
286
-            public void setSeckill(String seckill) {
287
-                this.seckill = seckill;
288
-            }
251
+        public void setIs_used(String is_used) {
252
+            this.is_used = is_used;
253
+        }
289 254
 
290
-            public String getPlateMerProfit() {
291
-                return plate_mer_profit;
292
-            }
255
+        public String getCreate_time() {
256
+            return create_time;
257
+        }
293 258
 
294
-            public void setPlateMerProfit(String plate_mer_profit) {
295
-                this.plate_mer_profit = plate_mer_profit;
296
-            }
259
+        public void setCreate_time(String create_time) {
260
+            this.create_time = create_time;
261
+        }
297 262
 
298
-            public String getType() {
299
-                return type;
300
-            }
263
+        public String getSeckill() {
264
+            return seckill;
265
+        }
301 266
 
302
-            public void setType(String type) {
303
-                this.type = type;
304
-            }
267
+        public void setSeckill(String seckill) {
268
+            this.seckill = seckill;
269
+        }
305 270
 
306
-            public String getYanglao() {
307
-                return yanglao;
308
-            }
271
+        public Object getPlate_mer_profit() {
272
+            return plate_mer_profit;
273
+        }
309 274
 
310
-            public void setYanglao(String yanglao) {
311
-                this.yanglao = yanglao;
312
-            }
275
+        public void setPlate_mer_profit(Object plate_mer_profit) {
276
+            this.plate_mer_profit = plate_mer_profit;
277
+        }
313 278
 
314
-            public String getSpecialMerchant() {
315
-                return special_merchant;
316
-            }
279
+        public String getType() {
280
+            return type;
281
+        }
317 282
 
318
-            public void setSpecialMerchant(String special_merchant) {
319
-                this.special_merchant = special_merchant;
320
-            }
283
+        public void setType(String type) {
284
+            this.type = type;
285
+        }
321 286
 
322
-            public Object getIssetCoupon() {
323
-                return issetCoupon;
324
-            }
287
+        public String getYanglao() {
288
+            return yanglao;
289
+        }
325 290
 
326
-            public void setIssetCoupon(Object issetCoupon) {
327
-                this.issetCoupon = issetCoupon;
328
-            }
291
+        public void setYanglao(String yanglao) {
292
+            this.yanglao = yanglao;
293
+        }
329 294
 
330
-            public List<String> getSliderImage() {
331
-                return slider_image;
332
-            }
295
+        public String getSpecial_merchant() {
296
+            return special_merchant;
297
+        }
333 298
 
334
-            public void setSliderImage(List<String> slider_image) {
335
-                this.slider_image = slider_image;
336
-            }
299
+        public void setSpecial_merchant(String special_merchant) {
300
+            this.special_merchant = special_merchant;
337 301
         }
338 302
     }
339 303
 }

+ 34 - 33
app/src/main/java/com/yihucha/hbyhc/presentation/shop/view_model/VipAreaViewModel.java

@@ -1,10 +1,13 @@
1 1
 package com.yihucha.hbyhc.presentation.shop.view_model;
2 2
 
3
+import android.annotation.SuppressLint;
4
+
3 5
 import androidx.lifecycle.MutableLiveData;
4 6
 
5 7
 import com.blankj.utilcode.util.ToastUtils;
6 8
 import com.yihucha.hbyhc.base.BaseViewModel;
7 9
 import com.yihucha.hbyhc.network.BaseObserver;
10
+import com.yihucha.hbyhc.network.DataJavaResponse;
8 11
 import com.yihucha.hbyhc.network.DataResponse;
9 12
 import com.yihucha.hbyhc.network.NetworkApi;
10 13
 import com.yihucha.hbyhc.network.service.ApiService;
@@ -26,57 +29,55 @@ import retrofit2.Response;
26 29
  */
27 30
 public class VipAreaViewModel extends BaseViewModel {
28 31
 
29
-    public MutableLiveData<List<VipAreaBean.Data.ListDTO>> vipAreaData = new MutableLiveData<>();
32
+    public MutableLiveData<List<VipAreaBean.ListDTO>> vipAreaData = new MutableLiveData<>();
30 33
     public MutableLiveData<List<BannerDataBean>> bannerData = new MutableLiveData<>();
31 34
 
32
-    public void requestData(int page,int limit,String keyword){
33
-        StoreService service = NetworkApi.createService(StoreService.class);
34
-        Call<VipAreaBean> call = service.getVipAreanList(page, limit,keyword);
35
-        call.enqueue(new Callback<VipAreaBean>() {
35
+    public void requestData(int page, int limit, String keyword) {
36
+        NetworkApi.createService(StoreService.class).getVipAreanList(page, limit, keyword)
37
+                .compose(NetworkApi.applySchedulers(new BaseObserver<DataJavaResponse<VipAreaBean>>() {
36 38
             @Override
37
-            public void onResponse(Call<VipAreaBean> call, Response<VipAreaBean> response) {
38
-                if (response.code() == 200 && response.body() != null) {
39
-                    if (response.body().getData() != null && response.body().getData().getCount() > 0) {
40
-                        vipAreaData.postValue(response.body().getData().getList());
41
-                        return;
42
-                    }
39
+            public void onSuccess(DataJavaResponse<VipAreaBean> response) {
40
+                if (response.responseCode == 200 && response.getData() != null) {
41
+                    vipAreaData.postValue(response.getData().getList());
42
+                    return;
43 43
                 }
44 44
                 vipAreaData.postValue(null);
45 45
             }
46
+
46 47
             @Override
47
-            public void onFailure(Call<VipAreaBean> call, Throwable t) {
48
+            public void onFailure(Throwable e) {
48 49
                 failed.postValue("数据加载失败!");
49 50
             }
50
-        });
51
+        }));
51 52
     }
52 53
 
53
-    public void requestGongchang(int page,int limit,String keyword){
54
-        StoreService service = NetworkApi.createService(StoreService.class);
55
-        Call<VipAreaBean> call = service.getGongchangAreanList(page, limit,"gongchang",keyword);
56
-        call.enqueue(new Callback<VipAreaBean>() {
57
-            @Override
58
-            public void onResponse(Call<VipAreaBean> call, Response<VipAreaBean> response) {
59
-                if (response.code() == 200 && response.body() != null) {
60
-                    if (response.body().getData() != null && response.body().getData().getCount() > 0) {
61
-                        vipAreaData.postValue(response.body().getData().getList());
62
-                        return;
54
+    public void requestGongchang(int page, int limit, String keyword) {
55
+        NetworkApi.createService(StoreService.class)
56
+                .getGongchangAreanList(page, limit, "gongchang", keyword)
57
+                .compose(NetworkApi.applySchedulers(new BaseObserver<DataJavaResponse<VipAreaBean>>() {
58
+                    @Override
59
+                    public void onSuccess(DataJavaResponse<VipAreaBean> response) {
60
+                        if (response.responseCode == 200 && response.getData() != null) {
61
+                            vipAreaData.postValue(response.getData().getList());
62
+                            return;
63
+                        }
64
+                        vipAreaData.postValue(null);
63 65
                     }
64
-                }
65
-                vipAreaData.postValue(null);
66
-            }
67
-            @Override
68
-            public void onFailure(Call<VipAreaBean> call, Throwable t) {
69
-                failed.postValue("数据加载失败!");
70
-            }
71
-        });
66
+
67
+                    @Override
68
+                    public void onFailure(Throwable e) {
69
+                        failed.postValue("数据加载失败!");
70
+                    }
71
+                }));
72 72
     }
73
+
73 74
     public void getUserData() {
74 75
         ApiService apiService = NetworkApi.createService(ApiService.class);
75 76
         apiService.userBanner().compose(NetworkApi.applySchedulers(new BaseObserver<DataResponse<List<BannerDataBean>>>() {
76 77
             @Override
77 78
             public void onSuccess(DataResponse<List<BannerDataBean>> listDataResponse) {
78 79
                 if (listDataResponse.responseCode == 200) {
79
-                    System.out.println(listDataResponse.getData().size()+"**********************");
80
+                    System.out.println(listDataResponse.getData().size() + "**********************");
80 81
                     bannerData.postValue(listDataResponse.getData());
81 82
                 } else {
82 83
                     ToastUtils.showLong(listDataResponse.responseError);
@@ -98,7 +99,7 @@ public class VipAreaViewModel extends BaseViewModel {
98 99
             @Override
99 100
             public void onSuccess(DataResponse<List<BannerDataBean>> listDataResponse) {
100 101
                 if (listDataResponse.responseCode == 200) {
101
-                    System.out.println(listDataResponse.getData().size()+"**********************");
102
+                    System.out.println(listDataResponse.getData().size() + "**********************");
102 103
                     bannerData.postValue(listDataResponse.getData());
103 104
                 } else {
104 105
                     ToastUtils.showLong(listDataResponse.responseError);

+ 29 - 0
app/src/main/java/com/yihucha/hbyhc/utils/EmptyCheckUtils.kt

@@ -0,0 +1,29 @@
1
+package com.yihucha.hbyhc.utils
2
+
3
+/**
4
+ *  author : zhangbing
5
+ *  time   : 2023/10/27 11:14
6
+ *  com.jyd.spiapp.utils
7
+ */
8
+class EmptyCheckUtils {
9
+    companion object{
10
+        @JvmStatic
11
+        fun isEmpty(str: String?): Boolean = str?.trim()?.isEmpty() ?: true
12
+        @JvmStatic
13
+        fun isEmpty(collection: Collection<Any>?) = collection?.isEmpty() ?:true
14
+        @JvmStatic
15
+        fun isEmpty(collection: List<Any>?) = collection?.isEmpty() ?:true
16
+        @JvmStatic
17
+        fun isEmpty(arr: Array<Any>?) = arr?.isEmpty() ?:true
18
+
19
+        @JvmStatic
20
+        fun isEmpty(any: Any?) = any?.let { false }?:true
21
+
22
+        @JvmStatic
23
+        fun isNotEmpty(str: String?): Boolean = str?.trim()?.isNotEmpty() ?: false
24
+        @JvmStatic
25
+        fun isNotEmpty(collection: Collection<Any>?) = collection?.isNotEmpty() ?:false
26
+        @JvmStatic
27
+        fun isNotEmpty(any:Any?) = any?.let { true } ?: false
28
+    }
29
+}

+ 209 - 0
app/src/main/java/com/yihucha/hbyhc/utils/StringUtils.kt

@@ -0,0 +1,209 @@
1
+package com.yihucha.hbyhc.utils
2
+
3
+import java.util.regex.Matcher
4
+import java.util.regex.Pattern
5
+
6
+/**
7
+ *  author : zhangbing
8
+ *  time   : 2023/12/2 12:20
9
+ *  com.passenger.utils
10
+ */
11
+const val PHONE_REGEX = "^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\\d{8}$" //手机号正则
12
+const val EMAIL_REGEX = "^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$" //邮箱正则
13
+const val PASSWORD_REGEX = "^\\w{4,32}$" //密码正则。4~32位的字母、数字、下划线
14
+const val VERIFY_CODE_REGEX = "^[a-zA-Z\\d]{6}$" //验证码正则
15
+
16
+class StringUtils {
17
+    companion object {
18
+        /**
19
+         * 籍贯信息集合(全国省会、直辖市、自治区)
20
+         */
21
+        var oriGin = mutableMapOf<String, String>()
22
+
23
+        init {
24
+            oriGin["11"] = "北京市"
25
+
26
+            oriGin["12"] = "天津市"
27
+
28
+            oriGin["13"] = "河北省"
29
+
30
+            oriGin["14"] = "山西省"
31
+
32
+            oriGin["15"] = "内蒙古自治区"
33
+
34
+            oriGin["21"] = "辽宁省"
35
+
36
+            oriGin["22"] = "吉林省"
37
+
38
+            oriGin["23"] = "黑龙江省"
39
+
40
+            oriGin["31"] = "上海市"
41
+
42
+            oriGin["32"] = "江苏省"
43
+
44
+            oriGin["33"] = "浙江省"
45
+
46
+            oriGin["34"] = "安徽省"
47
+
48
+            oriGin["35"] = "福建省"
49
+
50
+            oriGin["36"] = "江西省"
51
+
52
+            oriGin["37"] = "山东省"
53
+
54
+            oriGin["41"] = "河南省"
55
+
56
+            oriGin["42"] = "湖北省"
57
+
58
+            oriGin["43"] = "湖南省"
59
+
60
+            oriGin["44"] = "广东省"
61
+
62
+            oriGin["45"] = "广西壮族自治区"
63
+
64
+            oriGin["46"] = "海南省"
65
+
66
+            oriGin["50"] = "重庆市"
67
+
68
+            oriGin["51"] = "四川省"
69
+
70
+            oriGin["52"] = "贵州省"
71
+
72
+            oriGin["53"] = "云南省"
73
+
74
+            oriGin["54"] = "西藏自治区"
75
+
76
+            oriGin["61"] = "陕西省"
77
+
78
+            oriGin["62"] = "甘肃省"
79
+
80
+            oriGin["63"] = "青海省"
81
+
82
+            oriGin["64"] = "宁夏回族自治区"
83
+
84
+            oriGin["65"] = "新疆维吾尔自治区"
85
+
86
+            oriGin["71"] = "台湾省"
87
+
88
+            oriGin["81"] = "香港特别行政区"
89
+
90
+            oriGin["82"] = "澳门特别行政区"
91
+
92
+            oriGin["91"] = "国外"
93
+        }
94
+
95
+        /**
96
+         * 手机号码检测
97
+         */
98
+        @JvmStatic
99
+        fun isPhone(phone: String?): Boolean {
100
+            return phone?.let { p ->
101
+                Pattern.compile(PHONE_REGEX)?.let {
102
+                    it.matcher(p).matches()
103
+                } ?: false
104
+            } ?: false
105
+        }
106
+
107
+        /**
108
+         * URL移除 http或https头部信息
109
+         */
110
+        @JvmStatic
111
+        fun formatUrl(source: String?): String? {
112
+            source
113
+                ?.replace("http://", "")
114
+                ?.replace("https://", "")
115
+                ?.apply {
116
+                    if (isEmpty()) {
117
+                        return source
118
+                    }
119
+                    var i = indexOf('/')
120
+                    if (i >= 0)
121
+                        return substring(i)
122
+                } ?: return source
123
+            return source
124
+        }
125
+
126
+        /**
127
+         * 手机号码脱敏
128
+         */
129
+        @JvmStatic
130
+        fun resetPhone(phone: String?): String {
131
+            return if (EmptyCheckUtils.isEmpty(phone)) "" else {
132
+                phone!!.let {
133
+                    var str1 = it.substring(0, 3)
134
+                    var str2 = it.substring(it.length - 4)
135
+                    "$str1****$str2"
136
+                }
137
+            }
138
+        }
139
+
140
+        /**
141
+         * 身份证号码脱敏
142
+         */
143
+        @JvmStatic
144
+        fun resetIdCard(idcard: String?): String {
145
+            return if (EmptyCheckUtils.isEmpty(idcard)) "" else {
146
+                idcard!!.let {
147
+                    var str1 = it.substring(0, 3)
148
+                    var str2 = it.substring(it.length - 4)
149
+                    "$str1************$str2"
150
+                }
151
+            }
152
+        }
153
+
154
+        /**
155
+         * 根据身份证前两位,获取籍贯信息
156
+         */
157
+        @JvmStatic
158
+        fun getOriGin(key: String): String {
159
+            return if (oriGin.contains(key)) {
160
+                oriGin[key]!!
161
+            } else {
162
+                "未知"
163
+            }
164
+        }
165
+
166
+        /**
167
+         * 根据时间戳,获取分钟、秒等信息
168
+         */
169
+        @JvmStatic
170
+        fun getTime(long: Long): String {
171
+            return if (long == 0L) "00:00" else {
172
+                if (long <= 59L) {
173
+                    if (long > 9) {
174
+                        "00:$long"
175
+                    } else {
176
+                        "00:0$long"
177
+                    }
178
+                } else {
179
+                    var time = ""
180
+                    var min = long / 60
181
+                    var sec = long % 60
182
+                    time += if (min > 9) {
183
+                        "$min"
184
+                    } else {
185
+                        "0$min"
186
+                    }
187
+                    time += ":"
188
+                    time += if (sec > 9) {
189
+                        "$sec"
190
+                    } else {
191
+                        "0$sec"
192
+                    }
193
+                    time
194
+                }
195
+            }
196
+        }
197
+
198
+        /**
199
+         * 数字前面自动拼接0
200
+         */
201
+        fun formatNumber(number: Int): String {
202
+            return if (number > 9) number.toString() else "0${number}"
203
+        }
204
+
205
+    }
206
+
207
+
208
+
209
+}

+ 63 - 31
app/src/main/java/com/yihucha/hbyhc/view/CustomDialog.java

@@ -23,6 +23,7 @@ import com.yihucha.hbyhc.callback.ThreeInputButtonsListener;
23 23
 import com.yihucha.hbyhc.callback.TwoButtonsListener;
24 24
 import com.yihucha.hbyhc.callback.TwoInputButtonsListener;
25 25
 import com.yihucha.hbyhc.presentation.annuity.RealNameAuthenticationActivity;
26
+import com.yihucha.hbyhc.utils.EmptyCheckUtils;
26 27
 import com.yihucha.hbyhc.utils.GlideUtils;
27 28
 import com.yihucha.hbyhc.utils.StringsUtil;
28 29
 import com.liys.dialoglib.LDialog;
@@ -98,8 +99,8 @@ public class CustomDialog {
98 99
                                      int leftTextColor, int rightTextColor, final
99 100
                                      TwoButtonsListener twoButtonsListener) {
100 101
         LDialog dialog = LDialog.newInstance(context, R.layout.dialog_confirm);
101
-        if (StringsUtil.isEmpty(context.getString(title))){
102
-            dialog.setGone(R.id.confirm_title,false);
102
+        if (StringsUtil.isEmpty(context.getString(title))) {
103
+            dialog.setGone(R.id.confirm_title, false);
103 104
         }
104 105
         dialog.setMaskValue(0.5f).setText(R.id.confirm_title, title).setText(R.id.confirm_content, content)
105 106
                 .setText(R.id.confirm_negative, leftText)
@@ -165,6 +166,7 @@ public class CustomDialog {
165 166
         }
166 167
         dialog.show();
167 168
     }
169
+
168 170
     //版本升级进度条弹窗
169 171
     public static void downlaodDialog(AppCompatActivity context, LiveData<Integer> process) {
170 172
         LDialog dialog = LDialog.newInstance(context, R.layout.dialog_downlaod_process);
@@ -175,9 +177,9 @@ public class CustomDialog {
175 177
         progressBar.setMax(100);
176 178
         process.observe(context, process1 -> {
177 179
 //            System.out.println("CustomDialog.downlaodDialog----------"+process1);
178
-            if (process1 >= 100||process1<0) {
180
+            if (process1 >= 100 || process1 < 0) {
179 181
                 dialog.dismiss();
180
-            } else{
182
+            } else {
181 183
                 progressBar.setProgress(process1);
182 184
             }
183 185
         });
@@ -490,14 +492,27 @@ public class CustomDialog {
490 492
      * @param context
491 493
      */
492 494
     public static void getEnterTheInvitationCode(Context context, OneInputButtonsListener oneInputButtonsListener) {
495
+        getEnterCodeWithTitle(context, null, oneInputButtonsListener);
496
+    }
497
+
498
+    /**
499
+     * 输入邀请码
500
+     *
501
+     * @param context
502
+     * @title 标题提示语
503
+     */
504
+    public static void getEnterCodeWithTitle(Context context, String title, OneInputButtonsListener oneInputButtonsListener) {
493 505
         LDialog lDialog = LDialog.newInstance(context, R.layout.dialog_enter_the_invitation_code);
506
+        if (EmptyCheckUtils.isNotEmpty(title)) {
507
+            lDialog.setText(R.id.tv_title, title);
508
+        }
494 509
         EditText etInvitationCode = lDialog.getView(R.id.et_invitationcode);
495
-        lDialog.setMaskValue(0.5f).setGravity(Gravity.CENTER).setCancelBtn(R.id.confirm_negative).setOnClickListener(new LDialog.DialogOnClickListener() {
496
-            @Override
497
-            public void onClick(View v, LDialog lDialog) {
498
-                oneInputButtonsListener.clickButton(etInvitationCode.getText().toString());
499
-            }
500
-        }, R.id.confirm_positive).show();
510
+        lDialog.setMaskValue(0.5f)
511
+                .setGravity(Gravity.CENTER)
512
+                .setCancelBtn(R.id.confirm_negative)
513
+                .setOnClickListener((v, lDialog1) -> oneInputButtonsListener
514
+                        .clickButton(etInvitationCode.getText().toString()), R.id.confirm_positive)
515
+                .show();
501 516
     }
502 517
 
503 518
     /**
@@ -511,11 +526,12 @@ public class CustomDialog {
511 526
         tvContent.setText(s);
512 527
         lDialog.setMaskValue(0.5f).setGravity(Gravity.CENTER).setCancelBtn(R.id.confirm_negative).show();
513 528
     }
529
+
514 530
     /**
515 531
      * 取消支付弹窗
516 532
      */
517
-    public static void showCanclePayDialog(Context context,OneButtonsListener oneButtonsListener){
518
-        LDialog lDialog = LDialog.newInstance(context,R.layout.dialog_cancle_pay);
533
+    public static void showCanclePayDialog(Context context, OneButtonsListener oneButtonsListener) {
534
+        LDialog lDialog = LDialog.newInstance(context, R.layout.dialog_cancle_pay);
519 535
         //确认离开
520 536
         lDialog.getView(R.id.bt_likai).setOnClickListener(new View.OnClickListener() {
521 537
             @Override
@@ -533,24 +549,40 @@ public class CustomDialog {
533 549
         });
534 550
         lDialog.show();
535 551
     }
536
-    public static void showCanclePayDialog(Context context,OneButtonsListener oneButtonsListener,String title,
537
-                                           String leftBtn,String rightBtn){
538
-        LDialog lDialog = LDialog.newInstance(context,R.layout.dialog_cancle_pay);
552
+
553
+    /**
554
+     * 确认弹窗dialog
555
+     *
556
+     * @param context
557
+     * @param oneButtonsListener 点击回调
558
+     * @param title              标题
559
+     * @param content            内容
560
+     * @param leftBtn            取消按钮
561
+     * @param rightBtn           类似确认按钮
562
+     */
563
+    public static void showConfirmDialog(Context context, String title,
564
+                                         String content, String leftBtn, String rightBtn,
565
+                                         OneButtonsListener oneButtonsListener) {
566
+        LDialog lDialog = LDialog.newInstance(context, R.layout.dialog_confirm);
567
+        if (EmptyCheckUtils.isEmpty(title)) {
568
+            lDialog.setGone(R.id.confirm_title, true);
569
+        } else {
570
+            lDialog.setText(R.id.confirm_title, title);
571
+        }
572
+        if (EmptyCheckUtils.isEmpty(content)) {
573
+            lDialog.setGone(R.id.confirm_content, true);
574
+        } else {
575
+            lDialog.setText(R.id.confirm_content, content);
576
+        }
577
+        lDialog.setText(R.id.confirm_negative, leftBtn);
578
+        lDialog.setText(R.id.confirm_positive, rightBtn);
539 579
         //确认离开
540
-        lDialog.getView(R.id.bt_likai).setOnClickListener(new View.OnClickListener() {
541
-            @Override
542
-            public void onClick(View view) {
543
-                oneButtonsListener.clickButton();
544
-                lDialog.cancel();
545
-            }
580
+        lDialog.getView(R.id.confirm_positive).setOnClickListener(view -> {
581
+            oneButtonsListener.clickButton();
582
+            lDialog.cancel();
546 583
         });
547 584
         //继续支付
548
-        lDialog.getView(R.id.bt_continue).setOnClickListener(new View.OnClickListener() {
549
-            @Override
550
-            public void onClick(View view) {
551
-                lDialog.cancel();
552
-            }
553
-        });
585
+        lDialog.getView(R.id.confirm_negative).setOnClickListener(view -> lDialog.cancel());
554 586
         lDialog.show();
555 587
     }
556 588
 
@@ -610,16 +642,16 @@ public class CustomDialog {
610 642
 
611 643
     /**
612 644
      * 区域代理弹窗
613
-     * @param area 区域信息
614 645
      *
646
+     * @param area 区域信息
615 647
      */
616 648
 
617
-    public static void getAreaDailiDialog(Context context,String area,boolean isCity){
618
-        LDialog lDialog = LDialog.newInstance(context,R.layout.layout_dialog_daili);
649
+    public static void getAreaDailiDialog(Context context, String area, boolean isCity) {
650
+        LDialog lDialog = LDialog.newInstance(context, R.layout.layout_dialog_daili);
619 651
         ConstraintLayout layout = lDialog.findViewById(R.id.parent_layout);
620 652
         if (isCity) {
621 653
             layout.setBackgroundResource(R.mipmap.img_daili_dialog_bg);
622
-        }else {
654
+        } else {
623 655
             layout.setBackgroundResource(R.mipmap.img_dialog_daili);
624 656
         }
625 657
         TextView areaView = lDialog.getView(R.id.tv_content_area);

+ 15 - 0
app/src/main/res/drawable/shape_jiantou_right_red.xml

@@ -0,0 +1,15 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
3
+    <item
4
+        android:width="12dp"
5
+        android:height="12dp">
6
+        <shape android:shape="rectangle">
7
+            <gradient
8
+                android:angle="90"
9
+                android:endColor="#fffc517d"
10
+                android:startColor="#fff52137"
11
+                android:type="linear"
12
+                android:useLevel="true" />
13
+        </shape>
14
+    </item>
15
+</shape>

+ 13 - 0
app/src/main/res/drawable/shape_line_white_50dp.xml

@@ -0,0 +1,13 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<shape xmlns:android="http://schemas.android.com/apk/res/android" >
3
+
4
+
5
+    <!-- 圆角 -->
6
+    <corners android:radius="50dp" />
7
+
8
+    <stroke
9
+        android:color="@color/white"
10
+        android:width="2dp"/>
11
+
12
+
13
+</shape>

+ 13 - 0
app/src/main/res/drawable/shape_white_50dp.xml

@@ -0,0 +1,13 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<shape xmlns:android="http://schemas.android.com/apk/res/android"   android:shape="rectangle" >
3
+
4
+    <solid android:color="#ffffff" />
5
+
6
+<!--    <stroke-->
7
+<!--        android:color="@color/gray_9e9e9e"-->
8
+<!--        android:width="0.5dp"/>-->
9
+
10
+    <corners android:radius="50dp"/>
11
+
12
+
13
+</shape>

+ 2 - 2
app/src/main/res/drawable/shape_white_with_line_color_8dp.xml

@@ -8,8 +8,8 @@
8 8
 <!--        android:width="0.5dp"/>-->
9 9
 
10 10
     <corners android:radius="8dp"/>
11
-    <stroke android:color="#FEF0F1"
12
-        android:width="2dp"
11
+    <stroke android:color="@color/gray_e5e5e5"
12
+        android:width="1dp"
13 13
         />
14 14
 
15 15
 </shape>

+ 1 - 8
app/src/main/res/layout/activity_login_phone.xml

@@ -8,18 +8,10 @@
8 8
         android:layout_width="wrap_content"
9 9
         android:layout_height="wrap_content"
10 10
         android:src="@mipmap/logo_220608"
11
-
12 11
         android:layout_marginTop="59dp"
13 12
         android:layout_gravity="center_horizontal"
14 13
         />
15 14
 
16
-    <ImageView
17
-        android:id="@+id/iv_cxb_name"
18
-        android:layout_width="wrap_content"
19
-        android:layout_height="wrap_content"
20
-        android:layout_marginTop="13dp"
21
-        android:src="@mipmap/chuxubao_name"
22
-        android:layout_gravity="center_horizontal"/>
23 15
     <LinearLayout
24 16
         android:layout_width="match_parent"
25 17
         android:layout_height="wrap_content"
@@ -41,6 +33,7 @@
41 33
                 android:maxLength="11"
42 34
                 android:inputType="number"
43 35
                 android:hint="@string/input_phone"
36
+                android:text="13718363025"
44 37
                 android:layout_height="wrap_content" />
45 38
 
46 39
             <TextView

+ 216 - 0
app/src/main/res/layout/activity_yhchome_search.xml

@@ -0,0 +1,216 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    xmlns:tools="http://schemas.android.com/tools"
4
+    android:layout_width="match_parent"
5
+    android:layout_height="match_parent"
6
+    android:background="@color/white_f8f8f8"
7
+    android:fitsSystemWindows="true"
8
+    android:orientation="vertical"
9
+    tools:context=".presentation.home.YHCHomeSearchActivity">
10
+
11
+    <LinearLayout
12
+        android:layout_width="match_parent"
13
+        android:layout_height="wrap_content"
14
+        android:gravity="center"
15
+        android:orientation="horizontal">
16
+
17
+        <ImageView
18
+            android:id="@+id/iv_goback"
19
+            android:layout_width="wrap_content"
20
+            android:layout_height="wrap_content"
21
+            android:padding="16dp"
22
+            android:src="@mipmap/icon_title_back" />
23
+
24
+        <LinearLayout
25
+            android:id="@+id/ll_search"
26
+            android:layout_width="0dp"
27
+            android:layout_height="32dp"
28
+            android:layout_marginRight="13dp"
29
+            android:layout_weight="1"
30
+            android:background="@drawable/shape_line_fe0032_15dp"
31
+            android:gravity="center_vertical"
32
+            android:orientation="horizontal">
33
+
34
+            <EditText
35
+                android:id="@+id/et_search"
36
+                android:layout_width="0dp"
37
+                android:layout_height="match_parent"
38
+                android:layout_marginLeft="13dp"
39
+                android:layout_weight="1"
40
+                android:background="@null"
41
+                android:hint="搜索"
42
+                android:textColor="@color/black_333333"
43
+                android:textSize="13sp" />
44
+
45
+            <TextView
46
+                android:id="@+id/tv_click_search"
47
+                android:layout_width="wrap_content"
48
+                android:layout_height="match_parent"
49
+                android:background="@drawable/shape_fe0032_50dp"
50
+                android:gravity="center"
51
+                android:paddingLeft="12dp"
52
+                android:paddingRight="12dp"
53
+                android:text="@string/search"
54
+                android:textColor="@color/white"
55
+                android:textSize="14sp" />
56
+        </LinearLayout>
57
+
58
+
59
+    </LinearLayout>
60
+
61
+    <include
62
+        android:id="@+id/search_records"
63
+        layout="@layout/search_history_is_recommended"
64
+        android:layout_width="match_parent"
65
+        android:layout_height="wrap_content" />
66
+
67
+    <LinearLayout
68
+        android:id="@+id/layout_select"
69
+        android:layout_width="match_parent"
70
+        android:layout_height="wrap_content"
71
+        android:layout_marginTop="22dp"
72
+        android:orientation="horizontal"
73
+        android:visibility="gone"
74
+        >
75
+
76
+        <LinearLayout
77
+            android:id="@+id/ll_recommend"
78
+            android:layout_width="0dp"
79
+            android:layout_height="wrap_content"
80
+            android:layout_weight="1"
81
+            android:gravity="center"
82
+            android:orientation="horizontal">
83
+            <com.yihucha.hbyhc.view.BoldText
84
+                android:id="@+id/btv_recommend"
85
+                android:layout_width="wrap_content"
86
+                android:layout_height="wrap_content"
87
+                android:text="综合"
88
+                android:textColor="@color/red_fe0032"
89
+                android:textSize="16sp" />
90
+            <ImageView
91
+                android:id="@+id/iv_jiangxu_zonghe"
92
+                android:layout_width="wrap_content"
93
+                android:layout_height="wrap_content"
94
+                android:src="@mipmap/tuijian_xiala_red"
95
+                android:layout_marginLeft="5dp"
96
+                />
97
+        </LinearLayout>
98
+
99
+        <LinearLayout
100
+            android:id="@+id/ll_search_sales"
101
+            android:layout_width="0dp"
102
+            android:layout_height="wrap_content"
103
+            android:layout_weight="1"
104
+            android:gravity="center"
105
+            android:orientation="vertical">
106
+
107
+            <LinearLayout
108
+                android:layout_width="wrap_content"
109
+                android:layout_height="wrap_content"
110
+                android:gravity="center_vertical"
111
+                android:orientation="horizontal">
112
+
113
+                <com.yihucha.hbyhc.view.BoldText
114
+                    android:id="@+id/btv_search_sales"
115
+                    android:layout_width="wrap_content"
116
+                    android:layout_height="wrap_content"
117
+                    android:text="@string/search_sales"
118
+                    android:textColor="@color/black_333333"
119
+                    android:textSize="16sp" />
120
+
121
+                <LinearLayout
122
+                    android:layout_width="wrap_content"
123
+                    android:layout_height="wrap_content"
124
+                    android:layout_marginLeft="3dp"
125
+                    android:orientation="vertical">
126
+
127
+                    <ImageView
128
+                        android:id="@+id/iv_shengxu_sales"
129
+                        android:layout_width="wrap_content"
130
+                        android:layout_height="wrap_content"
131
+                        android:src="@mipmap/tuijian_shangla" />
132
+
133
+                    <ImageView
134
+                        android:id="@+id/iv_jiangxu_sale"
135
+                        android:layout_width="wrap_content"
136
+                        android:layout_height="wrap_content"
137
+                        android:src="@mipmap/tuijian_xiala" />
138
+                </LinearLayout>
139
+
140
+
141
+            </LinearLayout>
142
+        </LinearLayout>
143
+
144
+
145
+        <LinearLayout
146
+            android:id="@+id/ll_search_price"
147
+            android:layout_width="0dp"
148
+            android:layout_height="wrap_content"
149
+            android:layout_weight="1"
150
+            android:gravity="center"
151
+            android:orientation="vertical">
152
+
153
+            <LinearLayout
154
+                android:layout_width="wrap_content"
155
+                android:layout_height="wrap_content"
156
+                android:gravity="center_vertical"
157
+                android:orientation="horizontal">
158
+
159
+                <com.yihucha.hbyhc.view.BoldText
160
+                    android:id="@+id/btv_search_price"
161
+                    android:layout_width="wrap_content"
162
+                    android:layout_height="wrap_content"
163
+                    android:text="@string/search_price"
164
+                    android:textColor="@color/black_333333"
165
+                    android:textSize="16sp" />
166
+
167
+                <LinearLayout
168
+                    android:layout_width="wrap_content"
169
+                    android:layout_height="wrap_content"
170
+                    android:layout_marginLeft="3dp"
171
+                    android:orientation="vertical">
172
+
173
+                    <ImageView
174
+                        android:id="@+id/iv_shengxu"
175
+                        android:layout_width="wrap_content"
176
+                        android:layout_height="wrap_content"
177
+                        android:src="@mipmap/tuijian_shangla" />
178
+
179
+                    <ImageView
180
+                        android:id="@+id/iv_jiangxu"
181
+                        android:layout_width="wrap_content"
182
+                        android:layout_height="wrap_content"
183
+                        android:src="@mipmap/tuijian_xiala" />
184
+                </LinearLayout>
185
+
186
+            </LinearLayout>
187
+        </LinearLayout>
188
+    </LinearLayout>
189
+
190
+    <com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout
191
+        android:id="@+id/refreshLayout"
192
+        android:layout_width="match_parent"
193
+        android:layout_height="match_parent"
194
+        android:layout_marginTop="12dp"
195
+        >
196
+
197
+        <RelativeLayout
198
+            android:layout_width="match_parent"
199
+            android:layout_height="match_parent">
200
+
201
+            <androidx.recyclerview.widget.RecyclerView
202
+                android:id="@+id/rv_product_search"
203
+                android:layout_width="match_parent"
204
+                android:layout_height="wrap_content" />
205
+
206
+            <include
207
+                android:id="@+id/no_search"
208
+                layout="@layout/search_not_found"
209
+                android:layout_width="match_parent"
210
+                android:layout_height="wrap_content"
211
+                android:visibility="gone" />
212
+        </RelativeLayout>
213
+
214
+    </com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout>
215
+
216
+</LinearLayout>

+ 5 - 4
app/src/main/res/layout/dialog_confirm.xml

@@ -6,7 +6,7 @@
6 6
     android:background="@drawable/shape_ffffff_8dp"
7 7
     xmlns:app="http://schemas.android.com/apk/res-auto"
8 8
     android:gravity="center_horizontal"
9
-    android:paddingTop="20dp"
9
+    android:paddingTop="10dp"
10 10
     android:orientation="vertical" >
11 11
 
12 12
     <com.yihucha.hbyhc.view.BoldText
@@ -15,19 +15,20 @@
15 15
         android:layout_height="wrap_content"
16 16
         android:textColor="#000000"
17 17
         android:textSize="18sp"
18
-        android:visibility="visible" />
18
+        android:visibility="visible"
19
+        android:layout_marginTop="10dp"
20
+        />
19 21
 
20 22
     <com.yihucha.hbyhc.view.JustifyTextView
21 23
         android:id="@+id/confirm_content"
22 24
         android:layout_width="wrap_content"
23 25
         android:layout_height="wrap_content"
24
-        android:layout_marginTop="20dp"
26
+        android:layout_marginTop="10dp"
25 27
         android:layout_marginLeft="22dp"
26 28
         android:layout_marginRight="22dp"
27 29
         android:layout_marginBottom="20dp"
28 30
         android:textColor="@color/black_333333"
29 31
         android:lineSpacingExtra="3dp"
30
-
31 32
         android:gravity="center"
32 33
         android:textSize="15sp"
33 34
       />

+ 2 - 1
app/src/main/res/layout/dialog_enter_the_invitation_code.xml

@@ -8,7 +8,8 @@
8 8
     android:layout_marginRight="47dp"
9 9
     android:layout_height="wrap_content">
10 10
 
11
-    <TextView
11
+    <com.yihucha.hbyhc.view.BoldText
12
+        android:id="@+id/tv_title"
12 13
         android:layout_width="wrap_content"
13 14
         android:layout_height="wrap_content"
14 15
         android:textColor="@color/black_333333"

+ 384 - 172
app/src/main/res/layout/fragment_home.xml

@@ -3,220 +3,433 @@
3 3
     xmlns:app="http://schemas.android.com/apk/res-auto"
4 4
     xmlns:tools="http://schemas.android.com/tools"
5 5
     android:layout_width="match_parent"
6
-    android:orientation="vertical"
7 6
     android:layout_height="match_parent"
8 7
     android:background="@color/white_f8f8f8"
8
+    android:orientation="vertical"
9 9
     tools:context="com.yihucha.hbyhc.presentation.home.HomeFragment">
10 10
 
11
+    <include
12
+        android:id="@+id/head_view"
13
+        layout="@layout/home_head"
14
+        android:layout_width="wrap_content"
15
+        android:layout_height="wrap_content" />
11 16
 
12
-<com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout
13
-    android:id="@+id/refreshLayout"
14
-    android:layout_width="match_parent"
15
-    android:layout_height="match_parent"
16
-    app:tr_pureScrollMode_on="true"
17
-    android:layout_below="@+id/head_view"
18
-    >
19
-    <com.yihucha.hbyhc.view.NaviBarChangeStatusScrollView
20
-        android:id="@+id/scrollview"
17
+    <com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout
18
+        android:id="@+id/refreshLayout"
21 19
         android:layout_width="match_parent"
22 20
         android:layout_height="match_parent"
23
-        android:fillViewport="true"
24
-        android:clipToPadding="false"
25
-        android:fitsSystemWindows="false"
26
-        android:orientation="vertical"
27
-        android:scrollbars="none">
28
-        <LinearLayout
21
+        android:layout_below="@+id/head_view"
22
+        android:layout_marginTop="-45dp"
23
+        app:tr_pureScrollMode_on="true">
24
+
25
+        <com.yihucha.hbyhc.view.NaviBarChangeStatusScrollView
26
+            android:id="@+id/scrollview"
29 27
             android:layout_width="match_parent"
30
-            android:layout_height="wrap_content"
31
-            android:focusable="true"
32
-            android:focusableInTouchMode="true"
33
-            android:orientation="vertical">
34
-            <View
35
-                android:id="@+id/virtual_status_bar"
36
-                android:layout_width="match_parent"
37
-                android:layout_height="0dp"
38
-                android:background="@color/translate" />
39
-            <com.youth.banner.Banner
40
-                android:id="@+id/banner_home"
41
-                android:layout_width="match_parent"
42
-                app:layout_constraintTop_toTopOf="parent"
43
-                app:layout_constraintStart_toStartOf="parent"
44
-                app:layout_constraintEnd_toEndOf="parent"
45
-                android:layout_height="140dp" />
46
-
47
-            <include
48
-                android:id="@+id/view_jingangqu"
49
-                layout="@layout/home_king_kong_area"
50
-                 android:layout_width="match_parent"
51
-                android:layout_marginTop="13dp"
52
-                android:layout_marginLeft="16dp"
53
-                android:layout_marginRight="16dp"
54
-                android:layout_height="wrap_content"
28
+            android:layout_height="match_parent"
29
+            android:clipToPadding="false"
30
+            android:fillViewport="true"
31
+            android:fitsSystemWindows="false"
32
+            android:orientation="vertical"
33
+            android:scrollbars="none">
55 34
 
56
-                />
57 35
             <LinearLayout
58
-                android:id="@+id/ll_the_announcement"
59
-                android:layout_marginTop="13dp"
60
-                android:layout_marginLeft="16dp"
61
-                android:layout_marginRight="16dp"
62
-                android:background="#FFF9ED"
63
-                android:paddingLeft="13dp"
64
-                android:paddingRight="13dp"
65
-                android:paddingBottom="10dp"
66
-                android:paddingTop="10dp"
67 36
                 android:layout_width="match_parent"
68 37
                 android:layout_height="wrap_content"
69
-                android:gravity="center_vertical"
70
-                android:visibility="gone"
71
-                android:orientation="horizontal">
38
+                android:focusable="true"
39
+                android:focusableInTouchMode="true"
40
+                android:orientation="vertical"
41
+                android:paddingTop="3dp">
72 42
 
73
-                <ImageView
74
-                    android:layout_width="wrap_content"
75
-                    android:layout_height="wrap_content"
76
-                    android:src="@mipmap/home_the_horn_220926"/>
77
-                <com.sunfusheng.marqueeview.MarqueeView
78
-                    android:id="@+id/marqueeView"
43
+                <androidx.cardview.widget.CardView
79 44
                     android:layout_width="match_parent"
80
-                    android:layout_marginLeft="7dp"
81 45
                     android:layout_height="wrap_content"
82
-                    app:mvAnimDuration="1000"
83
-                    app:mvDirection="bottom_to_top"
84
-                    app:mvInterval="3000"
85
-                    app:mvTextColor="@color/red_ff6010"
86
-                    app:mvTextSize="15sp"
87
-                    app:mvSingleLine="true"/>
88
-            </LinearLayout>
46
+                    android:layout_marginLeft="10dp"
47
+                    android:layout_marginRight="10dp"
48
+                    app:cardCornerRadius="10dp">
49
+
50
+                    <com.youth.banner.Banner
51
+                        android:id="@+id/banner_home"
52
+                        android:layout_width="match_parent"
53
+                        android:layout_height="140dp" />
54
+                </androidx.cardview.widget.CardView>
89 55
 
90
-            <RelativeLayout
91
-                android:id="@+id/layout_seckill"
92
-                android:layout_width="match_parent"
93
-                android:layout_height="220dp"
94
-                android:background="@mipmap/img_ms_bg"
95
-                android:layout_marginLeft="16dp"
96
-                android:layout_marginRight="16dp"
97
-                android:paddingLeft="10dp"
98
-                android:paddingRight="10dp"
99
-                android:paddingTop="13dp"
100
-                android:paddingBottom="13dp"
101
-                android:layout_marginTop="13dp"
102
-                android:visibility="gone"
103
-                >
104
-                <ImageView
105
-                    android:id="@+id/imgv_xsms"
106
-                    android:layout_width="wrap_content"
107
-                    android:layout_height="wrap_content"
108
-                    android:src="@mipmap/img_miaosha_home"
109
-                    />
110 56
                 <LinearLayout
111
-                    android:id="@+id/layout_time"
112
-                    android:layout_width="wrap_content"
57
+                    android:layout_width="match_parent"
113 58
                     android:layout_height="wrap_content"
114
-                    android:layout_alignBottom="@+id/imgv_xsms"
115
-                    android:layout_toRightOf="@+id/imgv_xsms"
116
-                    android:layout_marginLeft="10dp"
117
-                    android:orientation="horizontal"
118
-                    >
59
+                    android:layout_marginTop="10dp"
60
+                    android:orientation="horizontal">
61
+
119 62
                     <TextView
120
-                        android:id="@+id/tv_hours"
121
-                        android:layout_width="wrap_content"
63
+                        android:layout_width="0dp"
122 64
                         android:layout_height="wrap_content"
123
-                        android:textSize="11sp"
124
-                        android:text="12"
125
-                        android:textColor="@color/white"
126
-                        android:padding="1dp"
127
-                        android:background="@drawable/shape_black_2dp"
128
-                        />
65
+                        android:layout_weight="1"
66
+                        android:drawableTop="@mipmap/icon_cxb"
67
+                        android:drawablePadding="4dp"
68
+                        android:gravity="center_horizontal"
69
+                        android:text="储蓄保商城" />
70
+
129 71
                     <TextView
130
-                        android:id="@+id/tv_maohao1"
131
-                        android:layout_width="wrap_content"
72
+                        android:layout_width="0dp"
132 73
                         android:layout_height="wrap_content"
133
-                        android:text=" : "
134
-                        android:textSize="11sp"
135
-                        android:textColor="@color/black_333333"/>
74
+                        android:layout_weight="1"
75
+                        android:drawableTop="@mipmap/icon_ms"
76
+                        android:drawablePadding="4dp"
77
+                        android:gravity="center_horizontal"
78
+                        android:text="限时秒杀" />
79
+
136 80
                     <TextView
137
-                        android:id="@+id/tv_minute"
81
+                        android:layout_width="0dp"
82
+                        android:layout_height="wrap_content"
83
+                        android:layout_weight="1"
84
+                        android:drawableTop="@mipmap/icon_vip"
85
+                        android:drawablePadding="4dp"
86
+                        android:gravity="center_horizontal"
87
+                        android:text="会员专区" />
88
+                </LinearLayout>
89
+
90
+                <RelativeLayout
91
+                    android:id="@+id/layout_vip"
92
+                    android:layout_width="match_parent"
93
+                    android:layout_height="230dp"
94
+                    android:layout_marginLeft="12dp"
95
+                    android:layout_marginTop="10dp"
96
+                    android:layout_marginRight="12dp"
97
+                    android:background="@mipmap/bg_vip_home"
98
+                    android:paddingLeft="3dp"
99
+                    android:paddingTop="13dp"
100
+                    android:paddingRight="3dp"
101
+                    android:paddingBottom="13dp"
102
+                    android:visibility="gone">
103
+
104
+                    <com.yihucha.hbyhc.view.BoldText
105
+                        android:id="@+id/imgv_vip"
138 106
                         android:layout_width="wrap_content"
139 107
                         android:layout_height="wrap_content"
140
-                        android:textSize="11sp"
141
-                        android:text="12"
108
+                        android:text="会员专区\t好物超值购"
142 109
                         android:textColor="@color/white"
143
-                        android:padding="1dp"
144
-                        android:background="@drawable/shape_black_2dp"
145
-                        />
146
-                    <TextView
147
-                        android:id="@+id/tv_maohao2"
110
+                        android:textSize="17sp" />
111
+
112
+                    <com.yihucha.hbyhc.view.BoldText
113
+                        android:id="@+id/tv_buy_now"
148 114
                         android:layout_width="wrap_content"
149 115
                         android:layout_height="wrap_content"
150
-                        android:text=" : "
151
-                        android:textSize="11sp"
152
-                        android:textColor="@color/black_333333"
153
-                        />
154
-                    <TextView
155
-                        android:id="@+id/tv_sencond"
116
+                        android:layout_alignParentRight="true"
117
+                        android:layout_gravity="center_vertical"
118
+                        android:layout_marginRight="12dp"
119
+                        android:background="@drawable/shape_line_white_50dp"
120
+                        android:drawableRight="@mipmap/img_jt_right"
121
+                        android:drawablePadding="5dp"
122
+                        android:paddingLeft="8dp"
123
+                        android:paddingTop="3dp"
124
+                        android:paddingRight="8dp"
125
+                        android:paddingBottom="3dp"
126
+                        android:text="立即抢购"
127
+                        android:textColor="@color/white"
128
+                        android:textSize="15sp" />
129
+
130
+                    <androidx.cardview.widget.CardView
131
+                        android:layout_width="match_parent"
132
+                        android:layout_height="wrap_content"
133
+                        android:layout_below="@id/imgv_vip"
134
+                        android:layout_alignParentBottom="true"
135
+                        android:layout_marginTop="10dp"
136
+                        app:cardCornerRadius="5dp">
137
+
138
+                        <androidx.recyclerview.widget.RecyclerView
139
+                            android:id="@+id/rv_vip"
140
+                            android:layout_width="match_parent"
141
+                            android:layout_height="wrap_content" />
142
+                    </androidx.cardview.widget.CardView>
143
+
144
+                </RelativeLayout>
145
+
146
+                <RelativeLayout
147
+                    android:id="@+id/layout_seckill"
148
+                    android:layout_width="match_parent"
149
+                    android:layout_height="290dp"
150
+                    android:layout_marginLeft="12dp"
151
+                    android:layout_marginTop="10dp"
152
+                    android:layout_marginRight="12dp"
153
+                    android:background="@mipmap/bg_ms_home"
154
+                    android:paddingLeft="10dp"
155
+                    android:paddingTop="13dp"
156
+                    android:paddingRight="10dp"
157
+                    android:paddingBottom="13dp"
158
+                    android:visibility="gone">
159
+
160
+                    <com.yihucha.hbyhc.view.BoldText
161
+                        android:id="@+id/imgv_xsms"
156 162
                         android:layout_width="wrap_content"
157 163
                         android:layout_height="wrap_content"
158
-                        android:textSize="11sp"
159
-                        android:text="12"
164
+                        android:text="超级秒杀\t低价限时抢"
160 165
                         android:textColor="@color/white"
161
-                        android:padding="1dp"
162
-                        android:background="@drawable/shape_black_2dp"
163
-                        />
164
-                </LinearLayout>
165
-                <TextView
166
-                    android:id="@+id/tv_get_more"
167
-                    android:layout_width="wrap_content"
168
-                    android:layout_height="wrap_content"
169
-                    android:text="查看更多"
170
-                    android:layout_alignParentRight="true"
171
-                    android:textColor="@color/white"
172
-                    android:textSize="11sp"
173
-                    android:drawableRight="@mipmap/img_jt_right"
174
-                    android:drawablePadding="5dp"
175
-                    />
176
-                <androidx.recyclerview.widget.RecyclerView
177
-                    android:id="@+id/rv_miaosha"
166
+                        android:textSize="17sp" />
167
+
168
+                    <LinearLayout
169
+                        android:id="@+id/layout_time"
170
+                        android:layout_width="wrap_content"
171
+                        android:layout_height="wrap_content"
172
+                        android:layout_alignTop="@+id/imgv_xsms"
173
+                        android:layout_alignBottom="@+id/imgv_xsms"
174
+                        android:layout_marginLeft="10dp"
175
+                        android:layout_toRightOf="@+id/imgv_xsms"
176
+                        android:orientation="horizontal">
177
+
178
+                        <TextView
179
+                            android:id="@+id/tv_hours"
180
+                            android:layout_width="wrap_content"
181
+                            android:layout_height="wrap_content"
182
+                            android:layout_gravity="center_vertical"
183
+                            android:background="@drawable/shape_white_2dp"
184
+                            android:padding="1dp"
185
+                            android:text="12"
186
+                            android:textColor="@color/red_fe0032"
187
+                            android:textSize="11sp" />
188
+
189
+                        <TextView
190
+                            android:id="@+id/tv_maohao1"
191
+                            android:layout_width="wrap_content"
192
+                            android:layout_height="wrap_content"
193
+                            android:layout_gravity="center_vertical"
194
+                            android:text=" : "
195
+                            android:textColor="@color/white"
196
+                            android:textSize="11sp" />
197
+
198
+                        <TextView
199
+                            android:id="@+id/tv_minute"
200
+                            android:layout_width="wrap_content"
201
+                            android:layout_height="wrap_content"
202
+                            android:layout_gravity="center_vertical"
203
+                            android:background="@drawable/shape_white_2dp"
204
+                            android:padding="1dp"
205
+                            android:text="12"
206
+                            android:textColor="@color/red_fe0032"
207
+                            android:textSize="11sp" />
208
+
209
+                        <TextView
210
+                            android:id="@+id/tv_maohao2"
211
+                            android:layout_width="wrap_content"
212
+                            android:layout_height="wrap_content"
213
+                            android:layout_gravity="center_vertical"
214
+                            android:text=" : "
215
+                            android:textColor="@color/white"
216
+                            android:textSize="11sp" />
217
+
218
+                        <TextView
219
+                            android:id="@+id/tv_sencond"
220
+                            android:layout_width="wrap_content"
221
+                            android:layout_height="wrap_content"
222
+                            android:layout_gravity="center_vertical"
223
+                            android:background="@drawable/shape_white_2dp"
224
+                            android:padding="1dp"
225
+                            android:text="12"
226
+                            android:textColor="@color/red_fe0032"
227
+                            android:textSize="11sp" />
228
+                    </LinearLayout>
229
+
230
+                    <androidx.cardview.widget.CardView
231
+                        android:layout_width="match_parent"
232
+                        android:layout_height="wrap_content"
233
+                        android:layout_above="@+id/layout_get_more"
234
+                        android:layout_below="@id/imgv_xsms"
235
+                        android:layout_marginTop="10dp"
236
+                        app:cardCornerRadius="5dp">
237
+
238
+                        <androidx.recyclerview.widget.RecyclerView
239
+                            android:id="@+id/rv_miaosha"
240
+                            android:layout_width="match_parent"
241
+                            android:layout_height="wrap_content" />
242
+                    </androidx.cardview.widget.CardView>
243
+
244
+                    <LinearLayout
245
+                        android:id="@+id/layout_get_more"
246
+                        android:layout_width="wrap_content"
247
+                        android:layout_height="wrap_content"
248
+                        android:layout_alignParentBottom="true"
249
+                        android:layout_centerHorizontal="true"
250
+                        android:layout_marginTop="23dp"
251
+                        android:layout_marginBottom="13dp"
252
+                        android:background="@drawable/shape_white_50dp"
253
+                        android:orientation="horizontal"
254
+                        android:paddingLeft="15dp"
255
+                        android:paddingTop="5dp"
256
+                        android:paddingRight="15dp"
257
+                        android:paddingBottom="5dp">
258
+
259
+                        <com.yihucha.hbyhc.view.BoldText
260
+                            android:id="@+id/tv_get_more"
261
+                            android:layout_width="wrap_content"
262
+                            android:layout_height="wrap_content"
263
+                            android:layout_gravity="center_vertical"
264
+                            android:drawablePadding="5dp"
265
+                            android:text="立即前往"
266
+                            android:textColor="@color/red_f83554"
267
+                            android:textSize="15sp" />
268
+
269
+                        <ImageView
270
+                            android:layout_width="15dp"
271
+                            android:layout_height="15dp"
272
+                            android:layout_gravity="center_vertical"
273
+                            android:layout_marginLeft="5dp"
274
+                            android:background="@drawable/shape_fe0032_50dp"
275
+                            android:padding="3dp"
276
+                            android:src="@mipmap/img_jt_right" />
277
+                    </LinearLayout>
278
+
279
+                </RelativeLayout>
280
+
281
+                <LinearLayout
178 282
                     android:layout_width="match_parent"
179 283
                     android:layout_height="wrap_content"
180
-                    android:layout_alignParentBottom="true"
181
-                    android:layout_below="@id/imgv_xsms"
182
-                    android:layout_marginTop="10dp"
183
-                    />
184
-            </RelativeLayout>
284
+                    android:layout_marginTop="22dp"
285
+                    android:orientation="horizontal">
185 286
 
186
-            <ImageView
187
-                android:id="@+id/iv_huiyuan"
188
-                android:layout_width="match_parent"
189
-                android:layout_marginTop="26px"
190
-                android:layout_height="wrap_content"
191
-                android:src="@mipmap/img_ckvip"/>
192
-
193
-            <androidx.recyclerview.widget.RecyclerView
194
-                android:layout_marginTop="13dp"
195
-                android:layout_marginLeft="16dp"
196
-                android:layout_marginRight="16dp"
197
-                android:nestedScrollingEnabled="false"
198
-                android:id="@+id/rv_home_list"
199
-                android:layout_width="match_parent"
200
-                android:layout_height="wrap_content" />
287
+                    <LinearLayout
288
+                        android:id="@+id/ll_recommend"
289
+                        android:layout_width="0dp"
290
+                        android:layout_height="wrap_content"
291
+                        android:layout_weight="1"
292
+                        android:gravity="center"
293
+                        android:orientation="vertical">
201 294
 
295
+                        <com.yihucha.hbyhc.view.BoldText
296
+                            android:id="@+id/btv_recommend"
297
+                            android:layout_width="wrap_content"
298
+                            android:layout_height="wrap_content"
299
+                            android:text="推荐"
300
+                            android:textColor="@color/red_fe0032"
301
+                            android:textSize="16sp" />
302
+                    </LinearLayout>
202 303
 
203
-        </LinearLayout>
304
+                    <LinearLayout
305
+                        android:id="@+id/ll_search_update"
306
+                        android:layout_width="0dp"
307
+                        android:layout_height="wrap_content"
308
+                        android:layout_weight="1"
309
+                        android:gravity="center"
310
+                        android:orientation="vertical">
204 311
 
205
-    </com.yihucha.hbyhc.view.NaviBarChangeStatusScrollView>
312
+                        <com.yihucha.hbyhc.view.BoldText
313
+                            android:id="@+id/btv_search_update"
314
+                            android:layout_width="wrap_content"
315
+                            android:layout_height="wrap_content"
316
+                            android:text="@string/search_update"
317
+                            android:textColor="@color/black_333333"
318
+                            android:textSize="16sp" />
319
+                    </LinearLayout>
206 320
 
207
-</com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout>
321
+                    <LinearLayout
322
+                        android:id="@+id/ll_search_sales"
323
+                        android:layout_width="0dp"
324
+                        android:layout_height="wrap_content"
325
+                        android:layout_weight="1"
326
+                        android:gravity="center"
327
+                        android:orientation="vertical">
208 328
 
209
-    <include
210
-        android:id="@+id/head_view"
211
-        layout="@layout/home_head"
212
-        android:layout_width="wrap_content"
213
-        android:layout_height="141dp"></include>
329
+                        <LinearLayout
330
+                            android:layout_width="wrap_content"
331
+                            android:layout_height="wrap_content"
332
+                            android:gravity="center_vertical"
333
+                            android:orientation="horizontal">
334
+
335
+                            <com.yihucha.hbyhc.view.BoldText
336
+                                android:id="@+id/btv_search_sales"
337
+                                android:layout_width="wrap_content"
338
+                                android:layout_height="wrap_content"
339
+                                android:text="@string/search_sales"
340
+                                android:textColor="@color/black_333333"
341
+                                android:textSize="16sp" />
342
+
343
+                            <LinearLayout
344
+                                android:layout_width="wrap_content"
345
+                                android:layout_height="wrap_content"
346
+                                android:layout_marginLeft="3dp"
347
+                                android:orientation="vertical">
348
+
349
+                                <ImageView
350
+                                    android:id="@+id/iv_shengxu_sales"
351
+                                    android:layout_width="wrap_content"
352
+                                    android:layout_height="wrap_content"
353
+                                    android:src="@mipmap/tuijian_shangla" />
354
+
355
+                                <ImageView
356
+                                    android:id="@+id/iv_jiangxu_sale"
357
+                                    android:layout_width="wrap_content"
358
+                                    android:layout_height="wrap_content"
359
+                                    android:src="@mipmap/tuijian_xiala" />
360
+                            </LinearLayout>
361
+
362
+
363
+                        </LinearLayout>
364
+                    </LinearLayout>
365
+
366
+
367
+                    <LinearLayout
368
+                        android:id="@+id/ll_search_price"
369
+                        android:layout_width="0dp"
370
+                        android:layout_height="wrap_content"
371
+                        android:layout_weight="1"
372
+                        android:gravity="center"
373
+                        android:orientation="vertical">
374
+
375
+                        <LinearLayout
376
+                            android:layout_width="wrap_content"
377
+                            android:layout_height="wrap_content"
378
+                            android:gravity="center_vertical"
379
+                            android:orientation="horizontal">
380
+
381
+                            <com.yihucha.hbyhc.view.BoldText
382
+                                android:id="@+id/btv_search_price"
383
+                                android:layout_width="wrap_content"
384
+                                android:layout_height="wrap_content"
385
+                                android:text="@string/search_price"
386
+                                android:textColor="@color/black_333333"
387
+                                android:textSize="16sp" />
388
+
389
+                            <LinearLayout
390
+                                android:layout_width="wrap_content"
391
+                                android:layout_height="wrap_content"
392
+                                android:layout_marginLeft="3dp"
393
+                                android:orientation="vertical">
214 394
 
215
-<!--站位-->
395
+                                <ImageView
396
+                                    android:id="@+id/iv_shengxu"
397
+                                    android:layout_width="wrap_content"
398
+                                    android:layout_height="wrap_content"
399
+                                    android:src="@mipmap/tuijian_shangla" />
400
+
401
+                                <ImageView
402
+                                    android:id="@+id/iv_jiangxu"
403
+                                    android:layout_width="wrap_content"
404
+                                    android:layout_height="wrap_content"
405
+                                    android:src="@mipmap/tuijian_xiala" />
406
+                            </LinearLayout>
407
+
408
+                        </LinearLayout>
409
+                    </LinearLayout>
410
+                </LinearLayout>
411
+
412
+                <androidx.recyclerview.widget.RecyclerView
413
+                    android:id="@+id/rv_home_list"
414
+                    android:layout_width="match_parent"
415
+                    android:layout_height="wrap_content"
416
+                    android:layout_marginLeft="16dp"
417
+                    android:layout_marginTop="13dp"
418
+                    android:layout_marginRight="16dp"
419
+                    android:nestedScrollingEnabled="false" />
420
+            </LinearLayout>
421
+
422
+        </com.yihucha.hbyhc.view.NaviBarChangeStatusScrollView>
423
+
424
+    </com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout>
425
+
426
+
427
+    <!--站位-->
216 428
     <View
217 429
         android:id="@+id/view_occupy"
218 430
         android:layout_width="wrap_content"
219 431
         android:layout_height="wrap_content" />
432
+
220 433
     <ImageView
221 434
         android:id="@+id/tv_scroll_top"
222 435
         android:layout_width="@dimen/to_top"
@@ -225,7 +438,6 @@
225 438
         android:layout_alignParentBottom="true"
226 439
         android:layout_marginRight="16dp"
227 440
         android:layout_marginBottom="30dp"
228
-        android:visibility="gone"
229 441
         android:src="@mipmap/to_top"
230
-        />
442
+        android:visibility="gone" />
231 443
 </RelativeLayout>

+ 19 - 52
app/src/main/res/layout/home_head.xml

@@ -2,14 +2,15 @@
2 2
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 3
     android:id="@+id/rl_top"
4 4
     android:layout_width="match_parent"
5
-    android:layout_height="140dp">
5
+    android:layout_height="wrap_content"
6
+    >
6 7
 
7 8
     <View
8 9
         android:id="@+id/view_header_bg"
9 10
         android:layout_width="match_parent"
10
-        android:layout_height="match_parent"
11
-        android:alpha="0"
12
-        android:background="@color/white" />
11
+        android:layout_height="190dp"
12
+        android:alpha="1"
13
+        android:background="@mipmap/home_top_bg" />
13 14
 
14 15
     <View
15 16
         android:id="@+id/view_top"
@@ -18,7 +19,7 @@
18 19
 
19 20
     <LinearLayout
20 21
         android:layout_width="match_parent"
21
-        android:layout_height="match_parent"
22
+        android:layout_height="wrap_content"
22 23
         android:layout_below="@id/view_top"
23 24
         android:orientation="vertical">
24 25
 
@@ -35,56 +36,22 @@
35 36
                 android:layout_height="36dp"
36 37
                 android:src="@mipmap/img_head_pig" />
37 38
 
38
-            <LinearLayout
39
-                android:layout_width="0dp"
40
-                android:layout_height="match_parent"
41
-                android:layout_marginLeft="8dp"
42
-                android:layout_weight="1"
43
-                android:orientation="vertical">
44
-
45
-                <com.yihucha.hbyhc.view.BoldText
46
-                    android:id="@+id/btv_name"
47
-                    android:layout_width="wrap_content"
48
-                    android:layout_height="wrap_content"
49
-                    android:text="@string/login"
50
-                    android:textColor="@color/white"
51
-                    android:textSize="15sp" />
52
-
53
-                <TextView
54
-                    android:id="@+id/tv_annuity"
55
-                    android:layout_width="wrap_content"
56
-                    android:layout_height="wrap_content"
57
-                    android:text="@string/draw_pension"
58
-                    android:textColor="@color/white"
59
-                    android:textSize="12sp" />
60
-            </LinearLayout>
61
-
62
-            <LinearLayout
39
+            <com.yihucha.hbyhc.view.BoldText
40
+                android:id="@+id/btv_name"
63 41
                 android:layout_width="wrap_content"
64 42
                 android:layout_height="wrap_content"
65
-                android:gravity="center"
66
-                android:orientation="vertical"
67
-                android:visibility="gone">
68
-
69
-                <ImageView
70
-                    android:layout_width="wrap_content"
71
-                    android:layout_height="wrap_content"
72
-                    android:src="@mipmap/home_annuity_220614" />
73
-
74
-                <TextView
75
-                    android:id="@+id/tv_send_annuity"
76
-                    android:layout_width="wrap_content"
77
-                    android:layout_height="wrap_content"
78
-                    android:layout_marginTop="3dp"
79
-                    android:text="@string/send_pension"
80
-                    android:textColor="@color/white"
81
-                    android:textSize="9.5sp" />
82
-            </LinearLayout>
83
-
43
+                android:layout_weight="1"
44
+                android:text="@string/login"
45
+                android:textColor="@color/black_333333"
46
+                android:textSize="17sp"
47
+                android:paddingLeft="12dp"
48
+                android:layout_gravity="center_vertical"
49
+                />
84 50
             <LinearLayout
85 51
                 android:layout_width="wrap_content"
86 52
                 android:layout_height="wrap_content"
87
-                android:paddingLeft="8dp"
53
+                android:paddingLeft="15dp"
54
+                android:paddingRight="8dp"
88 55
                 android:gravity="center"
89 56
                 android:orientation="vertical">
90 57
 
@@ -92,7 +59,7 @@
92 59
                     android:id="@+id/iv_message"
93 60
                     android:layout_width="match_parent"
94 61
                     android:layout_height="wrap_content"
95
-                    android:src="@mipmap/home_message_220614"
62
+                    android:src="@mipmap/icon_home_msg"
96 63
                     />
97 64
 
98 65
                 <TextView
@@ -101,7 +68,7 @@
101 68
                     android:layout_height="wrap_content"
102 69
                     android:layout_marginTop="3dp"
103 70
                     android:text="@string/message"
104
-                    android:textColor="@color/white"
71
+                    android:textColor="@color/black_333333"
105 72
                     android:textSize="9.5sp" />
106 73
             </LinearLayout>
107 74
         </LinearLayout>

+ 44 - 44
app/src/main/res/layout/item_home_miaosha.xml

@@ -1,55 +1,50 @@
1 1
 <?xml version="1.0" encoding="utf-8"?>
2 2
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
-    android:layout_width="wrap_content"
4
-    android:layout_height="match_parent"
5 3
     xmlns:app="http://schemas.android.com/apk/res-auto"
6 4
     android:id="@+id/layout_parent"
7
-    android:paddingLeft="5dp"
8
-    android:paddingRight="5dp"
9
-    >
5
+    android:layout_width="wrap_content"
6
+    android:layout_height="match_parent"
7
+    android:padding="5dp">
8
+
10 9
     <RelativeLayout
11 10
         android:layout_width="wrap_content"
12
-        android:layout_height="match_parent"
13
-        android:layout_marginBottom="10dp"
14
-        android:background="@drawable/shape_white_with_line_color_8dp">
11
+        android:layout_height="match_parent">
15 12
 
16 13
         <com.yihucha.hbyhc.view.RoundCornerImageView
17 14
             android:id="@+id/imgv_item"
18 15
             android:layout_width="match_parent"
19 16
             android:layout_height="90dp"
20
-            app:rciv_left_top_radius="8dp"
21
-            app:rciv_right_top_radius="8dp"
22 17
             android:padding="1dp"
23 18
             android:scaleType="fitXY"
24
-            />
19
+            app:rciv_left_top_radius="8dp"
20
+            app:rciv_right_top_radius="8dp" />
25 21
 
26 22
         <TextView
27 23
             android:id="@+id/tv_name_item"
28
-            android:layout_width="wrap_content"
24
+            android:layout_width="match_parent"
29 25
             android:layout_height="wrap_content"
30 26
             android:layout_below="@+id/imgv_item"
27
+            android:layout_marginLeft="5dp"
31 28
             android:layout_marginTop="11dp"
29
+            android:layout_marginRight="5dp"
32 30
             android:ellipsize="end"
33 31
             android:maxLines="1"
34 32
             android:text="迪奥Dior花香"
35 33
             android:textColor="@color/black_333333"
36
-            android:textSize="12sp"
37
-            android:layout_marginLeft="5dp"
38
-            android:layout_marginRight="5dp"
39
-            />
34
+            android:textSize="12sp" />
40 35
 
41 36
         <LinearLayout
42
-            android:layout_width="match_parent"
37
+            android:layout_width="wrap_content"
43 38
             android:layout_height="wrap_content"
44 39
             android:layout_below="@+id/tv_name_item"
40
+            android:layout_centerHorizontal="true"
41
+            android:layout_marginLeft="5dp"
45 42
             android:layout_marginTop="5dp"
43
+            android:layout_marginRight="5dp"
46 44
             android:layout_marginBottom="10dp"
47
-            android:paddingRight="3dp"
48 45
             android:background="@drawable/shape_line_fe0032_2dp"
49 46
             android:orientation="horizontal"
50
-            android:layout_marginLeft="5dp"
51
-            android:layout_marginRight="5dp"
52
-            >
47
+            android:paddingRight="3dp">
53 48
 
54 49
             <ImageView
55 50
                 android:id="@+id/imgv_yanglaojin"
@@ -69,37 +64,42 @@
69 64
                 android:textColor="@color/red_fe0032"
70 65
                 android:textSize="9sp" />
71 66
         </LinearLayout>
72
-    </RelativeLayout>
73
-    <RelativeLayout
74
-        android:layout_width="wrap_content"
75
-        android:layout_height="wrap_content"
76
-        android:layout_alignParentBottom="true"
77
-        android:layout_centerHorizontal="true"
78
-        android:background="@mipmap/img_ms_item_bg"
79
-        android:orientation="horizontal">
80 67
 
81
-        <LinearLayout
68
+        <RelativeLayout
69
+            android:id="@+id/price_layout"
82 70
             android:layout_width="wrap_content"
83 71
             android:layout_height="wrap_content"
72
+            android:layout_alignParentBottom="true"
84 73
             android:layout_centerHorizontal="true"
85
-            android:orientation="horizontal">
74
+            android:background="@mipmap/img_ms_qiang"
75
+            android:orientation="horizontal"
76
+            android:visibility="visible">
86 77
 
87
-            <TextView
88
-                android:id="@+id/tv_rmb_item"
78
+            <LinearLayout
89 79
                 android:layout_width="wrap_content"
90 80
                 android:layout_height="wrap_content"
91
-                android:text="¥"
92
-                android:textColor="@color/white"
93
-                android:textSize="10sp" />
81
+                android:layout_centerVertical="true"
82
+                android:orientation="horizontal"
83
+                android:paddingLeft="15dp">
94 84
 
95
-            <TextView
96
-                android:id="@+id/tv_price_item"
97
-                android:layout_width="wrap_content"
98
-                android:layout_height="wrap_content"
99
-                android:text="86"
100
-                android:textColor="@color/white"
101
-                android:textSize="13sp" />
102
-        </LinearLayout>
85
+                <TextView
86
+                    android:id="@+id/tv_rmb_item"
87
+                    android:layout_width="wrap_content"
88
+                    android:layout_height="wrap_content"
89
+                    android:text="¥"
90
+                    android:textColor="@color/red_fe0032"
91
+                    android:textSize="9sp" />
92
+
93
+                <com.yihucha.hbyhc.view.BoldText
94
+                    android:id="@+id/tv_price_item"
95
+                    android:layout_width="wrap_content"
96
+                    android:layout_height="wrap_content"
97
+                    android:text="86"
98
+                    android:textColor="@color/red_fe0032"
99
+                    android:textSize="15sp" />
100
+            </LinearLayout>
101
+        </RelativeLayout>
103 102
     </RelativeLayout>
104 103
 
104
+
105 105
 </RelativeLayout>

+ 99 - 0
app/src/main/res/layout/item_home_vip.xml

@@ -0,0 +1,99 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    xmlns:app="http://schemas.android.com/apk/res-auto"
4
+    android:id="@+id/layout_parent"
5
+    android:layout_width="wrap_content"
6
+    android:layout_height="match_parent"
7
+    android:padding="5dp"
8
+    >
9
+
10
+    <RelativeLayout
11
+        android:layout_width="wrap_content"
12
+        android:layout_height="match_parent"
13
+        >
14
+
15
+        <com.yihucha.hbyhc.view.RoundCornerImageView
16
+            android:id="@+id/imgv_item"
17
+            android:layout_width="match_parent"
18
+            android:layout_height="90dp"
19
+            android:padding="1dp"
20
+            android:scaleType="fitXY"
21
+            app:rciv_left_top_radius="8dp"
22
+            app:rciv_right_top_radius="8dp" />
23
+
24
+        <TextView
25
+            android:id="@+id/tv_name_item"
26
+            android:layout_width="match_parent"
27
+            android:layout_height="wrap_content"
28
+            android:layout_below="@+id/imgv_item"
29
+            android:layout_marginLeft="5dp"
30
+            android:layout_marginTop="11dp"
31
+            android:layout_marginRight="5dp"
32
+            android:ellipsize="end"
33
+            android:maxLines="1"
34
+            android:text="迪奥Dior花香"
35
+            android:textColor="@color/black_333333"
36
+            android:textSize="12sp" />
37
+
38
+        <LinearLayout
39
+            android:layout_width="wrap_content"
40
+            android:layout_height="wrap_content"
41
+            android:layout_below="@+id/tv_name_item"
42
+            android:layout_centerHorizontal="true"
43
+            android:layout_marginLeft="5dp"
44
+            android:layout_marginTop="5dp"
45
+            android:layout_marginRight="5dp"
46
+            android:layout_marginBottom="10dp"
47
+            android:background="@drawable/shape_line_fe0032_2dp"
48
+            android:orientation="horizontal"
49
+            android:paddingRight="3dp">
50
+
51
+            <ImageView
52
+                android:id="@+id/imgv_yanglaojin"
53
+                android:layout_width="wrap_content"
54
+                android:layout_height="wrap_content"
55
+                android:src="@mipmap/img_yg" />
56
+
57
+            <TextView
58
+                android:id="@+id/tv_yanglaojin"
59
+                android:layout_width="wrap_content"
60
+                android:layout_height="wrap_content"
61
+                android:layout_gravity="center_vertical"
62
+                android:layout_marginLeft="5dp"
63
+                android:layout_weight="1"
64
+                android:gravity="left"
65
+                android:text="养老金 ¥11.11"
66
+                android:textColor="@color/red_fe0032"
67
+                android:textSize="9sp" />
68
+        </LinearLayout>
69
+
70
+        <LinearLayout
71
+            android:id="@+id/price_layout_vip"
72
+            android:layout_width="wrap_content"
73
+            android:layout_height="wrap_content"
74
+            android:layout_alignParentBottom="true"
75
+            android:layout_centerHorizontal="true"
76
+            android:layout_centerVertical="true"
77
+            android:orientation="horizontal"
78
+            android:visibility="visible">
79
+
80
+            <TextView
81
+                android:id="@+id/tv_rmb_item_vip"
82
+                android:layout_width="wrap_content"
83
+                android:layout_height="wrap_content"
84
+                android:text="¥"
85
+                android:textColor="@color/red_fe0032"
86
+                android:textSize="9sp" />
87
+
88
+            <com.yihucha.hbyhc.view.BoldText
89
+                android:id="@+id/tv_price_item_vip"
90
+                android:layout_width="wrap_content"
91
+                android:layout_height="wrap_content"
92
+                android:text="86"
93
+                android:textColor="@color/red_fe0032"
94
+                android:textSize="15sp" />
95
+        </LinearLayout>
96
+    </RelativeLayout>
97
+
98
+
99
+</RelativeLayout>

+ 46 - 0
app/src/main/res/layout/item_message.xml

@@ -0,0 +1,46 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    android:layout_width="match_parent"
4
+    android:layout_height="80dp"
5
+    android:padding="12dp">
6
+
7
+    <ImageView
8
+        android:id="@+id/imgv_msg"
9
+        android:layout_width="45dp"
10
+        android:layout_height="45dp"
11
+        android:src="@mipmap/img_msg" />
12
+
13
+    <com.yihucha.hbyhc.view.BoldText
14
+        android:id="@+id/tv_title"
15
+        android:layout_width="wrap_content"
16
+        android:layout_height="wrap_content"
17
+        android:layout_alignTop="@+id/imgv_msg"
18
+        android:layout_marginLeft="12dp"
19
+        android:layout_toRightOf="@+id/imgv_msg"
20
+        android:text="养老金结算通知"
21
+        android:textColor="@color/black_333333"
22
+        android:textSize="16sp" />
23
+
24
+    <TextView
25
+        android:id="@+id/tv_time"
26
+        android:layout_width="wrap_content"
27
+        android:layout_height="wrap_content"
28
+        android:layout_alignTop="@+id/tv_title"
29
+        android:layout_marginLeft="12dp"
30
+        android:layout_alignBottom="@+id/tv_title"
31
+        android:layout_alignParentRight="true"
32
+        android:text="2019-12-03"
33
+        android:textColor="@color/gray_999999"
34
+        android:textSize="12sp" />
35
+    <TextView
36
+        android:id="@+id/tv_content"
37
+        android:layout_width="wrap_content"
38
+        android:layout_height="wrap_content"
39
+        android:layout_alignLeft="@+id/tv_title"
40
+        android:layout_below="@+id/tv_title"
41
+        android:text="这是公告内容这是公告内容这是公告这是公告内容这是公告内容这是公告这是公告内容…"
42
+        android:textColor="@color/gray_999999"
43
+        android:layout_marginTop="5dp"
44
+        android:textSize="13sp" />
45
+
46
+</RelativeLayout>

BIN
app/src/main/res/mipmap-xxxhdpi/bg_ms_home.png


BIN
app/src/main/res/mipmap-xxxhdpi/bg_vip_home.png


BIN
app/src/main/res/mipmap-xxxhdpi/home_top_bg.png


BIN
app/src/main/res/mipmap-xxxhdpi/home_top_bg_scroll.png


BIN
app/src/main/res/mipmap-xxxhdpi/icon_cxb.png


BIN
app/src/main/res/mipmap-xxxhdpi/icon_home_msg.png


BIN
app/src/main/res/mipmap-xxxhdpi/icon_ms.png


BIN
app/src/main/res/mipmap-xxxhdpi/icon_vip.png


BIN
app/src/main/res/mipmap-xxxhdpi/img_ms_qiang.png


BIN
app/src/main/res/mipmap-xxxhdpi/img_msg.png


+ 1 - 0
app/src/main/res/values/colors.xml

@@ -22,6 +22,7 @@
22 22
 
23 23
     <color name="translate33">#33000000</color>
24 24
     <color name="red_fe0032">#FE0032</color>
25
+    <color name="red_f83554">#F83554</color>
25 26
     <color name="red_ff6010">#FF6010</color>
26 27
     <color name="red_fe7577">#FE7577</color>
27 28
     <color name="red_fd1b48">#FD1B48</color>

BIN
jd_sdk_lib/build/intermediates/compiled_local_resources/debug/out/layout_web_bottom_layout.xml.flat


+ 2 - 2
jd_sdk_lib/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties

@@ -1,8 +1,8 @@
1
-#Thu Jan 25 17:14:02 CST 2024
1
+#Sun Jan 28 13:37:21 CST 2024
2 2
 com.jd.jdsdk.jd_sdk_lib-main-7\:/drawable-xxhdpi/kepler_back_pressed.png=E\:\\Android_project\\yihucha\\jd_sdk_lib\\build\\intermediates\\packaged_res\\debug\\drawable-xxhdpi-v4\\kepler_back_pressed.png
3 3
 com.jd.jdsdk.jd_sdk_lib-main-7\:/drawable/pressbar_color.xml=E\:\\Android_project\\yihucha\\jd_sdk_lib\\build\\intermediates\\packaged_res\\debug\\drawable\\pressbar_color.xml
4
-com.jd.jdsdk.jd_sdk_lib-main-7\:/drawable/sdk_title_bg_with_shadow.xml=E\:\\Android_project\\yihucha\\jd_sdk_lib\\build\\intermediates\\packaged_res\\debug\\drawable\\sdk_title_bg_with_shadow.xml
5 4
 com.jd.jdsdk.jd_sdk_lib-main-7\:/layout/web_bottom_layout.xml=E\:\\Android_project\\yihucha\\jd_sdk_lib\\build\\intermediates\\packaged_res\\debug\\layout\\web_bottom_layout.xml
5
+com.jd.jdsdk.jd_sdk_lib-main-7\:/drawable/sdk_title_bg_with_shadow.xml=E\:\\Android_project\\yihucha\\jd_sdk_lib\\build\\intermediates\\packaged_res\\debug\\drawable\\sdk_title_bg_with_shadow.xml
6 6
 com.jd.jdsdk.jd_sdk_lib-main-7\:/layout/neterror_layout.xml=E\:\\Android_project\\yihucha\\jd_sdk_lib\\build\\intermediates\\packaged_res\\debug\\layout\\neterror_layout.xml
7 7
 com.jd.jdsdk.jd_sdk_lib-main-7\:/drawable-xxhdpi/seclect_item_serch.png=E\:\\Android_project\\yihucha\\jd_sdk_lib\\build\\intermediates\\packaged_res\\debug\\drawable-xxhdpi-v4\\seclect_item_serch.png
8 8
 com.jd.jdsdk.jd_sdk_lib-main-7\:/drawable/kepler_dialog_button_ne.xml=E\:\\Android_project\\yihucha\\jd_sdk_lib\\build\\intermediates\\packaged_res\\debug\\drawable\\kepler_dialog_button_ne.xml

+ 0 - 65
jd_sdk_lib/build/intermediates/incremental/debug/packageDebugResources/merged.dir/values/values.xml

@@ -1,65 +0,0 @@
1
-<?xml version="1.0" encoding="utf-8"?>
2
-<resources>
3
-    <string name="Illegal_info"> Illegal application ,check init !</string>
4
-    <string name="app_name">sdk</string>
5
-    <string name="give_up_affirm">确认离开</string>
6
-    <string name="give_up_goon">继续支付</string>
7
-    <string name="give_up_message">"下单后24小时内未支付成功,订单将被取消,请尽快完成支付。"</string>
8
-    <string name="give_up_title">确定要离开收银台</string>
9
-    <string name="history">最近浏览</string>
10
-    <string name="kepler_check_net">请检查您的网络环境</string>
11
-    <string name="loginout">退出登录</string>
12
-    <string name="loginout_success">注销成功</string>
13
-    <string name="message">消息</string>
14
-    <string name="not_login">未登录</string>
15
-    <string name="order">订单中心</string>
16
-    <string name="search">搜索</string>
17
-    <style name="AppBaseTheme" parent="android:Theme.Light">
18
-        
19
-    </style>
20
-    <style name="AppTheme" parent="AppBaseTheme">
21
-        
22
-    </style>
23
-    <style name="KeplerDialog" parent="android:style/Theme.Dialog">
24
-        <item name="android:background">#00000000</item>
25
-        <item name="android:windowBackground">@android:color/transparent</item>
26
-        <item name="android:windowNoTitle">true</item>
27
-        <item name="android:windowIsFloating">true</item>
28
-    </style>
29
-    <style name="sdw_79351b">
30
-        <item name="android:shadowColor">#ff79351b</item>
31
-        <item name="android:shadowDx">0.0</item>
32
-        <item name="android:shadowDy">1.0</item>
33
-        <item name="android:shadowRadius">1.0</item>
34
-    </style>
35
-    <style name="sdw_white">
36
-        <item name="android:shadowColor">#7fffffff</item>
37
-        <item name="android:shadowDx">0.0</item>
38
-        <item name="android:shadowDy">0.65</item>
39
-        <item name="android:shadowRadius">1.0</item>
40
-    </style>
41
-    <style name="text_15_666666_sdw" parent="@style/sdw_white">
42
-        <item name="android:textSize">15.0dip</item>
43
-        <item name="android:textColor">#ff666666</item>
44
-    </style>
45
-    <style name="text_15_ffffff_sdw" parent="@style/sdw_79351b">
46
-        <item name="android:textSize">15.0dip</item>
47
-        <item name="android:textColor">#ffffffff</item>
48
-    </style>
49
-    <style name="text_16_666666">
50
-        <item name="android:textSize">16sp</item>
51
-        <item name="android:textColor">#000000</item>
52
-    </style>
53
-    <style name="text_18_black">
54
-        <item name="android:textSize">18sp</item>
55
-        <item name="android:textColor">#000000</item>
56
-    </style>
57
-    <style name="text_18_red">
58
-        <item name="android:textSize">20sp</item>
59
-        <item name="android:textColor">#FF0000</item>
60
-    </style>
61
-    <style name="text_18_white">
62
-        <item name="android:textSize">18sp</item>
63
-        <item name="android:textColor">#ffffff</item>
64
-    </style>
65
-</resources>

+ 4 - 1
jd_sdk_lib/build/intermediates/packaged_res/debug/layout/web_bottom_layout.xml

@@ -35,6 +35,9 @@
35 35
 
36 36
     <include
37 37
         android:layout_marginTop="40dp"
38
-        layout="@layout/neterror_layout" />
38
+        layout="@layout/neterror_layout"
39
+        android:layout_width="match_parent"
40
+        android:layout_height="match_parent"
41
+        />
39 42
 
40 43
 </RelativeLayout>