中建365-二期开发-商城开发
parent
c31e4d3f7b
commit
35996556a9
@ -0,0 +1,181 @@
|
||||
package com.zj365.dc.activity.shop
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.xty.base.act.BaseListAct
|
||||
import com.xty.base.act.BaseVmAct
|
||||
import com.xty.common.Const
|
||||
import com.xty.common.R
|
||||
import com.xty.common.arouter.ARouterUrl
|
||||
import com.xty.network.model.ShopCategoryBean
|
||||
import com.zj365.dc.adapter.shop.ShopCategoryAdapter
|
||||
import com.zj365.dc.adapter.shop.ShopChildCategoryAdapter
|
||||
import com.zj365.dc.adapter.shop.ShopGoodsTwoAdapter
|
||||
import com.zj365.dc.databinding.ActShopCategoryBinding
|
||||
import com.zj365.dc.vm.ShopMallVm
|
||||
import okhttp3.internal.notify
|
||||
import java.util.ArrayList
|
||||
|
||||
@Route(path = ARouterUrl.SHOP_CATEGORY)
|
||||
class ShopCategoryActivity : BaseVmAct<ShopMallVm>() {
|
||||
|
||||
val binding by lazy { ActShopCategoryBinding.inflate(layoutInflater) }
|
||||
|
||||
val mCategoryAdapter by lazy { ShopCategoryAdapter() }
|
||||
|
||||
val mGoodsAdapter by lazy { ShopGoodsTwoAdapter() }
|
||||
|
||||
val mChildCategoryAdapter by lazy { ShopChildCategoryAdapter() }
|
||||
|
||||
var goodsName:String? = null
|
||||
|
||||
var categoryId:Long = 0L
|
||||
var mCategoryList = ArrayList<ShopCategoryBean>()
|
||||
var parentId:Long = 0L
|
||||
|
||||
var index = 0
|
||||
var page:Int = 1
|
||||
|
||||
fun initAdapter() {
|
||||
|
||||
|
||||
|
||||
binding.recyclerView.adapter = mGoodsAdapter
|
||||
binding.recyclerView.layoutManager = LinearLayoutManager(this@ShopCategoryActivity)
|
||||
|
||||
binding.childRecyclerView.adapter = mChildCategoryAdapter
|
||||
binding.childRecyclerView.layoutManager = LinearLayoutManager(this@ShopCategoryActivity)
|
||||
|
||||
mChildCategoryAdapter.setOnItemClickListener { adapter, view, position ->
|
||||
var bean = adapter.data[position] as ShopCategoryBean
|
||||
(adapter.data as ArrayList<ShopCategoryBean>).forEach {
|
||||
it.isChecked = false
|
||||
|
||||
}
|
||||
bean.isChecked = true
|
||||
categoryId = bean.id
|
||||
mViewModel.getGoodsList(goodsName,categoryId,0,page)
|
||||
mChildCategoryAdapter.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
binding.mRefresh.setOnRefreshListener {
|
||||
page = 1
|
||||
loadData()
|
||||
binding.mRefresh.finishRefresh(1000)
|
||||
}
|
||||
binding.mRefresh.setEnableLoadMore(true)
|
||||
binding.mRefresh.setOnLoadMoreListener {
|
||||
page++
|
||||
loadData()
|
||||
binding.mRefresh.finishLoadMore(1000)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun loadData(){
|
||||
mViewModel.getGoodsList(goodsName,categoryId,0,page)
|
||||
|
||||
}
|
||||
|
||||
override fun initView() {
|
||||
super.initView()
|
||||
statusBar(binding.title.mView)
|
||||
binding.title.mTvTitle.text ="商品分类"
|
||||
binding.title.mIvBack.setOnClickListener {
|
||||
finish()
|
||||
}
|
||||
categoryId = intent.getLongExtra("id",0)
|
||||
parentId = categoryId
|
||||
|
||||
mCategoryList = intent.getParcelableArrayListExtra<ShopCategoryBean>("categoryList")!!
|
||||
initAdapter()
|
||||
mCategoryList.forEachIndexed { index, shopCategoryBean ->
|
||||
if (shopCategoryBean.id == categoryId){
|
||||
this.index = index
|
||||
shopCategoryBean.isChecked = true
|
||||
}
|
||||
}
|
||||
|
||||
binding.categoryRecyclerView.adapter = mCategoryAdapter
|
||||
|
||||
if(mCategoryList.size != 8){
|
||||
binding.categoryRecyclerView.layoutManager = LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false)
|
||||
}else if(mCategoryList.size == 8){
|
||||
binding.categoryRecyclerView.layoutManager = GridLayoutManager(this,4)
|
||||
}
|
||||
mCategoryAdapter.setNewInstance(mCategoryList)
|
||||
binding.categoryRecyclerView.scrollToPosition(index)
|
||||
|
||||
mCategoryAdapter.setOnItemClickListener { adapter, view, position ->
|
||||
var bean = adapter.data[position] as ShopCategoryBean
|
||||
(adapter.data as ArrayList<ShopCategoryBean>).forEach {
|
||||
it.isChecked = false
|
||||
|
||||
}
|
||||
bean.isChecked = true
|
||||
parentId = bean.id
|
||||
mViewModel.getGoodsCategory(bean.id)
|
||||
mCategoryAdapter.notifyDataSetChanged()
|
||||
}
|
||||
mViewModel.getGoodsCategory(categoryId)
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun liveObserver() {
|
||||
mViewModel.categoryLiveDate.observe(this){
|
||||
it.data.add(0,ShopCategoryBean(parentId,parentId,"全部",0,null,true))
|
||||
it.data.forEachIndexed { index, shopCategoryBean ->
|
||||
|
||||
if (shopCategoryBean.isChecked){
|
||||
categoryId = shopCategoryBean.id
|
||||
mViewModel.getGoodsList(goodsName,shopCategoryBean.id,0,page)
|
||||
|
||||
}
|
||||
}
|
||||
mChildCategoryAdapter.setNewInstance(it.data)
|
||||
}
|
||||
|
||||
|
||||
mViewModel.goodsLiveData.observe(this){
|
||||
|
||||
if (page == 1) {
|
||||
if (it.data.records.isNullOrEmpty()) {
|
||||
mGoodsAdapter.setNewInstance(null)
|
||||
mGoodsAdapter.setEmptyView(getNoneView())
|
||||
binding.mRefresh?.setEnableLoadMore(false)
|
||||
} else {
|
||||
if (it.data.records.size < Const.PAGE_SIZE) {
|
||||
binding.mRefresh?.setEnableLoadMore(false)
|
||||
} else {
|
||||
binding.mRefresh?.setEnableLoadMore(true)
|
||||
++page
|
||||
}
|
||||
mGoodsAdapter.setNewInstance(it.data.records)
|
||||
}
|
||||
} else {
|
||||
if (it.data.records.isNullOrEmpty()) {
|
||||
binding.mRefresh?.setEnableLoadMore(false)
|
||||
}else{
|
||||
if (it.data.records.size < Const.PAGE_SIZE) {
|
||||
binding.mRefresh?.setEnableLoadMore(false)
|
||||
}else{
|
||||
++page
|
||||
}
|
||||
mGoodsAdapter.addData(it.data.records)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun getNoneView() =
|
||||
LayoutInflater.from(this).inflate(R.layout.view_none_data, binding.recyclerView, false)
|
||||
|
||||
override fun setLayout() = binding.root
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.zj365.dc.adapter.shop
|
||||
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.ruffian.library.widget.RImageView
|
||||
import com.xty.base.adapter.BaseAdapter
|
||||
import com.xty.common.setImage
|
||||
import com.xty.network.model.ShopCategoryBean
|
||||
import com.zj365.dc.R
|
||||
import de.hdodenhof.circleimageview.CircleImageView
|
||||
|
||||
class ShopCategoryAdapter : BaseAdapter<ShopCategoryBean>(R.layout.item_shop_categroy) {
|
||||
override fun convert(holder: BaseViewHolder, item: ShopCategoryBean) {
|
||||
|
||||
if (data.size != 8){
|
||||
var screenWidth = context.resources.displayMetrics.widthPixels
|
||||
val layoutParam = holder.getView<LinearLayout>(R.id.root).layoutParams
|
||||
layoutParam.width = screenWidth /4
|
||||
holder.getView<LinearLayout>(R.id.root).layoutParams = layoutParam
|
||||
}
|
||||
|
||||
var img = holder.getView<RImageView>(R.id.img_category)
|
||||
var categoryName = holder.getView<TextView>(R.id.tv_category)
|
||||
if (item.isChecked){
|
||||
img.borderColor = context.getColor(R.color.col_02c)
|
||||
categoryName.setTextColor(context.getColor(R.color.col_02c))
|
||||
}else{
|
||||
img.borderColor = context.getColor(R.color.white)
|
||||
categoryName.setTextColor(context.getColor(R.color.col_313))
|
||||
|
||||
}
|
||||
item.pic?.let {
|
||||
img.setImage(context,it)
|
||||
|
||||
}
|
||||
holder.setText(R.id.tv_category,item.categoryName)
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.zj365.dc.adapter.shop
|
||||
|
||||
import android.graphics.Color
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.xty.base.adapter.BaseAdapter
|
||||
import com.xty.network.model.ShopCategoryBean
|
||||
import com.zj365.dc.R
|
||||
|
||||
class ShopChildCategoryAdapter : BaseAdapter<ShopCategoryBean>(R.layout.item_category_child) {
|
||||
override fun convert(holder: BaseViewHolder, item: ShopCategoryBean) {
|
||||
holder.setText(R.id.tv_child_category,item.categoryName)
|
||||
if (item.isChecked){
|
||||
holder.setTextColor(R.id.tv_child_category,context.getColor(R.color.col_02c))
|
||||
holder.setBackgroundColor(R.id.tv_child_category, Color.parseColor("#2102C191"))
|
||||
}else{
|
||||
holder.setTextColor(R.id.tv_child_category,context.getColor(R.color.col_313))
|
||||
holder.setBackgroundColor(R.id.tv_child_category,context.getColor(R.color.white))
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.zj365.dc.adapter.shop
|
||||
|
||||
import android.widget.TextView
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.ruffian.library.widget.RImageView
|
||||
import com.xty.base.adapter.BaseAdapter
|
||||
import com.xty.common.setImage
|
||||
import com.xty.common.util.SpannableUtils
|
||||
import com.xty.network.model.GoodsRecordsBean
|
||||
import com.zj365.dc.R
|
||||
import org.w3c.dom.Text
|
||||
|
||||
class ShopGoodsAdapter : BaseAdapter<GoodsRecordsBean.GoodsBean>(R.layout.item_shop_list) {
|
||||
override fun convert(holder: BaseViewHolder, item: GoodsRecordsBean.GoodsBean) {
|
||||
holder.getView<RImageView>(R.id.img_goods).setImage(context,item.imgs)
|
||||
holder.setText(R.id.tv_goods_name,item.prodName)
|
||||
holder.setText(R.id.tv_price,"¥ ${item.price}")
|
||||
SpannableUtils.setMoney(holder.getView<TextView>(R.id.tv_line_price),item.oriPrice)
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.zj365.dc.adapter.shop
|
||||
|
||||
import android.widget.TextView
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.ruffian.library.widget.RImageView
|
||||
import com.xty.base.adapter.BaseAdapter
|
||||
import com.xty.common.setImage
|
||||
import com.xty.common.util.SpannableUtils
|
||||
import com.xty.network.model.GoodsRecordsBean
|
||||
import com.zj365.dc.R
|
||||
|
||||
class ShopGoodsTwoAdapter : BaseAdapter<GoodsRecordsBean.GoodsBean>(R.layout.item_goods_list_two_style) {
|
||||
override fun convert(holder: BaseViewHolder, item: GoodsRecordsBean.GoodsBean) {
|
||||
holder.getView<RImageView>(R.id.img_goods).setImage(context,item.imgs)
|
||||
holder.setText(R.id.tv_goods_name,item.prodName)
|
||||
holder.setText(R.id.tv_price,"¥ ${item.price}")
|
||||
SpannableUtils.setMoney(holder.getView<TextView>(R.id.tv_line_price),item.oriPrice)
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
package com.zj365.dc.fragment
|
||||
|
||||
import android.os.Parcelable
|
||||
import android.text.TextUtils
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.tamsiree.rxkit.RxKeyboardTool
|
||||
import com.xty.base.fragment.BaseFragList
|
||||
import com.xty.base.fragment.BaseVmFrag
|
||||
import com.xty.base.vm.BaseVm
|
||||
import com.xty.common.arouter.ARouterUrl
|
||||
import com.xty.common.arouter.RouteManager
|
||||
import com.xty.common.util.CommonToastUtils
|
||||
import com.xty.network.model.ShopCategoryBean
|
||||
import com.zj365.dc.adapter.shop.ShopCategoryAdapter
|
||||
import com.zj365.dc.adapter.shop.ShopGoodsAdapter
|
||||
import com.zj365.dc.databinding.FragShopBinding
|
||||
import com.zj365.dc.vm.ShopMallVm
|
||||
import java.util.ArrayList
|
||||
|
||||
class ShopFragment: BaseFragList<ShopMallVm>() {
|
||||
val binding by lazy { FragShopBinding.inflate(layoutInflater) }
|
||||
|
||||
val mCategoryAdapter by lazy { ShopCategoryAdapter() }
|
||||
|
||||
val mGoodsAdapter by lazy { ShopGoodsAdapter() }
|
||||
|
||||
|
||||
var goodsName:String? = null
|
||||
|
||||
override fun initAdapter() {
|
||||
binding.recyclerView.adapter = mGoodsAdapter
|
||||
binding.recyclerView.layoutManager = GridLayoutManager(requireContext(),2)
|
||||
|
||||
binding.categoryRecyclerView.adapter = mCategoryAdapter
|
||||
|
||||
mCategoryAdapter.setOnItemClickListener { adapter, view, position ->
|
||||
var bean = adapter.data[position] as ShopCategoryBean
|
||||
bundle.clear()
|
||||
bundle.putLong("id",bean.id)
|
||||
bundle.putParcelableArrayList("categoryList",adapter.data as ArrayList<ShopCategoryBean>)
|
||||
RouteManager.goAct(ARouterUrl.SHOP_CATEGORY,bundle)
|
||||
}
|
||||
|
||||
setRecycleRefresh(binding.recyclerView,binding.mRefresh,true)
|
||||
}
|
||||
|
||||
override fun refresh() {
|
||||
mViewModel.getGoodsList(null,0L,1,page)
|
||||
}
|
||||
|
||||
override fun initView() {
|
||||
super.initView()
|
||||
mViewModel.getGoodsCategory(0L)
|
||||
mViewModel.getGoodsList(null,0L,0,page)
|
||||
|
||||
binding.etSearch.setOnEditorActionListener(object : TextView.OnEditorActionListener {
|
||||
override fun onEditorAction(p0: TextView?, p1: Int, p2: KeyEvent?): Boolean {
|
||||
if(p1 == EditorInfo.IME_ACTION_SEARCH){
|
||||
goodsName = binding.etSearch.text.toString().trim()
|
||||
if(TextUtils.isEmpty(goodsName)){
|
||||
CommonToastUtils.showToast("请输入搜索内容")
|
||||
return true
|
||||
}
|
||||
|
||||
mViewModel.getGoodsList(goodsName,0L,0,page)
|
||||
|
||||
RxKeyboardTool.hideSoftInput(requireActivity())
|
||||
return true
|
||||
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
override fun setViewModel()= ShopMallVm()
|
||||
override fun observer() {
|
||||
mViewModel.categoryLiveDate.observe(this){
|
||||
if(it.data.size != 8){
|
||||
binding.categoryRecyclerView.layoutManager = LinearLayoutManager(requireContext(),LinearLayoutManager.HORIZONTAL,false)
|
||||
}else if(it.data.size == 8){
|
||||
binding.categoryRecyclerView.layoutManager = GridLayoutManager(requireContext(),4)
|
||||
|
||||
}
|
||||
|
||||
mCategoryAdapter.setNewInstance(it.data)
|
||||
}
|
||||
|
||||
mViewModel.goodsLiveData.observe(this){
|
||||
if(page == 1){
|
||||
mGoodsAdapter.setNewInstance(it.data.records)
|
||||
|
||||
}else{
|
||||
mGoodsAdapter.addData(it.data.records)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun setLayout() = binding.root
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.zj365.dc.vm
|
||||
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.alibaba.fastjson.JSONObject
|
||||
import com.xty.base.vm.BaseVm
|
||||
import com.xty.network.model.GoodsRecordsBean
|
||||
import com.xty.network.model.RespBody
|
||||
import com.xty.network.model.ShopCategoryBean
|
||||
|
||||
class ShopMallVm : BaseVm() {
|
||||
|
||||
val categoryLiveDate by lazy { MutableLiveData<RespBody<MutableList<ShopCategoryBean>>>() }
|
||||
|
||||
val goodsLiveData by lazy { MutableLiveData<RespBody<GoodsRecordsBean>>() }
|
||||
|
||||
fun getGoodsCategory(parentId:Long){
|
||||
startHttp {
|
||||
var code = apiInterface().getGoodsCategory(parentId)
|
||||
code.getCodeStatus(categoryLiveDate, nowData)
|
||||
}
|
||||
}
|
||||
|
||||
fun getGoodsList(prodName:String?,categoryId:Long,isRec:Int,pageSize:Int){
|
||||
startHttp {
|
||||
var json = JSONObject()
|
||||
prodName?.let {
|
||||
json.put("prodName",it)
|
||||
}
|
||||
json.put("categoryId",categoryId)
|
||||
json.put("isRec",isRec)
|
||||
json.put("pageSize",20)
|
||||
json.put("pageNum",pageSize)
|
||||
var code = apiInterface().getGoodsList(retrofits.getRequestBody(json.toString()))
|
||||
code.getCodeStatus(goodsLiveData, nowData)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white">
|
||||
|
||||
<include layout="@layout/title_white_bar"
|
||||
android:id ="@+id/title"/>
|
||||
|
||||
<com.ruffian.library.widget.RRelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_36"
|
||||
android:layout_marginLeft="@dimen/dp_16"
|
||||
android:layout_marginRight="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
app:corner_radius="@dimen/dp_18"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:background="@color/white"
|
||||
app:background_normal="@color/col_2F2">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_search"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@mipmap/ic_search"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="@dimen/dp_21"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_search"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="请输入商品名称"
|
||||
android:layout_toRightOf="@+id/img_search"
|
||||
android:layout_centerVertical="true"
|
||||
android:textColor="@color/col_313"
|
||||
android:background="@null"
|
||||
android:textColorHint="@color/col_7c7"
|
||||
android:imeOptions="actionSearch"
|
||||
android:singleLine="true"
|
||||
android:inputType="text"
|
||||
android:textSize="@dimen/sp_13"
|
||||
android:layout_marginLeft="@dimen/dp_7"/>
|
||||
|
||||
</com.ruffian.library.widget.RRelativeLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_17"
|
||||
android:background="@color/white"
|
||||
android:layout_marginBottom="@dimen/dp_19"
|
||||
android:id="@+id/category_recyclerView"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="@dimen/dp_12"
|
||||
android:background="@color/col_6f7">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/child_recyclerView"
|
||||
android:layout_width="@dimen/dp_76"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"/>
|
||||
|
||||
<com.scwang.smart.refresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/mRefresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
android:layout_marginLeft="@dimen/dp_9"
|
||||
android:layout_marginRight="@dimen/dp_13"
|
||||
app:srlAccentColor="@color/white">
|
||||
|
||||
<com.scwang.smart.refresh.header.ClassicsHeader
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:foregroundTint="@color/white"
|
||||
app:srlAccentColor="@color/black"
|
||||
app:srlPrimaryColor="@color/white" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/recyclerView"/>
|
||||
|
||||
<com.scwang.smart.refresh.footer.ClassicsFooter
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:ignore="MissingDefaultResource"
|
||||
android:background="@color/white">
|
||||
<com.ruffian.library.widget.RRelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_36"
|
||||
android:layout_marginLeft="@dimen/dp_16"
|
||||
android:layout_marginRight="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_56"
|
||||
app:corner_radius="@dimen/dp_18"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:background="@color/white"
|
||||
app:background_normal="@color/col_2F2">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_search"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@mipmap/ic_search"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="@dimen/dp_21"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_search"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="请输入商品名称"
|
||||
android:layout_toRightOf="@+id/img_search"
|
||||
android:layout_centerVertical="true"
|
||||
android:textColor="@color/col_313"
|
||||
android:background="@null"
|
||||
android:textColorHint="@color/col_7c7"
|
||||
android:imeOptions="actionSearch"
|
||||
android:singleLine="true"
|
||||
android:inputType="text"
|
||||
android:textSize="@dimen/sp_13"
|
||||
android:layout_marginLeft="@dimen/dp_7"/>
|
||||
|
||||
</com.ruffian.library.widget.RRelativeLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_17"
|
||||
android:background="@color/white"
|
||||
android:layout_marginBottom="@dimen/dp_5"
|
||||
android:id="@+id/category_recyclerView"/>
|
||||
|
||||
<com.scwang.smart.refresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/mRefresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/col_6f7"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
app:srlAccentColor="@color/col_6f7">
|
||||
|
||||
<com.scwang.smart.refresh.header.ClassicsHeader
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:foregroundTint="@color/white"
|
||||
app:srlAccentColor="@color/black"
|
||||
app:srlPrimaryColor="@color/white" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginLeft="@dimen/dp_15"
|
||||
android:layout_marginRight="@dimen/dp_15"
|
||||
android:id="@+id/recyclerView"/>
|
||||
|
||||
<com.scwang.smart.refresh.footer.ClassicsFooter
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
|
||||
</LinearLayout>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/tv_child_category"
|
||||
android:layout_width="@dimen/dp_76"
|
||||
android:layout_height="@dimen/dp_39"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textColor="@color/col_313"
|
||||
android:textStyle="bold"
|
||||
tools:text="女士"
|
||||
android:gravity="center"
|
||||
android:background="@color/white"
|
||||
/>
|
||||
|
@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shape_round_white"
|
||||
tools:ignore="MissingDefaultResource">
|
||||
|
||||
<com.ruffian.library.widget.RImageView
|
||||
android:id="@+id/img_goods"
|
||||
android:layout_width="@dimen/dp_89"
|
||||
android:layout_height="@dimen/dp_89"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginLeft="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginBottom="@dimen/dp_12"
|
||||
android:scaleType="fitXY"
|
||||
app:is_circle="false"
|
||||
app:corner_radius_bottom_left="@dimen/dp_0"
|
||||
app:corner_radius_bottom_right="@dimen/dp_0"
|
||||
app:corner_radius_top_right="@dimen/dp_8"
|
||||
app:corner_radius_top_left="@dimen/dp_8"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_goods_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@+id/img_goods"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:gravity="left"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textColor="@color/col_313"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginRight="@dimen/dp_12"
|
||||
android:layout_marginLeft="@dimen/dp_7"
|
||||
tools:text="中健健康智能手表血糖血脂尿酸风险长续航中健健康智能手表血糖血脂尿酸风险长续航中健健康智能手表血糖血脂尿酸风险长续航中健健康智能手表血糖血脂尿酸风险长续航..."
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_price"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_goods_name"
|
||||
app:layout_constraintLeft_toRightOf="@+id/img_goods"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:textColor="@color/col_2621"
|
||||
android:textSize="@dimen/sp_15"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
tools:text="¥1999.00"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_line_price"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_goods_name"
|
||||
app:layout_constraintLeft_toRightOf="@+id/tv_price"
|
||||
android:textColor="@color/col_c7c"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:textSize="@dimen/sp_15"
|
||||
android:layout_marginLeft="@dimen/dp_7"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
tools:text="¥1999.00"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/root"
|
||||
android:gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.ruffian.library.widget.RImageView
|
||||
android:id="@+id/img_category"
|
||||
android:layout_width="@dimen/dp_47"
|
||||
android:layout_height="@dimen/dp_47"
|
||||
android:background="@mipmap/icon_default_avator"
|
||||
app:is_circle="true"
|
||||
app:border_color="@color/white"
|
||||
app:border_width="@dimen/dp_1"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_category"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/col_313"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
tools:text="低卡零食"/>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shape_round_white"
|
||||
android:paddingBottom="@dimen/dp_21"
|
||||
tools:ignore="MissingDefaultResource">
|
||||
|
||||
<com.ruffian.library.widget.RImageView
|
||||
android:id="@+id/img_goods"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_165"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:is_circle="false"
|
||||
android:scaleType="fitXY"
|
||||
app:corner_radius_bottom_left="@dimen/dp_0"
|
||||
app:corner_radius_bottom_right="@dimen/dp_0"
|
||||
app:corner_radius_top_right="@dimen/dp_8"
|
||||
app:corner_radius_top_left="@dimen/dp_8"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_goods_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/img_goods"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:gravity="left"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textColor="@color/col_313"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
tools:text="中健健康智能手表血糖血脂尿酸风险长续航中健健康智能手表血糖血脂尿酸风险长续航中健健康智能手表血糖血脂尿酸风险长续航中健健康智能手表血糖血脂尿酸风险长续航..."
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_price"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_goods_name"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:textColor="@color/col_2621"
|
||||
android:textSize="@dimen/sp_15"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
tools:text="¥1999.00"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_line_price"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_goods_name"
|
||||
app:layout_constraintLeft_toRightOf="@+id/tv_price"
|
||||
android:textColor="@color/col_c7c"
|
||||
android:textSize="@dimen/sp_15"
|
||||
android:layout_marginLeft="@dimen/dp_7"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
tools:text="¥1999.00"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/col_02c" android:state_checked="true"/>
|
||||
<item android:color="@color/col_333" android:state_checked="false"/>
|
||||
</selector>
|
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="true">
|
||||
<shape>
|
||||
<stroke android:color="@color/col_02c" android:width="@dimen/dp_1"/>
|
||||
<corners android:radius="@dimen/dp_6"/>
|
||||
<solid android:color="@color/white"/>
|
||||
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:state_checked="false">
|
||||
<shape>
|
||||
<stroke android:color="#1A333333" android:width="@dimen/dp_1"/>
|
||||
<corners android:radius="@dimen/dp_6"/>
|
||||
<solid android:color="@color/white"/>
|
||||
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
@ -0,0 +1,19 @@
|
||||
package com.xty.network.model
|
||||
|
||||
data class GoodsRecordsBean(
|
||||
var records:ArrayList<GoodsBean>
|
||||
) {
|
||||
data class GoodsBean(
|
||||
var id:Long,
|
||||
var prodName:String,
|
||||
var oriPrice:String,
|
||||
var price:String,
|
||||
var brief:String,
|
||||
var content:String,
|
||||
var pic:String,
|
||||
var imgs:String,
|
||||
var status:Int,
|
||||
var categoryId:Long,
|
||||
var prodType:Int,
|
||||
var soldNum:String)
|
||||
}
|
Loading…
Reference in New Issue