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
1f59a09b
Commit
1f59a09b
authored
Nov 01, 2023
by
小费同学阿
💬
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev_xf_' into dev_xf_
parents
3f07162f
102f3bc2
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
135 additions
and
21 deletions
+135
-21
ApiService.kt
.../src/main/java/com/xx/hbhconsumer/data/http/ApiService.kt
+4
-0
GoodsRequest.java
...ava/com/xx/hbhconsumer/data/http/requst/GoodsRequest.java
+29
-0
ShopRequest.java
...java/com/xx/hbhconsumer/data/http/requst/ShopRequest.java
+3
-0
CategoryViewModel.java
...ava/com/xx/hbhconsumer/ui/category/CategoryViewModel.java
+2
-1
MapActivity.java
.../src/main/java/com/xx/hbhconsumer/ui/map/MapActivity.java
+1
-6
MapViewModel.java
...src/main/java/com/xx/hbhconsumer/ui/map/MapViewModel.java
+15
-1
ShopSearchActivity.java
...n/java/com/xx/hbhconsumer/ui/shop/ShopSearchActivity.java
+24
-7
ShopSearchViewModel.java
.../java/com/xx/hbhconsumer/ui/shop/ShopSearchViewModel.java
+23
-0
activity_shop_search.xml
consumer/src/main/res/layout/activity_shop_search.xml
+34
-6
No files found.
consumer/src/main/java/com/xx/hbhconsumer/data/http/ApiService.kt
View file @
1f59a09b
...
@@ -246,6 +246,10 @@ interface ApiService {
...
@@ -246,6 +246,10 @@ interface ApiService {
@POST
(
"app/commodity/consumer-app/merchant-commodity"
)
@POST
(
"app/commodity/consumer-app/merchant-commodity"
)
fun
getShopGoodsList
(
@Body
requestBody
:
RequestBody
):
Observable
<
BasePageResponse
<
ShopGoodsBean
>>
fun
getShopGoodsList
(
@Body
requestBody
:
RequestBody
):
Observable
<
BasePageResponse
<
ShopGoodsBean
>>
@Headers
(
"Content-type:application/json"
)
@GET
(
"app/commodity/consumer-app/six-commodity"
)
fun
getSixCommodity
(
@Query
(
"merchantId"
)
merchantId
:
String
?):
Observable
<
BaseResponse
<
List
<
ShopGoodsBean
>>>
@Headers
(
"Content-type:application/json"
)
@Headers
(
"Content-type:application/json"
)
@GET
(
"app/merchant/{businessId}"
)
@GET
(
"app/merchant/{businessId}"
)
fun
getShopDetail
(
@Path
(
"businessId"
)
businessId
:
String
?):
Observable
<
BaseResponse
<
ShopDetailBean
>>
fun
getShopDetail
(
@Path
(
"businessId"
)
businessId
:
String
?):
Observable
<
BaseResponse
<
ShopDetailBean
>>
...
...
consumer/src/main/java/com/xx/hbhconsumer/data/http/requst/GoodsRequest.java
View file @
1f59a09b
...
@@ -5,6 +5,9 @@ import com.xx.hbhconsumer.data.http.respons.CreditGoodsDetailBean;
...
@@ -5,6 +5,9 @@ import com.xx.hbhconsumer.data.http.respons.CreditGoodsDetailBean;
import
com.xx.hbhconsumer.data.http.respons.GoodsBean
;
import
com.xx.hbhconsumer.data.http.respons.GoodsBean
;
import
com.xx.hbhconsumer.data.http.respons.GoodsDetailBean
;
import
com.xx.hbhconsumer.data.http.respons.GoodsDetailBean
;
import
com.xx.hbhconsumer.data.http.respons.ShopAndGoodsBean
;
import
com.xx.hbhconsumer.data.http.respons.ShopAndGoodsBean
;
import
com.xx.hbhconsumer.data.http.respons.ShopGoodsBean
;
import
java.util.List
;
import
io.reactivex.rxjava3.core.Observable
;
import
io.reactivex.rxjava3.core.Observable
;
import
me.goldze.mvvmhabit.http.ApiParams
;
import
me.goldze.mvvmhabit.http.ApiParams
;
...
@@ -38,6 +41,32 @@ public class GoodsRequest extends BaseRespons {
...
@@ -38,6 +41,32 @@ public class GoodsRequest extends BaseRespons {
return
getApiService
().
queryGoodsDetail
(
businessId
);
return
getApiService
().
queryGoodsDetail
(
businessId
);
}
}
public
Observable
<
BaseResponse
<
List
<
ShopGoodsBean
>>>
getSixCommodity
(
String
merchantId
)
{
return
getApiService
().
getSixCommodity
(
merchantId
);
}
public
Observable
<
BasePageResponse
<
ShopGoodsBean
>>
getShopGoodsList
(
List
<
String
>
categoryIdList
,
String
merchantId
,
String
searchWord
,
String
sortRules
)
{
ApiParams
<
ShopGoodsListRequestBody
>
apiParams
=
new
ApiParams
<>();
ShopGoodsListRequestBody
requestBody
=
new
ShopGoodsListRequestBody
(
categoryIdList
,
merchantId
,
searchWord
,
sortRules
);
RequestBody
body
=
apiParams
.
setParams
(
requestBody
);
return
getApiService
().
getShopGoodsList
(
body
);
}
public
class
ShopGoodsListRequestBody
{
public
List
<
String
>
categoryIdList
;
public
String
merchantId
;
public
String
searchWord
;
public
String
sortRules
;
public
ShopGoodsListRequestBody
(
List
<
String
>
categoryIdList
,
String
merchantId
,
String
searchWord
,
String
sortRules
)
{
this
.
categoryIdList
=
categoryIdList
;
this
.
merchantId
=
merchantId
;
this
.
searchWord
=
searchWord
;
this
.
sortRules
=
sortRules
;
}
}
class
ListShopGoodsByCategoryRequestBody
{
class
ListShopGoodsByCategoryRequestBody
{
String
categoryId
;
String
categoryId
;
String
searchWord
;
String
searchWord
;
...
...
consumer/src/main/java/com/xx/hbhconsumer/data/http/requst/ShopRequest.java
View file @
1f59a09b
...
@@ -48,6 +48,9 @@ public class ShopRequest extends BaseRespons {
...
@@ -48,6 +48,9 @@ public class ShopRequest extends BaseRespons {
return
getApiService
().
getShopDetail
(
affiliatedCompany
);
return
getApiService
().
getShopDetail
(
affiliatedCompany
);
}
}
public
Observable
<
BaseResponse
<
List
<
ShopGoodsBean
>>>
getSixCommodity
(
String
merchantId
)
{
return
getApiService
().
getSixCommodity
(
merchantId
);
}
public
Observable
<
BasePageResponse
<
ShopGoodsBean
>>
getShopGoodsList
(
List
<
String
>
categoryIdList
,
String
merchantId
,
String
searchWord
,
String
sortRules
)
{
public
Observable
<
BasePageResponse
<
ShopGoodsBean
>>
getShopGoodsList
(
List
<
String
>
categoryIdList
,
String
merchantId
,
String
searchWord
,
String
sortRules
)
{
ApiParams
<
ShopGoodsListRequestBody
>
apiParams
=
new
ApiParams
<>();
ApiParams
<
ShopGoodsListRequestBody
>
apiParams
=
new
ApiParams
<>();
...
...
consumer/src/main/java/com/xx/hbhconsumer/ui/category/CategoryViewModel.java
View file @
1f59a09b
...
@@ -98,6 +98,7 @@ public class CategoryViewModel extends BaseViewModel<CategoryRequest> {
...
@@ -98,6 +98,7 @@ public class CategoryViewModel extends BaseViewModel<CategoryRequest> {
public
void
goGoodsList
(
String
categoryId
)
{
public
void
goGoodsList
(
String
categoryId
)
{
Bundle
bundle
=
new
Bundle
();
Bundle
bundle
=
new
Bundle
();
bundle
.
putString
(
"categoryId"
,
categoryId
);
bundle
.
putString
(
"categoryId"
,
categoryId
);
startActivity
(
GoodsListActivity
.
class
,
bundle
);
bundle
.
putString
(
"merchantId"
,
merchantId
);
startActivity
(
ShopSearchActivity
.
class
,
bundle
);
}
}
}
}
consumer/src/main/java/com/xx/hbhconsumer/ui/map/MapActivity.java
View file @
1f59a09b
...
@@ -50,7 +50,6 @@ import java.util.HashMap;
...
@@ -50,7 +50,6 @@ import java.util.HashMap;
import
me.goldze.mvvmhabit.base.BaseActivity
;
import
me.goldze.mvvmhabit.base.BaseActivity
;
import
me.goldze.mvvmhabit.utils.StringUtils
;
import
me.goldze.mvvmhabit.utils.StringUtils
;
import
me.goldze.mvvmhabit.utils.ToastUtils
;
import
me.tatarka.bindingcollectionadapter2.BR
;
import
me.tatarka.bindingcollectionadapter2.BR
;
public
class
MapActivity
extends
BaseActivity
<
ActivityMapBinding
,
MapViewModel
>
implements
OnFMMapInitListener
,
SearchBar
.
OnSearchResultCallback
,
public
class
MapActivity
extends
BaseActivity
<
ActivityMapBinding
,
MapViewModel
>
implements
OnFMMapInitListener
,
SearchBar
.
OnSearchResultCallback
,
...
@@ -159,7 +158,7 @@ public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel>
...
@@ -159,7 +158,7 @@ public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel>
fmMapView
.
setLayoutParams
(
params
);
fmMapView
.
setLayoutParams
(
params
);
binding
.
llMapView
.
removeAllViews
();
binding
.
llMapView
.
removeAllViews
();
binding
.
llMapView
.
addView
(
fmMapView
);
binding
.
llMapView
.
addView
(
fmMapView
);
mFMMap
=
new
FMMap
(
fmMapView
);
//获取地图操作对象
mFMMap
=
fmMapView
.
getFMMap
(
);
//获取地图操作对象
mFMMap
.
setOnFMMapInitListener
(
this
);
mFMMap
.
setOnFMMapInitListener
(
this
);
mFMMap
.
setOnFMMapClickListener
(
this
);
mFMMap
.
setOnFMMapClickListener
(
this
);
mFMMap
.
openMapById
(
mapId
,
true
);
//打开地图
mFMMap
.
openMapById
(
mapId
,
true
);
//打开地图
...
@@ -204,7 +203,6 @@ public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel>
...
@@ -204,7 +203,6 @@ public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel>
*/
*/
@Override
@Override
public
void
onMapInitSuccess
(
String
path
)
{
public
void
onMapInitSuccess
(
String
path
)
{
ToastUtils
.
showShort
(
"地图加载成功"
);
firstLoadSuccess
=
true
;
firstLoadSuccess
=
true
;
//线图层
//线图层
mLineLayer
=
mFMMap
.
getFMLayerProxy
().
getFMLineLayer
();
mLineLayer
=
mFMMap
.
getFMLayerProxy
().
getFMLineLayer
();
...
@@ -245,7 +243,6 @@ public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel>
...
@@ -245,7 +243,6 @@ public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel>
@Override
@Override
public
void
onMapInitFailure
(
String
s
,
int
errorCode
)
{
public
void
onMapInitFailure
(
String
s
,
int
errorCode
)
{
ToastUtils
.
showShort
(
"地图加载失败:"
+
errorCode
);
FMLog
.
le
(
"onMapInitFailure"
,
FMErrorMsg
.
getErrorMsg
(
errorCode
));
FMLog
.
le
(
"onMapInitFailure"
,
FMErrorMsg
.
getErrorMsg
(
errorCode
));
}
}
...
@@ -325,7 +322,6 @@ public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel>
...
@@ -325,7 +322,6 @@ public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel>
// 起点
// 起点
if
(
mSartCoord
==
null
)
{
if
(
mSartCoord
==
null
)
{
ToastUtils
.
showShort
(
"添加起点"
);
clear
();
clear
();
mSartCoord
=
mapCoordResult
.
getMapCoord
();
mSartCoord
=
mapCoordResult
.
getMapCoord
();
...
@@ -336,7 +332,6 @@ public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel>
...
@@ -336,7 +332,6 @@ public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel>
// 终点
// 终点
if
(
mEndCoord
==
null
)
{
if
(
mEndCoord
==
null
)
{
ToastUtils
.
showShort
(
"添加终点"
);
mEndCoord
=
mapCoordResult
.
getMapCoord
();
mEndCoord
=
mapCoordResult
.
getMapCoord
();
mEndGroupId
=
mapCoordResult
.
getGroupId
();
mEndGroupId
=
mapCoordResult
.
getGroupId
();
createEndImageMarker
();
createEndImageMarker
();
...
...
consumer/src/main/java/com/xx/hbhconsumer/ui/map/MapViewModel.java
View file @
1f59a09b
...
@@ -7,6 +7,7 @@ import androidx.lifecycle.MutableLiveData;
...
@@ -7,6 +7,7 @@ import androidx.lifecycle.MutableLiveData;
import
com.xx.hbhconsumer.data.http.requst.MapRequest
;
import
com.xx.hbhconsumer.data.http.requst.MapRequest
;
import
com.xx.hbhconsumer.data.http.respons.DictValueBean
;
import
com.xx.hbhconsumer.data.http.respons.DictValueBean
;
import
com.xx.hbhconsumer.data.http.respons.YearBean
;
import
com.xx.hbhconsumer.data.local.LocalData
;
import
com.xx.hbhconsumer.data.local.LocalData
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -69,7 +70,7 @@ public class MapViewModel extends BaseViewModel<MapRequest> {
...
@@ -69,7 +70,7 @@ public class MapViewModel extends BaseViewModel<MapRequest> {
for
(
DictValueBean
dictValueBean
:
recruitBeans
)
{
for
(
DictValueBean
dictValueBean
:
recruitBeans
)
{
if
(
LocalData
.
getAffiliatedCompany
().
equals
(
"2"
)
&&
dictValueBean
.
getDictLabel
().
equals
(
"滨海宏达公司"
))
{
if
(
LocalData
.
getAffiliatedCompany
().
equals
(
"2"
)
&&
dictValueBean
.
getDictLabel
().
equals
(
"滨海宏达公司"
))
{
newList
.
add
(
dictValueBean
);
newList
.
add
(
dictValueBean
);
}
else
{
}
else
if
(!
dictValueBean
.
getDictLabel
().
equals
(
"滨海宏达公司"
))
{
if
(!
StringUtils
.
isEmpty
(
dictValueBean
.
getRemark
()))
{
if
(!
StringUtils
.
isEmpty
(
dictValueBean
.
getRemark
()))
{
newList
.
add
(
dictValueBean
);
newList
.
add
(
dictValueBean
);
}
}
...
@@ -78,6 +79,7 @@ public class MapViewModel extends BaseViewModel<MapRequest> {
...
@@ -78,6 +79,7 @@ public class MapViewModel extends BaseViewModel<MapRequest> {
if
(
newList
.
isEmpty
())
{
if
(
newList
.
isEmpty
())
{
ToastUtils
.
showShort
(
"暂无地图数据"
);
ToastUtils
.
showShort
(
"暂无地图数据"
);
}
else
{
}
else
{
newList
.
get
(
0
).
setChecked
(
true
);
checkMap
(
newList
.
get
(
0
));
checkMap
(
newList
.
get
(
0
));
}
}
mapList
.
postValue
(
newList
);
mapList
.
postValue
(
newList
);
...
@@ -98,6 +100,18 @@ public class MapViewModel extends BaseViewModel<MapRequest> {
...
@@ -98,6 +100,18 @@ public class MapViewModel extends BaseViewModel<MapRequest> {
});
});
public
void
checkMap
(
DictValueBean
data
)
{
public
void
checkMap
(
DictValueBean
data
)
{
List
<
DictValueBean
>
list
=
new
ArrayList
<>();
for
(
DictValueBean
yearBean
:
mapList
.
getValue
())
{
if
(
data
.
getDictLabel
().
equals
(
yearBean
.
getDictLabel
()))
{
yearBean
.
setChecked
(
true
);
}
else
{
yearBean
.
setChecked
(
false
);
}
list
.
add
(
yearBean
);
}
mapList
.
postValue
(
list
);
region
.
postValue
(
data
.
getDictLabel
());
region
.
postValue
(
data
.
getDictLabel
());
mapId
.
postValue
(
data
.
getRemark
());
mapId
.
postValue
(
data
.
getRemark
());
checkMapFlag
.
postValue
(
false
);
checkMapFlag
.
postValue
(
false
);
...
...
consumer/src/main/java/com/xx/hbhconsumer/ui/shop/ShopSearchActivity.java
View file @
1f59a09b
...
@@ -22,6 +22,7 @@ import java.util.ArrayList;
...
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.List
;
import
me.goldze.mvvmhabit.base.BaseActivity
;
import
me.goldze.mvvmhabit.base.BaseActivity
;
import
me.goldze.mvvmhabit.utils.StringUtils
;
import
me.tatarka.bindingcollectionadapter2.BR
;
import
me.tatarka.bindingcollectionadapter2.BR
;
public
class
ShopSearchActivity
extends
BaseActivity
<
ActivityShopSearchBinding
,
ShopSearchViewModel
>
{
public
class
ShopSearchActivity
extends
BaseActivity
<
ActivityShopSearchBinding
,
ShopSearchViewModel
>
{
...
@@ -38,7 +39,12 @@ public class ShopSearchActivity extends BaseActivity<ActivityShopSearchBinding,
...
@@ -38,7 +39,12 @@ public class ShopSearchActivity extends BaseActivity<ActivityShopSearchBinding,
@Override
@Override
public
void
initData
()
{
public
void
initData
()
{
super
.
initData
();
super
.
initData
();
String
merchantId
=
getIntent
().
getStringExtra
(
"merchantId"
);
if
(
StringUtils
.
isEmpty
(
merchantId
))
{
binding
.
tvSort
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
binding
.
tvSort
.
setVisibility
(
View
.
GONE
);
}
viewModel
.
showSortFlag
.
observe
(
this
,
showSortFlag
->
{
viewModel
.
showSortFlag
.
observe
(
this
,
showSortFlag
->
{
if
(
showSortFlag
)
{
if
(
showSortFlag
)
{
binding
.
rlSearchArea
.
setVisibility
(
View
.
VISIBLE
);
binding
.
rlSearchArea
.
setVisibility
(
View
.
VISIBLE
);
...
@@ -107,12 +113,9 @@ public class ShopSearchActivity extends BaseActivity<ActivityShopSearchBinding,
...
@@ -107,12 +113,9 @@ public class ShopSearchActivity extends BaseActivity<ActivityShopSearchBinding,
SearchHistoryAdapter
searchHistoryAdapter
=
new
SearchHistoryAdapter
(
this
);
SearchHistoryAdapter
searchHistoryAdapter
=
new
SearchHistoryAdapter
(
this
);
//把adapterset进去
//把adapterset进去
binding
.
rvSearchHistory
.
setAdapter
(
searchHistoryAdapter
);
binding
.
rvSearchHistory
.
setAdapter
(
searchHistoryAdapter
);
searchHistoryAdapter
.
setOnItemClick
(
new
xxBaseRecyclerViewAdapter
.
OnItemClick
<
String
>()
{
searchHistoryAdapter
.
setOnItemClick
((
position
,
data
)
->
{
@Override
viewModel
.
searchWordClick
(
data
);
public
void
itemClickCalBack
(
int
position
,
String
data
)
{
binding
.
etSearch
.
clearFocus
();
viewModel
.
searchWordClick
(
data
);
binding
.
etSearch
.
clearFocus
();
}
});
});
viewModel
.
searchWordList
.
observe
(
this
,
searchWordList
->
{
viewModel
.
searchWordList
.
observe
(
this
,
searchWordList
->
{
...
@@ -139,6 +142,7 @@ public class ShopSearchActivity extends BaseActivity<ActivityShopSearchBinding,
...
@@ -139,6 +142,7 @@ public class ShopSearchActivity extends BaseActivity<ActivityShopSearchBinding,
shopDetailGoodsAdapter
.
notifyDataSetChanged
();
shopDetailGoodsAdapter
.
notifyDataSetChanged
();
if
(
shopBeanList
.
isEmpty
())
{
if
(
shopBeanList
.
isEmpty
())
{
binding
.
rlNoData
.
setVisibility
(
View
.
VISIBLE
);
binding
.
rlNoData
.
setVisibility
(
View
.
VISIBLE
);
viewModel
.
loadShopRecommendGoods
();
}
else
{
}
else
{
binding
.
rlNoData
.
setVisibility
(
View
.
GONE
);
binding
.
rlNoData
.
setVisibility
(
View
.
GONE
);
}
}
...
@@ -147,6 +151,19 @@ public class ShopSearchActivity extends BaseActivity<ActivityShopSearchBinding,
...
@@ -147,6 +151,19 @@ public class ShopSearchActivity extends BaseActivity<ActivityShopSearchBinding,
binding
.
rlSearchHistoryBar
.
setVisibility
(
View
.
GONE
);
binding
.
rlSearchHistoryBar
.
setVisibility
(
View
.
GONE
);
});
});
ShopDetailGoodsAdapter
shopDetailGoodsAdapter1
=
new
ShopDetailGoodsAdapter
(
ShopSearchActivity
.
this
);
GridLayoutManager
gridLayoutManager1
=
new
GridLayoutManager
(
ShopSearchActivity
.
this
,
2
);
binding
.
rvRecommend
.
setLayoutManager
(
gridLayoutManager1
);
binding
.
rvRecommend
.
setAdapter
(
shopDetailGoodsAdapter1
);
shopDetailGoodsAdapter1
.
setOnItemClick
((
position
,
data
)
->
viewModel
.
goShopGoodsDetail
(
data
.
getBusinessId
()));
viewModel
.
shopRecommendGoodsBeanList
.
observe
(
this
,
shopBeanList
->
{
binding
.
rlCategoryBar
.
setVisibility
(
View
.
VISIBLE
);
shopDetailGoodsAdapter1
.
mList
=
shopBeanList
;
shopDetailGoodsAdapter1
.
notifyDataSetChanged
();
});
}
}
@Override
@Override
...
...
consumer/src/main/java/com/xx/hbhconsumer/ui/shop/ShopSearchViewModel.java
View file @
1f59a09b
...
@@ -24,6 +24,7 @@ import io.reactivex.rxjava3.functions.Consumer;
...
@@ -24,6 +24,7 @@ import io.reactivex.rxjava3.functions.Consumer;
import
me.goldze.mvvmhabit.base.BaseViewModel
;
import
me.goldze.mvvmhabit.base.BaseViewModel
;
import
me.goldze.mvvmhabit.binding.command.BindingAction
;
import
me.goldze.mvvmhabit.binding.command.BindingAction
;
import
me.goldze.mvvmhabit.binding.command.BindingCommand
;
import
me.goldze.mvvmhabit.binding.command.BindingCommand
;
import
me.goldze.mvvmhabit.http.ApiDisposableObserver
;
import
me.goldze.mvvmhabit.http.ApiDisposablePageObserver
;
import
me.goldze.mvvmhabit.http.ApiDisposablePageObserver
;
import
me.goldze.mvvmhabit.utils.RxUtils
;
import
me.goldze.mvvmhabit.utils.RxUtils
;
import
me.goldze.mvvmhabit.utils.StringUtils
;
import
me.goldze.mvvmhabit.utils.StringUtils
;
...
@@ -41,6 +42,7 @@ public class ShopSearchViewModel extends BaseViewModel<ShopRequest> {
...
@@ -41,6 +42,7 @@ public class ShopSearchViewModel extends BaseViewModel<ShopRequest> {
private
List
<
String
>
categoryIdList
;
private
List
<
String
>
categoryIdList
;
public
MutableLiveData
<
List
<
String
>>
searchWordList
=
new
MutableLiveData
<>(
new
ArrayList
<>());
public
MutableLiveData
<
List
<
String
>>
searchWordList
=
new
MutableLiveData
<>(
new
ArrayList
<>());
public
MutableLiveData
<
List
<
ShopGoodsBean
>>
shopGoodsBeanList
=
new
MutableLiveData
<>(
new
ArrayList
<>());
public
MutableLiveData
<
List
<
ShopGoodsBean
>>
shopGoodsBeanList
=
new
MutableLiveData
<>(
new
ArrayList
<>());
public
MutableLiveData
<
List
<
ShopGoodsBean
>>
shopRecommendGoodsBeanList
=
new
MutableLiveData
<>(
new
ArrayList
<>());
public
MutableLiveData
<
Integer
>
searchState
=
new
MutableLiveData
<>(
0
);
public
MutableLiveData
<
Integer
>
searchState
=
new
MutableLiveData
<>(
0
);
...
@@ -112,6 +114,27 @@ public class ShopSearchViewModel extends BaseViewModel<ShopRequest> {
...
@@ -112,6 +114,27 @@ public class ShopSearchViewModel extends BaseViewModel<ShopRequest> {
});
});
}
}
public
void
loadShopRecommendGoods
()
{
model
.
getSixCommodity
(
merchantId
)
.
compose
(
RxUtils
.
schedulersTransformer
())
//线程调度
.
doOnSubscribe
(
ShopSearchViewModel
.
this
)
.
doOnSubscribe
(
new
Consumer
<
Disposable
>()
{
@Override
public
void
accept
(
Disposable
disposable
)
throws
Exception
{
}
}).
subscribe
(
new
ApiDisposableObserver
<
List
<
ShopGoodsBean
>>()
{
@Override
public
void
onSuccess
(
List
<
ShopGoodsBean
>
resultBean
)
{
shopRecommendGoodsBeanList
.
postValue
(
resultBean
);
}
@Override
public
void
onError
(
String
Error
)
{
dismissDialog
();
}
});
}
public
BindingCommand
goCategory
=
new
BindingCommand
(
new
BindingAction
()
{
public
BindingCommand
goCategory
=
new
BindingCommand
(
new
BindingAction
()
{
@Override
@Override
public
void
call
()
{
public
void
call
()
{
...
...
consumer/src/main/res/layout/activity_shop_search.xml
View file @
1f59a09b
...
@@ -131,6 +131,7 @@
...
@@ -131,6 +131,7 @@
android:layout_marginTop=
"13dp"
>
android:layout_marginTop=
"13dp"
>
<TextView
<TextView
android:id=
"@+id/tv_sort"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerVertical=
"true"
android:layout_centerVertical=
"true"
...
@@ -177,14 +178,41 @@
...
@@ -177,14 +178,41 @@
android:id=
"@+id/rl_no_data"
android:id=
"@+id/rl_no_data"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:
layout_marginBottom=
"92dp
"
android:
visibility=
"gone
"
android:layout_below=
"@id/
top
_bar"
>
android:layout_below=
"@id/
rl_category
_bar"
>
<ImageView
<LinearLayout
android:layout_width=
"wrap_content"
android:id=
"@+id/tv_no_data"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:layout_marginLeft=
"17dp"
android:src=
"@mipmap/zhanwei_img_wushuju"
/>
android:layout_marginRight=
"17dp"
android:layout_marginTop=
"21dp"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@mipmap/dianpu_icon_tishi"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"5dp"
android:textColor=
"#C8382A"
android:textSize=
"14sp"
android:text=
"没有找到商品,以下是为您推荐的本店其他商品"
/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_recommend"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"17dp"
android:layout_marginRight=
"17dp"
android:layout_marginTop=
"21dp"
android:layout_below=
"@id/tv_no_data"
/>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
<RelativeLayout
...
...
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