中建365-二期开发-商城开发

develop
wlh 1 year ago
parent c31e4d3f7b
commit 35996556a9

@ -159,6 +159,10 @@
android:launchMode="singleTop"
android:screenOrientation="portrait" />
<activity android:name=".activity.shop.ShopCategoryActivity"
android:launchMode="singleTop"
android:screenOrientation="portrait" />
<activity
android:name="com.zj365.health.act.BindFamilyAct"

@ -57,6 +57,7 @@ import com.zj365.dc.fragment.DynamicManagementFrag
import com.zj365.dc.fragment.HealthHomeFrag
import com.zj365.dc.fragment.MessageFragment
import com.zj365.dc.fragment.MineFrag
import com.zj365.dc.fragment.ShopFragment
import com.zj365.dc.vm.MainVm
import com.zj365.health.act.binddevice.BaseDeviceBindListAct
import com.zj365.health.act.binddevice.BlueUtil
@ -134,6 +135,7 @@ class MainActivity : BaseVmAct<MainVm>(), Consumer<AbstractMeasureData> {
listOf(
HealthHomeFrag(),
// Fragment(),
ShopFragment(),
DynamicManagementFrag(),
MessageFragment(),
MineFrag()
@ -226,28 +228,28 @@ class MainActivity : BaseVmAct<MainVm>(), Consumer<AbstractMeasureData> {
return@setOnNavigationItemSelectedListener true
}
/* R.id.nav_server -> {
R.id.nav_server -> {
binding.mVp2.setCurrentItem(1, false)
return@setOnNavigationItemSelectedListener true
}*/
}
R.id.nav_dynamic_management -> {
if (MMkvHelper.getLong(Const.USER_ID).toString() == "0"){
RouteManager.goAct(ARouterUrl.LOGIN_ACT)
}else{
binding.mVp2.setCurrentItem(1, false)
binding.mVp2.setCurrentItem(2, false)
return@setOnNavigationItemSelectedListener true
}
}
R.id.nav_message -> {
binding.mVp2.setCurrentItem(2, false)
binding.mVp2.setCurrentItem(3, false)
return@setOnNavigationItemSelectedListener true
}
R.id.nav_mine -> {
binding.mVp2.setCurrentItem(3, false)
binding.mVp2.setCurrentItem(4, false)
return@setOnNavigationItemSelectedListener true
}

@ -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>

@ -7,11 +7,11 @@
android:icon="@drawable/sel_home"
android:title="@string/home"
app:showAsAction="ifRoom" />
<!-- <item
<item
android:id="@+id/nav_server"
android:icon="@drawable/sel_server"
android:title="@string/shopping"
app:showAsAction="ifRoom" />-->
app:showAsAction="ifRoom" />
<item
android:id="@+id/nav_dynamic_management"

@ -29,6 +29,8 @@ abstract class BaseFragList<V:BaseVm> :BaseVmFrag<V>() {
}
refresh.setEnableLoadMore(isLoadMore)
refresh.setOnLoadMoreListener {
page++
refresh()
refresh.finishLoadMore(1000)
}
}

@ -15,7 +15,7 @@ buildscript {
maven { url "https://mirrors.tencent.com/nexus/repository/maven-public/" }
maven {url 'https://developer.huawei.com/repo/'}
maven{ url 'https://maven.aliyun.com/nexus/content/groups/public/'}
maven{ url 'https://oss.sonatype.org/content/repositories/snapshots'}
// maven{ url 'https://oss.sonatype.org/content/repositories/snapshots'}
}
dependencies {
@ -42,7 +42,7 @@ allprojects {
maven { url "https://www.jitpack.io" }
maven {url 'https://developer.huawei.com/repo/'}
maven{ url 'https://maven.aliyun.com/nexus/content/groups/public/'}
maven{ url 'https://oss.sonatype.org/content/repositories/snapshots'}
// maven{ url 'https://oss.sonatype.org/content/repositories/snapshots'}
flatDir{
dirs project(':common').file('lib')

@ -22,6 +22,9 @@ class ARouterUrl {
const val MESSAGE_DETAIL_NEW = "/com/zj365/dc/activity/MessageDetailNewAct"
const val WATCH_FAMILY_HEALTH = "/com/zj365/dc/activity/WatchFamilyHealthAct"
//商城
const val SHOP_CATEGORY = "/com/zj365/dc/activity/shop/ShopCategoryActivity"
// const val FAMILY_INFO="/com/zj365/dc/act/FamilyMainAct"
const val AGAIN_SIGN = "/com/zj365/dc/act/AgainSignAct"

@ -1,11 +1,13 @@
package com.xty.common.util
import android.graphics.Paint
import android.graphics.Typeface
import android.text.SpannableString
import android.text.Spanned
import android.text.style.AbsoluteSizeSpan
import android.text.style.ForegroundColorSpan
import android.text.style.StyleSpan
import android.widget.TextView
object SpannableUtils {
@ -111,5 +113,12 @@ object SpannableUtils {
return statuSpan
}
fun setMoney(txtView: TextView, num:String){
var statuSpan = SpannableString("¥ ${num}")
txtView.text = statuSpan
txtView.paint.flags = Paint.STRIKE_THRU_TEXT_FLAG
txtView.paint.isAntiAlias = true
}
}

@ -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

@ -27,6 +27,7 @@ import com.xty.common.setImage
import com.xty.common.util.PermissionUtils
import com.xty.network.MyRetrofit
import com.xty.network.model.SettingBean
import com.xty.network.model.UserEquipmentInformationizationBean
import com.zj365.mime.BuildConfig
import com.zj365.mime.R
import com.zj365.mime.databinding.ActDevInfoBinding
@ -53,6 +54,8 @@ class DevInfoAct : BaseVmAct<SettingVm>() {
var user: SettingBean.User? = null
var userId: String? = null
var devInfo: UserEquipmentInformationizationBean? = null
private val unBindDialog by lazy {
FactorySettingDialog(this, getString(R.string.dialog_un_bind)) {
//确认解除绑定
@ -129,9 +132,16 @@ class DevInfoAct : BaseVmAct<SettingVm>() {
binding.tvContactKefu.text = span
binding.tvDeviceSetting.setOnClickListener {
bundle.clear()
bundle.putString("web_site_url","${BuildConfig.h5url}pages/index/index?pageId=braceletSetting")
RouteManager.goAct(ARouterUrl.H5_ACT,bundle)
devInfo?.let {
if(it.bindType == 1){
bundle.clear()
bundle.putString("web_site_url","${BuildConfig.h5url}pages/index/index?pageId=braceletSetting")
RouteManager.goAct(ARouterUrl.H5_ACT,bundle)
}else{
RouteManager.goAct(ARouterUrl.WEAR_MANAGER)
}
}
}
binding.tvRecharge.setOnClickListener {
@ -169,6 +179,7 @@ class DevInfoAct : BaseVmAct<SettingVm>() {
}
mViewModel.deviceInfo.observe(this) {
devInfo = it.data
if(it.data.bindType == 1){
binding.mNickName.text = "设备名称:${it.data.watchName?:""}"
binding.mNum.text = "设备编码:${it.data.bluetooth?:""}"
@ -184,7 +195,7 @@ class DevInfoAct : BaseVmAct<SettingVm>() {
binding.mActiveCode.text = "设备激活码:${it.data.activationCode?:""}"
binding.mActiveCode.visibility = View.GONE
binding.tvRecharge.visibility = View.GONE
binding.tvDeviceSetting.visibility = View.GONE
binding.tvDeviceSetting.visibility = View.VISIBLE
binding.ivDevice.setImage(this,it.data.deviceImageUrl)
}

@ -655,6 +655,7 @@
android:background="@color/col_f1f" />
<TextView
android:visibility="gone"
android:id="@+id/mTvDevice"
android:layout_width="match_parent"
android:layout_height="wrap_content"

@ -42,7 +42,9 @@
android:id="@+id/recycler"/>
</LinearLayout>
<include layout="@layout/layout_ele_fence_setting"
android:id="@+id/cl_setting"
android:visibility="gone"/>
<LinearLayout
android:id="@+id/ll_btn"

@ -1,5 +1,6 @@
<?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="wrap_content"
@ -29,6 +30,14 @@
android:layout_marginTop="@dimen/dp_12"
android:textSize="@dimen/sp_16"
android:textStyle="bold"/>
<SeekBar
android:id="@+id/skb_radius"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_6"
android:layout_marginTop="@dimen/dp_19"
android:layout_marginRight="@dimen/dp_24"
android:progressDrawable="@mipmap/icon_seekbar_drawer"/>
<TextView
android:layout_width="wrap_content"
@ -42,7 +51,39 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/dp_12"
>
<RadioGroup
android:id="@+id/rb_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:id="@+id/rb_leave"
android:layout_width="@dimen/dp_74"
android:layout_height="@dimen/dp_33"
android:button="@null"
android:background="@drawable/selector_ele_setting"
android:text="禁出"
android:gravity="center"
android:textColor="@color/color_02c_333"
android:checked="true"/>
<RadioButton
android:id="@+id/rb_enter"
android:layout_width="@dimen/dp_74"
android:layout_height="@dimen/dp_33"
android:button="@null"
android:background="@drawable/selector_ele_setting"
android:text="禁入"
android:gravity="center"
android:layout_marginLeft="@dimen/dp_12"
android:textColor="@color/color_02c_333"
/>
</RadioGroup>
</RelativeLayout>

@ -1846,4 +1846,16 @@ interface ApiInterface {
*/
@POST("customer/material/index")
suspend fun getEnterpriseInfoHomeList():RespBody<MutableList<EnterpriseInfoHomeBean>>
/**
* 商城分类
*/
@GET("customer/mall/category/list")
suspend fun getGoodsCategory(@Query("parentId") parentId:Long):RespBody<MutableList<ShopCategoryBean>>
/**
* 商品列表
*/
@POST("customer/mall/prod/getProdList")
suspend fun getGoodsList(@Body rb: RequestBody):RespBody<GoodsRecordsBean>
}

@ -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)
}

@ -0,0 +1,15 @@
package com.xty.network.model
import android.os.Parcelable
import kotlinx.android.parcel.Parcelize
@Parcelize
data class ShopCategoryBean(
var id:Long,
var parentId:Long,
var categoryName:String,
var categoryType:Int, //商品类型1普通商品2VIP商品3增值服务
var pic:String?,
var isChecked:Boolean = false
): Parcelable
Loading…
Cancel
Save