添加合作商页面
This commit is contained in:
parent
32b6c53e47
commit
4ed5297c1f
|
|
@ -1,26 +0,0 @@
|
||||||
package com.cheng.bole.bean
|
|
||||||
|
|
||||||
import java.io.Serializable
|
|
||||||
|
|
||||||
data class SupplierGoodsBean(
|
|
||||||
val city_id: String,
|
|
||||||
val city_name: String,
|
|
||||||
val company: CompanyBean,
|
|
||||||
val contact: List<ContactsInfoBean>,
|
|
||||||
val create_time: String,
|
|
||||||
val file: List<UploadFileEntity>,
|
|
||||||
val goods_description: String,
|
|
||||||
val goods_name: String,
|
|
||||||
val goods_price: String,
|
|
||||||
val goods_price_show: String,
|
|
||||||
val goods_price_type: String,
|
|
||||||
val id: String,
|
|
||||||
val remark: String,
|
|
||||||
val review_time: String,
|
|
||||||
val status: String,
|
|
||||||
val type: String,
|
|
||||||
val update_time: String,
|
|
||||||
val user_id: String,
|
|
||||||
val view_count: String,
|
|
||||||
val is_broadcast: Boolean
|
|
||||||
) : Serializable
|
|
||||||
|
|
@ -11,8 +11,6 @@ object EventConstants {
|
||||||
|
|
||||||
const val HOME_BOTTOM_TAB_CHECK = "client.main.bottom.tab.check" //底部tab切换
|
const val HOME_BOTTOM_TAB_CHECK = "client.main.bottom.tab.check" //底部tab切换
|
||||||
|
|
||||||
const val HOME_NOTICE_CHECK = "client.main.notice.check" //首页通知点击
|
|
||||||
|
|
||||||
const val GOODS_SELECT = "client.goods.select" //点击切换支付的会员类型
|
const val GOODS_SELECT = "client.goods.select" //点击切换支付的会员类型
|
||||||
|
|
||||||
const val PAY_SELECT = "client.pay.select" //点击切换支付类型
|
const val PAY_SELECT = "client.pay.select" //点击切换支付类型
|
||||||
|
|
@ -34,6 +32,8 @@ object EventConstants {
|
||||||
|
|
||||||
const val BID_TYPE_CHECK = "client.bid.type.check" //标讯类型切换
|
const val BID_TYPE_CHECK = "client.bid.type.check" //标讯类型切换
|
||||||
|
|
||||||
|
const val GOODS_TYPE_CHECK = "client.goods.type.check" //商品类型切换
|
||||||
|
|
||||||
const val JUMP_TO_TOOLS = "client.jump.to.tools" //跳转到企业工具
|
const val JUMP_TO_TOOLS = "client.jump.to.tools" //跳转到企业工具
|
||||||
|
|
||||||
const val JUMP_TO_BID_DETAIL = "client.jump.to.bid.detail" //跳转到标讯详情页
|
const val JUMP_TO_BID_DETAIL = "client.jump.to.bid.detail" //跳转到标讯详情页
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import android.view.ViewTreeObserver
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
import com.cheng.bole.R
|
import com.cheng.bole.R
|
||||||
import com.cheng.bole.bean.AreaBean
|
import com.cheng.bole.bean.AreaBean
|
||||||
import com.cheng.bole.bean.SupplierGoodsBean
|
import com.cheng.bole.bean.MerchantGoodsBean
|
||||||
import com.cheng.bole.bean.UploadFileEntity
|
import com.cheng.bole.bean.UploadFileEntity
|
||||||
import com.cheng.bole.common.Constants
|
import com.cheng.bole.common.Constants
|
||||||
import com.cheng.bole.databinding.FragmentPublishGoodsMessageBinding
|
import com.cheng.bole.databinding.FragmentPublishGoodsMessageBinding
|
||||||
|
|
@ -40,7 +40,7 @@ import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
class PublishGoodsMessageFragment: BaseFragment<FragmentPublishGoodsMessageBinding, PublishGoodsMessageViewModel>() {
|
class PublishGoodsMessageFragment: BaseFragment<FragmentPublishGoodsMessageBinding, PublishGoodsMessageViewModel>() {
|
||||||
private val from by lazy { arguments?.getInt("from") ?: 0 }
|
private val from by lazy { arguments?.getInt("from") ?: 0 }
|
||||||
|
|
||||||
private var goodsDetail: SupplierGoodsBean? = null
|
private var goodsDetail: MerchantGoodsBean? = null
|
||||||
|
|
||||||
private val imageAdapter by lazy { AddBidImageAdapter(requireContext(), uploadedImgList) }
|
private val imageAdapter by lazy { AddBidImageAdapter(requireContext(), uploadedImgList) }
|
||||||
private var uploadedImgList: ArrayList<UploadFileEntity> = ArrayList()
|
private var uploadedImgList: ArrayList<UploadFileEntity> = ArrayList()
|
||||||
|
|
@ -90,9 +90,9 @@ class PublishGoodsMessageFragment: BaseFragment<FragmentPublishGoodsMessageBindi
|
||||||
override fun initData() {
|
override fun initData() {
|
||||||
super.initData()
|
super.initData()
|
||||||
goodsDetail = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
goodsDetail = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
arguments?.getSerializable("item", SupplierGoodsBean::class.java)
|
arguments?.getSerializable("item", MerchantGoodsBean::class.java)
|
||||||
} else {
|
} else {
|
||||||
arguments?.getSerializable("item") as? SupplierGoodsBean
|
arguments?.getSerializable("item") as? MerchantGoodsBean
|
||||||
}
|
}
|
||||||
if (goodsDetail != null) {
|
if (goodsDetail != null) {
|
||||||
setData(goodsDetail!!)
|
setData(goodsDetail!!)
|
||||||
|
|
@ -280,7 +280,7 @@ class PublishGoodsMessageFragment: BaseFragment<FragmentPublishGoodsMessageBindi
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n", "NotifyDataSetChanged")
|
@SuppressLint("SetTextI18n", "NotifyDataSetChanged")
|
||||||
private fun setData(detail: SupplierGoodsBean) {
|
private fun setData(detail: MerchantGoodsBean) {
|
||||||
if (detail.status == "3") {
|
if (detail.status == "3") {
|
||||||
binding.tvReason.text = "理由:${detail.remark}"
|
binding.tvReason.text = "理由:${detail.remark}"
|
||||||
binding.tvTime.text = detail.review_time
|
binding.tvTime.text = detail.review_time
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ class QYZCFragment : BaseFragment<FragmentQyzcBinding, QYZCViewModel>() {
|
||||||
city = it[0]
|
city = it[0]
|
||||||
binding.tvArea.text = city!!.name
|
binding.tvArea.text = city!!.name
|
||||||
}
|
}
|
||||||
f.show(childFragmentManager, SelectAreaDialog::class.java.simpleName)
|
f.show(childFragmentManager, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.tvSendCode.onClick {
|
binding.tvSendCode.onClick {
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ class ZZDBDetailFragment : BaseFragment<FragmentZzdbDetailBinding, ZZDBDetailVie
|
||||||
city = it[0]
|
city = it[0]
|
||||||
binding.tvArea.text = city!!.name
|
binding.tvArea.text = city!!.name
|
||||||
}
|
}
|
||||||
f.show(childFragmentManager, SelectAreaDialog::class.java.simpleName)
|
f.show(childFragmentManager, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.tvSendCode.onClick {
|
binding.tvSendCode.onClick {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,26 @@
|
||||||
package com.cheng.bole.ui.fragment.merchant
|
package com.cheng.bole.ui.fragment.merchant
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.graphics.Typeface
|
||||||
|
import android.text.TextUtils
|
||||||
|
import android.view.KeyEvent
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.fragment.app.FragmentStatePagerAdapter
|
||||||
|
import com.angcyo.tablayout.delegate.ViewPager1Delegate
|
||||||
|
import com.cheng.bole.R
|
||||||
|
import com.cheng.bole.bean.AreaBean
|
||||||
|
import com.cheng.bole.common.Constants
|
||||||
|
import com.cheng.bole.common.EventConstants
|
||||||
import com.cheng.bole.databinding.FragmentMerchantBinding
|
import com.cheng.bole.databinding.FragmentMerchantBinding
|
||||||
|
import com.cheng.bole.impl.TextWatcherImpl
|
||||||
|
import com.cheng.bole.manager.EventReportManager
|
||||||
|
import com.cheng.bole.manager.SearchHistoryManager
|
||||||
|
import com.cheng.bole.ui.base.BasePageAdapter
|
||||||
|
import com.cheng.bole.ui.dialog.SelectAreaDialog
|
||||||
|
import com.cheng.bole.ui.fragment.merchant.list.MerchantGoodsListFragment
|
||||||
|
import com.example.base.extensions.onClick
|
||||||
import com.example.base.ui.BaseFragment
|
import com.example.base.ui.BaseFragment
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -8,5 +28,104 @@ import com.example.base.ui.BaseFragment
|
||||||
* 合作商
|
* 合作商
|
||||||
*/
|
*/
|
||||||
class MerchantFragment : BaseFragment<FragmentMerchantBinding, MerchantViewModel>() {
|
class MerchantFragment : BaseFragment<FragmentMerchantBinding, MerchantViewModel>() {
|
||||||
|
private val keyword by lazy { arguments?.getString("keyword") ?: "" }
|
||||||
|
|
||||||
|
private val tabText = listOf("全部", "服务", "产品", "其他")
|
||||||
|
private val fragmentList by lazy { mutableListOf<Fragment>() }
|
||||||
|
private val pageAdapter by lazy {
|
||||||
|
BasePageAdapter(
|
||||||
|
childFragmentManager,
|
||||||
|
tabText,
|
||||||
|
fragmentList,
|
||||||
|
FragmentStatePagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private var city: AreaBean? = AreaBean(0, name = "全国")
|
||||||
|
|
||||||
|
private val textWatcher = object : TextWatcherImpl() {
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||||
|
binding.ivClearText.visibility = if (TextUtils.isEmpty(s)) View.GONE else View.VISIBLE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
super.initView()
|
||||||
|
initFragment()
|
||||||
|
binding.viewPager.adapter = pageAdapter
|
||||||
|
binding.viewPager.offscreenPageLimit = fragmentList.size
|
||||||
|
binding.tabLayout.setupViewPager(ViewPager1Delegate.install(binding.viewPager, binding.tabLayout))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initFragment() {
|
||||||
|
fragmentList.add(MerchantGoodsListFragment.newInstance(""))
|
||||||
|
fragmentList.add(MerchantGoodsListFragment.newInstance("1"))
|
||||||
|
fragmentList.add(MerchantGoodsListFragment.newInstance("2"))
|
||||||
|
fragmentList.add(MerchantGoodsListFragment.newInstance("3"))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
super.initData()
|
||||||
|
binding.etSearch.setText(keyword)
|
||||||
|
fragmentList.forEach {
|
||||||
|
val fragment = it as MerchantGoodsListFragment
|
||||||
|
fragment.setKeyword(keyword)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initListener() {
|
||||||
|
super.initListener()
|
||||||
|
binding.etSearch.addTextChangedListener(textWatcher)
|
||||||
|
|
||||||
|
binding.tvCity.onClick {
|
||||||
|
val f = SelectAreaDialog.newInstance(if (city != null) listOf(city!!) else emptyList(), true, showAll = true)
|
||||||
|
f.setOnSelectListener {
|
||||||
|
city = if (it.size == 1) it[0] else null
|
||||||
|
binding.tvCity.text = if (city != null) city!!.name else "全国"
|
||||||
|
fragmentList.forEach { f ->
|
||||||
|
val fragment = f as MerchantGoodsListFragment
|
||||||
|
fragment.setCity(if (city != null) "${city!!.id}" else "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
f.show(childFragmentManager, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.ivClearText.onClick {
|
||||||
|
binding.etSearch.setText("")
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.etSearch.setOnEditorActionListener { _, _, event ->
|
||||||
|
if (event != null && event.keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_DOWN) {
|
||||||
|
val keyword = binding.etSearch.text.toString().trim()
|
||||||
|
fragmentList.forEach {
|
||||||
|
val fragment = it as MerchantGoodsListFragment
|
||||||
|
fragment.setKeyword(keyword)
|
||||||
|
}
|
||||||
|
SearchHistoryManager.addHistory(keyword)
|
||||||
|
return@setOnEditorActionListener true
|
||||||
|
}
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.tabLayout.observeIndexChange { fromIndex, toIndex, _, _ ->
|
||||||
|
binding.viewPager.currentItem = toIndex
|
||||||
|
if (fromIndex != -1) {
|
||||||
|
(binding.tabLayout.getChildAt(fromIndex) as TextView).typeface = Typeface.DEFAULT
|
||||||
|
(binding.tabLayout.getChildAt(fromIndex) as TextView).setBackgroundResource(R.drawable.shape_push_bid_type_default)
|
||||||
|
}
|
||||||
|
(binding.tabLayout.getChildAt(toIndex) as TextView).typeface = Constants.douyinsansB
|
||||||
|
(binding.tabLayout.getChildAt(toIndex) as TextView).setBackgroundResource(R.drawable.shape_push_bid_type_checked)
|
||||||
|
EventReportManager.eventReport(EventConstants.GOODS_TYPE_CHECK, "", (binding.tabLayout.getChildAt(toIndex) as TextView).text.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initObserve() {
|
||||||
|
super.initObserve()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroyView() {
|
||||||
|
binding.etSearch.removeTextChangedListener(textWatcher)
|
||||||
|
super.onDestroyView()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.cheng.bole.ui.fragment.merchant.list
|
||||||
|
|
||||||
|
import android.text.TextUtils
|
||||||
|
import android.widget.ImageView
|
||||||
|
import android.widget.TextView
|
||||||
|
import coil.load
|
||||||
|
import coil.transform.RoundedCornersTransformation
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.cheng.bole.R
|
||||||
|
import com.cheng.bole.bean.MerchantGoodsBean
|
||||||
|
import com.cheng.bole.common.Constants
|
||||||
|
import com.example.base.ui.list.LoadMoreAdapter
|
||||||
|
import com.example.base.utils.DensityUtils
|
||||||
|
|
||||||
|
class MerchantGoodsAdapter: LoadMoreAdapter<MerchantGoodsBean>(R.layout.listitem_merchant_goods) {
|
||||||
|
override fun convert(holder: BaseViewHolder, item: MerchantGoodsBean) {
|
||||||
|
if (item.file.isNotEmpty()) {
|
||||||
|
holder.getView<ImageView>(R.id.iv_cover).load(item.file[0].url){
|
||||||
|
transformations(RoundedCornersTransformation(DensityUtils.dp2px(8f).toFloat()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
holder.setText(R.id.tv_name, item.goods_name)
|
||||||
|
holder.setText(R.id.tv_desc, item.goods_description)
|
||||||
|
holder.setText(R.id.tv_price, item.goods_price_show)
|
||||||
|
holder.setText(R.id.tv_location, if (TextUtils.isEmpty(item.city_name)) "全国" else item.city_name)
|
||||||
|
holder.setText(R.id.tv_company_avatar, item.company.company_name.take(2) + "\n" + item.company.company_name.substring(2, 4))
|
||||||
|
holder.setText(R.id.tv_company_name, item.company.company_name)
|
||||||
|
holder.setText(R.id.tv_view_count, "已浏览${if (!TextUtils.isEmpty(item.view_count)) item.view_count else 0}")
|
||||||
|
holder.getView<TextView>(R.id.tv_price).typeface = Constants.dDIN_PRO_M
|
||||||
|
holder.getView<TextView>(R.id.tv_company_avatar).typeface = Constants.almmsht
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,92 @@
|
||||||
|
package com.cheng.bole.ui.fragment.merchant.list
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import com.cheng.bole.R
|
||||||
|
import com.cheng.bole.bean.MerchantGoodsBean
|
||||||
|
import com.cheng.bole.databinding.FragmentMerchantGoodsListBinding
|
||||||
|
import com.cheng.bole.ui.activity.PublicActivity
|
||||||
|
import com.cheng.bole.ui.fragment.mine.vip.VipFragment
|
||||||
|
import com.example.base.decoration.FirstItemOffsetDecoration
|
||||||
|
import com.example.base.ui.list.ListFragment
|
||||||
|
import com.example.base.utils.DensityUtils
|
||||||
|
|
||||||
|
class MerchantGoodsListFragment : ListFragment<FragmentMerchantGoodsListBinding, MerchantGoodsListViewModel, MerchantGoodsBean>() {
|
||||||
|
private val type by lazy { arguments?.getString("type") ?: "" }
|
||||||
|
private val userId by lazy { arguments?.getString("userId") ?: "" }
|
||||||
|
|
||||||
|
private var keyword: String = ""
|
||||||
|
|
||||||
|
private var item: MerchantGoodsBean? = null
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun newInstance(type: String, userId: String = ""): MerchantGoodsListFragment {
|
||||||
|
val args = Bundle()
|
||||||
|
args.putString("type", type)
|
||||||
|
args.putString("userId", userId)
|
||||||
|
val fragment = MerchantGoodsListFragment()
|
||||||
|
fragment.arguments = args
|
||||||
|
return fragment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun noDataClick() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun bindAdapter() = MerchantGoodsAdapter()
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
super.initView()
|
||||||
|
|
||||||
|
binding.mRecyclerView.addItemDecoration(FirstItemOffsetDecoration(DensityUtils.dp2px(7f), FirstItemOffsetDecoration.top))
|
||||||
|
mEmptyView.setNoDataLogo(R.mipmap.ic_empty_data)
|
||||||
|
mEmptyView.setNoDataText("暂无合作商")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
super.initData()
|
||||||
|
mViewModel.params["query"] = keyword
|
||||||
|
mViewModel.params["type"] = type
|
||||||
|
mViewModel.params["user_id"] = userId
|
||||||
|
firstLoad()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initListener() {
|
||||||
|
super.initListener()
|
||||||
|
mAdapter.setOnItemClickListener { _, _, i ->
|
||||||
|
item = mAdapter.getItem(i)
|
||||||
|
mViewModel.checkAuth()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initObserve() {
|
||||||
|
super.initObserve()
|
||||||
|
mViewModel.authLiveData.observe(this) {
|
||||||
|
if (it.auth) {
|
||||||
|
// PublicActivity.start(requireActivity(), SupplierGoodsDetailFragment::class.java, Pair("item", item))
|
||||||
|
} else {
|
||||||
|
PublicActivity.start(requireContext(), VipFragment::class.java, Pair("origin", "view_goods"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun setKeyword(keyword: String) {
|
||||||
|
this.keyword = keyword
|
||||||
|
if (isResumed) {
|
||||||
|
mViewModel.params["query"] = keyword
|
||||||
|
mViewModel.params["type"] = type
|
||||||
|
mViewModel.params["user_id"] = userId
|
||||||
|
firstLoad()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setCity(cityId: String) {
|
||||||
|
if (isResumed) {
|
||||||
|
mViewModel.params["city_id"] = cityId
|
||||||
|
mViewModel.params["type"] = type
|
||||||
|
mViewModel.params["user_id"] = userId
|
||||||
|
firstLoad()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.cheng.bole.ui.fragment.merchant.list
|
||||||
|
|
||||||
|
import androidx.collection.ArrayMap
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import com.cheng.bole.bean.MerchantGoodsBean
|
||||||
|
import com.cheng.bole.bean.UserAuthBean
|
||||||
|
import com.cheng.bole.net.ApiFactory
|
||||||
|
import com.cheng.bole.net.model.toListResult
|
||||||
|
import com.example.base.extensions.toast
|
||||||
|
import com.example.base.utils.L
|
||||||
|
import com.example.base.viewmodel.ListViewModel
|
||||||
|
|
||||||
|
class MerchantGoodsListViewModel: ListViewModel<MerchantGoodsBean>() {
|
||||||
|
override suspend fun requestApi(params: ArrayMap<String, String>): Result<List<MerchantGoodsBean>> {
|
||||||
|
return ApiFactory.apiService.searchSupplier(params).toListResult()
|
||||||
|
}
|
||||||
|
|
||||||
|
val authLiveData = MutableLiveData<UserAuthBean>()
|
||||||
|
|
||||||
|
fun checkAuth() {
|
||||||
|
launchOnUiTryCatch({
|
||||||
|
val response = ApiFactory.apiService.checkAuth()
|
||||||
|
if (response.status) {
|
||||||
|
authLiveData.postValue(response.data)
|
||||||
|
} else toast(response.message, true)
|
||||||
|
}, {
|
||||||
|
setError(it)
|
||||||
|
L.d(it)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -22,6 +22,7 @@ import com.example.base.decoration.FirstItemOffsetDecoration
|
||||||
import com.example.base.ui.list.ListFragment
|
import com.example.base.ui.list.ListFragment
|
||||||
import com.example.base.utils.DensityUtils
|
import com.example.base.utils.DensityUtils
|
||||||
import com.example.base.widget.PageStatus
|
import com.example.base.widget.PageStatus
|
||||||
|
import androidx.core.view.isNotEmpty
|
||||||
|
|
||||||
class PushListFragment : ListFragment<FragmentPushListBinding, PushListViewModel, BidItemBean>() {
|
class PushListFragment : ListFragment<FragmentPushListBinding, PushListViewModel, BidItemBean>() {
|
||||||
private val subId by lazy { arguments?.getString("subId") ?: "" }
|
private val subId by lazy { arguments?.getString("subId") ?: "" }
|
||||||
|
|
@ -107,7 +108,7 @@ class PushListFragment : ListFragment<FragmentPushListBinding, PushListViewModel
|
||||||
tvTab.setBackgroundResource(R.drawable.shape_push_bid_type_default)
|
tvTab.setBackgroundResource(R.drawable.shape_push_bid_type_default)
|
||||||
|
|
||||||
val lp = DslTabLayout.LayoutParams(DensityUtils.dp2px(84f), DensityUtils.dp2px(34f))
|
val lp = DslTabLayout.LayoutParams(DensityUtils.dp2px(84f), DensityUtils.dp2px(34f))
|
||||||
lp.marginStart = if (binding.tabLayout.childCount != 0) DensityUtils.dp2px(5f) else DensityUtils.dp2px(12f)
|
lp.marginStart = if (binding.tabLayout.isNotEmpty()) DensityUtils.dp2px(5f) else DensityUtils.dp2px(12f)
|
||||||
lp.marginEnd = if (binding.tabLayout.childCount < bidType.size - 1) DensityUtils.dp2px(5f) else DensityUtils.dp2px(12f)
|
lp.marginEnd = if (binding.tabLayout.childCount < bidType.size - 1) DensityUtils.dp2px(5f) else DensityUtils.dp2px(12f)
|
||||||
tvTab.layoutParams = lp
|
tvTab.layoutParams = lp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ class AddSubscribeFragment : BaseFragment<FragmentAddSubscribeBinding, AddSubscr
|
||||||
binding.tvArea.text =
|
binding.tvArea.text =
|
||||||
if (selectedCity.size == UserConfigManager.getCityList().size) "全国" else selectedCity.joinToString(",") { it.name }
|
if (selectedCity.size == UserConfigManager.getCityList().size) "全国" else selectedCity.joinToString(",") { it.name }
|
||||||
}
|
}
|
||||||
f.show(childFragmentManager, SelectAreaDialog::class.java.simpleName)
|
f.show(childFragmentManager, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.tvSource.onClick {
|
binding.tvSource.onClick {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,129 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:src="@mipmap/ic_merchant_top_bg"
|
||||||
|
app:layout_constraintDimensionRatio="h,1125:528"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/layout_search"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dp_36"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginStart="@dimen/dp_16"
|
||||||
|
android:layout_marginTop="@dimen/dp_48"
|
||||||
|
android:layout_marginEnd="@dimen/dp_16"
|
||||||
|
android:background="@drawable/shape_white_cor10"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingStart="@dimen/dp_12"
|
||||||
|
android:paddingEnd="@dimen/dp_12"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_city"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:drawableEnd="@mipmap/ic_option_arrow_down"
|
||||||
|
android:drawablePadding="@dimen/dp_4"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="全国"
|
||||||
|
android:textColor="@color/color_1a1a1a"
|
||||||
|
android:textSize="@dimen/sp_14" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="@dimen/dp_1"
|
||||||
|
android:layout_height="@dimen/dp_24"
|
||||||
|
android:layout_marginStart="@dimen/dp_12"
|
||||||
|
android:background="@color/color_eeeeee" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatEditText
|
||||||
|
android:id="@+id/et_search"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_10"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@null"
|
||||||
|
android:imeOptions="actionSearch"
|
||||||
|
android:drawableStart="@mipmap/ic_search"
|
||||||
|
android:drawablePadding="@dimen/dp_11"
|
||||||
|
android:hint="输入关键词"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="@color/color_1a1a1a"
|
||||||
|
android:textColorHint="@color/color_bcbcbc"
|
||||||
|
android:textSize="@dimen/sp_14" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/iv_clear_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_10"
|
||||||
|
android:src="@mipmap/ic_clear_text"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.angcyo.tablayout.DslTabLayout
|
||||||
|
android:id="@+id/tabLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dp_34"
|
||||||
|
android:layout_marginTop="@dimen/dp_20"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/layout_search"
|
||||||
|
app:tab_deselect_color="@color/color_1a1a1a"
|
||||||
|
app:tab_draw_indicator="false"
|
||||||
|
app:tab_enable_gradient_text_size="false"
|
||||||
|
app:tab_enable_text_bold="false"
|
||||||
|
app:tab_item_auto_equ_width="false"
|
||||||
|
app:tab_select_color="@color/color_125ffe"
|
||||||
|
app:tab_text_max_size="@dimen/sp_16"
|
||||||
|
app:tab_text_min_size="@dimen/sp_14">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="@dimen/dp_54"
|
||||||
|
android:layout_height="@dimen/dp_34"
|
||||||
|
android:layout_marginStart="@dimen/dp_16"
|
||||||
|
android:background="@drawable/shape_white_cor6"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="全部" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="@dimen/dp_54"
|
||||||
|
android:layout_height="@dimen/dp_34"
|
||||||
|
android:layout_marginStart="@dimen/dp_12"
|
||||||
|
android:background="@drawable/shape_white_cor6"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="服务" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="@dimen/dp_54"
|
||||||
|
android:layout_height="@dimen/dp_34"
|
||||||
|
android:layout_marginStart="@dimen/dp_12"
|
||||||
|
android:background="@drawable/shape_white_cor6"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="产品" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="@dimen/dp_54"
|
||||||
|
android:layout_height="@dimen/dp_34"
|
||||||
|
android:layout_marginStart="@dimen/dp_12"
|
||||||
|
android:background="@drawable/shape_white_cor6"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="其他" />
|
||||||
|
|
||||||
|
</com.angcyo.tablayout.DslTabLayout>
|
||||||
|
|
||||||
|
<androidx.viewpager.widget.ViewPager
|
||||||
|
android:id="@+id/viewPager"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginTop="@dimen/dp_9"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tabLayout" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?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="match_parent">
|
||||||
|
|
||||||
|
<com.scwang.smart.refresh.layout.SmartRefreshLayout
|
||||||
|
android:id="@+id/mRefreshLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/mRecyclerView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
|
tools:listitem="@layout/listitem_merchant_goods" />
|
||||||
|
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
@ -0,0 +1,134 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<com.lihang.ShadowLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_9"
|
||||||
|
android:layout_marginEnd="@dimen/dp_9"
|
||||||
|
app:hl_cornerRadius="@dimen/dp_8"
|
||||||
|
app:hl_shadowColor="#0d4a4f5b"
|
||||||
|
app:hl_shadowLimit="@dimen/dp_7">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingStart="@dimen/dp_12"
|
||||||
|
android:paddingTop="@dimen/dp_16"
|
||||||
|
android:paddingEnd="@dimen/dp_12"
|
||||||
|
android:paddingBottom="@dimen/dp_16">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/iv_cover"
|
||||||
|
android:layout_width="@dimen/dp_110"
|
||||||
|
android:layout_height="@dimen/dp_80"
|
||||||
|
android:src="@mipmap/ic_launcher_icon"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_name"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="@dimen/dp_12"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:fontFamily="sans-serif-medium"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="水泥批发、建筑材料供应"
|
||||||
|
android:textColor="@color/color_1a1a1a"
|
||||||
|
android:textSize="@dimen/sp_15"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/iv_cover"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/iv_cover" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_desc"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/dp_4"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="水泥批发"
|
||||||
|
android:textColor="@color/color_666666"
|
||||||
|
android:textSize="@dimen/sp_12"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/tv_name"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/tv_name"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_name" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_price"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:lines="1"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="面议"
|
||||||
|
android:textColor="@color/color_ff493c"
|
||||||
|
android:textSize="@dimen/sp_20"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/iv_cover"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/tv_location"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/tv_name" />
|
||||||
|
|
||||||
|
<com.cheng.bole.widget.CommonShapeView
|
||||||
|
android:id="@+id/tv_location"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="@dimen/dp_18"
|
||||||
|
android:layout_marginEnd="@dimen/dp_12"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:paddingStart="@dimen/dp_4"
|
||||||
|
android:paddingEnd="@dimen/dp_4"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="全国"
|
||||||
|
android:textColor="#585D6C"
|
||||||
|
android:textSize="@dimen/sp_11"
|
||||||
|
app:csb_cornerRadius="@dimen/dp_2"
|
||||||
|
app:csb_fillColor="#F4F6FA"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/tv_price"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/iv_cover"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/tv_price"
|
||||||
|
app:layout_constraintWidth_max="72dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_company_avatar"
|
||||||
|
android:layout_width="@dimen/dp_20"
|
||||||
|
android:layout_height="@dimen/dp_20"
|
||||||
|
android:layout_marginTop="@dimen/dp_12"
|
||||||
|
android:background="@mipmap/ic_company_name_avater_bg"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="永康\n市欧"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="6sp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/iv_cover" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_company_name"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_6"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="永康市欧努家具有限公司"
|
||||||
|
android:textColor="@color/color_1a1a1a"
|
||||||
|
android:textSize="@dimen/sp_12"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/tv_company_avatar"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/tv_view_count"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/tv_company_avatar"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/tv_company_avatar" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_view_count"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="已浏览 0"
|
||||||
|
android:textColor="@color/color_999999"
|
||||||
|
android:textSize="@dimen/sp_10"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/tv_company_avatar"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/tv_company_avatar" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</com.lihang.ShadowLayout>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 732 B |
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
Loading…
Reference in New Issue