Commit 28ffd364 authored by david's avatar david

完善搜索功能

parent 92ee4707
...@@ -2,13 +2,17 @@ package com.xx.hbhconsumer.adapter; ...@@ -2,13 +2,17 @@ package com.xx.hbhconsumer.adapter;
import android.content.Context; import android.content.Context;
import com.bumptech.glide.Glide;
import com.xx.hbhconsumer.R; import com.xx.hbhconsumer.R;
import com.xx.hbhconsumer.data.http.respons.OrderBean; import com.xx.hbhconsumer.data.http.respons.OrderBean;
import com.xx.hbhconsumer.data.http.respons.SearchGoodsBean; import com.xx.hbhconsumer.data.http.respons.SearchGoodsBean;
import com.xx.hbhconsumer.databinding.ItemSearchGoodsBinding; import com.xx.hbhconsumer.databinding.ItemSearchGoodsBinding;
import com.xx.hbhconsumer.databinding.ItemSearchShopGoodsBinding; import com.xx.hbhconsumer.databinding.ItemSearchShopGoodsBinding;
import com.xx.hbhconsumer.utils.RetrofitClient;
import com.xx.xxviewlibrary.base.xxBaseRecyclerViewAdapter; import com.xx.xxviewlibrary.base.xxBaseRecyclerViewAdapter;
import me.goldze.mvvmhabit.utils.StringUtils;
public class SearchGoodsAdapter extends xxBaseRecyclerViewAdapter<ItemSearchGoodsBinding, SearchGoodsBean> { public class SearchGoodsAdapter extends xxBaseRecyclerViewAdapter<ItemSearchGoodsBinding, SearchGoodsBean> {
...@@ -26,5 +30,14 @@ public class SearchGoodsAdapter extends xxBaseRecyclerViewAdapter<ItemSearchGood ...@@ -26,5 +30,14 @@ public class SearchGoodsAdapter extends xxBaseRecyclerViewAdapter<ItemSearchGood
protected void covert(ItemSearchGoodsBinding dataBind, SearchGoodsBean data, int position) { protected void covert(ItemSearchGoodsBinding dataBind, SearchGoodsBean data, int position) {
// 将接口调出来的布局遍历上去 // 将接口调出来的布局遍历上去
dataBind.setSearchGoodsBean(data); dataBind.setSearchGoodsBean(data);
Glide.with(mContext).load(RetrofitClient.baseImgUrl + data.getCommodityPictureFile().getFilePath())
.into(dataBind.ivGoodsImg);
dataBind.tvGoodsName.setText(data.getCommodityName());
String price = String.valueOf(data.getCommodityPrice());
if (!StringUtils.isEmpty(price) && price.contains("\\.")) {
dataBind.tvPriceInteger.setText(price.split("\\.")[0]);
dataBind.tvPriceDecimal.setText("." + price.split("\\.")[1]);
}
} }
} }
...@@ -40,16 +40,14 @@ public class SearchShopAdapter extends xxBaseRecyclerViewAdapter<ItemSearchShopB ...@@ -40,16 +40,14 @@ public class SearchShopAdapter extends xxBaseRecyclerViewAdapter<ItemSearchShopB
.into(dataBind.ivShopLogo); .into(dataBind.ivShopLogo);
} }
dataBind.rbLevel.setRating(Float.parseFloat(String.valueOf(data.getRating())));
dataBind.rvGoodsList.setNestedScrollingEnabled(false); dataBind.rvGoodsList.setNestedScrollingEnabled(false);
//获取适配器上下文 //获取适配器上下文
SearchShopGoodsAdapter orderListAdapter = new SearchShopGoodsAdapter(mContext); SearchShopGoodsAdapter orderListAdapter = new SearchShopGoodsAdapter(mContext);
LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
dataBind.rvGoodsList.setLayoutManager(layoutManager);
//把adapterset进去 //把adapterset进去
dataBind.rvGoodsList.setAdapter(orderListAdapter); dataBind.rvGoodsList.setAdapter(orderListAdapter);
orderListAdapter.mList = data.getCommodityList(); orderListAdapter.mList = data.getCommodityList();
orderListAdapter.notifyDataSetChanged();
} }
} }
...@@ -4,5 +4,5 @@ data class SearchGoodsBean( ...@@ -4,5 +4,5 @@ data class SearchGoodsBean(
val businessId: String, val businessId: String,
val commodityName: String, val commodityName: String,
val commodityPictureFile: CommodityPictureFile, val commodityPictureFile: CommodityPictureFile,
val commodityPrice: Int val commodityPrice: Double
) )
\ No newline at end of file
...@@ -4,7 +4,7 @@ data class SearchShopBean( ...@@ -4,7 +4,7 @@ data class SearchShopBean(
val businessId: String, val businessId: String,
val commodityList: List<Commodity>, val commodityList: List<Commodity>,
val logoFile: LogoFile, val logoFile: LogoFile,
val rating: Int, val rating: Double,
val storeName: String val storeName: String
) )
......
...@@ -19,7 +19,7 @@ data class ShopDetailBean( ...@@ -19,7 +19,7 @@ data class ShopDetailBean(
val operatingPermit: String, val operatingPermit: String,
val operation: String, val operation: String,
val personPhone: String, val personPhone: String,
val rating: Int, val rating: Double,
val remark: String, val remark: String,
val responsiblePerson: String, val responsiblePerson: String,
val status: String, val status: String,
......
...@@ -3,31 +3,19 @@ package com.xx.hbhconsumer.ui.search; ...@@ -3,31 +3,19 @@ package com.xx.hbhconsumer.ui.search;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import androidx.viewpager2.widget.ViewPager2;
import com.google.android.flexbox.FlexDirection; import com.google.android.flexbox.FlexDirection;
import com.google.android.flexbox.FlexWrap; import com.google.android.flexbox.FlexWrap;
import com.google.android.flexbox.FlexboxLayoutManager; import com.google.android.flexbox.FlexboxLayoutManager;
import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;
import com.xx.hbhconsumer.R; import com.xx.hbhconsumer.R;
import com.xx.hbhconsumer.adapter.OrderAdapter;
import com.xx.hbhconsumer.adapter.SearchGoodsAdapter; import com.xx.hbhconsumer.adapter.SearchGoodsAdapter;
import com.xx.hbhconsumer.adapter.SearchHistoryAdapter; import com.xx.hbhconsumer.adapter.SearchHistoryAdapter;
import com.xx.hbhconsumer.adapter.SearchShopAdapter; import com.xx.hbhconsumer.adapter.SearchShopAdapter;
import com.xx.hbhconsumer.data.http.requst.LoginRequest;
import com.xx.hbhconsumer.data.http.requst.SearchRequest; import com.xx.hbhconsumer.data.http.requst.SearchRequest;
import com.xx.hbhconsumer.data.http.respons.OrderBean; import com.xx.hbhconsumer.data.http.respons.OrderBean;
import com.xx.hbhconsumer.data.http.respons.SearchGoodsBean;
import com.xx.hbhconsumer.data.http.respons.SearchShopBean;
import com.xx.hbhconsumer.databinding.ActivitySearchBinding; import com.xx.hbhconsumer.databinding.ActivitySearchBinding;
import com.xx.hbhconsumer.ui.order.OrderListFragment;
import com.xx.hbhconsumer.ui.recruit.RecruitListViewModel;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -53,87 +41,84 @@ public class SearchActivity extends BaseActivity<ActivitySearchBinding, SearchVi ...@@ -53,87 +41,84 @@ public class SearchActivity extends BaseActivity<ActivitySearchBinding, SearchVi
List<OrderBean> orderBeanList = new ArrayList<>(); List<OrderBean> orderBeanList = new ArrayList<>();
viewModel.showPriceFlag.observe(this, new Observer<Boolean>() { viewModel.showPriceFlag.observe(this, showPriceFlag -> {
@Override if (showPriceFlag) {
public void onChanged(Boolean showPriceFlag) { binding.rlSearchArea.setVisibility(View.VISIBLE);
if (showPriceFlag) { binding.llPriceSearch.setVisibility(View.VISIBLE);
binding.rlSearchArea.setVisibility(View.VISIBLE);
binding.llPriceSearch.setVisibility(View.VISIBLE); viewModel.showSortFlag.postValue(false);
} else { } else {
binding.rlSearchArea.setVisibility(View.GONE); binding.rlSearchArea.setVisibility(View.GONE);
binding.llPriceSearch.setVisibility(View.GONE); binding.llPriceSearch.setVisibility(View.GONE);
}
} }
}); });
viewModel.showSortFlag.observe(this, new Observer<Boolean>() { viewModel.showSortFlag.observe(this, showPriceFlag -> {
@Override if (showPriceFlag) {
public void onChanged(Boolean showPriceFlag) { binding.rlSearchArea.setVisibility(View.VISIBLE);
if (showPriceFlag) { binding.llSortSelect.setVisibility(View.VISIBLE);
binding.rlSearchArea.setVisibility(View.VISIBLE);
binding.llSortSelect.setVisibility(View.VISIBLE); viewModel.showPriceFlag.postValue(false);
} else { } else {
binding.rlSearchArea.setVisibility(View.GONE); binding.rlSearchArea.setVisibility(View.GONE);
binding.llSortSelect.setVisibility(View.GONE); binding.llSortSelect.setVisibility(View.GONE);
}
} }
}); });
viewModel.searchType.observe(this, new Observer<Integer>() { viewModel.searchType.observe(this, searchType -> {
@Override if (searchType == 0) {
public void onChanged(Integer searchType) { binding.rvSearchHistory.setVisibility(View.VISIBLE);
if (searchType == 0) { binding.rlSearchHistoryBar.setVisibility(View.VISIBLE);
binding.rvSearchHistory.setVisibility(View.VISIBLE); binding.rvSearchGoodsList.setVisibility(View.GONE);
binding.rlSearchHistoryBar.setVisibility(View.VISIBLE); binding.rvSearchShopList.setVisibility(View.GONE);
binding.rvSearchResult.setVisibility(View.GONE); binding.rlSearchTab.setVisibility(View.GONE);
binding.rlSearchTab.setVisibility(View.GONE); binding.rlSearchArea.setVisibility(View.GONE);
binding.rlSearchArea.setVisibility(View.GONE); binding.rlSearchBar.setVisibility(View.GONE);
binding.rlSearchBar.setVisibility(View.GONE);
} else {
binding.rvSearchHistory.setVisibility(View.GONE);
binding.rlSearchHistoryBar.setVisibility(View.GONE);
if (searchType == 1) {
binding.rvSearchGoodsList.setVisibility(View.VISIBLE);
binding.rvSearchShopList.setVisibility(View.GONE);
} else { } else {
binding.rvSearchHistory.setVisibility(View.GONE); binding.rvSearchGoodsList.setVisibility(View.GONE);
binding.rlSearchHistoryBar.setVisibility(View.GONE); binding.rvSearchShopList.setVisibility(View.VISIBLE);
binding.rvSearchResult.setVisibility(View.VISIBLE);
binding.rlSearchTab.setVisibility(View.VISIBLE);
binding.rlSearchBar.setVisibility(View.VISIBLE);
} }
binding.rlSearchTab.setVisibility(View.VISIBLE);
binding.rlSearchBar.setVisibility(View.VISIBLE);
} }
}); });
viewModel.searchGoodsBeanList.observe(this, new Observer<List<SearchGoodsBean>>() { //获取适配器上下文
@Override SearchGoodsAdapter searchGoodsAdapter = new SearchGoodsAdapter(SearchActivity.this);
public void onChanged(List<SearchGoodsBean> goodsBeanList) { //获取适配器上下文
//获取适配器上下文 GridLayoutManager manager = new GridLayoutManager(SearchActivity.this,2);
SearchGoodsAdapter searchGoodsAdapter = new SearchGoodsAdapter(SearchActivity.this); binding.rvSearchGoodsList.setLayoutManager(manager);
//获取适配器上下文 //把adapterset进去
GridLayoutManager manager = new GridLayoutManager(SearchActivity.this,2); binding.rvSearchGoodsList.setAdapter(searchGoodsAdapter);
binding.rvSearchResult.setLayoutManager(manager); searchGoodsAdapter.setOnItemClick((position, data) -> viewModel.goGoodsDetail(data.getBusinessId()));
//把adapterset进去
binding.rvSearchResult.setAdapter(searchGoodsAdapter);
searchGoodsAdapter.mList = goodsBeanList;
searchGoodsAdapter.setOnItemClick((position, data) -> viewModel.goGoodsDetail(position));
} viewModel.searchGoodsBeanList.observe(this, goodsBeanList -> {
searchGoodsAdapter.mList = goodsBeanList;
searchGoodsAdapter.notifyDataSetChanged();
}); });
viewModel.searchShopBeanList.observe(this, new Observer<List<SearchShopBean>>() {
@Override
public void onChanged(List<SearchShopBean> searchShopBeanList) {
//获取适配器上下文
SearchShopAdapter orderListAdapter = new SearchShopAdapter(SearchActivity.this);
//把adapterset进去
binding.rvSearchResult.setAdapter(orderListAdapter);
orderListAdapter.mList = searchShopBeanList;
orderListAdapter.setOnItemClick((position, data) -> viewModel.goShopDetail(data.getBusinessId())); //获取适配器上下文
SearchShopAdapter searchShopAdapter = new SearchShopAdapter(SearchActivity.this);
//把adapterset进去
binding.rvSearchShopList.setAdapter(searchShopAdapter);
searchShopAdapter.setOnItemClick((position, data) -> viewModel.goShopDetail(data.getBusinessId()));
} viewModel.searchShopBeanList.observe(this, searchShopBeanList -> {
searchShopAdapter.mList = searchShopBeanList;
searchShopAdapter.notifyDataSetChanged();
}); });
FlexboxLayoutManager manager = new FlexboxLayoutManager(this, FlexDirection.ROW, FlexWrap.WRAP); FlexboxLayoutManager flexboxLayoutManager = new FlexboxLayoutManager(this, FlexDirection.ROW, FlexWrap.WRAP);
binding.rvSearchHistory.setLayoutManager(manager); binding.rvSearchHistory.setLayoutManager(flexboxLayoutManager);
//获取适配器上下文 //获取适配器上下文
SearchHistoryAdapter orderListAdapter = new SearchHistoryAdapter(this); SearchHistoryAdapter orderListAdapter = new SearchHistoryAdapter(this);
//把adapterset进去 //把adapterset进去
...@@ -145,12 +130,10 @@ public class SearchActivity extends BaseActivity<ActivitySearchBinding, SearchVi ...@@ -145,12 +130,10 @@ public class SearchActivity extends BaseActivity<ActivitySearchBinding, SearchVi
public void onTabSelected(TabLayout.Tab tab) { public void onTabSelected(TabLayout.Tab tab) {
switch (tab.getPosition()) { switch (tab.getPosition()) {
case 0: case 0:
viewModel.searchType.postValue(1); viewModel.search(1);
viewModel.search();
break; break;
case 1: case 1:
viewModel.searchType.postValue(2); viewModel.search(2);
viewModel.search();
break; break;
} }
} }
......
package com.xx.hbhconsumer.ui.search;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.GridLayoutManager;
import com.xx.hbhconsumer.BR;
import com.xx.hbhconsumer.R;
import com.xx.hbhconsumer.adapter.OrderAdapter;
import com.xx.hbhconsumer.adapter.SearchGoodsAdapter;
import com.xx.hbhconsumer.adapter.ShopGoodsAdapter;
import com.xx.hbhconsumer.data.http.requst.LoginRequest;
import com.xx.hbhconsumer.data.http.respons.OrderBean;
import com.xx.hbhconsumer.databinding.FragmentOrderListBinding;
import com.xx.hbhconsumer.databinding.FragmentSearchGoodsListBinding;
import java.util.ArrayList;
import java.util.List;
import me.goldze.mvvmhabit.base.BaseFragment;
public class SearchGoodsListFragment extends BaseFragment<FragmentSearchGoodsListBinding, SearchGoodsListViewModel> {
public static SearchGoodsListFragment newInstance(Integer orderType) {
Bundle args = new Bundle();
args.putInt("orderType", orderType);
SearchGoodsListFragment fragment = new SearchGoodsListFragment();
fragment.setArguments(args);
return fragment;
}
@Override
public void initData() {
List<OrderBean> orderBeanList = new ArrayList<>();
}
@Override
public int viewModelType() {
return 1;
}
@Override
public int initContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return R.layout.fragment_search_goods_list;
}
@Override
public int initVariableId() {
return BR.searchGoodsListViewModel;
}
@Override
public SearchGoodsListViewModel initViewModel() {
LoginRequest model = new LoginRequest();
return new SearchGoodsListViewModel(getActivity().getApplication(), model);
}
}
package com.xx.hbhconsumer.ui.search;
import android.app.Application;
import androidx.annotation.NonNull;
import com.xx.hbhconsumer.data.http.requst.LoginRequest;
import com.xx.hbhconsumer.ui.order.OrderDetailActivity;
import me.goldze.mvvmhabit.base.BaseViewModel;
public class SearchGoodsListViewModel extends BaseViewModel<LoginRequest> {
public SearchGoodsListViewModel(@NonNull Application application, LoginRequest model) {
super(application, model);
}
public void goOrderDetail(int position) {
startActivity(OrderDetailActivity.class);
}
}
package com.xx.hbhconsumer.ui.search;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import com.xx.hbhconsumer.BR;
import com.xx.hbhconsumer.R;
import com.xx.hbhconsumer.adapter.OrderAdapter;
import com.xx.hbhconsumer.adapter.SearchShopAdapter;
import com.xx.hbhconsumer.data.http.requst.LoginRequest;
import com.xx.hbhconsumer.data.http.respons.OrderBean;
import com.xx.hbhconsumer.data.http.respons.ShopAndGoodsBean;
import com.xx.hbhconsumer.databinding.FragmentOrderListBinding;
import com.xx.hbhconsumer.databinding.FragmentSearchShopListBinding;
import java.util.ArrayList;
import java.util.List;
import me.goldze.mvvmhabit.base.BaseFragment;
public class SearchShopListFragment extends BaseFragment<FragmentSearchShopListBinding, SearchShopListViewModel> {
public static SearchShopListFragment newInstance(Integer orderType) {
Bundle args = new Bundle();
args.putInt("orderType", orderType);
SearchShopListFragment fragment = new SearchShopListFragment();
fragment.setArguments(args);
return fragment;
}
@Override
public void initData() {
List<ShopAndGoodsBean> orderBeanList = new ArrayList<>();
ShopAndGoodsBean orderBean = new ShopAndGoodsBean();
orderBeanList.add(orderBean);
orderBeanList.add(orderBean);
orderBeanList.add(orderBean);
orderBeanList.add(orderBean);
}
@Override
public int viewModelType() {
return 1;
}
@Override
public int initContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return R.layout.fragment_search_shop_list;
}
@Override
public int initVariableId() {
return BR.searchShopListViewModel;
}
@Override
public SearchShopListViewModel initViewModel() {
LoginRequest model = new LoginRequest();
return new SearchShopListViewModel(getActivity().getApplication(), model);
}
}
package com.xx.hbhconsumer.ui.search;
import android.app.Application;
import androidx.annotation.NonNull;
import com.xx.hbhconsumer.data.http.requst.LoginRequest;
import com.xx.hbhconsumer.ui.order.OrderDetailActivity;
import me.goldze.mvvmhabit.base.BaseViewModel;
public class SearchShopListViewModel extends BaseViewModel<LoginRequest> {
public SearchShopListViewModel(@NonNull Application application, LoginRequest model) {
super(application, model);
}
public void goOrderDetail(int position) {
startActivity(OrderDetailActivity.class);
}
}
...@@ -12,6 +12,8 @@ import androidx.lifecycle.MutableLiveData; ...@@ -12,6 +12,8 @@ import androidx.lifecycle.MutableLiveData;
import com.xx.hbhconsumer.data.http.requst.SearchRequest; import com.xx.hbhconsumer.data.http.requst.SearchRequest;
import com.xx.hbhconsumer.data.http.respons.SearchGoodsBean; import com.xx.hbhconsumer.data.http.respons.SearchGoodsBean;
import com.xx.hbhconsumer.data.http.respons.SearchShopBean; import com.xx.hbhconsumer.data.http.respons.SearchShopBean;
import com.xx.hbhconsumer.ui.credit.CreditsGoodsDetailActivity;
import com.xx.hbhconsumer.ui.goods.GoodsDetailActivity;
import com.xx.hbhconsumer.ui.shop.ShopDetailActivity; import com.xx.hbhconsumer.ui.shop.ShopDetailActivity;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -45,8 +47,10 @@ public class SearchViewModel extends BaseViewModel<SearchRequest> { ...@@ -45,8 +47,10 @@ public class SearchViewModel extends BaseViewModel<SearchRequest> {
super(application, model); super(application, model);
} }
public void goGoodsDetail(int p) { public void goGoodsDetail(String goodsId) {
Bundle bundle = new Bundle();
bundle.putString("goodsId", goodsId);
startActivity(GoodsDetailActivity.class, bundle);
} }
public void goShopDetail(String merchantId) { public void goShopDetail(String merchantId) {
...@@ -55,13 +59,13 @@ public class SearchViewModel extends BaseViewModel<SearchRequest> { ...@@ -55,13 +59,13 @@ public class SearchViewModel extends BaseViewModel<SearchRequest> {
startActivity(ShopDetailActivity.class, bundle); startActivity(ShopDetailActivity.class, bundle);
} }
public void search() { public void search(Integer searchFlag) {
if (searchType.getValue() == 0) {
if (searchFlag == 1) {
searchType.postValue(1); searchType.postValue(1);
}
if (searchType.getValue() == 1) {
searchGoods(); searchGoods();
} else if (searchType.getValue() == 2) { } else if (searchFlag == 2) {
searchType.postValue(2);
searchShop(); searchShop();
} }
} }
...@@ -120,7 +124,7 @@ public class SearchViewModel extends BaseViewModel<SearchRequest> { ...@@ -120,7 +124,7 @@ public class SearchViewModel extends BaseViewModel<SearchRequest> {
}); });
} }
public BindingCommand search = new BindingCommand(() -> search()); public BindingCommand search = new BindingCommand(() -> search(1));
public BindingCommand reset = new BindingCommand(() -> { public BindingCommand reset = new BindingCommand(() -> {
lowPrice.set(""); lowPrice.set("");
...@@ -128,7 +132,7 @@ public class SearchViewModel extends BaseViewModel<SearchRequest> { ...@@ -128,7 +132,7 @@ public class SearchViewModel extends BaseViewModel<SearchRequest> {
}); });
public BindingCommand searchPrice = new BindingCommand(() -> { public BindingCommand searchPrice = new BindingCommand(() -> {
search(); search(1);
}); });
public void sort(View view) { public void sort(View view) {
......
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
<variable <variable
name="searchViewModel" name="searchViewModel"
type="com.xx.hbhconsumer.ui.search.SearchViewModel" /> type="com.xx.hbhconsumer.ui.search.SearchViewModel" />
<import type="me.goldze.mvvmhabit.binding.viewadapter.recyclerview.LayoutManagers" />
<import type="me.goldze.mvvmhabit.binding.viewadapter.recyclerview.LineManagers" />
</data> </data>
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -160,10 +164,20 @@ ...@@ -160,10 +164,20 @@
</RelativeLayout> </RelativeLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_search_result" android:id="@+id/rv_search_goods_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@id/rl_search_tab" android:layout_marginLeft="17dp"
android:layout_marginRight="17dp"
android:layout_below="@id/rl_search_bar"
android:visibility="gone"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_search_shop_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/rl_search_bar"
binding:layoutManager="@{LayoutManagers.linear(1,false)}"
android:visibility="gone"/> android:visibility="gone"/>
<RelativeLayout <RelativeLayout
......
...@@ -148,7 +148,8 @@ ...@@ -148,7 +148,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="17dp" android:layout_marginLeft="17dp"
android:layout_marginRight="17dp" android:layout_marginRight="17dp"
android:layout_marginTop="13dp"> android:layout_marginTop="13dp"
android:paddingBottom="13dp">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
......
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:binding="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="searchGoodsListViewModel"
type="com.xx.hbhconsumer.ui.search.SearchGoodsListViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:fitsSystemWindows="true">
<RelativeLayout
android:id="@+id/bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="31dp"
android:layout_marginBottom="21dp"
android:layout_marginLeft="17dp"
android:layout_marginRight="17dp"
android:background="@color/white">
<TextView
android:id="@+id/tv_sort_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="7dp"
android:text="综合"
android:textSize="14sp"
android:textColor="#FF333333"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/tv_sort_label"
android:src="@mipmap/home_icon_xiajiantou"/>
<TextView
android:id="@+id/tv_price_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/iv_price_icon"
android:layout_marginRight="7dp"
android:text="价位"
android:textSize="14sp"
android:textColor="#FF333333"/>
<ImageView
android:id="@+id/iv_price_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:src="@mipmap/home_icon_xiajiantou"/>
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_goods_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="21dp"
android:layout_marginLeft="17dp"
android:layout_marginRight="17dp"
app:layout_constraintTop_toBottomOf="@id/bar"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:binding="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="searchShopListViewModel"
type="com.xx.hbhconsumer.ui.search.SearchShopListViewModel" />
<import type="me.goldze.mvvmhabit.binding.viewadapter.recyclerview.LayoutManagers" />
<import type="me.goldze.mvvmhabit.binding.viewadapter.recyclerview.LineManagers" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:fitsSystemWindows="true">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_shop_list"
android:layout_width="match_parent"
android:layout_height="0dp"
binding:layoutManager="@{LayoutManagers.linear(1,false)}"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
...@@ -48,12 +48,14 @@ ...@@ -48,12 +48,14 @@
android:textSize="10sp" android:textSize="10sp"
android:text="¥"/> android:text="¥"/>
<TextView <TextView
android:id="@+id/tv_price_integer"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/price_yellow" android:textColor="@color/price_yellow"
android:textSize="16sp" android:textSize="16sp"
android:text="3499"/> android:text="3499"/>
<TextView <TextView
android:id="@+id/tv_price_decimal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/price_yellow" android:textColor="@color/price_yellow"
......
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
<variable <variable
name="searchShopBean" name="searchShopBean"
type="com.xx.hbhconsumer.data.http.respons.SearchShopBean" /> type="com.xx.hbhconsumer.data.http.respons.SearchShopBean" />
<import type="me.goldze.mvvmhabit.binding.viewadapter.recyclerview.LayoutManagers" />
<import type="me.goldze.mvvmhabit.binding.viewadapter.recyclerview.LineManagers" />
</data> </data>
<RelativeLayout <RelativeLayout
...@@ -21,15 +25,13 @@ ...@@ -21,15 +25,13 @@
<RelativeLayout <RelativeLayout
android:id="@+id/rl_shop_info" android:id="@+id/rl_shop_info"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="64dp"
android:layout_marginBottom="17dp">
<ImageView <ImageView
android:id="@+id/iv_shop_logo" android:id="@+id/iv_shop_logo"
android:layout_width="64dp" android:layout_width="64dp"
android:layout_height="64dp" android:layout_height="64dp"
android:layout_marginLeft="17dp"
android:layout_marginTop="17dp"
android:layout_marginBottom="17dp"
android:layout_marginRight="11dp" android:layout_marginRight="11dp"
android:src="@mipmap/wode_img_morentouxiang" /> android:src="@mipmap/wode_img_morentouxiang" />
...@@ -37,12 +39,25 @@ ...@@ -37,12 +39,25 @@
android:id="@+id/tv_shop_name" android:id="@+id/tv_shop_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="23dp" android:layout_marginTop="7dp"
android:layout_toRightOf="@id/iv_shop_logo" android:layout_toRightOf="@id/iv_shop_logo"
android:text="曲美家具有限公司" android:text="曲美家具有限公司"
android:textColor="#FF333333" android:textColor="#FF333333"
android:textSize="16sp" /> android:textSize="16sp" />
<RatingBar
android:id="@+id/rb_level"
style="?android:attr/ratingBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/iv_shop_logo"
android:layout_alignParentBottom="true"
android:layout_marginBottom="7dp"
android:isIndicator="true"
android:numStars="5"
android:stepSize="0.5"
android:theme="@style/RatingBar_CustomColor"/>
<TextView <TextView
android:id="@+id/btn_register" android:id="@+id/btn_register"
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -64,6 +79,8 @@ ...@@ -64,6 +79,8 @@
android:id="@+id/rv_goods_list" android:id="@+id/rv_goods_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/rl_shop_info"/> android:layout_below="@+id/rl_shop_info"
android:layout_marginBottom="18dp"
binding:layoutManager="@{LayoutManagers.linear(0,false)}"/>
</RelativeLayout> </RelativeLayout>
</layout> </layout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment