wenjuan.su 1 рік тому
батько
коміт
bf8af9f072

+ 3 - 3
.idea/deploymentTargetDropDown.xml

@@ -6,12 +6,12 @@
6
         <type value="RUNNING_DEVICE_TARGET" />
6
         <type value="RUNNING_DEVICE_TARGET" />
7
         <deviceKey>
7
         <deviceKey>
8
           <Key>
8
           <Key>
9
-            <type value="VIRTUAL_DEVICE_PATH" />
10
-            <value value="$USER_HOME$/.android/avd/Pixel_7_API_33.avd" />
9
+            <type value="SERIAL_NUMBER" />
10
+            <value value="8a759d16" />
11
           </Key>
11
           </Key>
12
         </deviceKey>
12
         </deviceKey>
13
       </Target>
13
       </Target>
14
     </runningDeviceTargetSelectedWithDropDown>
14
     </runningDeviceTargetSelectedWithDropDown>
15
-    <timeTargetWasSelectedWithDropDown value="2025-04-23T06:20:47.641624Z" />
15
+    <timeTargetWasSelectedWithDropDown value="2025-04-23T06:39:36.995402Z" />
16
   </component>
16
   </component>
17
 </project>
17
 </project>

+ 2 - 2
.idea/deploymentTargetSelector.xml

@@ -4,10 +4,10 @@
4
     <selectionStates>
4
     <selectionStates>
5
       <SelectionState runConfigName="app">
5
       <SelectionState runConfigName="app">
6
         <option name="selectionMode" value="DROPDOWN" />
6
         <option name="selectionMode" value="DROPDOWN" />
7
-        <DropdownSelection timestamp="2025-04-19T06:37:06.884508Z">
7
+        <DropdownSelection timestamp="2025-04-23T05:51:25.734909100Z">
8
           <Target type="DEFAULT_BOOT">
8
           <Target type="DEFAULT_BOOT">
9
             <handle>
9
             <handle>
10
-              <DeviceId pluginId="LocalEmulator" identifier="path=/Users/swj/.android/avd/Pixel4API30.avd" />
10
+              <DeviceId pluginId="Default" identifier="serial=emulator-5554;connection=343b6e12" />
11
             </handle>
11
             </handle>
12
           </Target>
12
           </Target>
13
         </DropdownSelection>
13
         </DropdownSelection>

+ 1 - 0
.idea/gradle.xml

@@ -16,6 +16,7 @@
16
             <option value="$PROJECT_DIR$/jd_sdk_lib" />
16
             <option value="$PROJECT_DIR$/jd_sdk_lib" />
17
           </set>
17
           </set>
18
         </option>
18
         </option>
19
+        <option name="resolveExternalAnnotations" value="false" />
19
       </GradleProjectSettings>
20
       </GradleProjectSettings>
20
     </option>
21
     </option>
21
   </component>
22
   </component>

Різницю між файлами не показано, бо вона завелика
+ 7 - 7
app/src/main/java/com/yihucha/hbyhc/config/Constants.java


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

@@ -229,6 +229,7 @@ public class LoginViewModel extends BaseViewModel {
229
         map.put("nickname",nickName);
229
         map.put("nickname",nickName);
230
         map.put("avatarUrl",avatar);
230
         map.put("avatarUrl",avatar);
231
 
231
 
232
+        Log.d(TAG, "getWxBinding:api/third/binding wechat " + map);
232
         AuthService authService = NetworkApi.createService(AuthService.class);
233
         AuthService authService = NetworkApi.createService(AuthService.class);
233
         authService.wxloginbinding(map).compose(NetworkApi.applySchedulers(new BaseObserver<DataResponse<LoginModel>>() {
234
         authService.wxloginbinding(map).compose(NetworkApi.applySchedulers(new BaseObserver<DataResponse<LoginModel>>() {
234
             @Override
235
             @Override

+ 24 - 2
app/src/main/java/com/yihucha/hbyhc/presentation/mine/ThirdPartyBindingActivity.java

@@ -8,6 +8,7 @@ import android.os.Bundle;
8
 import android.os.Handler;
8
 import android.os.Handler;
9
 import android.os.Message;
9
 import android.os.Message;
10
 import android.text.TextUtils;
10
 import android.text.TextUtils;
11
+import android.util.Log;
11
 import android.view.View;
12
 import android.view.View;
12
 import android.widget.Toast;
13
 import android.widget.Toast;
13
 
14
 
@@ -54,12 +55,16 @@ import java.util.Map;
54
  */
55
  */
55
 public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<ActivityThirdPartyBindingBinding> implements View.OnClickListener {
56
 public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<ActivityThirdPartyBindingBinding> implements View.OnClickListener {
56
     private static final int SDK_AUTH_FLAG = 2;
57
     private static final int SDK_AUTH_FLAG = 2;
58
+    private static final String TAG = "ThirdPartyBindingActivity";
57
     private BindingStateBViewModel mBindingStateBViewModel;
59
     private BindingStateBViewModel mBindingStateBViewModel;
58
 
60
 
59
     private   boolean flagAlipayAuthorization ; //表示支付宝是否授权
61
     private   boolean flagAlipayAuthorization ; //表示支付宝是否授权
60
     private   boolean flagWechatAuthorization ; //表示微信是否授权
62
     private   boolean flagWechatAuthorization ; //表示微信是否授权
61
     private BindingStateBean wechatBean;
63
     private BindingStateBean wechatBean;
62
     private BindingStateBean alipayBean;
64
     private BindingStateBean alipayBean;
65
+    private  int number = 0;
66
+    private  boolean alipayBtnClickFlag = false;
67
+    private  boolean wechatBtnClickFlag = false;
63
     @SuppressLint("HandlerLeak")
68
     @SuppressLint("HandlerLeak")
64
     private final Handler mHandler = new Handler() {
69
     private final Handler mHandler = new Handler() {
65
         @SuppressWarnings("unused")
70
         @SuppressWarnings("unused")
@@ -117,6 +122,7 @@ public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<Acti
117
     @Override
122
     @Override
118
     protected void onResume() {
123
     protected void onResume() {
119
         super.onResume();
124
         super.onResume();
125
+        number = 0 ;
120
         mBindingStateBViewModel.getBindingState();
126
         mBindingStateBViewModel.getBindingState();
121
     }
127
     }
122
 
128
 
@@ -127,6 +133,7 @@ public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<Acti
127
         mBindingStateBViewModel.mBindingStateBean.observe(this, new Observer<List<BindingStateBean>>() {
133
         mBindingStateBViewModel.mBindingStateBean.observe(this, new Observer<List<BindingStateBean>>() {
128
             @Override
134
             @Override
129
             public void onChanged(List<BindingStateBean> bindingStateBeans) {
135
             public void onChanged(List<BindingStateBean> bindingStateBeans) {
136
+
130
                 for (int i = 0; i < bindingStateBeans.size(); i++) {
137
                 for (int i = 0; i < bindingStateBeans.size(); i++) {
131
                     if (bindingStateBeans.get(i).getType().equals("1")) {
138
                     if (bindingStateBeans.get(i).getType().equals("1")) {
132
                         wechatBean = bindingStateBeans.get(i);
139
                         wechatBean = bindingStateBeans.get(i);
@@ -145,11 +152,14 @@ public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<Acti
145
 //                        mViewBinding.llWechatAuthorization.setEnabled(false);
152
 //                        mViewBinding.llWechatAuthorization.setEnabled(false);
146
 //                        mViewBinding.llWechatAuthorization.setClickable(false);
153
 //                        mViewBinding.llWechatAuthorization.setClickable(false);
147
                         flagWechatAuthorization = true ;
154
                         flagWechatAuthorization = true ;
148
-                    } else if (bindingStateBeans.get(i).getType().equals("2")) {
155
+                        wechatBtnClickFlag = false;
156
+                    }
157
+                    else if (bindingStateBeans.get(i).getType().equals("2")) {
149
                         alipayBean = bindingStateBeans.get(i);
158
                         alipayBean = bindingStateBeans.get(i);
150
                         mViewBinding.tvAlipayBeAuthorized.setVisibility(View.VISIBLE);
159
                         mViewBinding.tvAlipayBeAuthorized.setVisibility(View.VISIBLE);
151
                         mViewBinding.tvAlipayUnauthorized.setVisibility(View.GONE);
160
                         mViewBinding.tvAlipayUnauthorized.setVisibility(View.GONE);
152
                         mViewBinding.llAlipayInfo.setVisibility(View.VISIBLE);
161
                         mViewBinding.llAlipayInfo.setVisibility(View.VISIBLE);
162
+                        alipayBtnClickFlag = false;
153
 //                        mViewBinding.llAlipayAuthorization.setEnabled(false);
163
 //                        mViewBinding.llAlipayAuthorization.setEnabled(false);
154
 //                        mViewBinding.llAlipayAuthorization.setClickable(false);
164
 //                        mViewBinding.llAlipayAuthorization.setClickable(false);
155
                         String imageUrl = alipayBean.getAvater(); // Replace with your actual IP address and image path
165
                         String imageUrl = alipayBean.getAvater(); // Replace with your actual IP address and image path
@@ -164,10 +174,18 @@ public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<Acti
164
                         flagAlipayAuthorization = true;
174
                         flagAlipayAuthorization = true;
165
                     }
175
                     }
166
                 }
176
                 }
177
+
178
+                if(wechatBtnClickFlag || alipayBtnClickFlag){
179
+                    mBindingStateBViewModel.getBindingState();
180
+                }
167
             }
181
             }
168
         });
182
         });
169
 
183
 
170
-        mBindingStateBViewModel.failed.observe(this, s -> ToastUtils.showLong(s));
184
+        mBindingStateBViewModel.failed.observe(this, s -> {
185
+            LogUtil.e("failed.-----","BindingState-----");
186
+            ToastUtils.showLong(s);
187
+
188
+        });
171
 
189
 
172
         //支付宝链接
190
         //支付宝链接
173
         mBindingStateBViewModel.mAuthInfoSucceed.observe(this, new Observer<String>() {
191
         mBindingStateBViewModel.mAuthInfoSucceed.observe(this, new Observer<String>() {
@@ -236,6 +254,7 @@ public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<Acti
236
                 unbindAccountThird(2);
254
                 unbindAccountThird(2);
237
                 return ;
255
                 return ;
238
             }
256
             }
257
+            alipayBtnClickFlag = true;
239
             mBindingStateBViewModel.getAuthInfo();
258
             mBindingStateBViewModel.getAuthInfo();
240
         }else if (v == mViewBinding.llWechatAuthorization){
259
         }else if (v == mViewBinding.llWechatAuthorization){
241
 
260
 
@@ -244,6 +263,7 @@ public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<Acti
244
                 unbindAccountThird(1);
263
                 unbindAccountThird(1);
245
                return;
264
                return;
246
             }
265
             }
266
+            wechatBtnClickFlag = true;
247
             regToWx();
267
             regToWx();
248
         }
268
         }
249
     }
269
     }
@@ -268,6 +288,7 @@ public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<Acti
268
                                 mViewBinding.tvWxBeAuthorized.setVisibility(View.GONE);
288
                                 mViewBinding.tvWxBeAuthorized.setVisibility(View.GONE);
269
                                 mViewBinding.tvWxUnauthorized.setVisibility(View.VISIBLE);
289
                                 mViewBinding.tvWxUnauthorized.setVisibility(View.VISIBLE);
270
                                 flagWechatAuthorization = false;
290
                                 flagWechatAuthorization = false;
291
+                                wechatBtnClickFlag = false ;
271
                                 mViewBinding.llWechatInfo.setVisibility(View.GONE);
292
                                 mViewBinding.llWechatInfo.setVisibility(View.GONE);
272
                             }
293
                             }
273
                             else if(type == 2){
294
                             else if(type == 2){
@@ -275,6 +296,7 @@ public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<Acti
275
                                 mViewBinding.tvAlipayUnauthorized.setVisibility(View.VISIBLE);
296
                                 mViewBinding.tvAlipayUnauthorized.setVisibility(View.VISIBLE);
276
                                 mViewBinding.llAlipayInfo.setVisibility(View.GONE);
297
                                 mViewBinding.llAlipayInfo.setVisibility(View.GONE);
277
                                 flagAlipayAuthorization = false ;
298
                                 flagAlipayAuthorization = false ;
299
+                                alipayBtnClickFlag = false ;
278
                             }
300
                             }
279
 
301
 
280
                         } else {
302
                         } else {

+ 8 - 2
app/src/main/java/com/yihucha/hbyhc/presentation/mine/model/WechatOpenIdBean.java

@@ -17,7 +17,7 @@ public class WechatOpenIdBean {
17
     private String nickName ;
17
     private String nickName ;
18
     private String avater ;
18
     private String avater ;
19
 
19
 
20
-
20
+    private String headimgurl ;
21
     public void  setNickname(String nickName){
21
     public void  setNickname(String nickName){
22
         this.nickName = nickName ;
22
         this.nickName = nickName ;
23
 
23
 
@@ -31,10 +31,16 @@ public class WechatOpenIdBean {
31
         this.avater = avater ;
31
         this.avater = avater ;
32
 
32
 
33
     }
33
     }
34
-
35
     public String getAvater() {
34
     public String getAvater() {
36
         return avater == null ? "" : avater;
35
         return avater == null ? "" : avater;
37
     }
36
     }
37
+    public void  setHeadimgurl(String headimgurl){
38
+        this.headimgurl = headimgurl ;
39
+
40
+    }
41
+    public String getHeadimgurl() {
42
+        return headimgurl == null ? "" : headimgurl;
43
+    }
38
     public String getUnionid() {
44
     public String getUnionid() {
39
         return unionid == null ? "" : unionid;
45
         return unionid == null ? "" : unionid;
40
     }
46
     }

+ 6 - 1
app/src/main/java/com/yihucha/hbyhc/presentation/mine/view_model/BindingStateBViewModel.java

@@ -1,6 +1,7 @@
1
 package com.yihucha.hbyhc.presentation.mine.view_model;
1
 package com.yihucha.hbyhc.presentation.mine.view_model;
2
 
2
 
3
 import android.annotation.SuppressLint;
3
 import android.annotation.SuppressLint;
4
+import android.util.Log;
4
 
5
 
5
 import androidx.lifecycle.MutableLiveData;
6
 import androidx.lifecycle.MutableLiveData;
6
 
7
 
@@ -36,20 +37,24 @@ public class BindingStateBViewModel extends BaseViewModel {
36
      */
37
      */
37
     @SuppressLint("CheckResult")
38
     @SuppressLint("CheckResult")
38
     public void getBindingState() {
39
     public void getBindingState() {
40
+        LogUtil.e("BindingStateBViewModel.getBindingState-----","BindingState-----");
39
         UserService userService = NetworkApi.createService(UserService.class);
41
         UserService userService = NetworkApi.createService(UserService.class);
40
         userService.getBindingState().compose(NetworkApi.applySchedulers(new BaseObserver<DataResponse<List<BindingStateBean>>>() {
42
         userService.getBindingState().compose(NetworkApi.applySchedulers(new BaseObserver<DataResponse<List<BindingStateBean>>>() {
41
             @Override
43
             @Override
42
             public void onSuccess(DataResponse<List<BindingStateBean>> listDataResponse) {
44
             public void onSuccess(DataResponse<List<BindingStateBean>> listDataResponse) {
43
                 if (listDataResponse.responseCode == 200) {
45
                 if (listDataResponse.responseCode == 200) {
46
+                    LogUtil.e("BindingStateBViewModel.getBindingState","200-----BindingState-----");
44
                     mBindingStateBean.postValue(listDataResponse.getData());
47
                     mBindingStateBean.postValue(listDataResponse.getData());
45
                 } else {
48
                 } else {
46
 //                    ToastUtils.showLong(listDataResponse.responseError);
49
 //                    ToastUtils.showLong(listDataResponse.responseError);
47
-                    LogUtil.e("BindingStateBViewModel.getBindingState",listDataResponse.responseError);
50
+                    failed.postValue(listDataResponse.responseError);
51
+                    LogUtil.e("BindingStateBViewModel.getBindingState ---BindingState- ",listDataResponse.responseError);
48
                 }
52
                 }
49
             }
53
             }
50
 
54
 
51
             @Override
55
             @Override
52
             public void onFailure(Throwable e) {
56
             public void onFailure(Throwable e) {
57
+//                failed.postValue(e.responseError);
53
 //                failed.postValue(getString(R.string.failed_string));
58
 //                failed.postValue(getString(R.string.failed_string));
54
             }
59
             }
55
         }));
60
         }));

+ 23 - 2
app/src/main/java/com/yihucha/hbyhc/presentation/pyyx/activity/JDActivity.kt

@@ -1,6 +1,7 @@
1
 package com.yihucha.hbyhc.presentation.pyyx.activity
1
 package com.yihucha.hbyhc.presentation.pyyx.activity
2
 
2
 
3
 import android.os.Bundle
3
 import android.os.Bundle
4
+import android.text.Editable
4
 import android.view.View
5
 import android.view.View
5
 import androidx.constraintlayout.widget.ConstraintLayout
6
 import androidx.constraintlayout.widget.ConstraintLayout
6
 import androidx.core.widget.NestedScrollView
7
 import androidx.core.widget.NestedScrollView
@@ -13,7 +14,6 @@ import com.yihucha.hbyhc.R
13
 import com.yihucha.hbyhc.base.BaseActivity
14
 import com.yihucha.hbyhc.base.BaseActivity
14
 import com.yihucha.hbyhc.config.BusinessConstants
15
 import com.yihucha.hbyhc.config.BusinessConstants
15
 import com.yihucha.hbyhc.config.Constants
16
 import com.yihucha.hbyhc.config.Constants
16
-import com.yihucha.hbyhc.config.HttpUrl
17
 import com.yihucha.hbyhc.databinding.ActivityTbBinding
17
 import com.yihucha.hbyhc.databinding.ActivityTbBinding
18
 import com.yihucha.hbyhc.presentation.pyyx.PyyxTvListBean
18
 import com.yihucha.hbyhc.presentation.pyyx.PyyxTvListBean
19
 import com.yihucha.hbyhc.presentation.pyyx.adapter.ProductThirdPartAdapter
19
 import com.yihucha.hbyhc.presentation.pyyx.adapter.ProductThirdPartAdapter
@@ -21,6 +21,7 @@ import com.yihucha.hbyhc.presentation.pyyx.adapter.RvTextViewAdapter
21
 import com.yihucha.hbyhc.presentation.pyyx.viewmodel.ThirdPartViewModel
21
 import com.yihucha.hbyhc.presentation.pyyx.viewmodel.ThirdPartViewModel
22
 import com.yihucha.hbyhc.utils.DensityUtils
22
 import com.yihucha.hbyhc.utils.DensityUtils
23
 import com.yihucha.hbyhc.utils.LoginUtils
23
 import com.yihucha.hbyhc.utils.LoginUtils
24
+import com.yihucha.hbyhc.utils.MyTextWathcer
24
 import qiu.niorgai.StatusBarCompat
25
 import qiu.niorgai.StatusBarCompat
25
 
26
 
26
 /**
27
 /**
@@ -45,7 +46,8 @@ class JDActivity : BaseActivity() {
45
     private val viewModel by lazy {
46
     private val viewModel by lazy {
46
         ViewModelProvider(this)[ThirdPartViewModel::class.java].apply {
47
         ViewModelProvider(this)[ThirdPartViewModel::class.java].apply {
47
             topSelectTitles = listOf(
48
             topSelectTitles = listOf(
48
-                PyyxTvListBean("居家日用", true, 1),
49
+                PyyxTvListBean("全部", true, -1),
50
+                PyyxTvListBean("居家日用", false, 1),
49
                 PyyxTvListBean("食品", false, 2),
51
                 PyyxTvListBean("食品", false, 2),
50
                 PyyxTvListBean("生鲜", false, 3),
52
                 PyyxTvListBean("生鲜", false, 3),
51
                 PyyxTvListBean("图书", false, 4),
53
                 PyyxTvListBean("图书", false, 4),
@@ -157,6 +159,25 @@ class JDActivity : BaseActivity() {
157
         binding.imgToTop.setOnClickListener {
159
         binding.imgToTop.setOnClickListener {
158
             binding.scrollView.scrollTo(0, 0)
160
             binding.scrollView.scrollTo(0, 0)
159
         }
161
         }
162
+
163
+        binding.edtSearch.addTextChangedListener(object : MyTextWathcer() {
164
+            override fun afterTextChanged(s: Editable?) {
165
+                super.afterTextChanged(s)
166
+                val str = s?.toString()?.trim() ?: ""
167
+                viewModel.keyWord = str
168
+                if (str.isEmpty()) {
169
+                    binding.imgClear.visibility = View.GONE
170
+                }else{
171
+                    binding.imgClear.visibility = View.VISIBLE
172
+                }
173
+            }
174
+        })
175
+        binding.imgClear.setOnClickListener {
176
+            binding.edtSearch.setText("")
177
+        }
178
+        binding.tvSearch.setOnClickListener {
179
+            viewModel.getJdList(viewModel.currentTitleBean.titleId)
180
+        }
160
     }
181
     }
161
 
182
 
162
     private fun initData() {
183
     private fun initData() {

+ 37 - 8
app/src/main/java/com/yihucha/hbyhc/presentation/pyyx/activity/PDDActivity.kt

@@ -1,6 +1,7 @@
1
 package com.yihucha.hbyhc.presentation.pyyx.activity
1
 package com.yihucha.hbyhc.presentation.pyyx.activity
2
 
2
 
3
 import android.os.Bundle
3
 import android.os.Bundle
4
+import android.text.Editable
4
 import android.view.View
5
 import android.view.View
5
 import androidx.constraintlayout.widget.ConstraintLayout
6
 import androidx.constraintlayout.widget.ConstraintLayout
6
 import androidx.core.widget.NestedScrollView
7
 import androidx.core.widget.NestedScrollView
@@ -13,7 +14,6 @@ import com.yihucha.hbyhc.R
13
 import com.yihucha.hbyhc.base.BaseActivity
14
 import com.yihucha.hbyhc.base.BaseActivity
14
 import com.yihucha.hbyhc.config.BusinessConstants
15
 import com.yihucha.hbyhc.config.BusinessConstants
15
 import com.yihucha.hbyhc.config.Constants
16
 import com.yihucha.hbyhc.config.Constants
16
-import com.yihucha.hbyhc.config.HttpUrl
17
 import com.yihucha.hbyhc.databinding.ActivityTbBinding
17
 import com.yihucha.hbyhc.databinding.ActivityTbBinding
18
 import com.yihucha.hbyhc.presentation.pyyx.PyyxTvListBean
18
 import com.yihucha.hbyhc.presentation.pyyx.PyyxTvListBean
19
 import com.yihucha.hbyhc.presentation.pyyx.adapter.ProductThirdPartAdapter
19
 import com.yihucha.hbyhc.presentation.pyyx.adapter.ProductThirdPartAdapter
@@ -21,6 +21,7 @@ import com.yihucha.hbyhc.presentation.pyyx.adapter.RvTextViewAdapter
21
 import com.yihucha.hbyhc.presentation.pyyx.viewmodel.ThirdPartViewModel
21
 import com.yihucha.hbyhc.presentation.pyyx.viewmodel.ThirdPartViewModel
22
 import com.yihucha.hbyhc.utils.DensityUtils
22
 import com.yihucha.hbyhc.utils.DensityUtils
23
 import com.yihucha.hbyhc.utils.LoginUtils
23
 import com.yihucha.hbyhc.utils.LoginUtils
24
+import com.yihucha.hbyhc.utils.MyTextWathcer
24
 import qiu.niorgai.StatusBarCompat
25
 import qiu.niorgai.StatusBarCompat
25
 
26
 
26
 /**
27
 /**
@@ -45,7 +46,8 @@ class PDDActivity : BaseActivity() {
45
     }
46
     }
46
     val catListAdapter by lazy {
47
     val catListAdapter by lazy {
47
         RvTextViewAdapter(
48
         RvTextViewAdapter(
48
-            this,null)
49
+            this, null
50
+        )
49
     }
51
     }
50
 
52
 
51
     private var titleId = 0
53
     private var titleId = 0
@@ -63,7 +65,8 @@ class PDDActivity : BaseActivity() {
63
         val params = binding.titleLayout.layoutParams as ConstraintLayout.LayoutParams
65
         val params = binding.titleLayout.layoutParams as ConstraintLayout.LayoutParams
64
         params.topMargin = DensityUtils.getStatusBarHeight(this)
66
         params.topMargin = DensityUtils.getStatusBarHeight(this)
65
         binding.tvTitle.text = "拼多多"
67
         binding.tvTitle.text = "拼多多"
66
-        Glide.with(this).load(BusinessConstants.HOST+"mweb/img/pinduoduo.jpg").into(binding.banner)
68
+        Glide.with(this).load(BusinessConstants.HOST + "mweb/img/pinduoduo.jpg")
69
+            .into(binding.banner)
67
         binding.bgView.setBackgroundResource(R.mipmap.home_bg)
70
         binding.bgView.setBackgroundResource(R.mipmap.home_bg)
68
         binding.rvProductList.layoutManager = LinearLayoutManager(context)
71
         binding.rvProductList.layoutManager = LinearLayoutManager(context)
69
         binding.rvProductList.adapter = adapter
72
         binding.rvProductList.adapter = adapter
@@ -114,9 +117,9 @@ class PDDActivity : BaseActivity() {
114
 
117
 
115
         binding.scrollView.setOnScrollChangeListener(NestedScrollView.OnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
118
         binding.scrollView.setOnScrollChangeListener(NestedScrollView.OnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
116
             val rootPicHeight: Int = binding.banner.height
119
             val rootPicHeight: Int = binding.banner.height
117
-            if (scrollY<rootPicHeight){
120
+            if (scrollY < rootPicHeight) {
118
                 binding.imgToTop.visibility = View.GONE
121
                 binding.imgToTop.visibility = View.GONE
119
-            }else{
122
+            } else {
120
                 binding.imgToTop.visibility = View.VISIBLE
123
                 binding.imgToTop.visibility = View.VISIBLE
121
             }
124
             }
122
         })
125
         })
@@ -124,6 +127,24 @@ class PDDActivity : BaseActivity() {
124
             binding.scrollView.scrollTo(0, 0)
127
             binding.scrollView.scrollTo(0, 0)
125
         }
128
         }
126
 
129
 
130
+        binding.edtSearch.addTextChangedListener(object : MyTextWathcer() {
131
+            override fun afterTextChanged(s: Editable?) {
132
+                super.afterTextChanged(s)
133
+                val str = s?.toString()?.trim() ?: ""
134
+                viewModel.keyWord = str
135
+                if (str.isEmpty()) {
136
+                    binding.imgClear.visibility = View.GONE
137
+                }else{
138
+                    binding.imgClear.visibility = View.VISIBLE
139
+                }
140
+            }
141
+        })
142
+        binding.imgClear.setOnClickListener {
143
+            binding.edtSearch.setText("")
144
+        }
145
+        binding.tvSearch.setOnClickListener {
146
+            viewModel.getPinduoduoList(titleId)
147
+        }
127
     }
148
     }
128
 
149
 
129
     private fun initData() {
150
     private fun initData() {
@@ -141,14 +162,22 @@ class PDDActivity : BaseActivity() {
141
                 val catBeans = it.mapIndexed { index, bean ->
162
                 val catBeans = it.mapIndexed { index, bean ->
142
                     PyyxTvListBean(
163
                     PyyxTvListBean(
143
                         title = bean.name,
164
                         title = bean.name,
144
-                        checked = index == 0,
165
+                        checked = false,
145
                         titleId = bean.id
166
                         titleId = bean.id
146
                     )
167
                     )
147
                 }
168
                 }
148
-                titleId = catBeans.first().titleId
169
+                val beans = catBeans.toMutableList()
170
+                beans.add(
171
+                    0, PyyxTvListBean(
172
+                        title = "全部",
173
+                        checked = true,
174
+                        titleId = -1
175
+                    )
176
+                )
177
+                titleId = beans.first().titleId
149
                 viewModel.getPinduoduoList(titleId)
178
                 viewModel.getPinduoduoList(titleId)
150
                 binding.rvTopSelector.visibility = View.VISIBLE
179
                 binding.rvTopSelector.visibility = View.VISIBLE
151
-                catListAdapter.resetTitles(catBeans)
180
+                catListAdapter.resetTitles(beans)
152
             }
181
             }
153
         }
182
         }
154
 
183
 

+ 39 - 12
app/src/main/java/com/yihucha/hbyhc/presentation/pyyx/activity/SNActivity.kt

@@ -1,6 +1,7 @@
1
 package com.yihucha.hbyhc.presentation.pyyx.activity
1
 package com.yihucha.hbyhc.presentation.pyyx.activity
2
 
2
 
3
 import android.os.Bundle
3
 import android.os.Bundle
4
+import android.text.Editable
4
 import android.view.View
5
 import android.view.View
5
 import androidx.constraintlayout.widget.ConstraintLayout
6
 import androidx.constraintlayout.widget.ConstraintLayout
6
 import androidx.core.widget.NestedScrollView
7
 import androidx.core.widget.NestedScrollView
@@ -9,17 +10,17 @@ import androidx.recyclerview.widget.LinearLayoutManager
9
 import com.bumptech.glide.Glide
10
 import com.bumptech.glide.Glide
10
 import com.lcodecore.tkrefreshlayout.RefreshListenerAdapter
11
 import com.lcodecore.tkrefreshlayout.RefreshListenerAdapter
11
 import com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout
12
 import com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout
12
-import com.yihucha.hbyhc.R
13
 import com.yihucha.hbyhc.base.BaseActivity
13
 import com.yihucha.hbyhc.base.BaseActivity
14
 import com.yihucha.hbyhc.config.BusinessConstants
14
 import com.yihucha.hbyhc.config.BusinessConstants
15
 import com.yihucha.hbyhc.config.Constants
15
 import com.yihucha.hbyhc.config.Constants
16
-import com.yihucha.hbyhc.config.HttpUrl
17
 import com.yihucha.hbyhc.databinding.ActivityTbBinding
16
 import com.yihucha.hbyhc.databinding.ActivityTbBinding
17
+import com.yihucha.hbyhc.presentation.pyyx.PyyxTvListBean
18
 import com.yihucha.hbyhc.presentation.pyyx.adapter.ProductThirdPartAdapter
18
 import com.yihucha.hbyhc.presentation.pyyx.adapter.ProductThirdPartAdapter
19
 import com.yihucha.hbyhc.presentation.pyyx.adapter.RvTextViewAdapter
19
 import com.yihucha.hbyhc.presentation.pyyx.adapter.RvTextViewAdapter
20
 import com.yihucha.hbyhc.presentation.pyyx.viewmodel.ThirdPartViewModel
20
 import com.yihucha.hbyhc.presentation.pyyx.viewmodel.ThirdPartViewModel
21
 import com.yihucha.hbyhc.utils.DensityUtils
21
 import com.yihucha.hbyhc.utils.DensityUtils
22
 import com.yihucha.hbyhc.utils.LoginUtils
22
 import com.yihucha.hbyhc.utils.LoginUtils
23
+import com.yihucha.hbyhc.utils.MyTextWathcer
23
 import qiu.niorgai.StatusBarCompat
24
 import qiu.niorgai.StatusBarCompat
24
 
25
 
25
 /**
26
 /**
@@ -59,7 +60,7 @@ class SNActivity : BaseActivity() {
59
         val params = binding.titleLayout.layoutParams as ConstraintLayout.LayoutParams
60
         val params = binding.titleLayout.layoutParams as ConstraintLayout.LayoutParams
60
         params.topMargin = DensityUtils.getStatusBarHeight(this)
61
         params.topMargin = DensityUtils.getStatusBarHeight(this)
61
         binding.tvTitle.text = "苏宁"
62
         binding.tvTitle.text = "苏宁"
62
-        Glide.with(this).load(BusinessConstants.HOST+"mweb/img/suning.jpg").into(binding.banner)
63
+        Glide.with(this).load(BusinessConstants.HOST + "mweb/img/suning.jpg").into(binding.banner)
63
         binding.rvProductList.layoutManager =
64
         binding.rvProductList.layoutManager =
64
             LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
65
             LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
65
         binding.rvTopSelector.adapter = titleAdapter
66
         binding.rvTopSelector.adapter = titleAdapter
@@ -102,11 +103,11 @@ class SNActivity : BaseActivity() {
102
 
103
 
103
 
104
 
104
         titleAdapter.setOnItemClickListener { pos ->
105
         titleAdapter.setOnItemClickListener { pos ->
105
-            if (pos<viewModel.topSelectTitles.indexOf(viewModel.currentTitleBean)){
106
+            if (pos < viewModel.topSelectTitles.indexOf(viewModel.currentTitleBean)) {
106
                 //选前面的
107
                 //选前面的
107
-                if (pos>0)
108
+                if (pos > 0)
108
                     binding.rvTopSelector.smoothScrollToPosition(pos - 1)
109
                     binding.rvTopSelector.smoothScrollToPosition(pos - 1)
109
-            }else{
110
+            } else {
110
                 //选后面的
111
                 //选后面的
111
                 if (pos < viewModel.topSelectTitles.size - 1)
112
                 if (pos < viewModel.topSelectTitles.size - 1)
112
                     binding.rvTopSelector.smoothScrollToPosition(pos + 1)
113
                     binding.rvTopSelector.smoothScrollToPosition(pos + 1)
@@ -119,23 +120,49 @@ class SNActivity : BaseActivity() {
119
 
120
 
120
         binding.scrollView.setOnScrollChangeListener(NestedScrollView.OnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
121
         binding.scrollView.setOnScrollChangeListener(NestedScrollView.OnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
121
             val rootPicHeight: Int = binding.banner.height
122
             val rootPicHeight: Int = binding.banner.height
122
-            if (scrollY<rootPicHeight){
123
+            if (scrollY < rootPicHeight) {
123
                 binding.imgToTop.visibility = View.GONE
124
                 binding.imgToTop.visibility = View.GONE
124
-            }else{
125
+            } else {
125
                 binding.imgToTop.visibility = View.VISIBLE
126
                 binding.imgToTop.visibility = View.VISIBLE
126
             }
127
             }
127
         })
128
         })
128
         binding.imgToTop.setOnClickListener {
129
         binding.imgToTop.setOnClickListener {
129
             binding.scrollView.scrollTo(0, 0)
130
             binding.scrollView.scrollTo(0, 0)
130
         }
131
         }
132
+        binding.edtSearch.addTextChangedListener(object : MyTextWathcer() {
133
+            override fun afterTextChanged(s: Editable?) {
134
+                super.afterTextChanged(s)
135
+                val str = s?.toString()?.trim() ?: ""
136
+                viewModel.keyWord = str
137
+                if (str.isEmpty()) {
138
+                    binding.imgClear.visibility = View.GONE
139
+                } else {
140
+                    binding.imgClear.visibility = View.VISIBLE
141
+                }
142
+            }
143
+        })
144
+        binding.imgClear.setOnClickListener {
145
+            binding.edtSearch.setText("")
146
+        }
147
+        binding.tvSearch.setOnClickListener {
148
+            viewModel.getSuningList(viewModel.currentTitleBean.titleId)
149
+        }
131
     }
150
     }
132
 
151
 
133
     private fun initData() {
152
     private fun initData() {
134
         viewModel.getClassesType(4)
153
         viewModel.getClassesType(4)
135
-        viewModel.classesLiveData.observe(this){
136
-            viewModel.topSelectTitles = it
154
+        viewModel.classesLiveData.observe(this) {
155
+            viewModel.topSelectTitles = it.toMutableList().apply {
156
+                add(
157
+                    0, PyyxTvListBean(
158
+                        title = "全部",
159
+                        checked = true,
160
+                        titleId = -1
161
+                    )
162
+                )
163
+            }
137
             titleAdapter.resetTitles(viewModel.topSelectTitles)
164
             titleAdapter.resetTitles(viewModel.topSelectTitles)
138
-            viewModel.currentTitleBean=viewModel.topSelectTitles.first { it.checked }
165
+            viewModel.currentTitleBean = viewModel.topSelectTitles.first { it.checked }
139
             viewModel.getSuningList(viewModel.currentTitleBean.titleId)
166
             viewModel.getSuningList(viewModel.currentTitleBean.titleId)
140
         }
167
         }
141
 
168
 
@@ -145,7 +172,7 @@ class SNActivity : BaseActivity() {
145
             binding.llNoData.llNotFound.visibility = if (it.isEmpty()) View.VISIBLE else View.GONE
172
             binding.llNoData.llNotFound.visibility = if (it.isEmpty()) View.VISIBLE else View.GONE
146
             adapter.updateData(it)
173
             adapter.updateData(it)
147
         }
174
         }
148
-        viewModel.failed.observe(this){
175
+        viewModel.failed.observe(this) {
149
             binding.refreshLayout.finishRefreshing()
176
             binding.refreshLayout.finishRefreshing()
150
             binding.refreshLayout.finishLoadmore()
177
             binding.refreshLayout.finishLoadmore()
151
         }
178
         }

+ 31 - 2
app/src/main/java/com/yihucha/hbyhc/presentation/pyyx/activity/VIPActivity.kt

@@ -2,6 +2,7 @@ package com.yihucha.hbyhc.presentation.pyyx.activity
2
 
2
 
3
 import android.graphics.Color
3
 import android.graphics.Color
4
 import android.os.Bundle
4
 import android.os.Bundle
5
+import android.text.Editable
5
 import android.view.View
6
 import android.view.View
6
 import androidx.constraintlayout.widget.ConstraintLayout
7
 import androidx.constraintlayout.widget.ConstraintLayout
7
 import androidx.core.widget.NestedScrollView
8
 import androidx.core.widget.NestedScrollView
@@ -13,13 +14,14 @@ import com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout
13
 import com.yihucha.hbyhc.base.BaseActivity
14
 import com.yihucha.hbyhc.base.BaseActivity
14
 import com.yihucha.hbyhc.config.BusinessConstants
15
 import com.yihucha.hbyhc.config.BusinessConstants
15
 import com.yihucha.hbyhc.config.Constants
16
 import com.yihucha.hbyhc.config.Constants
16
-import com.yihucha.hbyhc.config.HttpUrl
17
 import com.yihucha.hbyhc.databinding.ActivityTbBinding
17
 import com.yihucha.hbyhc.databinding.ActivityTbBinding
18
+import com.yihucha.hbyhc.presentation.pyyx.PyyxTvListBean
18
 import com.yihucha.hbyhc.presentation.pyyx.adapter.ProductThirdPartAdapter
19
 import com.yihucha.hbyhc.presentation.pyyx.adapter.ProductThirdPartAdapter
19
 import com.yihucha.hbyhc.presentation.pyyx.adapter.RvTextViewAdapter
20
 import com.yihucha.hbyhc.presentation.pyyx.adapter.RvTextViewAdapter
20
 import com.yihucha.hbyhc.presentation.pyyx.viewmodel.ThirdPartViewModel
21
 import com.yihucha.hbyhc.presentation.pyyx.viewmodel.ThirdPartViewModel
21
 import com.yihucha.hbyhc.utils.DensityUtils
22
 import com.yihucha.hbyhc.utils.DensityUtils
22
 import com.yihucha.hbyhc.utils.LoginUtils
23
 import com.yihucha.hbyhc.utils.LoginUtils
24
+import com.yihucha.hbyhc.utils.MyTextWathcer
23
 import qiu.niorgai.StatusBarCompat
25
 import qiu.niorgai.StatusBarCompat
24
 
26
 
25
 /**
27
 /**
@@ -128,13 +130,40 @@ class VIPActivity : BaseActivity() {
128
         binding.imgToTop.setOnClickListener {
130
         binding.imgToTop.setOnClickListener {
129
             binding.scrollView.scrollTo(0, 0)
131
             binding.scrollView.scrollTo(0, 0)
130
         }
132
         }
133
+
134
+        binding.edtSearch.addTextChangedListener(object : MyTextWathcer() {
135
+            override fun afterTextChanged(s: Editable?) {
136
+                super.afterTextChanged(s)
137
+                val str = s?.toString()?.trim() ?: ""
138
+                viewModel.keyWord = str
139
+                if (str.isEmpty()) {
140
+                    binding.imgClear.visibility = View.GONE
141
+                }else{
142
+                    binding.imgClear.visibility = View.VISIBLE
143
+                }
144
+            }
145
+        })
146
+        binding.imgClear.setOnClickListener {
147
+            binding.edtSearch.setText("")
148
+        }
149
+        binding.tvSearch.setOnClickListener {
150
+            viewModel.getVipList(viewModel.currentTitleBean.titleId)
151
+        }
131
     }
152
     }
132
 
153
 
133
     private fun initData() {
154
     private fun initData() {
134
 
155
 
135
         viewModel.getClassesType(5)
156
         viewModel.getClassesType(5)
136
         viewModel.classesLiveData.observe(this) {
157
         viewModel.classesLiveData.observe(this) {
137
-            viewModel.topSelectTitles = it
158
+            viewModel.topSelectTitles = it.toMutableList().apply {
159
+                add(
160
+                    0, PyyxTvListBean(
161
+                        title = "全部",
162
+                        checked = true,
163
+                        titleId = -1
164
+                    )
165
+                )
166
+            }
138
             titleAdapter.resetTitles(viewModel.topSelectTitles)
167
             titleAdapter.resetTitles(viewModel.topSelectTitles)
139
             viewModel.currentTitleBean = viewModel.topSelectTitles.first { it.checked }
168
             viewModel.currentTitleBean = viewModel.topSelectTitles.first { it.checked }
140
             viewModel.getVipList(viewModel.currentTitleBean.titleId)
169
             viewModel.getVipList(viewModel.currentTitleBean.titleId)

+ 38 - 15
app/src/main/java/com/yihucha/hbyhc/presentation/pyyx/viewmodel/ThirdPartViewModel.kt

@@ -34,11 +34,12 @@ class ThirdPartViewModel : BaseViewModel() {
34
     val pageDatasLiveData = MutableLiveData<MutableList<HomeProductBean>>()
34
     val pageDatasLiveData = MutableLiveData<MutableList<HomeProductBean>>()
35
 
35
 
36
     val classesLiveData = MutableLiveData<List<PyyxTvListBean>>()
36
     val classesLiveData = MutableLiveData<List<PyyxTvListBean>>()
37
-
37
+    var keyWord = ""
38
     lateinit var currentTitleBean: PyyxTvListBean
38
     lateinit var currentTitleBean: PyyxTvListBean
39
 
39
 
40
     var topSelectTitles = listOf(
40
     var topSelectTitles = listOf(
41
-        PyyxTvListBean("美食", true, 6),
41
+        PyyxTvListBean("全部", true, -1),
42
+        PyyxTvListBean("美食", false, 6),
42
         PyyxTvListBean("女装", false, 1),
43
         PyyxTvListBean("女装", false, 1),
43
         PyyxTvListBean("母婴", false, 2),
44
         PyyxTvListBean("母婴", false, 2),
44
         PyyxTvListBean("美妆", false, 3),
45
         PyyxTvListBean("美妆", false, 3),
@@ -67,10 +68,10 @@ class ThirdPartViewModel : BaseViewModel() {
67
                 BaseObserver<DataResponse<List<ClassesTypeBean>>>() {
68
                 BaseObserver<DataResponse<List<ClassesTypeBean>>>() {
68
                 override fun onSuccess(t: DataResponse<List<ClassesTypeBean>>?) {
69
                 override fun onSuccess(t: DataResponse<List<ClassesTypeBean>>?) {
69
                     if (t?.responseCode == 200) {
70
                     if (t?.responseCode == 200) {
70
-                        classesLiveData.postValue(t!!.data.mapIndexed { pos, bean ->
71
+                        classesLiveData.postValue(t.data.mapIndexed { pos, bean ->
71
                             PyyxTvListBean(
72
                             PyyxTvListBean(
72
                                 title = bean.c_name,
73
                                 title = bean.c_name,
73
-                                checked = pos == 0,
74
+                                checked = false,
74
                                 titleId = bean.cid.toInt()
75
                                 titleId = bean.cid.toInt()
75
                             )
76
                             )
76
                         })
77
                         })
@@ -123,7 +124,12 @@ class ThirdPartViewModel : BaseViewModel() {
123
         val map: MutableMap<String, Any> = HashMap()
124
         val map: MutableMap<String, Any> = HashMap()
124
         map["page"] = page
125
         map["page"] = page
125
         map["limit"] = 10
126
         map["limit"] = 10
126
-        map["cid"] = cid
127
+        if (cid != -1) {
128
+            map["cid"] = cid
129
+        }
130
+        if (keyWord.isNotEmpty()) {
131
+            map["keyword"] = keyWord
132
+        }
127
         val productService = NetworkApi.createService(ProductService::class.java)
133
         val productService = NetworkApi.createService(ProductService::class.java)
128
         productService.getJdProductList(map)
134
         productService.getJdProductList(map)
129
             .compose(
135
             .compose(
@@ -156,7 +162,12 @@ class ThirdPartViewModel : BaseViewModel() {
156
         val map: MutableMap<String, Any> = java.util.HashMap()
162
         val map: MutableMap<String, Any> = java.util.HashMap()
157
         map["page"] = page
163
         map["page"] = page
158
         map["limit"] = 10
164
         map["limit"] = 10
159
-        map["cid"] = cid
165
+        if (cid != -1) {
166
+            map["cid"] = cid
167
+        }
168
+        if (keyWord.isNotEmpty()) {
169
+            map["keyword"] = keyWord
170
+        }
160
         val productService = NetworkApi.createService(ProductService::class.java)
171
         val productService = NetworkApi.createService(ProductService::class.java)
161
         productService.getVipProductList(map)
172
         productService.getVipProductList(map)
162
             .compose(
173
             .compose(
@@ -223,11 +234,16 @@ class ThirdPartViewModel : BaseViewModel() {
223
      * 拼多多列表
234
      * 拼多多列表
224
      */
235
      */
225
     @SuppressLint("CheckResult")
236
     @SuppressLint("CheckResult")
226
-    fun getPinduoduoList(catId:Int) {
237
+    fun getPinduoduoList(catId: Int) {
227
         val map: MutableMap<String, Any> = java.util.HashMap()
238
         val map: MutableMap<String, Any> = java.util.HashMap()
228
         map["page"] = page
239
         map["page"] = page
229
         map["limit"] = 10
240
         map["limit"] = 10
230
-        map["cat_id"] = catId
241
+        if (catId != -1) {
242
+            map["cat_id"] = catId
243
+        }
244
+        if (keyWord.isNotEmpty()) {
245
+            map["keyword"] = keyWord
246
+        }
231
         val productService = NetworkApi.createService(ProductService::class.java)
247
         val productService = NetworkApi.createService(ProductService::class.java)
232
         productService.getPinduoduoProductList(map)
248
         productService.getPinduoduoProductList(map)
233
             .compose(
249
             .compose(
@@ -263,7 +279,12 @@ class ThirdPartViewModel : BaseViewModel() {
263
         val map: MutableMap<String, Any> = java.util.HashMap()
279
         val map: MutableMap<String, Any> = java.util.HashMap()
264
         map["page"] = page
280
         map["page"] = page
265
         map["limit"] = 10
281
         map["limit"] = 10
266
-        map["cid"] = cid
282
+        if (cid != -1) {
283
+            map["cid"] = cid
284
+        }
285
+        if (keyWord.isNotEmpty()) {
286
+            map["keyword"] = keyWord
287
+        }
267
         val productService = NetworkApi.createService(ProductService::class.java)
288
         val productService = NetworkApi.createService(ProductService::class.java)
268
         productService.getSuningProductList(map)
289
         productService.getSuningProductList(map)
269
             .compose(
290
             .compose(
@@ -292,19 +313,21 @@ class ThirdPartViewModel : BaseViewModel() {
292
     }
313
     }
293
 
314
 
294
     val pddCatLiveData = MutableLiveData<List<PddClassesBean.Data>>()
315
     val pddCatLiveData = MutableLiveData<List<PddClassesBean.Data>>()
316
+
295
     /**
317
     /**
296
      * pdd 分类
318
      * pdd 分类
297
      */
319
      */
298
     @SuppressLint("CheckResult")
320
     @SuppressLint("CheckResult")
299
-    fun requestPddCat(){
300
-        val map = mapOf<String,Any>(Pair("parentId","0"))
321
+    fun requestPddCat() {
322
+        val map = mapOf<String, Any>(Pair("parentId", "0"))
301
         val service = NetworkApi.createService(PyyxService::class.java)
323
         val service = NetworkApi.createService(PyyxService::class.java)
302
-        service.requestPddCat(map).compose(NetworkApi.applySchedulers(object : BaseObserver<DataResponse<PddClassesBean>>(){
324
+        service.requestPddCat(map).compose(NetworkApi.applySchedulers(object :
325
+            BaseObserver<DataResponse<PddClassesBean>>() {
303
             override fun onSuccess(t: DataResponse<PddClassesBean>?) {
326
             override fun onSuccess(t: DataResponse<PddClassesBean>?) {
304
                 t?.apply {
327
                 t?.apply {
305
-                    if (responseCode==200) {
306
-                        data?.let { catData->
307
-                            catData.data?.let { cats->
328
+                    if (responseCode == 200) {
329
+                        data?.let { catData ->
330
+                            catData.data?.let { cats ->
308
                                 pddCatLiveData.postValue(cats)
331
                                 pddCatLiveData.postValue(cats)
309
                             }
332
                             }
310
 
333
 

+ 15 - 5
app/src/main/java/com/yihucha/hbyhc/wxapi/WXEntryActivity.java

@@ -149,7 +149,7 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
149
 //                WXEventBean wxEventBean = new WXEventBean();
149
 //                WXEventBean wxEventBean = new WXEventBean();
150
 //                wxEventBean.setCode(code);
150
 //                wxEventBean.setCode(code);
151
 //                EventBus.getDefault().postSticky(wxEventBean);
151
 //                EventBus.getDefault().postSticky(wxEventBean);
152
-                    System.out.println(code+"WxEntity  err_ok");
152
+                    System.out.println(code+"   WxEntity  err_ok");
153
 //                    EventBus.getDefault().post("success");
153
 //                    EventBus.getDefault().post("success");
154
                     getOpenId(code);
154
                     getOpenId(code);
155
                     finish();
155
                     finish();
@@ -198,11 +198,14 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
198
                         //绑定
198
                         //绑定
199
                         //提现微信绑定
199
                         //提现微信绑定
200
                         System.out.println("sssssssssssssssssssssssssssssssss");
200
                         System.out.println("sssssssssssssssssssssssssssssssss");
201
-                        getBandOpenid(wechatOpenIdBeanDataJavaResponse.getData().getOpenid());
201
+                        String nickName = wechatOpenIdBeanDataJavaResponse.getData().getNickName();
202
+                        String avatar = wechatOpenIdBeanDataJavaResponse.getData().getHeadimgurl();
203
+                        System.out.println("sssssssssssssssssssssssssssssssss"+ nickName);
204
+                        Log.d(TAG, "wechat onSuccess:---nickname "+ nickName);
205
+                        getBandOpenid(wechatOpenIdBeanDataJavaResponse.getData().getOpenid(),nickName,avatar);
202
 /*                        getUpdateAccount(wechatOpenIdBeanDataJavaResponse.getData().getUnionid(),
206
 /*                        getUpdateAccount(wechatOpenIdBeanDataJavaResponse.getData().getUnionid(),
203
                                 wechatOpenIdBeanDataJavaResponse.getData().getUser().getNickname(),
207
                                 wechatOpenIdBeanDataJavaResponse.getData().getUser().getNickname(),
204
                                 wechatOpenIdBeanDataJavaResponse.getData().getUser().getAvatar());*/
208
                                 wechatOpenIdBeanDataJavaResponse.getData().getUser().getAvatar());*/
205
-
206
                         finish();
209
                         finish();
207
                     } else {
210
                     } else {
208
 //                    //授权逻辑
211
 //                    //授权逻辑
@@ -214,7 +217,9 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
214
 //                    AuthService authService= NetworkApi.createService(AuthService.class);
217
 //                    AuthService authService= NetworkApi.createService(AuthService.class);
215
                         Log.d(TAG, "wechat onSuccess: "+ wechatOpenIdBeanDataJavaResponse.getData());
218
                         Log.d(TAG, "wechat onSuccess: "+ wechatOpenIdBeanDataJavaResponse.getData());
216
                         String nickName = wechatOpenIdBeanDataJavaResponse.getData().getNickName();
219
                         String nickName = wechatOpenIdBeanDataJavaResponse.getData().getNickName();
217
-                        String avatar = wechatOpenIdBeanDataJavaResponse.getData().getAvater();
220
+                        String avatar = wechatOpenIdBeanDataJavaResponse.getData().getHeadimgurl();
221
+                        System.out.println(nickName+"----"+avatar);
222
+                        Log.d(TAG, "else wechat onSuccess:---nickname "+ nickName);
218
 //                        getUpdateAccount(code,nickName,avatar);
223
 //                        getUpdateAccount(code,nickName,avatar);
219
                         getWechatLogin(wechatOpenIdBeanDataJavaResponse.getData().getUnionid(),nickName,avatar);
224
                         getWechatLogin(wechatOpenIdBeanDataJavaResponse.getData().getUnionid(),nickName,avatar);
220
                         finish();
225
                         finish();
@@ -243,10 +248,14 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
243
      * @param openid
248
      * @param openid
244
      */
249
      */
245
     @SuppressLint("CheckResult")
250
     @SuppressLint("CheckResult")
246
-    private void getBandOpenid(String openid) {
251
+    private void getBandOpenid(String openid,String nickname,String avatar) {
247
         ShowLoadingDialog.showLoadingDialog(WXEntryActivity.this);
252
         ShowLoadingDialog.showLoadingDialog(WXEntryActivity.this);
248
         Map<String, Object> map = new HashMap<>();
253
         Map<String, Object> map = new HashMap<>();
249
         map.put("openid", openid);
254
         map.put("openid", openid);
255
+        map.put("nickname",nickname);
256
+        map.put("avatar",avatar);
257
+
258
+        Log.d(TAG, "getBandOpenid:api/user/extract/band_openid wechat "+ map);
250
         AuthService authService = NetworkApi.createService(AuthService.class);
259
         AuthService authService = NetworkApi.createService(AuthService.class);
251
         authService.getBandOpenid(map).compose(NetworkApi.applySchedulers(new BaseObserver<DataResponse>() {
260
         authService.getBandOpenid(map).compose(NetworkApi.applySchedulers(new BaseObserver<DataResponse>() {
252
             @Override
261
             @Override
@@ -323,6 +332,7 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
323
         map.put("openid", openid);
332
         map.put("openid", openid);
324
         map.put("nickname",nickname);
333
         map.put("nickname",nickname);
325
         map.put("avatar",avatar);
334
         map.put("avatar",avatar);
335
+        Log.d(TAG, "getWechatLogin:api/wechat/check wechat "+ map);
326
         AuthService authService = NetworkApi.createService(AuthService.class);
336
         AuthService authService = NetworkApi.createService(AuthService.class);
327
         authService.getWechatLogIn(map).compose(NetworkApi.applySchedulers(new BaseObserver<DataResponse<LoginModel>>() {
337
         authService.getWechatLogIn(map).compose(NetworkApi.applySchedulers(new BaseObserver<DataResponse<LoginModel>>() {
328
             @Override
338
             @Override

+ 59 - 7
app/src/main/res/layout/activity_tb.xml

@@ -48,6 +48,59 @@
48
             android:src="@mipmap/back_white"
48
             android:src="@mipmap/back_white"
49
             android:visibility="invisible" />
49
             android:visibility="invisible" />
50
     </LinearLayout>
50
     </LinearLayout>
51
+
52
+    <RelativeLayout
53
+        android:id="@+id/layout_search"
54
+        android:layout_width="match_parent"
55
+        android:layout_height="35dp"
56
+        android:layout_marginTop="@dimen/dp_10"
57
+        android:orientation="horizontal"
58
+        android:paddingLeft="@dimen/dp_10"
59
+        android:paddingTop="3dp"
60
+        android:paddingRight="@dimen/dp_10"
61
+        android:paddingBottom="3dp"
62
+        app:layout_constraintLeft_toLeftOf="parent"
63
+        app:layout_constraintRight_toRightOf="parent"
64
+        app:layout_constraintTop_toBottomOf="@+id/title_layout">
65
+
66
+        <EditText
67
+            android:id="@+id/edt_search"
68
+            android:layout_width="match_parent"
69
+            android:layout_height="match_parent"
70
+            android:background="@drawable/shape_white_50dp"
71
+            android:drawableLeft="@mipmap/img_store_search"
72
+            android:drawablePadding="3dp"
73
+            android:gravity="center_vertical"
74
+            android:hint="请输入搜索内容"
75
+            android:textSize="14sp"
76
+            android:paddingLeft="@dimen/dp_10"
77
+            android:textColor="@color/black_333333"
78
+            android:layout_toLeftOf="@+id/tv_search"
79
+            />
80
+        <ImageView
81
+            android:id="@+id/img_clear"
82
+            android:layout_width="20dp"
83
+            android:layout_height="20dp"
84
+            android:src="@mipmap/search_cha_220616"
85
+            android:scaleType="centerInside"
86
+            android:layout_centerVertical="true"
87
+            android:layout_alignRight="@id/edt_search"
88
+            android:layout_marginRight="5dp"
89
+            android:visibility="gone"
90
+            />
91
+        <TextView
92
+            android:id="@+id/tv_search"
93
+            android:layout_width="wrap_content"
94
+            android:layout_height="match_parent"
95
+            android:gravity="center"
96
+            android:paddingLeft="@dimen/dp_10"
97
+            android:text="@string/search"
98
+            android:textColor="@color/white"
99
+            android:textSize="16sp"
100
+            android:layout_alignParentRight="true"
101
+            />
102
+    </RelativeLayout>
103
+
51
     <com.yihucha.hbyhc.view.RoundCornerImageView
104
     <com.yihucha.hbyhc.view.RoundCornerImageView
52
         android:id="@+id/banner"
105
         android:id="@+id/banner"
53
         android:layout_width="match_parent"
106
         android:layout_width="match_parent"
@@ -55,10 +108,10 @@
55
         android:layout_marginLeft="@dimen/dp_10"
108
         android:layout_marginLeft="@dimen/dp_10"
56
         android:layout_marginTop="10dp"
109
         android:layout_marginTop="10dp"
57
         android:layout_marginRight="@dimen/dp_10"
110
         android:layout_marginRight="@dimen/dp_10"
58
-        app:layout_constraintLeft_toLeftOf="parent"
59
         android:scaleType="centerCrop"
111
         android:scaleType="centerCrop"
60
-        app:rciv_radius="10dp"
61
-        app:layout_constraintTop_toBottomOf="@+id/title_layout" />
112
+        app:layout_constraintLeft_toLeftOf="parent"
113
+        app:layout_constraintTop_toBottomOf="@+id/layout_search"
114
+        app:rciv_radius="10dp" />
62
 
115
 
63
     <androidx.recyclerview.widget.RecyclerView
116
     <androidx.recyclerview.widget.RecyclerView
64
         android:id="@+id/rv_top_selector"
117
         android:id="@+id/rv_top_selector"
@@ -107,11 +160,10 @@
107
         android:id="@+id/img_to_top"
160
         android:id="@+id/img_to_top"
108
         android:layout_width="wrap_content"
161
         android:layout_width="wrap_content"
109
         android:layout_height="wrap_content"
162
         android:layout_height="wrap_content"
110
-        android:src="@mipmap/to_top"
111
-        app:layout_constraintRight_toRightOf="parent"
112
-        app:layout_constraintBottom_toBottomOf="parent"
113
         android:layout_marginRight="@dimen/dp_10"
163
         android:layout_marginRight="@dimen/dp_10"
114
         android:layout_marginBottom="20dp"
164
         android:layout_marginBottom="20dp"
165
+        android:src="@mipmap/to_top"
115
         android:visibility="gone"
166
         android:visibility="gone"
116
-        />
167
+        app:layout_constraintBottom_toBottomOf="parent"
168
+        app:layout_constraintRight_toRightOf="parent" />
117
 </androidx.constraintlayout.widget.ConstraintLayout>
169
 </androidx.constraintlayout.widget.ConstraintLayout>

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

@@ -1,4 +1,4 @@
1
-#Sat Apr 19 15:35:25 CST 2025
1
+#Wed Apr 23 14:26:03 CST 2025
2
 com.jd.jdsdk.jd_sdk_lib-main-7\:/drawable-xxhdpi/kepler_back_normal.png=/Users/wenjuan.su/Downloads/yihucha/jd_sdk_lib/build/intermediates/packaged_res/debug/drawable-xxhdpi-v4/kepler_back_normal.png
2
 com.jd.jdsdk.jd_sdk_lib-main-7\:/drawable-xxhdpi/kepler_back_normal.png=/Users/wenjuan.su/Downloads/yihucha/jd_sdk_lib/build/intermediates/packaged_res/debug/drawable-xxhdpi-v4/kepler_back_normal.png
3
 com.jd.jdsdk.jd_sdk_lib-main-7\:/drawable-xxhdpi/kepler_back_pressed.png=/Users/wenjuan.su/Downloads/yihucha/jd_sdk_lib/build/intermediates/packaged_res/debug/drawable-xxhdpi-v4/kepler_back_pressed.png
3
 com.jd.jdsdk.jd_sdk_lib-main-7\:/drawable-xxhdpi/kepler_back_pressed.png=/Users/wenjuan.su/Downloads/yihucha/jd_sdk_lib/build/intermediates/packaged_res/debug/drawable-xxhdpi-v4/kepler_back_pressed.png
4
 com.jd.jdsdk.jd_sdk_lib-main-7\:/drawable-xxhdpi/kepler_selcet_more_normal.png=/Users/wenjuan.su/Downloads/yihucha/jd_sdk_lib/build/intermediates/packaged_res/debug/drawable-xxhdpi-v4/kepler_selcet_more_normal.png
4
 com.jd.jdsdk.jd_sdk_lib-main-7\:/drawable-xxhdpi/kepler_selcet_more_normal.png=/Users/wenjuan.su/Downloads/yihucha/jd_sdk_lib/build/intermediates/packaged_res/debug/drawable-xxhdpi-v4/kepler_selcet_more_normal.png