Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
HBHAndroid
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨秀秀
HBHAndroid
Commits
9080d187
Commit
9080d187
authored
Aug 19, 2023
by
yangxuenan
Committed by
杨秀秀
Nov 21, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
功能完善
parent
c329aeb3
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
265 additions
and
214 deletions
+265
-214
CollectionGoodsAdapter.java
...va/com/xx/hbhconsumer/adapter/CollectionGoodsAdapter.java
+30
-3
SecondCategoryAdapter.java
...ava/com/xx/hbhconsumer/adapter/SecondCategoryAdapter.java
+0
-5
ThirdCategoryAdapter.java
...java/com/xx/hbhconsumer/adapter/ThirdCategoryAdapter.java
+2
-2
ApiService.kt
.../src/main/java/com/xx/hbhconsumer/data/http/ApiService.kt
+7
-0
CollectionRequest.java
...om/xx/hbhconsumer/data/http/requst/CollectionRequest.java
+7
-3
GoodsRequest.java
...ava/com/xx/hbhconsumer/data/http/requst/GoodsRequest.java
+5
-3
SettingsRequest.java
.../com/xx/hbhconsumer/data/http/requst/SettingsRequest.java
+14
-0
CategoryBean.kt
...java/com/xx/hbhconsumer/data/http/respons/CategoryBean.kt
+22
-18
CollectionBean.kt
...va/com/xx/hbhconsumer/data/http/respons/CollectionBean.kt
+2
-0
LocalData.kt
.../src/main/java/com/xx/hbhconsumer/data/local/LocalData.kt
+8
-0
GoodsDetailViewModel.java
...ava/com/xx/hbhconsumer/ui/goods/GoodsDetailViewModel.java
+4
-11
LogoffSecondStepViewModel.java
...m/xx/hbhconsumer/ui/logoff/LogoffSecondStepViewModel.java
+2
-0
MyCollectionActivity.java
.../xx/hbhconsumer/ui/mycollection/MyCollectionActivity.java
+15
-2
MyCollectionViewModel.java
...xx/hbhconsumer/ui/mycollection/MyCollectionViewModel.java
+59
-0
ForgetPwdViewModel.java
...in/java/com/xx/hbhconsumer/ui/pwd/ForgetPwdViewModel.java
+1
-34
LogoutDialog.kt
.../main/java/com/xx/hbhconsumer/ui/settings/LogoutDialog.kt
+3
-2
SettingsActivity.kt
...n/java/com/xx/hbhconsumer/ui/settings/SettingsActivity.kt
+2
-1
SettingsViewModel.java
...ava/com/xx/hbhconsumer/ui/settings/SettingsViewModel.java
+24
-119
radio_button_check_selector.xml
...mer/src/main/res/drawable/radio_button_check_selector.xml
+13
-0
activity_login.xml
consumer/src/main/res/layout/activity_login.xml
+1
-0
activity_my_collection.xml
consumer/src/main/res/layout/activity_my_collection.xml
+19
-2
activity_settings.xml
consumer/src/main/res/layout/activity_settings.xml
+7
-4
item_collection_goods.xml
consumer/src/main/res/layout/item_collection_goods.xml
+15
-0
item_search_shop.xml
consumer/src/main/res/layout/item_search_shop.xml
+1
-0
item_second_category.xml
consumer/src/main/res/layout/item_second_category.xml
+0
-1
item_second_category_text.xml
consumer/src/main/res/layout/item_second_category_text.xml
+1
-3
item_third_category.xml
consumer/src/main/res/layout/item_third_category.xml
+1
-1
No files found.
consumer/src/main/java/com/xx/hbhconsumer/adapter/CollectionGoodsAdapter.java
View file @
9080d187
package
com
.
xx
.
hbhconsumer
.
adapter
;
import
android.content.Context
;
import
android.view.View
;
import
com.bumptech.glide.Glide
;
import
com.xx.hbhconsumer.R
;
import
com.xx.hbhconsumer.data.http.respons.CollectionBean
;
import
com.xx.hbhconsumer.data.http.respons.OrderBean
;
import
com.xx.hbhconsumer.databinding.ItemCollectionGoodsBinding
;
import
com.xx.hbhconsumer.
databinding.ItemNewProductsGoodsBinding
;
import
com.xx.hbhconsumer.
ui.mycollection.MyCollectionViewModel
;
import
com.xx.hbhconsumer.utils.RetrofitClient
;
import
com.xx.xxviewlibrary.base.xxBaseRecyclerViewAdapter
;
...
...
@@ -16,9 +16,12 @@ import me.goldze.mvvmhabit.utils.StringUtils;
public
class
CollectionGoodsAdapter
extends
xxBaseRecyclerViewAdapter
<
ItemCollectionGoodsBinding
,
CollectionBean
>
{
public
CollectionGoodsAdapter
(
Context
context
)
{
private
MyCollectionViewModel
myCollectionViewModel
;
public
CollectionGoodsAdapter
(
Context
context
,
MyCollectionViewModel
myCollectionViewModel
)
{
super
(
context
);
mContext
=
context
;
this
.
myCollectionViewModel
=
myCollectionViewModel
;
}
@Override
...
...
@@ -36,6 +39,30 @@ public class CollectionGoodsAdapter extends xxBaseRecyclerViewAdapter<ItemCollec
dataBind
.
tvGoodsName
.
setText
(
data
.
getCommodityName
());
if
(
data
.
getEditState
())
{
dataBind
.
radioSelectedGroup
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
dataBind
.
radioSelectedGroup
.
setVisibility
(
View
.
GONE
);
}
if
(
data
.
getChecked
())
{
dataBind
.
rbCheckState
.
setChecked
(
true
);
}
else
{
dataBind
.
radioSelectedGroup
.
clearCheck
();
}
dataBind
.
rbCheckState
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
if
(
data
.
getChecked
())
{
data
.
setChecked
(
false
);
dataBind
.
radioSelectedGroup
.
clearCheck
();
}
else
{
data
.
setChecked
(
true
);
}
myCollectionViewModel
.
checkItem
();
}
});
String
price
=
data
.
getCommodityPrice
();
if
(!
StringUtils
.
isEmpty
(
price
)
&&
price
.
contains
(
"."
))
{
dataBind
.
tvPriceInteger
.
setText
(
price
.
split
(
"\\."
)[
0
]);
...
...
consumer/src/main/java/com/xx/hbhconsumer/adapter/SecondCategoryAdapter.java
View file @
9080d187
package
com
.
xx
.
hbhconsumer
.
adapter
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
androidx.recyclerview.widget.GridLayoutManager
;
import
com.xx.hbhconsumer.R
;
import
com.xx.hbhconsumer.data.http.respons.CategoryBean
;
import
com.xx.hbhconsumer.databinding.ItemSecondCategoryBinding
;
import
com.xx.hbhconsumer.ui.shop.ShopSearchActivity
;
import
com.xx.xxviewlibrary.base.xxBaseRecyclerViewAdapter
;
public
class
SecondCategoryAdapter
extends
xxBaseRecyclerViewAdapter
<
ItemSecondCategoryBinding
,
CategoryBean
>
{
...
...
consumer/src/main/java/com/xx/hbhconsumer/adapter/ThirdCategoryAdapter.java
View file @
9080d187
...
...
@@ -27,8 +27,8 @@ public class ThirdCategoryAdapter extends xxBaseRecyclerViewAdapter<ItemThirdCat
protected
void
covert
(
ItemThirdCategoryBinding
dataBind
,
CategoryBean
data
,
int
position
)
{
// 将接口调出来的布局遍历上去
dataBind
.
setCategoryBean
(
data
);
Glide
.
with
(
mContext
).
load
(
RetrofitClient
.
baseImgUrl
+
data
.
getCategoryImg
())
dataBind
.
tvCategoryName
.
setText
(
data
.
getCategoryName
());
Glide
.
with
(
mContext
).
load
(
RetrofitClient
.
baseImgUrl
+
data
.
getCategoryImg
File
().
getFilePath
())
.
into
(
dataBind
.
ivCategoryImage
);
}
}
consumer/src/main/java/com/xx/hbhconsumer/data/http/ApiService.kt
View file @
9080d187
...
...
@@ -381,4 +381,11 @@ interface ApiService {
@POST
(
"app/user/closure-with-reason"
)
fun
logoff
(
@Body
requestBody
:
RequestBody
):
Observable
<
BaseResponse
<
Boolean
>>
/**
* 查询活动列表信息
*/
@Headers
(
"Content-type:application/json"
)
@GET
(
"app/system-info/get-version"
)
fun
getVersion
():
Observable
<
BaseResponse
<
String
>>
}
\ No newline at end of file
consumer/src/main/java/com/xx/hbhconsumer/data/http/requst/CollectionRequest.java
View file @
9080d187
...
...
@@ -2,9 +2,6 @@ package com.xx.hbhconsumer.data.http.requst;
import
com.xx.hbhconsumer.data.http.BaseRespons
;
import
com.xx.hbhconsumer.data.http.respons.CollectionBean
;
import
com.xx.hbhconsumer.data.http.respons.ShopBean
;
import
java.util.List
;
import
io.reactivex.rxjava3.core.Observable
;
import
me.goldze.mvvmhabit.http.BasePageResponse
;
...
...
@@ -18,4 +15,11 @@ public class CollectionRequest extends BaseRespons {
public
Observable
<
BasePageResponse
<
CollectionBean
>>
memberCollectionList
()
{
return
getApiService
().
memberCollectionList
();
}
/**
* 低价好物商品列表
*/
public
Observable
<
BaseResponse
<
Integer
>>
cancelCollection
(
String
businessIds
)
{
return
getApiService
().
cancelCollection
(
businessIds
);
}
}
consumer/src/main/java/com/xx/hbhconsumer/data/http/requst/GoodsRequest.java
View file @
9080d187
...
...
@@ -15,9 +15,9 @@ import okhttp3.RequestBody;
public
class
GoodsRequest
extends
BaseRespons
{
public
Observable
<
BaseResponse
<
String
>>
memberCollection
(
String
merchantCommodityId
)
{
public
Observable
<
BaseResponse
<
String
>>
memberCollection
(
String
merchantCommodityId
,
String
flag
)
{
ApiParams
<
MemberCollectionRequestBody
>
apiParams
=
new
ApiParams
<>();
MemberCollectionRequestBody
requestBody
=
new
MemberCollectionRequestBody
(
merchantCommodityId
);
MemberCollectionRequestBody
requestBody
=
new
MemberCollectionRequestBody
(
flag
,
merchantCommodityId
);
RequestBody
body
=
apiParams
.
setParams
(
requestBody
);
return
getApiService
().
memberCollection
(
body
);
}
...
...
@@ -49,9 +49,11 @@ public class GoodsRequest extends BaseRespons {
}
class
MemberCollectionRequestBody
{
String
flag
;
String
merchantCommodityId
;
public
MemberCollectionRequestBody
(
String
merchantCommodityId
)
{
public
MemberCollectionRequestBody
(
String
flag
,
String
merchantCommodityId
)
{
this
.
flag
=
flag
;
this
.
merchantCommodityId
=
merchantCommodityId
;
}
}
...
...
consumer/src/main/java/com/xx/hbhconsumer/data/http/requst/SettingsRequest.java
0 → 100644
View file @
9080d187
package
com
.
xx
.
hbhconsumer
.
data
.
http
.
requst
;
import
com.xx.hbhconsumer.data.http.BaseRespons
;
import
io.reactivex.rxjava3.core.Observable
;
import
me.goldze.mvvmhabit.http.BaseResponse
;
public
class
SettingsRequest
extends
BaseRespons
{
public
Observable
<
BaseResponse
<
String
>>
getVersion
()
{
return
getApiService
().
getVersion
();
}
}
consumer/src/main/java/com/xx/hbhconsumer/data/http/respons/CategoryBean.kt
View file @
9080d187
package
com.xx.hbhconsumer.data.http.respons
import
com.github.gzuliyujiang.wheelview.contract.TextProvider
class
CategoryBean
(
va
r
delFla
g
:
String
,
va
r
categoryId
:
String
,
va
r
pid
:
String
,
va
r
superCategory
:
String
,
va
r
categoryCoding
:
String
,
va
r
categoryName
:
String
,
va
r
categoryImg
:
String
,
va
r
categoryLevel
:
Int
,
va
r
status
:
String
,
va
r
children
:
MutableList
<
CategoryBean
>
,
data class
CategoryBean
(
val
categoryCoding
:
String
,
val
categoryId
:
String
,
va
l
categoryIm
g
:
String
,
va
l
categoryImgFile
:
CategoryImgFile
,
va
l
categoryLevel
:
Int
,
va
l
categoryName
:
String
,
va
l
children
:
List
<
CategoryBean
>
,
va
l
delFlag
:
String
,
va
l
pid
:
String
,
va
l
remark
:
String
,
va
l
status
:
String
,
va
l
superCategory
:
String
,
var
checked
:
Boolean
)
:
TextProvider
{
override
fun
provideText
():
String
{
return
categoryName
;
}
}
\ No newline at end of file
)
data class
CategoryImgFile
(
val
businessId
:
String
,
val
filePath
:
String
,
val
newFileName
:
String
,
val
originalFileName
:
String
,
val
url
:
String
)
\ No newline at end of file
consumer/src/main/java/com/xx/hbhconsumer/data/http/respons/CollectionBean.kt
View file @
9080d187
...
...
@@ -17,6 +17,8 @@ class CollectionBean(
var
remark
:
String
,
var
updateBy
:
String
,
var
updateTime
:
String
,
var
checked
:
Boolean
,
var
editState
:
Boolean
)
{
}
consumer/src/main/java/com/xx/hbhconsumer/data/local/LocalData.kt
View file @
9080d187
...
...
@@ -7,6 +7,14 @@ import me.goldze.mvvmhabit.utils.SPUtils
object
LocalData
{
/**
* 存储用户信息
*/
@JvmStatic
fun
delAllData
()
{
SPUtils
.
getInstance
().
clear
()
}
/**
* 存储用户信息
*/
...
...
consumer/src/main/java/com/xx/hbhconsumer/ui/goods/GoodsDetailViewModel.java
View file @
9080d187
...
...
@@ -85,7 +85,7 @@ public class GoodsDetailViewModel extends BaseViewModel<GoodsRequest> {
}
private
void
memberCollection
()
{
model
.
memberCollection
(
goodsId
)
model
.
memberCollection
(
goodsId
,
"0"
)
.
compose
(
RxUtils
.
schedulersTransformer
())
//线程调度
.
doOnSubscribe
(
GoodsDetailViewModel
.
this
)
.
doOnSubscribe
(
new
Consumer
<
Disposable
>()
{
...
...
@@ -103,24 +103,20 @@ public class GoodsDetailViewModel extends BaseViewModel<GoodsRequest> {
public
void
onError
(
String
Error
)
{
dismissDialog
();
}
});
}
private
void
cancelCollection
()
{
model
.
cancelCollection
(
goodsId
)
model
.
memberCollection
(
goodsId
,
"1"
)
.
compose
(
RxUtils
.
schedulersTransformer
())
//线程调度
.
doOnSubscribe
(
GoodsDetailViewModel
.
this
)
.
doOnSubscribe
(
new
Consumer
<
Disposable
>()
{
@Override
public
void
accept
(
Disposable
disposable
)
throws
Exception
{
}
}).
subscribe
(
new
ApiDisposableObserver
<
Integer
>()
{
}).
subscribe
(
new
ApiDisposableObserver
<
String
>()
{
@Override
public
void
onSuccess
(
Integer
resultBean
)
{
public
void
onSuccess
(
String
resultBean
)
{
ToastUtils
.
showShort
(
"取消收藏成功!"
);
collectionState
.
postValue
(
"0"
);
}
...
...
@@ -130,9 +126,6 @@ public class GoodsDetailViewModel extends BaseViewModel<GoodsRequest> {
dismissDialog
();
}
});
}
...
...
consumer/src/main/java/com/xx/hbhconsumer/ui/logoff/LogoffSecondStepViewModel.java
View file @
9080d187
...
...
@@ -7,6 +7,7 @@ import android.app.Application;
import
androidx.annotation.NonNull
;
import
com.xx.hbhconsumer.data.http.requst.LogoffRequest
;
import
com.xx.hbhconsumer.data.local.LocalData
;
import
com.xx.hbhconsumer.ui.login.LoginActivity
;
import
io.reactivex.rxjava3.disposables.Disposable
;
...
...
@@ -49,6 +50,7 @@ public class LogoffSecondStepViewModel extends BaseViewModel<LogoffRequest> {
@Override
public
void
onSuccess
(
Boolean
resultBean
)
{
ToastUtils
.
showShort
(
"注销成功"
);
LocalData
.
delAllData
();
startActivity
(
LoginActivity
.
class
);
finish
();
}
...
...
consumer/src/main/java/com/xx/hbhconsumer/ui/mycollection/MyCollectionActivity.java
View file @
9080d187
...
...
@@ -36,7 +36,7 @@ public class MyCollectionActivity extends BaseActivity<ActivityMyCollectionBindi
GridLayoutManager
manager
=
new
GridLayoutManager
(
MyCollectionActivity
.
this
,
2
);
binding
.
rvGoodsList
.
setLayoutManager
(
manager
);
//获取适配器上下文
CollectionGoodsAdapter
collectionGoodsAdapter
=
new
CollectionGoodsAdapter
(
MyCollectionActivity
.
this
);
CollectionGoodsAdapter
collectionGoodsAdapter
=
new
CollectionGoodsAdapter
(
MyCollectionActivity
.
this
,
viewModel
);
//把adapterset进去
binding
.
rvGoodsList
.
setAdapter
(
collectionGoodsAdapter
);
collectionGoodsAdapter
.
setOnItemClick
(
new
xxBaseRecyclerViewAdapter
.
OnItemClick
<
CollectionBean
>()
{
...
...
@@ -49,12 +49,25 @@ public class MyCollectionActivity extends BaseActivity<ActivityMyCollectionBindi
viewModel
.
collectionList
.
observe
(
this
,
new
Observer
<
List
<
CollectionBean
>>()
{
@Override
public
void
onChanged
(
List
<
CollectionBean
>
collectionBeanList
)
{
if
(
collectionBeanList
.
isEmpty
())
{
binding
.
rvGoodsList
.
setVisibility
(
View
.
GONE
);
binding
.
rlNoData
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
binding
.
rvGoodsList
.
setVisibility
(
View
.
VISIBLE
);
binding
.
rlNoData
.
setVisibility
(
View
.
GONE
);
}
collectionGoodsAdapter
.
mList
=
collectionBeanList
;
collectionGoodsAdapter
.
notifyDataSetChanged
();
}
});
viewModel
.
checkCount
.
observe
(
this
,
new
Observer
<
Integer
>()
{
@Override
public
void
onChanged
(
Integer
checkCount
)
{
binding
.
tvCheckCount
.
setText
(
checkCount
.
toString
());
}
});
viewModel
.
editFlag
.
observe
(
this
,
new
Observer
<
Boolean
>()
{
@Override
public
void
onChanged
(
Boolean
editFlag
)
{
...
...
consumer/src/main/java/com/xx/hbhconsumer/ui/mycollection/MyCollectionViewModel.java
View file @
9080d187
...
...
@@ -28,11 +28,14 @@ import me.goldze.mvvmhabit.binding.command.BindingCommand;
import
me.goldze.mvvmhabit.http.ApiDisposableObserver
;
import
me.goldze.mvvmhabit.http.ApiDisposablePageObserver
;
import
me.goldze.mvvmhabit.utils.RxUtils
;
import
me.goldze.mvvmhabit.utils.StringUtils
;
import
me.goldze.mvvmhabit.utils.ToastUtils
;
public
class
MyCollectionViewModel
extends
BaseViewModel
<
CollectionRequest
>
{
public
MutableLiveData
<
List
<
CollectionBean
>>
collectionList
=
new
MutableLiveData
<>(
new
ArrayList
<>());
public
MutableLiveData
<
Boolean
>
editFlag
=
new
MutableLiveData
<>(
false
);
public
MutableLiveData
<
Integer
>
checkCount
=
new
MutableLiveData
<>(
0
);
public
MyCollectionViewModel
(
@NonNull
Application
application
)
{
super
(
application
);
...
...
@@ -97,7 +100,19 @@ public class MyCollectionViewModel extends BaseViewModel<CollectionRequest> {
public
BindingCommand
manager
=
new
BindingCommand
(
new
BindingAction
()
{
@Override
public
void
call
()
{
if
(
collectionList
.
getValue
().
isEmpty
())
{
ToastUtils
.
showShort
(
"无收藏可管理"
);
return
;
}
editFlag
.
postValue
(
true
);
List
<
CollectionBean
>
newList
=
new
ArrayList
<>();
for
(
CollectionBean
collectionBean
:
collectionList
.
getValue
())
{
collectionBean
.
setEditState
(
true
);
newList
.
add
(
collectionBean
);
}
collectionList
.
postValue
(
newList
);
}
});
...
...
@@ -106,7 +121,51 @@ public class MyCollectionViewModel extends BaseViewModel<CollectionRequest> {
@Override
public
void
call
()
{
editFlag
.
postValue
(
false
);
String
businessIds
=
""
;
for
(
CollectionBean
collectionBean
:
collectionList
.
getValue
())
{
if
(
collectionBean
.
getChecked
())
{
businessIds
+=
collectionBean
.
getBusinessId
()
+
","
;
}
}
if
(
StringUtils
.
isEmpty
(
businessIds
))
{
ToastUtils
.
showShort
(
"请选择要取消收藏的商品"
);
return
;
}
model
.
cancelCollection
(
businessIds
)
.
compose
(
RxUtils
.
schedulersTransformer
())
//线程调度
// .compose(RxUtils.exceptionTransformer()) // 网络错误的异常转换, 这里可以换成自己的ExceptionHandle
.
doOnSubscribe
(
MyCollectionViewModel
.
this
)
.
doOnSubscribe
(
new
Consumer
<
Disposable
>()
{
@Override
public
void
accept
(
Disposable
disposable
)
throws
Exception
{
}
}).
subscribe
(
new
ApiDisposableObserver
<
Integer
>()
{
@Override
public
void
onSuccess
(
Integer
resultBean
)
{
loadData
();
editFlag
.
postValue
(
false
);
ToastUtils
.
showShort
(
"取消收藏成功"
);
}
@Override
public
void
onError
(
String
Error
)
{
dismissDialog
();
}
});
}
});
public
void
checkItem
()
{
int
count
=
0
;
for
(
CollectionBean
collectionBean
:
collectionList
.
getValue
())
{
if
(
collectionBean
.
getChecked
())
{
count
++;
}
}
checkCount
.
postValue
(
count
);
}
}
consumer/src/main/java/com/xx/hbhconsumer/ui/pwd/ForgetPwdViewModel.java
View file @
9080d187
...
...
@@ -36,40 +36,6 @@ public class ForgetPwdViewModel extends BaseViewModel<ForgetPwdRequest> {
super
(
application
,
model
);
}
// 获取验证码
public
BindingCommand
getCode
=
new
BindingCommand
(
new
BindingAction
()
{
@Override
public
void
call
()
{
if
(
TextUtils
.
isEmpty
(
phone
.
get
().
toString
()))
{
ToastUtils
.
showShort
(
"请输入手机号!"
);
return
;
}
model
.
getCode
(
phone
.
get
().
toString
())
.
compose
(
RxUtils
.
schedulersTransformer
())
//线程调度
.
doOnSubscribe
(
ForgetPwdViewModel
.
this
)
.
doOnSubscribe
(
new
Consumer
<
Disposable
>()
{
@Override
public
void
accept
(
Disposable
disposable
)
throws
Exception
{
showDialog
(
"正在获取验证码"
);
}
}).
subscribe
(
new
ApiDisposableObserver
<
String
>()
{
@Override
public
void
onSuccess
(
String
resultBean
)
{
ToastUtils
.
showShort
(
"已经发送成功"
);
dismissDialog
();
}
@Override
public
void
onError
(
String
Error
)
{
dismissDialog
();
}
});
}
});
// 触发确认按钮
public
BindingCommand
confirm
=
new
BindingCommand
(
new
BindingAction
()
{
@Override
...
...
@@ -100,6 +66,7 @@ public class ForgetPwdViewModel extends BaseViewModel<ForgetPwdRequest> {
//是指token
Interceptor_TOKEN
=
"Bearer "
+
resultBean
;
startActivity
(
LoginActivity
.
class
);
finish
();
}
@Override
...
...
consumer/src/main/java/com/xx/hbhconsumer/ui/settings/LogoutDialog.kt
View file @
9080d187
...
...
@@ -9,7 +9,7 @@ import com.xx.hbhconsumer.databinding.DialogLogoutBinding
import
com.xx.xxviewlibrary.base.xxBaseDialog
import
me.jessyan.autosize.utils.AutoSizeUtils
class
LogoutDialog
(
context
:
Context
,
var
data
:
Int
):
xxBaseDialog
<
DialogLogoutBinding
>(
context
)
{
class
LogoutDialog
(
context
:
Context
,
var
viewModel
:
SettingsViewModel
):
xxBaseDialog
<
DialogLogoutBinding
>(
context
)
{
override
fun
InitView
():
DialogSet
{
return
DialogSet
(
R
.
layout
.
dialog_logout
,
true
,
...
...
@@ -26,7 +26,8 @@ class LogoutDialog(context:Context, var data: Int): xxBaseDialog<DialogLogoutBin
}
binding
.
tvConfirm
.
setOnClickListener
{
DialogClickListener
.
dialogClickBack
(
0
,
null
);
dismiss
()
viewModel
.
goLogin
()
}
}
...
...
consumer/src/main/java/com/xx/hbhconsumer/ui/settings/SettingsActivity.kt
View file @
9080d187
...
...
@@ -4,6 +4,7 @@ import android.os.Bundle
import
com.xx.hbhconsumer.BR
import
com.xx.hbhconsumer.R
import
com.xx.hbhconsumer.data.http.requst.LoginRequest
import
com.xx.hbhconsumer.data.http.requst.SettingsRequest
import
com.xx.hbhconsumer.databinding.ActivityLoginBinding
import
com.xx.hbhconsumer.databinding.ActivitySettingsBinding
import
me.goldze.mvvmhabit.base.BaseActivity
...
...
@@ -32,7 +33,7 @@ class SettingsActivity() : BaseActivity<ActivitySettingsBinding, SettingsViewMod
}
override
fun
initViewModel
():
SettingsViewModel
{
val
lm
:
LoginRequest
=
Login
Request
()
val
lm
=
Settings
Request
()
return
SettingsViewModel
(
application
,
lm
)
}
...
...
consumer/src/main/java/com/xx/hbhconsumer/ui/settings/SettingsViewModel.java
View file @
9080d187
package
com
.
xx
.
hbhconsumer
.
ui
.
settings
;
import
static
me
.
goldze
.
mvvmhabit
.
utils
.
Utils
.
Interceptor_TOKEN
;
import
android.app.Application
;
import
android.os.Bundle
;
import
android.text.TextUtils
;
import
android.view.View
;
import
androidx.annotation.NonNull
;
import
androidx.databinding.ObservableField
;
import
com.xx.hbhconsumer.data.http.requst.LoginRequest
;
import
com.xx.hbhconsumer.data.http.respons.UserInfoBean
;
import
com.xx.hbhconsumer.data.http.requst.SettingsRequest
;
import
com.xx.hbhconsumer.data.local.LocalData
;
import
com.xx.hbhconsumer.ui.login.LoginActivity
;
import
com.xx.hbhconsumer.ui.logoff.LogoffFirstStepActivity
;
import
com.xx.hbhconsumer.ui.
logoff.LogoffSecondStep
Activity
;
import
com.xx.hbhconsumer.ui.
main.Main
Activity
;
import
com.xx.hbhconsumer.ui.
pwd.ForgetPwd
Activity
;
import
com.xx.hbhconsumer.ui.
phone.Phone
Activity
;
import
com.xx.hbhconsumer.ui.
pwd.Pwd
Activity
;
import
com.xx.hbhconsumer.ui.
useragreement.UserAgreement
Activity
;
import
com.xx.xxviewlibrary.base.xxBaseDialog
;
import
io.reactivex.rxjava3.disposables.Disposable
;
import
io.reactivex.rxjava3.functions.Consumer
;
import
me.goldze.mvvmhabit.base.BaseViewModel
;
import
me.goldze.mvvmhabit.binding.command.BindingAction
;
import
me.goldze.mvvmhabit.binding.command.BindingCommand
;
import
me.goldze.mvvmhabit.http.ApiDisposableObserver
;
import
me.goldze.mvvmhabit.utils.RxUtils
;
import
me.goldze.mvvmhabit.utils.ToastUtils
;
public
class
SettingsViewModel
extends
BaseViewModel
<
Login
Request
>
{
public
class
SettingsViewModel
extends
BaseViewModel
<
Settings
Request
>
{
//用户名的绑定
public
ObservableField
<
String
>
userName
=
new
ObservableField
<>(
""
);
//密码的绑定
public
ObservableField
<
String
>
password
=
new
ObservableField
<>(
""
);
public
SettingsViewModel
(
@NonNull
Application
application
,
Login
Request
model
)
{
public
SettingsViewModel
(
@NonNull
Application
application
,
Settings
Request
model
)
{
super
(
application
,
model
);
}
//跳转开店页面
public
BindingCommand
goMerchantEnter
=
new
BindingCommand
(
new
BindingAction
()
{
public
void
goLogin
()
{
LocalData
.
delAllData
();
startActivity
(
LoginActivity
.
class
);
finish
();
}
public
BindingCommand
goPrivacyClause
=
new
BindingCommand
(
new
BindingAction
()
{
@Override
public
void
call
()
{
Bundle
bundle
=
new
Bundle
();
// bundle.putInt("pageStep", R.id.registerMaterialFragment
);
// startActivity(MerchantEnterActivity.class,bundle
);
Bundle
bundle
=
new
Bundle
();
bundle
.
putString
(
"basicName"
,
" 隐私协议"
);
startActivity
(
UserAgreementActivity
.
class
);
}
});
//跳转
首页
public
BindingCommand
go
Hom
e
=
new
BindingCommand
(
new
BindingAction
()
{
//跳转
开店页面
public
BindingCommand
go
Phon
e
=
new
BindingCommand
(
new
BindingAction
()
{
@Override
public
void
call
()
{
startActivity
(
Main
Activity
.
class
);
startActivity
(
Phone
Activity
.
class
);
}
});
//跳转
忘记密码
public
BindingCommand
forget
Pwd
=
new
BindingCommand
(
new
BindingAction
()
{
//跳转
首页
public
BindingCommand
go
Pwd
=
new
BindingCommand
(
new
BindingAction
()
{
@Override
public
void
call
()
{
startActivity
(
Forget
PwdActivity
.
class
);
startActivity
(
PwdActivity
.
class
);
}
});
...
...
@@ -82,97 +73,11 @@ public class SettingsViewModel extends BaseViewModel<LoginRequest> {
}
private
void
showSignDialog
(
View
view
)
{
LogoutDialog
dialog
=
new
LogoutDialog
(
view
.
getContext
(),
1
);
LogoutDialog
dialog
=
new
LogoutDialog
(
view
.
getContext
(),
this
);
dialog
.
setDialogClickListener
((
xxBaseDialog
.
onDialogClickListener
<
LogoutDialog
>)
(
code
,
data
)
->
startActivity
(
LoginActivity
.
class
));
dialog
.
show
();
}
//登陆
public
BindingCommand
login
=
new
BindingCommand
(
new
BindingAction
()
{
@Override
public
void
call
()
{
startActivity
(
MainActivity
.
class
);
if
(
TextUtils
.
isEmpty
(
userName
.
get
().
toString
()))
{
ToastUtils
.
showShort
(
"请输入账号!"
);
}
else
if
(
TextUtils
.
isEmpty
(
password
.
get
().
toString
()))
{
ToastUtils
.
showShort
(
"请输入密码!"
);
}
else
{
model
.
Login
(
/*userName.get().toString(), password.get().toString()*/
"13922222222"
,
"123456"
)
.
compose
(
RxUtils
.
schedulersTransformer
())
//线程调度
// .compose(RxUtils.exceptionTransformer()) // 网络错误的异常转换, 这里可以换成自己的ExceptionHandle
.
doOnSubscribe
(
SettingsViewModel
.
this
)
.
doOnSubscribe
(
new
Consumer
<
Disposable
>()
{
@Override
public
void
accept
(
Disposable
disposable
)
throws
Exception
{
showDialog
(
"正在请求..."
);
}
}).
subscribe
(
new
ApiDisposableObserver
<
String
>()
{
@Override
public
void
onSuccess
(
String
resultBean
)
{
//是指token
Interceptor_TOKEN
=
"Bearer "
+
resultBean
;
getuserInfo
();
// startActivity(HomeActivity.class);
}
@Override
public
void
onError
(
String
Error
)
{
dismissDialog
();
}
});
}
}
});
public
void
getuserInfo
()
{
model
.
getUserInfo
()
.
compose
(
RxUtils
.
schedulersTransformer
())
//线程调度
// .compose(RxUtils.exceptionTransformer()) // 网络错误的异常转换, 这里可以换成自己的ExceptionHandle
.
doOnSubscribe
(
SettingsViewModel
.
this
)
.
doOnSubscribe
(
new
Consumer
<
Disposable
>()
{
@Override
public
void
accept
(
Disposable
disposable
)
throws
Exception
{
}
}).
subscribe
(
new
ApiDisposableObserver
<
UserInfoBean
>()
{
@Override
public
void
onSuccess
(
UserInfoBean
resultBean
)
{
//将用户信息存储到本地
LocalData
.
saveUser
(
resultBean
.
getUser
());
dismissDialog
();
/* if (resultBean.getMerchant()==null)
{
Bundle bundle=new Bundle();
bundle.putInt("pageStep", R.id.registerMaterialFragment);
startActivity(MerchantEnterActivity.class,bundle);
}else if (resultBean.getMerchant().getAuditStatus().equals("0")){
Bundle bundle=new Bundle();
bundle.putInt("pageStep", R.id.merchantWaitFragment);
startActivity(MerchantEnterActivity.class,bundle);
}else {
LocalData.saveMerchant(resultBean.getMerchant());
startActivity(HomeActivity.class);
}*/
LocalData
.
saveMerchant
(
resultBean
.
getMerchant
());
// startActivity(AddProductActivity.class);
}
@Override
public
void
onError
(
String
Error
)
{
dismissDialog
();
}
});
}
}
consumer/src/main/res/drawable/radio_button_check_selector.xml
0 → 100644
View file @
9080d187
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<!-- 选中状态 -->
<item
android:state_enabled=
"true"
android:state_checked=
"true"
android:drawable=
"@mipmap/shangpin_icon_xuanzhong"
/>
<!-- 未被选中状态 -->
<item
android:state_enabled=
"true"
android:state_checked=
"false"
android:drawable=
"@mipmap/shangpin_icon_weixuanzhong"
/>
</selector>
\ No newline at end of file
consumer/src/main/res/layout/activity_login.xml
View file @
9080d187
...
...
@@ -90,6 +90,7 @@
android:layout_marginLeft=
"17dp"
style=
"@style/CommEdit"
android:hint=
"请输入账号"
android:inputType=
"phone"
android:text=
"@={loginViewModel.userName}"
android:background=
"@null"
/>
...
...
consumer/src/main/res/layout/activity_my_collection.xml
View file @
9080d187
...
...
@@ -16,7 +16,7 @@
<com.xx.xxviewlibrary.witget.XxBar
android:id=
"@+id/bar"
on_click=
"@{myCollectionViewModel.clickFinish}"
bar_title=
"
@{@string/navigation_sea}
"
bar_title=
"
商品
"
android:layout_width=
"match_parent"
android:layout_height=
"55dp"
/>
...
...
@@ -44,6 +44,21 @@
android:textColor=
"#FF5971A4"
binding:onClickCommand=
"@{myCollectionViewModel.confirm}"
/>
<RelativeLayout
android:id=
"@+id/rl_no_data"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_marginBottom=
"92dp"
android:layout_below=
"@id/bar"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:src=
"@mipmap/zhanwei_img_wushuju"
/>
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_goods_list"
android:layout_below=
"@id/bar"
...
...
@@ -78,6 +93,7 @@
android:textColor=
"#FF333333"
/>
<TextView
android:id=
"@+id/tv_check_count"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"3"
...
...
@@ -103,7 +119,8 @@
android:id=
"@+id/btn_aap_save"
android:textColor=
"@color/white"
android:textSize=
"16sp"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
binding:onClickCommand=
"@{myCollectionViewModel.confirm}"
/>
</LinearLayout>
...
...
consumer/src/main/res/layout/activity_settings.xml
View file @
9080d187
...
...
@@ -47,7 +47,8 @@
android:layout_height=
"72dp"
android:paddingLeft=
"17dp"
android:paddingRight=
"14dp"
android:background=
"@color/white"
>
android:background=
"@color/white"
binding:onClickCommand=
"@{settingsViewModel.goPwd}"
>
<TextView
android:layout_width=
"wrap_content"
...
...
@@ -77,7 +78,8 @@
android:layout_height=
"72dp"
android:paddingLeft=
"17dp"
android:paddingRight=
"14dp"
android:background=
"@color/white"
>
android:background=
"@color/white"
binding:onClickCommand=
"@{settingsViewModel.goPhone}"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
@@ -133,7 +135,8 @@
android:layout_below=
"@id/ll_part1"
android:layout_marginTop=
"17dp"
android:orientation=
"vertical"
android:background=
"@color/white"
>
android:background=
"@color/white"
binding:onClickCommand=
"@{settingsViewModel.goPrivacyClause}"
>
<RelativeLayout
android:id=
"@+id/rl_privacy_agreement"
android:layout_width=
"match_parent"
...
...
@@ -148,7 +151,7 @@
android:layout_centerVertical=
"true"
android:textSize=
"16sp"
android:textColor=
"#FF222222"
android:text=
"
修改密码
"
/>
android:text=
"
隐私协议
"
/>
<ImageView
android:layout_width=
"wrap_content"
...
...
consumer/src/main/res/layout/item_collection_goods.xml
View file @
9080d187
...
...
@@ -21,6 +21,21 @@
android:layout_height=
"165dp"
android:src=
"@mipmap/home_img_rexiaoqu"
/>
<RadioGroup
android:id=
"@+id/radio_selected_group"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:layout_marginRight=
"10dp"
android:layout_alignParentRight=
"true"
>
<androidx.appcompat.widget.AppCompatRadioButton
android:id=
"@+id/rb_check_state"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"@null"
android:button=
"@drawable/radio_button_check_selector"
/>
</RadioGroup>
<TextView
android:id=
"@+id/tv_goods_name"
android:layout_width=
"wrap_content"
...
...
consumer/src/main/res/layout/item_search_shop.xml
View file @
9080d187
...
...
@@ -25,6 +25,7 @@
<RelativeLayout
android:id=
"@+id/rl_shop_info"
android:layout_width=
"match_parent"
android:layout_marginTop=
"16dp"
android:layout_height=
"64dp"
android:layout_marginBottom=
"17dp"
>
...
...
consumer/src/main/res/layout/item_second_category.xml
View file @
9080d187
...
...
@@ -22,7 +22,6 @@
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"31dp"
android:textStyle=
"bold"
android:text=
"@={categoryBean.categoryName}"
android:textSize=
"16sp"
android:textColor=
"#FF333333"
/>
...
...
consumer/src/main/res/layout/item_second_category_text.xml
View file @
9080d187
...
...
@@ -15,7 +15,5 @@
android:paddingRight=
"17dp"
android:background=
"@drawable/bg_grey_radius_20"
android:textSize=
"14sp"
android:textColor=
"#FF333333"
android:text=
"@={categoryBean.categoryName}"
/>
android:textColor=
"#FF333333"
/>
</layout>
\ No newline at end of file
consumer/src/main/res/layout/item_third_category.xml
View file @
9080d187
...
...
@@ -23,12 +23,12 @@
android:src=
"@mipmap/third_category"
/>
<TextView
android:id=
"@+id/tv_category_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:layout_below=
"@id/iv_category_image"
android:layout_marginTop=
"13dp"
android:text=
"@={categoryBean.categoryName}"
android:textSize=
"13sp"
android:textColor=
"#FF333333"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment