diff --git a/app/src/main/java/com/cheng/bole/bean/MenuEntity.kt b/app/src/main/java/com/cheng/bole/bean/MenuEntity.kt index bf2fdf5..1af32d2 100644 --- a/app/src/main/java/com/cheng/bole/bean/MenuEntity.kt +++ b/app/src/main/java/com/cheng/bole/bean/MenuEntity.kt @@ -1,6 +1,7 @@ package com.cheng.bole.bean import com.cheng.bole.R +import com.cheng.bole.manager.UserConfigManager import java.io.Serializable data class MenuEntity( @@ -11,18 +12,22 @@ data class MenuEntity( companion object { fun getHomeMenu(): List { val list = mutableListOf() - list.add(MenuEntity("1", R.mipmap.ic_home_icon1, "代理记账")) - list.add(MenuEntity("2", R.mipmap.ic_home_icon2, "企业注册")) - list.add(MenuEntity("3", R.mipmap.ic_home_icon3, "标书制作")) - list.add(MenuEntity("4", R.mipmap.ic_home_icon4, "资质代办")) - list.add(MenuEntity("5", R.mipmap.ic_home_icon5, "招标公告")) - list.add(MenuEntity("6", R.mipmap.ic_home_icon6, "采购公告")) - list.add(MenuEntity("7", R.mipmap.ic_home_icon7, "招标预告")) - list.add(MenuEntity("8", R.mipmap.ic_home_icon8, "合同公告")) - list.add(MenuEntity("9", R.mipmap.ic_home_icon9, "中标结果")) - list.add(MenuEntity("10", R.mipmap.ic_home_icon10, "竟争性磋商")) - list.add(MenuEntity("11", R.mipmap.ic_home_icon11, "更正公告")) - list.add(MenuEntity("12", R.mipmap.ic_home_icon12, "终止公告")) + list.add(MenuEntity("dljz", R.mipmap.ic_home_icon1, "代理记账")) + list.add(MenuEntity("qyzc", R.mipmap.ic_home_icon2, "企业注册")) + list.add(MenuEntity("bszz", R.mipmap.ic_home_icon3, "标书制作")) + list.add(MenuEntity("zzdb", R.mipmap.ic_home_icon4, "资质代办")) + UserConfigManager.getBidTypes().forEach { + when(it.name) { + "招标公告" -> list.add(MenuEntity(it.id, R.mipmap.ic_home_icon5, it.name)) + "采购公告" -> list.add(MenuEntity(it.id, R.mipmap.ic_home_icon6, it.name)) + "招标计划" -> list.add(MenuEntity(it.id, R.mipmap.ic_home_icon7, it.name)) + "合同公告" -> list.add(MenuEntity(it.id, R.mipmap.ic_home_icon8, it.name)) + "中标公告" -> list.add(MenuEntity(it.id, R.mipmap.ic_home_icon9, it.name)) + "竞争性磋商" -> list.add(MenuEntity(it.id, R.mipmap.ic_home_icon10, it.name)) + "更正公告" -> list.add(MenuEntity(it.id, R.mipmap.ic_home_icon11, it.name)) + "终止公告" -> list.add(MenuEntity(it.id, R.mipmap.ic_home_icon12, it.name)) + } + } return list } } diff --git a/app/src/main/java/com/cheng/bole/bean/MerchantGoodsBean.kt b/app/src/main/java/com/cheng/bole/bean/MerchantGoodsBean.kt index ac7b44f..80bc398 100644 --- a/app/src/main/java/com/cheng/bole/bean/MerchantGoodsBean.kt +++ b/app/src/main/java/com/cheng/bole/bean/MerchantGoodsBean.kt @@ -8,7 +8,7 @@ data class MerchantGoodsBean( val company: CompanyBean, val contact: List, val create_time: String, - val file: List, + val file: List, val goods_description: String, val goods_name: String, val goods_price: String, diff --git a/app/src/main/java/com/cheng/bole/bean/UploadFileBean.kt b/app/src/main/java/com/cheng/bole/bean/UploadFileEntity.kt similarity index 71% rename from app/src/main/java/com/cheng/bole/bean/UploadFileBean.kt rename to app/src/main/java/com/cheng/bole/bean/UploadFileEntity.kt index 64e8ed2..3afaf20 100644 --- a/app/src/main/java/com/cheng/bole/bean/UploadFileBean.kt +++ b/app/src/main/java/com/cheng/bole/bean/UploadFileEntity.kt @@ -2,7 +2,7 @@ package com.cheng.bole.bean import java.io.Serializable -data class UploadFileBean( +data class UploadFileEntity( var id: String = "", var url: String = "" ): Serializable \ No newline at end of file diff --git a/app/src/main/java/com/cheng/bole/bean/UploadImgEntity.kt b/app/src/main/java/com/cheng/bole/bean/UploadImgEntity.kt deleted file mode 100644 index 111338b..0000000 --- a/app/src/main/java/com/cheng/bole/bean/UploadImgEntity.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.cheng.bole.bean - -import java.io.Serializable - -class UploadImgEntity : Serializable { - var id = "" - var url = "" -} \ No newline at end of file diff --git a/app/src/main/java/com/cheng/bole/bean/QualificationInfoBean.kt b/app/src/main/java/com/cheng/bole/bean/ZZDBInfoBean.kt similarity index 77% rename from app/src/main/java/com/cheng/bole/bean/QualificationInfoBean.kt rename to app/src/main/java/com/cheng/bole/bean/ZZDBInfoBean.kt index 3a41974..53f64f3 100644 --- a/app/src/main/java/com/cheng/bole/bean/QualificationInfoBean.kt +++ b/app/src/main/java/com/cheng/bole/bean/ZZDBInfoBean.kt @@ -2,7 +2,7 @@ package com.cheng.bole.bean import java.io.Serializable -data class QualificationInfoBean( +data class ZZDBInfoBean( val id: String, val name: String, val createTime: String, @@ -14,5 +14,5 @@ data class QualificationInfoBean( val range: String, val status: String, val updateTime: String, - val children: List + val children: List ) : Serializable \ No newline at end of file diff --git a/app/src/main/java/com/cheng/bole/common/EventConstants.kt b/app/src/main/java/com/cheng/bole/common/EventConstants.kt index 67d095f..2bed46d 100644 --- a/app/src/main/java/com/cheng/bole/common/EventConstants.kt +++ b/app/src/main/java/com/cheng/bole/common/EventConstants.kt @@ -38,6 +38,8 @@ object EventConstants { const val JUMP_TO_BID_SEARCH = "client.jump.to.bid.search" //跳转到搜索 + const val JUMP_TO_TOOLS = "client.jump.to.tools" //跳转到工具 + const val DIALOG_GO_TO_VIEW = "client.dialog.go.to.view" //前往保存文件的地址查看 const val JUMP_TO_ABOUT_US = "client.jump.to.about.us" //界面跳转 diff --git a/app/src/main/java/com/cheng/bole/net/ApiService.kt b/app/src/main/java/com/cheng/bole/net/ApiService.kt index 5da1b00..9845748 100644 --- a/app/src/main/java/com/cheng/bole/net/ApiService.kt +++ b/app/src/main/java/com/cheng/bole/net/ApiService.kt @@ -1,21 +1,31 @@ package com.cheng.bole.net +import com.cheng.bole.bean.AccountEntity +import com.cheng.bole.bean.AreaBean import com.cheng.bole.bean.BidDetailBean import com.cheng.bole.bean.BidItemBean import com.cheng.bole.bean.BidTypeBean -import com.cheng.bole.bean.AreaBean import com.cheng.bole.bean.CompanyBean import com.cheng.bole.bean.CorpInfoBean +import com.cheng.bole.bean.CouponEntity import com.cheng.bole.bean.GuideTotalBidInfoBean import com.cheng.bole.bean.GuideUpdateInfoBean import com.cheng.bole.bean.HotWordBean +import com.cheng.bole.bean.LoginEntity import com.cheng.bole.bean.MerchantGoodsBean -import com.cheng.bole.bean.QualificationInfoBean +import com.cheng.bole.bean.OrderPayEntity +import com.cheng.bole.bean.ZZDBInfoBean import com.cheng.bole.bean.SeatItemBean +import com.cheng.bole.bean.SendCodeEntity import com.cheng.bole.bean.SourceBean import com.cheng.bole.bean.SubscriptionBean import com.cheng.bole.bean.SubscriptionMessageBean +import com.cheng.bole.bean.UploadFileEntity import com.cheng.bole.bean.UserAuthBean +import com.cheng.bole.bean.UserConfigEntity +import com.cheng.bole.bean.UserEntity +import com.cheng.bole.bean.VipGoodsEntity +import com.cheng.bole.bean.WxServiceEntity import com.cheng.bole.net.model.HttpBaseResult import com.cheng.bole.net.model.HttpListResult import com.ylqh.cube.bean.CouponActivityEntity @@ -49,19 +59,19 @@ interface ApiService { @Query("ua") ua: String, @Query("imei") imei: String, @Query("cid") cid: String, - ): HttpBaseResult + ): HttpBaseResult /** * 发送验证码 */ @POST("/api/user/code") - suspend fun sendCode(@Body params: Map): HttpBaseResult + suspend fun sendCode(@Body params: Map): HttpBaseResult /** * 登录 */ @POST("/api/user/login") - suspend fun login(@Body requestBody: RequestBody): HttpBaseResult + suspend fun login(@Body requestBody: RequestBody): HttpBaseResult /** * 退出登录 @@ -85,20 +95,20 @@ interface ApiService { * 获取用户信息 */ @GET("/api/user") - suspend fun userInfo(): HttpBaseResult + suspend fun userInfo(): HttpBaseResult /** * 获取账号列表 */ @GET("/api/user/account") - suspend fun accountList(@Query("scene") scene: String): HttpBaseResult> + suspend fun accountList(@Query("scene") scene: String): HttpBaseResult> /** * 上传图片 */ @Multipart @POST("/api/user/upload") - suspend fun upload(@Part part: MultipartBody.Part, @Query("scene") scene: String): HttpBaseResult + suspend fun upload(@Part part: MultipartBody.Part, @Query("scene") scene: String): HttpBaseResult /** *删除用户文件 @@ -110,7 +120,7 @@ interface ApiService { * 联系客服 */ @GET("/api/weixin/service") - suspend fun wxService(): HttpBaseResult + suspend fun wxService(): HttpBaseResult /** * 事件上报 @@ -134,13 +144,13 @@ interface ApiService { * 获取VIP套餐列表 */ @GET("/api/order/goods") - suspend fun getGoodsList(@Query("type") type: String = "member"): HttpBaseResult> + suspend fun getGoodsList(@Query("type") type: String = "member"): HttpBaseResult> /** * 优惠券列表 */ @GET("/api/activity/coupon") - suspend fun couponList(@QueryMap params: Map): HttpBaseResult> + suspend fun couponList(@QueryMap params: Map): HttpBaseResult> /** * 获取优惠活动列表 @@ -158,7 +168,7 @@ interface ApiService { * 创建支付订单 */ @POST("/api/order") - suspend fun payCreateOrder(@Body requestBody: RequestBody): HttpBaseResult + suspend fun payCreateOrder(@Body requestBody: RequestBody): HttpBaseResult /** * 权限验证 @@ -245,7 +255,7 @@ interface ApiService { /** * 招标公告类型 */ - @GET("api/info/type") + @GET("/api/info/type") suspend fun getBidTypeList(): HttpBaseResult> /** @@ -330,7 +340,7 @@ interface ApiService { * 资质代办列表 */ @GET("/api/agency/cert") - suspend fun getAgencyList(@QueryMap map: Map): HttpBaseResult> + suspend fun getAgencyList(@QueryMap map: Map): HttpBaseResult> /** * 我的标讯列表 diff --git a/app/src/main/java/com/cheng/bole/ui/dialog/AccountListDialog.kt b/app/src/main/java/com/cheng/bole/ui/dialog/AccountListDialog.kt index 7a75391..b9b9756 100644 --- a/app/src/main/java/com/cheng/bole/ui/dialog/AccountListDialog.kt +++ b/app/src/main/java/com/cheng/bole/ui/dialog/AccountListDialog.kt @@ -93,10 +93,10 @@ class AccountListDialog : DialogFragment() { class AccountAdapter: BaseQuickAdapter(R.layout.listitem_account_login_tip) { override fun convert(holder: BaseViewHolder, item: com.cheng.bole.bean.AccountEntity) { if (item.vip_type == "1") { - holder.setGone(R.id.tv_vip_tag, true) + holder.setGone(R.id.iv_vip_tag, true) } else if (item.vip_type == "2" || item.vip_type == "3") { - holder.setText(R.id.tv_vip_tag, if (item.vip_type == "2") "会员" else "终生会员") - holder.setGone(R.id.tv_vip_tag, false) + holder.setImageResource(R.id.iv_vip_tag, if (item.vip_type == "2") R.mipmap.ic_vip_tag1 else R.mipmap.ic_vip_tag2) + holder.setGone(R.id.iv_vip_tag, false) } holder.setText(R.id.tv_username, item.name) holder.setText(R.id.tv_create_time, "${item.create_time} 注册") diff --git a/app/src/main/java/com/cheng/bole/ui/dialog/PopupDialog.kt b/app/src/main/java/com/cheng/bole/ui/dialog/PopupDialog.kt index 11047cb..230e693 100644 --- a/app/src/main/java/com/cheng/bole/ui/dialog/PopupDialog.kt +++ b/app/src/main/java/com/cheng/bole/ui/dialog/PopupDialog.kt @@ -81,7 +81,6 @@ object PopupDialog { } val selectedList = option.items.filter { item -> item.id != 0 } if (selectedList.isNotEmpty() && selectedList.all { item -> item.isChecked }) { - option.isChecked = true option.items[0].isChecked = true } } @@ -144,7 +143,12 @@ object PopupDialog { onDismiss.invoke() } - binding.btnReset.onClick { parentAdapter.setList(SearchOptionBean.getAreaOptionList()) } + binding.btnReset.onClick { + val optionList = SearchOptionBean.getAreaOptionList() + optionList[0].isChecked = true + parentAdapter.setList(optionList) + childAdapter.setList(optionList[0].items) + } binding.btnNext.onClick { val list = mutableListOf() diff --git a/app/src/main/java/com/cheng/bole/ui/dialog/SelectAreaDialog.kt b/app/src/main/java/com/cheng/bole/ui/dialog/SelectAreaDialog.kt new file mode 100644 index 0000000..9fc8558 --- /dev/null +++ b/app/src/main/java/com/cheng/bole/ui/dialog/SelectAreaDialog.kt @@ -0,0 +1,277 @@ +package com.cheng.bole.ui.dialog + +import android.annotation.SuppressLint +import android.app.Dialog +import android.graphics.Color +import android.graphics.drawable.ColorDrawable +import android.os.Bundle +import android.text.TextUtils +import android.view.Gravity +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.DialogFragment +import com.chad.library.adapter.base.BaseQuickAdapter +import com.chad.library.adapter.base.viewholder.BaseViewHolder +import com.cheng.bole.R +import com.cheng.bole.bean.AreaBean +import com.cheng.bole.databinding.DialogSelectAreaBinding +import com.cheng.bole.manager.UserConfigManager +import com.example.base.extensions.getColor +import com.example.base.extensions.onClick +import com.example.base.extensions.toast +import com.example.base.utils.DensityUtils +import com.example.base.utils.ScreenUtils +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken + +class SelectAreaDialog : DialogFragment() { + private val isSingle by lazy { arguments?.getBoolean("isSingle") ?: false } + private val showAll by lazy { arguments?.getBoolean("showAll") ?: false } + + private var mOnBackListener: ((List) -> Unit)? = null //回调事件 + + private lateinit var binding: DialogSelectAreaBinding + + override fun onStart() { + super.onStart() + val window = dialog?.window + val windowParams = window?.attributes + windowParams?.dimAmount = 0.7f + windowParams?.width = ScreenUtils.getWindowSize().x + windowParams?.gravity = Gravity.BOTTOM + windowParams?.windowAnimations = R.style.dialog_bottom + dialog?.window?.attributes = windowParams + } + + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { + dialog?.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) + return super.onCreateView(inflater, container, savedInstanceState) + } + + @SuppressLint("NotifyDataSetChanged") + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { + val view = layoutInflater.inflate(R.layout.dialog_select_area, null) + + binding = DialogSelectAreaBinding.bind(view) + + val listStr = arguments?.getString("list") + val defaultCityList = if (!TextUtils.isEmpty(listStr)) { + Gson().fromJson(listStr, object : TypeToken>() {}.type) + } else emptyList() + + val areaAdapter = AreaAdapter() + binding.rvParent.adapter = areaAdapter + + val cityAdapter = CityAdapter() + binding.rvChild.adapter = cityAdapter + + val areaList = UserConfigManager.getAreaList() + if (!isSingle) { + areaList.add(0, AreaBean(0, name = "全国地区")) + areaList.forEach { it.children.add(0, AreaBean(0, name = "全部")) } + if (defaultCityList.size == UserConfigManager.getCityList().size) { + areaList[0].isChecked = true + areaList[0].children[0].isChecked = true + } else { + areaList.forEach { area -> + area.children.forEach { child -> + if (defaultCityList.find { city -> city.id == child.id } != null) { + child.isChecked = true + if (areaList.find { it.isChecked } == null) { + area.isChecked = true + } + } + } + val selectedList = area.children.filter { item -> item.id != 0 } + if (selectedList.isNotEmpty() && selectedList.all { item -> item.isChecked }) { + area.children[0].isChecked = true + } + } + } + } else { + if (showAll) { + areaList.add(0, AreaBean(0, name = "全国地区", children = mutableListOf(AreaBean(0, name = "全国")))) + if (defaultCityList.isEmpty()) { + areaList[0].isChecked = true + areaList[0].children[0].isChecked = true + } + } + if (!showAll || areaList.isNotEmpty()) { + areaList.forEach { area -> + area.children.forEach { child -> + child.isChecked = defaultCityList.find { city -> city.id == child.id } != null + if (areaList.find { it.isChecked } == null) { + area.isChecked = true + } + } + } + } + } + if (areaList.find { it.isChecked } == null) { + areaList[0].isChecked = true + } + areaAdapter.setList(areaList) + cityAdapter.setList(areaList.find { it.isChecked }?.children) + + areaAdapter.setOnItemClickListener { _, _, position -> + val item = areaAdapter.getItem(position) + areaList.find { it.isChecked }?.isChecked = false + item.isChecked = true + areaAdapter.notifyDataSetChanged() + + cityAdapter.setList(item.children) + } + + cityAdapter.setOnItemClickListener { _, _, position -> + val item = cityAdapter.getItem(position) + if (isSingle) { + areaList.forEach { area -> + area.children.find { it.isChecked }?.isChecked = false + } + item.isChecked = true + } else { + item.isChecked = !item.isChecked + if (item.isChecked) { + if (item.id == 0) { + cityAdapter.data.forEach { it.isChecked = true } + } else { + if (cityAdapter.data.filter { it.id != 0 }.all { it.isChecked }) { + cityAdapter.data[0].isChecked = true + } + } + } else { + if (item.id == 0) { + cityAdapter.data.forEach { it.isChecked = false } + } else { + if (cityAdapter.data[0].isChecked) { + cityAdapter.data[0].isChecked = false + } + } + } + + if (areaAdapter.data[0].isChecked) { + for (i in 1 until areaAdapter.data.size) { + areaAdapter.getItem(i).children.forEach { + it.isChecked = false + } + } + } else { + if (areaAdapter.data[0].children[0].isChecked) { + areaAdapter.data[0].children[0].isChecked = false + } + } + } + cityAdapter.notifyDataSetChanged() + } + + binding.btnNext.onClick { + val selectedCityList = mutableListOf() + if (areaAdapter.data[0].children[0].id == 0 && areaAdapter.data[0].children[0].isChecked) { + areaAdapter.data.forEach { + selectedCityList.addAll(it.children.filter { item -> item.id != 0 }) + } + } else { + areaAdapter.data.forEach { + selectedCityList.addAll(it.children.filter { item -> item.isChecked && item.id != 0 }) + } + } + if (selectedCityList.isEmpty()) { + toast("请选择地区") + return@onClick + } + mOnBackListener?.invoke(selectedCityList) + dismiss() + } + + binding.ivClose.onClick { dismiss() } + + val dialog = Dialog(requireContext()) + dialog.setContentView(view) + return dialog + } + + fun setOnSelectListener(listener: ((List) -> Unit)) { + mOnBackListener = listener + } + + companion object { + fun newInstance(list: List = emptyList(), isSingle: Boolean = false, showAll: Boolean = false): SelectAreaDialog { + val arg = Bundle() + arg.putString("list", Gson().toJson(list)) + arg.putBoolean("isSingle", isSingle) + arg.putBoolean("showAll", showAll) + val fragment = SelectAreaDialog() + fragment.arguments = arg + return fragment + } + } + + class AreaAdapter() : BaseQuickAdapter(R.layout.listitem_search_option_parent) { + @SuppressLint("NotifyDataSetChanged") + override fun convert(holder: BaseViewHolder, item: AreaBean) { + holder.setText(R.id.tv_name, item.name) + holder.setVisible(R.id.view_tag, item.isChecked) + holder.itemView.setBackgroundColor(if (item.isChecked) Color.WHITE else Color.TRANSPARENT) + /*holder.setText(R.id.tv_title, item.name) + + val rvOptions = holder.getView(R.id.rv_options) + if (rvOptions.adapter == null) { + rvOptions.layoutManager = GridLayoutManager(context, 3) + rvOptions.addItemDecoration(GridSpaceItemDecoration(3, DensityUtils.dp2px(8f), DensityUtils.dp2px(8f))) + val adapter = CityItemAdapter() + rvOptions.adapter = adapter + } + val itemAdapter = rvOptions.adapter as CityItemAdapter + itemAdapter.setList(item.children) + itemAdapter.setOnItemClickListener { _, _, i -> + val childItem = itemAdapter.getItem(i) + if (!isSingle) { + if (holder.layoutPosition == 0) { + data.forEach { + it.children.forEach { item -> item.isChecked = false } + } + childItem.isChecked = true + notifyDataSetChanged() + } else { + childItem.isChecked = !childItem.isChecked + if (childItem.id == 0) { + item.children.forEach { item -> item.isChecked = childItem.isChecked } + } else { + if (!childItem.isChecked) { + item.children[0].isChecked = false + } else { + if (item.children.filter { item -> item.isChecked }.size == item.children.size - 1) { + item.children[0].isChecked = true + } + } + } + data[0].children[0].isChecked = false + notifyDataSetChanged() + } + } else { + data.forEach { + it.children.find { item -> item.isChecked }?.isChecked = false + } + childItem.isChecked = true + notifyDataSetChanged() + } + }*/ + } + } + + class CityAdapter : BaseQuickAdapter(R.layout.listitem_search_option_child) { + override fun convert(holder: BaseViewHolder, item: AreaBean) { + holder.setText(R.id.tv_name, item.name) + holder.setTextColor(R.id.tv_name, if (item.isChecked) getColor(R.color.color_125ffe) else getColor(R.color.color_1a1a1a)) + holder.setVisible(R.id.iv_check, item.isChecked) + holder.itemView.layoutParams.height = DensityUtils.dp2px(40f) + holder.itemView.setPadding(DensityUtils.dp2px(30f), 0, DensityUtils.dp2px(25f), 0) + /*holder.setText(R.id.tv_name, item.name) + holder.setTextColor(R.id.tv_name, if (item.isChecked) getColor(R.color.color_ff493c) else getColor(R.color.color_1a1a1a)) + holder.getView(R.id.tv_name).typeface = if (item.isChecked) Typeface.DEFAULT_BOLD else Typeface.DEFAULT + + holder.itemView.setBackgroundResource(R.drawable.shape_f7f7f7_cor4)*/ + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/bid/detail/BidDetailFragment.kt b/app/src/main/java/com/cheng/bole/ui/fragment/bid/detail/BidDetailFragment.kt index ba60dbb..dc19eab 100644 --- a/app/src/main/java/com/cheng/bole/ui/fragment/bid/detail/BidDetailFragment.kt +++ b/app/src/main/java/com/cheng/bole/ui/fragment/bid/detail/BidDetailFragment.kt @@ -10,7 +10,7 @@ import android.webkit.WebView import android.webkit.WebViewClient import com.cheng.bole.R import com.cheng.bole.bean.BidDetailBean -import com.cheng.bole.bean.UploadFileBean +import com.cheng.bole.bean.UploadFileEntity import com.cheng.bole.bean.WxShareEntity import com.cheng.bole.common.Constants import com.cheng.bole.common.EventConstants @@ -23,7 +23,6 @@ import com.cheng.bole.ui.dialog.DownloadAttachmentDialog import com.cheng.bole.utils.BidTypeUtils import com.example.base.browser.BrowserActivity import com.example.base.common.RxBus -import com.example.base.extensions.getColor import com.example.base.extensions.gone import com.example.base.extensions.onClick import com.example.base.extensions.toast @@ -166,7 +165,7 @@ class BidDetailFragment: BaseFragment>(Gson().toJson(detail!!.origin_content), object : TypeToken>() {}.type) + val imageList = Gson().fromJson>(Gson().toJson(detail!!.origin_content), object : TypeToken>() {}.type) imageAdapter.setList(imageList) binding.rvImage.visible() binding.webView.gone() diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/bid/detail/BidImageAdapter.kt b/app/src/main/java/com/cheng/bole/ui/fragment/bid/detail/BidImageAdapter.kt index f85cc12..241200a 100644 --- a/app/src/main/java/com/cheng/bole/ui/fragment/bid/detail/BidImageAdapter.kt +++ b/app/src/main/java/com/cheng/bole/ui/fragment/bid/detail/BidImageAdapter.kt @@ -8,11 +8,11 @@ import com.bumptech.glide.request.transition.Transition import com.chad.library.adapter.base.BaseQuickAdapter import com.chad.library.adapter.base.viewholder.BaseViewHolder import com.cheng.bole.R -import com.cheng.bole.bean.UploadFileBean +import com.cheng.bole.bean.UploadFileEntity import com.cheng.bole.utils.BitmapUtils -class BidImageAdapter: BaseQuickAdapter(R.layout.listitem_bid_detail_image) { - override fun convert(holder: BaseViewHolder, item: UploadFileBean) { +class BidImageAdapter: BaseQuickAdapter(R.layout.listitem_bid_detail_image) { + override fun convert(holder: BaseViewHolder, item: UploadFileEntity) { Glide.with(context) .asBitmap() .load(item.url) diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/home/HomeFragment.kt b/app/src/main/java/com/cheng/bole/ui/fragment/home/HomeFragment.kt index cce6a7e..05543d3 100644 --- a/app/src/main/java/com/cheng/bole/ui/fragment/home/HomeFragment.kt +++ b/app/src/main/java/com/cheng/bole/ui/fragment/home/HomeFragment.kt @@ -1,5 +1,6 @@ package com.cheng.bole.ui.fragment.home +import android.text.TextUtils import androidx.coordinatorlayout.widget.CoordinatorLayout import androidx.recyclerview.widget.RecyclerView.HORIZONTAL import com.cheng.bole.R @@ -10,9 +11,14 @@ import com.cheng.bole.common.EventConstants import com.cheng.bole.databinding.FragmentHomeBinding import com.cheng.bole.manager.EventReportManager import com.cheng.bole.manager.SearchHistoryManager +import com.cheng.bole.manager.UserConfigManager import com.cheng.bole.ui.activity.PublicActivity import com.cheng.bole.ui.fragment.bid.BidAdapter import com.cheng.bole.ui.fragment.bid.detail.BidDetailFragment +import com.cheng.bole.ui.fragment.home.bszz.BSZZFragment +import com.cheng.bole.ui.fragment.home.dljz.DLJZFragment +import com.cheng.bole.ui.fragment.home.qyzc.QYZCFragment +import com.cheng.bole.ui.fragment.home.zzdb.ZZDBFragment import com.cheng.bole.ui.fragment.mine.vip.VipFragment import com.cheng.bole.ui.fragment.search.SearchFragment import com.cheng.bole.ui.fragment.search.list.SearchListFragment @@ -50,7 +56,6 @@ class HomeFragment : ListFragment - mAdapter.setOnItemClickListener { _, _, i -> - item = mAdapter.getItem(i) - mViewModel.checkAuth() - } + item = mAdapter.getItem(i) + mViewModel.checkAuth() } keywordAdapter.setOnItemClickListener { _, _, i -> @@ -95,10 +103,42 @@ class HomeFragment : ListFragment + val item = menuAdapter.getItem(i) + when(item.id) { + "dljz" -> { + PublicActivity.start(requireContext(), DLJZFragment::class.java) + EventReportManager.eventReport(EventConstants.JUMP_TO_TOOLS, item.title) + } + "qyzc" -> { + PublicActivity.start(requireContext(), QYZCFragment::class.java) + EventReportManager.eventReport(EventConstants.JUMP_TO_TOOLS, item.title) + } + "bszz" -> { + PublicActivity.start(requireContext(), BSZZFragment::class.java) + EventReportManager.eventReport(EventConstants.JUMP_TO_TOOLS, item.title) + } + "zzdb" -> { + PublicActivity.start(requireContext(), ZZDBFragment::class.java) + EventReportManager.eventReport(EventConstants.JUMP_TO_TOOLS, item.title) + } + else -> { + PublicActivity.start(requireContext(), SearchListFragment::class.java, Pair("typeId", item.id)) + EventReportManager.eventReport(EventConstants.JUMP_TO_BID_SEARCH, item.title) + } + } + + } } override fun initObserve() { super.initObserve() + mViewModel.typeLiveData.observe(this) { + UserConfigManager.saveBidTypes(it) + menuAdapter.setList(MenuEntity.getHomeMenu()) + } + mViewModel.recommendLiveData.observe(this) { keywordAdapter.setList(it) } diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/home/HomeViewModel.kt b/app/src/main/java/com/cheng/bole/ui/fragment/home/HomeViewModel.kt index dd43d78..e6bbee6 100644 --- a/app/src/main/java/com/cheng/bole/ui/fragment/home/HomeViewModel.kt +++ b/app/src/main/java/com/cheng/bole/ui/fragment/home/HomeViewModel.kt @@ -3,6 +3,7 @@ package com.cheng.bole.ui.fragment.home import androidx.collection.ArrayMap import androidx.lifecycle.MutableLiveData import com.cheng.bole.bean.BidItemBean +import com.cheng.bole.bean.BidTypeBean import com.cheng.bole.bean.UserAuthBean import com.cheng.bole.net.ApiFactory import com.cheng.bole.net.model.toListResult @@ -12,6 +13,8 @@ import com.example.base.viewmodel.ListViewModel class HomeViewModel : ListViewModel() { val totalLiveData = MutableLiveData() + + val typeLiveData = MutableLiveData>() val authLiveData = MutableLiveData() val recommendLiveData = MutableLiveData>() @@ -23,6 +26,21 @@ class HomeViewModel : ListViewModel() { return response.toListResult() } + fun getBidTypeList() { + showDialog() + launchOnUiTryCatch({ + val response = ApiFactory.apiService.getBidTypeList() + if (response.status) { + typeLiveData.postValue(response.data) + } else toast(response.message, true) + dismissDialog() + }, { + dismissDialog() + setError(it) + L.d(it) + }) + } + fun getHotKeywordList(query: String) { launchOnUiTryCatch({ val params = mutableMapOf() diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/home/bszz/BSZZFragment.kt b/app/src/main/java/com/cheng/bole/ui/fragment/home/bszz/BSZZFragment.kt new file mode 100644 index 0000000..ec0f89a --- /dev/null +++ b/app/src/main/java/com/cheng/bole/ui/fragment/home/bszz/BSZZFragment.kt @@ -0,0 +1,136 @@ +package com.cheng.bole.ui.fragment.home.bszz + +import android.annotation.SuppressLint +import android.graphics.Color +import android.text.TextUtils +import android.view.ViewTreeObserver +import androidx.constraintlayout.widget.ConstraintLayout +import com.cheng.bole.R +import com.cheng.bole.bean.AreaBean +import com.cheng.bole.databinding.FragmentBszzBinding +import com.cheng.bole.impl.TextWatcherImpl +import com.cheng.bole.ui.dialog.SelectAreaDialog +import com.efs.sdk.memleaksdk.monitor.internal.bi +import com.example.base.extensions.onClick +import com.example.base.extensions.toast +import com.example.base.ui.BaseFragment +import com.example.base.utils.DensityUtils +import com.example.base.utils.ScreenUtils +import com.google.gson.JsonObject +import okhttp3.RequestBody.Companion.toRequestBody + +class BSZZFragment: BaseFragment() { + private var timestamp = "" + + private var city: AreaBean? = null + + private val textWatcher = object : TextWatcherImpl() { + @SuppressLint("SetTextI18n") + override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { + super.onTextChanged(s, start, before, count) + binding.tvTextCount.text = "${s?.length ?: 0}/300" + } + } + + override fun initView() { + super.initView() + mTitleBar?.background = null + setBackColor(R.color.white) + + binding.layoutContent.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener { + override fun onGlobalLayout() { + val lp = binding.tvArea.layoutParams as ConstraintLayout.LayoutParams + lp.topMargin = (ScreenUtils.getScreenWidth().toFloat() / DensityUtils.dp2px(375f) * DensityUtils.dp2px(410f)).toInt() + binding.tvArea.layoutParams = lp + binding.layoutContent.viewTreeObserver.removeOnGlobalLayoutListener(this) + } + }) + } + + override fun initData() { + super.initData() + } + + override fun initListener() { + super.initListener() + binding.etDesc.addTextChangedListener(textWatcher) + + binding.tvArea.onClick { + val f = SelectAreaDialog.newInstance(if (city != null) listOf(city!!) else emptyList(), true) + f.setOnSelectListener { + city = it[0] + binding.tvArea.text = city!!.name + } + f.show(childFragmentManager, SelectAreaDialog::class.java.simpleName) + } + + binding.tvSendCode.onClick { + val phone = binding.etPhone.text.toString() + if (TextUtils.isEmpty(phone)) { + toast("请输入手机号") + return@onClick + } + mViewModel.sendCode(phone) + } + + binding.btnNext.onClick { + val name = binding.etName.text.toString().trim() + val phone = binding.etPhone.text.toString().trim() + val code = binding.etCode.text.toString().trim() + val desc = binding.etDesc.text.toString().trim() + if (city == null) { + toast("请选择注册区域") + return@onClick + } + if (TextUtils.isEmpty(name)) { + toast("请输入姓名") + return@onClick + } + if (TextUtils.isEmpty(phone)) { + toast("请输入电话") + return@onClick + } + if (TextUtils.isEmpty(code)) { + toast("请输入验证码") + return@onClick + } + val jsonObject = JsonObject() + jsonObject.addProperty("source", "bid_book") + jsonObject.addProperty("city", city!!.name) + jsonObject.addProperty("cityId", "${city!!.id}") + jsonObject.addProperty("name", name) + jsonObject.addProperty("phone", phone) + jsonObject.addProperty("code", code) + jsonObject.addProperty("timestamp", timestamp) + jsonObject.addProperty("remark", desc) + mViewModel.addAgency(jsonObject.toString().toRequestBody()) + } + } + + @SuppressLint("SetTextI18n") + override fun initObserve() { + super.initObserve() + mViewModel.sendCodeLiveData.observe(this) { timestamp = it.timestamp } + mViewModel.countTimeLiveEvent.observe(this) { + if (it > 0) { + binding.tvSendCode.text = "重新获取(${it}s)" + binding.tvSendCode.isEnabled = false + binding.tvSendCode.alpha = 0.5f + } else { + binding.tvSendCode.text = "重新获取" + binding.tvSendCode.isEnabled = true + binding.tvSendCode.alpha = 1f + } + } + + mViewModel.addLiveData.observe(this) { + toast("提交成功") + requireActivity().finish() + } + } + + override fun onDestroyView() { + binding.etDesc.removeTextChangedListener(textWatcher) + super.onDestroyView() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/home/bszz/BSZZViewModel.kt b/app/src/main/java/com/cheng/bole/ui/fragment/home/bszz/BSZZViewModel.kt new file mode 100644 index 0000000..85aa8bd --- /dev/null +++ b/app/src/main/java/com/cheng/bole/ui/fragment/home/bszz/BSZZViewModel.kt @@ -0,0 +1,66 @@ +package com.cheng.bole.ui.fragment.home.bszz + +import androidx.lifecycle.MutableLiveData +import com.cheng.bole.bean.SendCodeEntity +import com.cheng.bole.net.ApiFactory +import com.example.base.common.RxCountDown +import com.example.base.extensions.toast +import com.example.base.utils.L +import com.example.base.viewmodel.BaseViewModel +import io.reactivex.rxjava3.disposables.Disposable +import okhttp3.RequestBody + +class BSZZViewModel: BaseViewModel() { + private var disposable: Disposable? = null + + var sendCodeLiveData = MutableLiveData() + val countTimeLiveEvent = MutableLiveData() + val addLiveData = MutableLiveData() + + fun sendCode(phone: String) { + showDialog() + launchOnUiTryCatch({ + val map = HashMap() + map["phone"] = phone + val response = ApiFactory.apiService.sendCode(map) + if (response.status) { + sendCodeLiveData.postValue(response.data) + startTimer() + } else { + toast(response.message, true) + } + dismissDialog() + }, { + dismissDialog() + setError(it) + L.d(it) + }) + } + + fun addAgency(requestBody: RequestBody) { + showDialog() + launchOnUiTryCatch({ + val response = ApiFactory.apiService.addAgency(requestBody) + if (response.status) { + addLiveData.postValue(Any()) + } else toast(response.message, true) + dismissDialog() + }, { + dismissDialog() + setError(it) + L.d(it) + }) + } + + private fun startTimer() { + disposable?.dispose() + disposable = RxCountDown.countdown(60).subscribe { + countTimeLiveEvent.value = it + } + } + + override fun onCleared() { + super.onCleared() + disposable?.dispose() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/home/dljz/DLJZFragment.kt b/app/src/main/java/com/cheng/bole/ui/fragment/home/dljz/DLJZFragment.kt new file mode 100644 index 0000000..1f9b508 --- /dev/null +++ b/app/src/main/java/com/cheng/bole/ui/fragment/home/dljz/DLJZFragment.kt @@ -0,0 +1,122 @@ +package com.cheng.bole.ui.fragment.home.dljz + +import android.annotation.SuppressLint +import android.text.TextUtils +import com.cheng.bole.bean.AreaBean +import com.cheng.bole.common.Constants +import com.cheng.bole.databinding.FragmentDljzBinding +import com.cheng.bole.impl.TextWatcherImpl +import com.cheng.bole.ui.dialog.SelectAreaDialog +import com.example.base.extensions.onClick +import com.example.base.extensions.toast +import com.example.base.ui.BaseFragment +import com.google.gson.JsonObject +import okhttp3.RequestBody.Companion.toRequestBody + +class DLJZFragment: BaseFragment() { + private var timestamp = "" + + private var city: AreaBean? = null + + private val textWatcher = object : TextWatcherImpl() { + @SuppressLint("SetTextI18n") + override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { + super.onTextChanged(s, start, before, count) + binding.tvTextCount.text = "${s?.length ?: 0}/300" + } + } + + override fun initView() { + super.initView() + mTitleBar?.background = null + + binding.tvTitle.typeface = Constants.almmsht + } + + override fun initData() { + super.initData() + } + + override fun initListener() { + super.initListener() + binding.etDesc.addTextChangedListener(textWatcher) + + binding.tvArea.onClick { + val f = SelectAreaDialog.newInstance(if (city != null) listOf(city!!) else emptyList(), true) + f.setOnSelectListener { + city = it[0] + binding.tvArea.text = city!!.name + } + f.show(childFragmentManager, SelectAreaDialog::class.java.simpleName) + } + + binding.tvSendCode.onClick { + val phone = binding.etPhone.text.toString() + if (TextUtils.isEmpty(phone)) { + toast("请输入手机号") + return@onClick + } + mViewModel.sendCode(phone) + } + + binding.btnNext.onClick { + val name = binding.etName.text.toString().trim() + val phone = binding.etPhone.text.toString().trim() + val code = binding.etCode.text.toString().trim() + val desc = binding.etDesc.text.toString().trim() + if (city == null) { + toast("请选择注册区域") + return@onClick + } + if (TextUtils.isEmpty(name)) { + toast("请输入姓名") + return@onClick + } + if (TextUtils.isEmpty(phone)) { + toast("请输入电话") + return@onClick + } + if (TextUtils.isEmpty(code)) { + toast("请输入验证码") + return@onClick + } + val jsonObject = JsonObject() + jsonObject.addProperty("source", "agency_charge") + jsonObject.addProperty("city", city!!.name) + jsonObject.addProperty("cityId", "${city!!.id}") + jsonObject.addProperty("name", name) + jsonObject.addProperty("phone", phone) + jsonObject.addProperty("code", code) + jsonObject.addProperty("timestamp", timestamp) + jsonObject.addProperty("remark", desc) + mViewModel.addAgency(jsonObject.toString().toRequestBody()) + } + } + + @SuppressLint("SetTextI18n") + override fun initObserve() { + super.initObserve() + mViewModel.sendCodeLiveData.observe(this) { timestamp = it.timestamp } + mViewModel.countTimeLiveEvent.observe(this) { + if (it > 0) { + binding.tvSendCode.text = "重新获取(${it}s)" + binding.tvSendCode.isEnabled = false + binding.tvSendCode.alpha = 0.5f + } else { + binding.tvSendCode.text = "重新获取" + binding.tvSendCode.isEnabled = true + binding.tvSendCode.alpha = 1f + } + } + + mViewModel.addLiveData.observe(this) { + toast("提交成功") + requireActivity().finish() + } + } + + override fun onDestroyView() { + binding.etDesc.removeTextChangedListener(textWatcher) + super.onDestroyView() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/home/dljz/DLJZViewModel.kt b/app/src/main/java/com/cheng/bole/ui/fragment/home/dljz/DLJZViewModel.kt new file mode 100644 index 0000000..6893d4c --- /dev/null +++ b/app/src/main/java/com/cheng/bole/ui/fragment/home/dljz/DLJZViewModel.kt @@ -0,0 +1,66 @@ +package com.cheng.bole.ui.fragment.home.dljz + +import androidx.lifecycle.MutableLiveData +import com.cheng.bole.bean.SendCodeEntity +import com.cheng.bole.net.ApiFactory +import com.example.base.common.RxCountDown +import com.example.base.extensions.toast +import com.example.base.utils.L +import com.example.base.viewmodel.BaseViewModel +import io.reactivex.rxjava3.disposables.Disposable +import okhttp3.RequestBody + +class DLJZViewModel : BaseViewModel() { + private var disposable: Disposable? = null + + var sendCodeLiveData = MutableLiveData() + val countTimeLiveEvent = MutableLiveData() + val addLiveData = MutableLiveData() + + fun sendCode(phone: String) { + showDialog() + launchOnUiTryCatch({ + val map = HashMap() + map["phone"] = phone + val response = ApiFactory.apiService.sendCode(map) + if (response.status) { + sendCodeLiveData.postValue(response.data) + startTimer() + } else { + toast(response.message, true) + } + dismissDialog() + }, { + dismissDialog() + setError(it) + L.d(it) + }) + } + + fun addAgency(requestBody: RequestBody) { + showDialog() + launchOnUiTryCatch({ + val response = ApiFactory.apiService.addAgency(requestBody) + if (response.status) { + addLiveData.postValue(Any()) + } else toast(response.message, true) + dismissDialog() + }, { + dismissDialog() + setError(it) + L.d(it) + }) + } + + private fun startTimer() { + disposable?.dispose() + disposable = RxCountDown.countdown(60).subscribe { + countTimeLiveEvent.value = it + } + } + + override fun onCleared() { + super.onCleared() + disposable?.dispose() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/home/qyzc/QYZCCompanyAdapter.kt b/app/src/main/java/com/cheng/bole/ui/fragment/home/qyzc/QYZCCompanyAdapter.kt new file mode 100644 index 0000000..17b3354 --- /dev/null +++ b/app/src/main/java/com/cheng/bole/ui/fragment/home/qyzc/QYZCCompanyAdapter.kt @@ -0,0 +1,45 @@ +package com.cheng.bole.ui.fragment.home.qyzc + +import android.annotation.SuppressLint +import android.content.Context +import android.view.View +import android.view.ViewGroup +import androidx.constraintlayout.widget.ConstraintLayout +import androidx.recyclerview.widget.RecyclerView +import com.chad.library.adapter.base.viewholder.BaseViewHolder +import com.cheng.bole.R +import com.example.base.utils.DensityUtils + +class QYZCCompanyAdapter(val context: Context, val data: MutableList): RecyclerView.Adapter() { + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder { + val view = View.inflate(context, R.layout.listitem_qyzc_company, null) + val lp = ConstraintLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, DensityUtils.dp2px(22f)) + lp.leftMargin = DensityUtils.dp2px(13f) + view.layoutParams = lp + return BaseViewHolder(view) + } + + @SuppressLint("DiscouragedApi") + override fun onBindViewHolder(holder: BaseViewHolder, position: Int) { + holder.setText(R.id.tv_name, data[position % data.size]) + } + + override fun getItemCount(): Int { + return if (data.isNotEmpty()) Int.MAX_VALUE else 0 + } + + companion object { + fun getList(): List { + return listOf( + "重庆做梦**科技有限公司", + "重庆荣科**科技有限公司", + "重庆高新**科技有限公司", + "重庆中天**科技有限公司", + "重庆太仓**科技有限公司", + "重庆云维**科技有限公司", + "重庆若晴**科技有限公司", + "重庆东方**科技有限公司" + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/home/qyzc/QYZCFragment.kt b/app/src/main/java/com/cheng/bole/ui/fragment/home/qyzc/QYZCFragment.kt new file mode 100644 index 0000000..a367d73 --- /dev/null +++ b/app/src/main/java/com/cheng/bole/ui/fragment/home/qyzc/QYZCFragment.kt @@ -0,0 +1,152 @@ +package com.cheng.bole.ui.fragment.home.qyzc + +import android.annotation.SuppressLint +import android.graphics.Color +import android.text.TextUtils +import android.view.ViewTreeObserver +import androidx.constraintlayout.widget.ConstraintLayout +import com.cheng.bole.R +import com.cheng.bole.bean.AreaBean +import com.cheng.bole.databinding.FragmentQyzcBinding +import com.cheng.bole.ui.dialog.SelectAreaDialog +import com.efs.sdk.memleaksdk.monitor.internal.bi +import com.example.base.extensions.onClick +import com.example.base.extensions.toast +import com.example.base.ui.BaseFragment +import com.google.gson.JsonObject +import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers +import io.reactivex.rxjava3.core.Observable +import io.reactivex.rxjava3.disposables.Disposable +import okhttp3.RequestBody.Companion.toRequestBody +import java.util.concurrent.TimeUnit + +class QYZCFragment : BaseFragment() { + private var timestamp = "" + + private var city: AreaBean? = null + + private val companyAdapter by lazy { QYZCCompanyAdapter(requireContext(), companyList) } + private val companyList = mutableListOf() + + private var scrollTask: Disposable? = null + + override fun initView() { + super.initView() + mTitleBar?.background = null + setBackColor(R.color.white) + + binding.mTitleBar.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener { + override fun onGlobalLayout() { + (binding.rvCompany.layoutParams as ConstraintLayout.LayoutParams).topMargin = binding.mTitleBar.height + binding.mTitleBar.viewTreeObserver.removeOnGlobalLayoutListener(this) + } + }) + } + + override fun initData() { + super.initData() + companyList.addAll(QYZCCompanyAdapter.getList()) + binding.rvCompany.adapter = companyAdapter + } + + override fun initListener() { + super.initListener() + + binding.tvArea.onClick { + val f = SelectAreaDialog.newInstance(if (city != null) listOf(city!!) else emptyList(), true) + f.setOnSelectListener { + city = it[0] + binding.tvArea.text = city!!.name + } + f.show(childFragmentManager, SelectAreaDialog::class.java.simpleName) + } + + binding.tvSendCode.onClick { + val phone = binding.etPhone.text.toString() + if (TextUtils.isEmpty(phone)) { + toast("请输入手机号") + return@onClick + } + mViewModel.sendCode(phone) + } + + binding.btnNext.onClick { + val name = binding.etName.text.toString().trim() + val phone = binding.etPhone.text.toString().trim() + val code = binding.etCode.text.toString().trim() + if (city == null) { + toast("请选择注册区域") + return@onClick + } + if (TextUtils.isEmpty(name)) { + toast("请输入姓名") + return@onClick + } + if (TextUtils.isEmpty(phone)) { + toast("请输入电话") + return@onClick + } + if (TextUtils.isEmpty(code)) { + toast("请输入验证码") + return@onClick + } + val jsonObject = JsonObject() + jsonObject.addProperty("source", "company_register") + jsonObject.addProperty("city", city!!.name) + jsonObject.addProperty("cityId", "${city!!.id}") + jsonObject.addProperty("name", name) + jsonObject.addProperty("phone", phone) + jsonObject.addProperty("code", code) + jsonObject.addProperty("timestamp", timestamp) + mViewModel.addAgency(jsonObject.toString().toRequestBody()) + } + } + + @SuppressLint("SetTextI18n") + override fun initObserve() { + super.initObserve() + mViewModel.sendCodeLiveData.observe(this) { timestamp = it.timestamp } + mViewModel.countTimeLiveEvent.observe(this) { + if (it > 0) { + binding.tvSendCode.text = "重新获取(${it}s)" + binding.tvSendCode.isEnabled = false + binding.tvSendCode.alpha = 0.5f + } else { + binding.tvSendCode.text = "重新获取" + binding.tvSendCode.isEnabled = true + binding.tvSendCode.alpha = 1f + } + } + + mViewModel.addLiveData.observe(this) { + toast("提交成功") + requireActivity().finish() + } + } + + private fun startScroll() { + if (companyList.isEmpty() || scrollTask != null) return + scrollTask = Observable.interval(300, 9, TimeUnit.MILLISECONDS) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe { + if (activity != null) { + binding.rvCompany.scrollBy(3, 0) + } + } + } + + private fun stopScroll() { + scrollTask?.dispose() + scrollTask = null + } + + override fun onStart() { + startScroll() + super.onStart() + } + + override fun onStop() { + stopScroll() + super.onStop() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/home/qyzc/QYZCViewModel.kt b/app/src/main/java/com/cheng/bole/ui/fragment/home/qyzc/QYZCViewModel.kt new file mode 100644 index 0000000..3b8bd1f --- /dev/null +++ b/app/src/main/java/com/cheng/bole/ui/fragment/home/qyzc/QYZCViewModel.kt @@ -0,0 +1,66 @@ +package com.cheng.bole.ui.fragment.home.qyzc + +import androidx.lifecycle.MutableLiveData +import com.cheng.bole.bean.SendCodeEntity +import com.cheng.bole.net.ApiFactory +import com.example.base.common.RxCountDown +import com.example.base.extensions.toast +import com.example.base.utils.L +import com.example.base.viewmodel.BaseViewModel +import io.reactivex.rxjava3.disposables.Disposable +import okhttp3.RequestBody + +class QYZCViewModel: BaseViewModel() { + private var disposable: Disposable? = null + + var sendCodeLiveData = MutableLiveData() + val countTimeLiveEvent = MutableLiveData() + val addLiveData = MutableLiveData() + + fun sendCode(phone: String) { + showDialog() + launchOnUiTryCatch({ + val map = HashMap() + map["phone"] = phone + val response = ApiFactory.apiService.sendCode(map) + if (response.status) { + sendCodeLiveData.postValue(response.data) + startTimer() + } else { + toast(response.message, true) + } + dismissDialog() + }, { + dismissDialog() + setError(it) + L.d(it) + }) + } + + fun addAgency(requestBody: RequestBody) { + showDialog() + launchOnUiTryCatch({ + val response = ApiFactory.apiService.addAgency(requestBody) + if (response.status) { + addLiveData.postValue(Any()) + } else toast(response.message, true) + dismissDialog() + }, { + dismissDialog() + setError(it) + L.d(it) + }) + } + + private fun startTimer() { + disposable?.dispose() + disposable = RxCountDown.countdown(60).subscribe { + countTimeLiveEvent.value = it + } + } + + override fun onCleared() { + super.onCleared() + disposable?.dispose() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/home/zzdb/ZZDBAdapter.kt b/app/src/main/java/com/cheng/bole/ui/fragment/home/zzdb/ZZDBAdapter.kt new file mode 100644 index 0000000..8ae0f81 --- /dev/null +++ b/app/src/main/java/com/cheng/bole/ui/fragment/home/zzdb/ZZDBAdapter.kt @@ -0,0 +1,28 @@ +package com.cheng.bole.ui.fragment.home.zzdb + +import com.chad.library.adapter.base.BaseQuickAdapter +import com.chad.library.adapter.base.viewholder.BaseViewHolder +import com.cheng.bole.R +import com.cheng.bole.bean.ZZDBInfoBean + +class ZZDBAdapter: BaseQuickAdapter(R.layout.listitem_zzdb_info) { + override fun convert(holder: BaseViewHolder, item: ZZDBInfoBean) { + holder.setText(R.id.tv_name, item.name) + holder.setGone(R.id.tv_level1, true) + holder.setGone(R.id.tv_level2, true) + holder.setGone(R.id.tv_level3, true) + item.children.forEach { + when (it.level) { + "1" -> { + holder.setVisible(R.id.tv_level1, true) + } + "2" -> { + holder.setVisible(R.id.tv_level2, true) + } + "3" -> { + holder.setVisible(R.id.tv_level3, true) + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/home/zzdb/ZZDBFragment.kt b/app/src/main/java/com/cheng/bole/ui/fragment/home/zzdb/ZZDBFragment.kt new file mode 100644 index 0000000..af0fc87 --- /dev/null +++ b/app/src/main/java/com/cheng/bole/ui/fragment/home/zzdb/ZZDBFragment.kt @@ -0,0 +1,102 @@ +package com.cheng.bole.ui.fragment.home.zzdb + +import android.view.KeyEvent +import android.view.ViewGroup +import android.view.ViewOutlineProvider +import android.view.ViewTreeObserver +import androidx.constraintlayout.widget.ConstraintLayout +import com.cheng.bole.R +import com.cheng.bole.databinding.FragmentZzdbBinding +import com.cheng.bole.ui.activity.PublicActivity +import com.cheng.bole.ui.fragment.home.zzdb.detail.ZZDBDetailFragment +import com.example.base.extensions.getColor +import com.example.base.ui.BaseFragment +import com.example.base.widget.EmptyView +import com.example.base.widget.PageStatus +import eightbitlab.com.blurview.BlurView + +class ZZDBFragment: BaseFragment() { + private val mAdapter by lazy { ZZDBAdapter() } + private val mEmptyView by lazy { EmptyView(requireContext()) } + + private var keyword = "" + + private var page = 1 + + override fun initView() { + super.initView() + mTitleBar?.setBackgroundColor(getColor(R.color.windowBackground)) + mTitleBar?.background?.alpha = 0 + + binding.mRecyclerView.adapter = mAdapter + mEmptyView.setNoDataLogo(R.mipmap.ic_empty_data) + mAdapter.setEmptyView(mEmptyView) + + binding.ivTopBg.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener { + override fun onGlobalLayout() { + (binding.layoutContent.layoutParams as ConstraintLayout.LayoutParams).topMargin = (binding.ivTopBg.height * 199f / 231f).toInt() + binding.layoutContent.setupWith(binding.root).setFrameClearDrawable(binding.layoutContent.background).setBlurRadius(5f) + binding.layoutContent.outlineProvider = ViewOutlineProvider.BACKGROUND + binding.layoutContent.setClipToOutline(true) + binding.ivTopBg.viewTreeObserver.removeOnGlobalLayoutListener(this) + } + }) + } + + override fun initData() { + super.initData() + mViewModel.getAgencyList(page, "") + } + + override fun initListener() { + super.initListener() + binding.mRefreshLayout.setOnRefreshListener { + page = 1 + mViewModel.getAgencyList(page, keyword) + } + + binding.mRefreshLayout.setOnLoadMoreListener { + page++ + mViewModel.getAgencyList(page, keyword) + } + + binding.etSearch.setOnEditorActionListener { _, _, event -> + if (event != null && event.keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_DOWN) { + page = 1 + keyword = binding.etSearch.text.toString().trim() + mViewModel.getAgencyList(page, keyword) + return@setOnEditorActionListener true + } + false + } + + mAdapter.setOnItemClickListener { _, _, i -> + PublicActivity.start(requireContext(), ZZDBDetailFragment::class.java, Pair("item", mAdapter.getItem(i))) + } + + binding.nestedScrollView.setOnScrollChangeListener { _, _, scrollY, _, _ -> + val offset = (binding.layoutContent.layoutParams as ConstraintLayout.LayoutParams).topMargin - binding.mTitleBar.height + mTitleBar?.background?.alpha = ((scrollY / offset.toFloat()).coerceAtMost(1f) * 255f).toInt() + } + } + + override fun initObserve() { + super.initObserve() + mViewModel.listLiveData.observe(this) { + if (page == 1) { + mAdapter.setList(it) + binding.mRefreshLayout.finishRefresh() + } else { + mAdapter.addData(it) + binding.mRefreshLayout.finishLoadMore() + } + binding.mRefreshLayout.setNoMoreData(it.size < 20) + + if (mAdapter.data.isNotEmpty()) { + mEmptyView.setStatus(PageStatus.GONG) + } else { + mEmptyView.setStatus(PageStatus.NO_DATA) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/home/zzdb/ZZDBViewModel.kt b/app/src/main/java/com/cheng/bole/ui/fragment/home/zzdb/ZZDBViewModel.kt new file mode 100644 index 0000000..4c27ce8 --- /dev/null +++ b/app/src/main/java/com/cheng/bole/ui/fragment/home/zzdb/ZZDBViewModel.kt @@ -0,0 +1,28 @@ +package com.cheng.bole.ui.fragment.home.zzdb + +import androidx.lifecycle.MutableLiveData +import com.cheng.bole.bean.ZZDBInfoBean +import com.cheng.bole.net.ApiFactory +import com.example.base.extensions.toast +import com.example.base.utils.L +import com.example.base.viewmodel.BaseViewModel + +class ZZDBViewModel: BaseViewModel() { + val listLiveData = MutableLiveData>() + + fun getAgencyList(page: Int, name: String) { + launchOnUiTryCatch({ + val params = mutableMapOf() + params["page"] = "$page" + params["size"] = "20" + params["name"] = name + val response = ApiFactory.apiService.getAgencyList(params) + if (response.status) { + listLiveData.postValue(response.data.items) + } else toast(response.message, true) + }, { + setError(it) + L.d(it) + }) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/home/zzdb/detail/ZZDBDetailFragment.kt b/app/src/main/java/com/cheng/bole/ui/fragment/home/zzdb/detail/ZZDBDetailFragment.kt new file mode 100644 index 0000000..0a04963 --- /dev/null +++ b/app/src/main/java/com/cheng/bole/ui/fragment/home/zzdb/detail/ZZDBDetailFragment.kt @@ -0,0 +1,225 @@ +package com.cheng.bole.ui.fragment.home.zzdb.detail + +import android.annotation.SuppressLint +import android.os.Build +import android.text.TextUtils +import androidx.constraintlayout.widget.ConstraintLayout +import com.cheng.bole.R +import com.cheng.bole.bean.AreaBean +import com.cheng.bole.bean.ZZDBInfoBean +import com.cheng.bole.databinding.FragmentZzdbDetailBinding +import com.cheng.bole.ui.dialog.SelectAreaDialog +import com.example.base.extensions.gone +import com.example.base.extensions.onClick +import com.example.base.extensions.toast +import com.example.base.extensions.visible +import com.example.base.ui.BaseFragment +import com.example.base.utils.BarUtils +import com.example.base.utils.DensityUtils +import com.google.gson.JsonObject +import com.gyf.immersionbar.ktx.actionBarHeight +import okhttp3.RequestBody.Companion.toRequestBody + +class ZZDBDetailFragment : BaseFragment() { + private var info: ZZDBInfoBean? = null + private var childInfo: ZZDBInfoBean? = null + + private val deviceAdapter by lazy { ZZDBDeviceAdapter() } + + private var isExpand = false + + private var timestamp = "" + + private var city: AreaBean? = null + + override fun initView() { + super.initView() + binding.rvDevice.adapter = deviceAdapter + + (binding.layoutBaseInfo.layoutParams as ConstraintLayout.LayoutParams).topMargin = BarUtils.getStatusBarHeight() + actionBarHeight + DensityUtils.dp2px(12f) + } + + override fun initData() { + super.initData() + info = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + arguments?.getSerializable("item", ZZDBInfoBean::class.java) + } else { + arguments?.getSerializable("item") as? ZZDBInfoBean + } + setBaseData() + } + + override fun initListener() { + super.initListener() + binding.tvMore.onClick { + isExpand = !isExpand + if (childInfo != null) { + setExpandStyle(childInfo!!) + } + } + + binding.rgLevel.setOnCheckedChangeListener { _, checkedId -> + when (checkedId) { + R.id.rb1 -> { + childInfo = this.info!!.children.find { it.level == "1" } + } + + R.id.rb2 -> { + childInfo = this.info!!.children.find { it.level == "2" } + } + + R.id.rb3 -> { + childInfo = this.info!!.children.find { it.level == "3" } + } + } + if (childInfo != null) { + setDetailData(childInfo!!) + } + } + + binding.tvArea.onClick { + val f = SelectAreaDialog.newInstance(if (city != null) listOf(city!!) else emptyList(), true) + f.setOnSelectListener { + city = it[0] + binding.tvArea.text = city!!.name + } + f.show(childFragmentManager, SelectAreaDialog::class.java.simpleName) + } + + binding.tvSendCode.onClick { + val phone = binding.etPhone.text.toString() + if (TextUtils.isEmpty(phone)) { + toast("请输入手机号") + return@onClick + } + mViewModel.sendCode(phone) + } + + binding.btnNext.onClick { + val name = binding.etName.text.toString().trim() + val phone = binding.etPhone.text.toString().trim() + val code = binding.etCode.text.toString().trim() + if (city == null) { + toast("请选择注册区域") + return@onClick + } + if (TextUtils.isEmpty(name)) { + toast("请输入姓名") + return@onClick + } + if (TextUtils.isEmpty(phone)) { + toast("请输入电话") + return@onClick + } + if (TextUtils.isEmpty(code)) { + toast("请输入验证码") + return@onClick + } + val jsonObject = JsonObject() + jsonObject.addProperty("source", "agency_cert") + jsonObject.addProperty("city", city!!.name) + jsonObject.addProperty("cityId", "${city!!.id}") + jsonObject.addProperty("name", name) + jsonObject.addProperty("phone", phone) + jsonObject.addProperty("code", code) + jsonObject.addProperty("timestamp", timestamp) + mViewModel.addAgency(jsonObject.toString().toRequestBody()) + } + } + + @SuppressLint("SetTextI18n") + override fun initObserve() { + super.initObserve() + mViewModel.sendCodeLiveData.observe(this) { timestamp = it.timestamp } + mViewModel.countTimeLiveEvent.observe(this) { + if (it > 0) { + binding.tvSendCode.text = "重新获取(${it}s)" + binding.tvSendCode.isEnabled = false + binding.tvSendCode.alpha = 0.5f + } else { + binding.tvSendCode.text = "重新获取" + binding.tvSendCode.isEnabled = true + binding.tvSendCode.alpha = 1f + } + } + + mViewModel.addLiveData.observe(this) { + toast("提交成功") + requireActivity().finish() + } + } + + private fun setBaseData() { + if (info != null) { + binding.tvName.text = info!!.name + info!!.children.forEach { + when (it.level) { + "1" -> { + binding.rb1.visible() + binding.rb1.isChecked = true + } + + "2" -> { + binding.rb2.visible() + binding.rb2.isChecked = !binding.rb1.isChecked + } + + "3" -> { + binding.rb3.visible() + binding.rb2.isChecked = !binding.rb1.isChecked && !binding.rb2.isChecked + } + } + } + } + } + + private fun setDetailData(info: ZZDBInfoBean) { + binding.tvRange.text = info.range + binding.tvAsset.text = info.property + binding.tvPerson.text = info.person + binding.tvPerformance.text = info.performance + + if (!TextUtils.isEmpty(info.equitment)) { + if (info.equitment.startsWith("具有下列机械设备:")) { + val deviceArray = info.equitment.split("\r\n\r\n") + val deviceList = mutableListOf() + deviceArray.forEach { + if (it.startsWith("(") && it.indexOf(")") != -1) { + deviceList.add(it.substring(it.indexOf(")") + 1, it.length - 1)) + } + } + deviceAdapter.setList(deviceList) + } else { + deviceAdapter.setList(listOf(info.equitment)) + } + } + + setExpandStyle(info) + } + + private fun setExpandStyle(info: ZZDBInfoBean) { + if (isExpand) { + binding.tvMore.text = "收起更多资质说明" + binding.tvMore.setCompoundDrawablesWithIntrinsicBounds(0 , 0, R.mipmap.ic_more_arrow_up, 0) + binding.layoutAsset.visible() + binding.layoutPerson.visible() + if (!TextUtils.isEmpty(info.performance)) { + binding.layoutPerformance.visible() + } else { + binding.layoutPerformance.gone() + } + if (!TextUtils.isEmpty(info.equitment)) { + binding.layoutDevice.visible() + } else { + binding.layoutDevice.gone() + } + } else { + binding.tvMore.text = "展开更多资质说明" + binding.tvMore.setCompoundDrawablesWithIntrinsicBounds(0 , 0, R.mipmap.ic_more_arrow_down, 0) + binding.layoutAsset.gone() + binding.layoutPerson.gone() + binding.layoutPerformance.gone() + binding.layoutDevice.gone() + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/home/zzdb/detail/ZZDBDetailViewModel.kt b/app/src/main/java/com/cheng/bole/ui/fragment/home/zzdb/detail/ZZDBDetailViewModel.kt new file mode 100644 index 0000000..15e2ce7 --- /dev/null +++ b/app/src/main/java/com/cheng/bole/ui/fragment/home/zzdb/detail/ZZDBDetailViewModel.kt @@ -0,0 +1,66 @@ +package com.cheng.bole.ui.fragment.home.zzdb.detail + +import androidx.lifecycle.MutableLiveData +import com.cheng.bole.bean.SendCodeEntity +import com.cheng.bole.net.ApiFactory +import com.example.base.common.RxCountDown +import com.example.base.extensions.toast +import com.example.base.utils.L +import com.example.base.viewmodel.BaseViewModel +import io.reactivex.rxjava3.disposables.Disposable +import okhttp3.RequestBody + +class ZZDBDetailViewModel: BaseViewModel() { + private var disposable: Disposable? = null + + var sendCodeLiveData = MutableLiveData() + val countTimeLiveEvent = MutableLiveData() + val addLiveData = MutableLiveData() + + fun sendCode(phone: String) { + showDialog() + launchOnUiTryCatch({ + val map = HashMap() + map["phone"] = phone + val response = ApiFactory.apiService.sendCode(map) + if (response.status) { + sendCodeLiveData.postValue(response.data) + startTimer() + } else { + toast(response.message, true) + } + dismissDialog() + }, { + dismissDialog() + setError(it) + L.d(it) + }) + } + + fun addAgency(requestBody: RequestBody) { + showDialog() + launchOnUiTryCatch({ + val response = ApiFactory.apiService.addAgency(requestBody) + if (response.status) { + addLiveData.postValue(Any()) + } else toast(response.message, true) + dismissDialog() + }, { + dismissDialog() + setError(it) + L.d(it) + }) + } + + private fun startTimer() { + disposable?.dispose() + disposable = RxCountDown.countdown(60).subscribe { + countTimeLiveEvent.value = it + } + } + + override fun onCleared() { + super.onCleared() + disposable?.dispose() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/home/zzdb/detail/ZZDBDeviceAdapter.kt b/app/src/main/java/com/cheng/bole/ui/fragment/home/zzdb/detail/ZZDBDeviceAdapter.kt new file mode 100644 index 0000000..e7a979a --- /dev/null +++ b/app/src/main/java/com/cheng/bole/ui/fragment/home/zzdb/detail/ZZDBDeviceAdapter.kt @@ -0,0 +1,12 @@ +package com.cheng.bole.ui.fragment.home.zzdb.detail + +import com.chad.library.adapter.base.BaseQuickAdapter +import com.chad.library.adapter.base.viewholder.BaseViewHolder +import com.cheng.bole.R + +class ZZDBDeviceAdapter: BaseQuickAdapter(R.layout.listitem_zzdb_device) { + override fun convert(holder: BaseViewHolder, item: String) { + holder.setText(R.id.tv_index, "${holder.layoutPosition + 1}") + holder.setText(R.id.tv_desc, item) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/mine/feedback/FeedbackFragment.kt b/app/src/main/java/com/cheng/bole/ui/fragment/mine/feedback/FeedbackFragment.kt index 84e064d..2a5111b 100644 --- a/app/src/main/java/com/cheng/bole/ui/fragment/mine/feedback/FeedbackFragment.kt +++ b/app/src/main/java/com/cheng/bole/ui/fragment/mine/feedback/FeedbackFragment.kt @@ -5,6 +5,12 @@ import android.text.Editable import android.text.TextUtils import android.text.TextWatcher import androidx.recyclerview.widget.GridLayoutManager +import com.cheng.bole.R +import com.cheng.bole.bean.UploadFileEntity +import com.cheng.bole.common.Constants +import com.cheng.bole.databinding.FragmentFeedbackBinding +import com.cheng.bole.ui.fragment.photo.AddImageAdapter +import com.cheng.bole.utils.PermissionUtils import com.example.base.extensions.onClick import com.example.base.extensions.toast import com.example.base.ui.BaseFragment @@ -13,11 +19,6 @@ import com.google.gson.JsonObject import com.huantansheng.easyphotos.EasyPhotos import com.huantansheng.easyphotos.callback.SelectCallback import com.huantansheng.easyphotos.models.album.entity.Photo -import com.cheng.bole.R -import com.cheng.bole.common.Constants -import com.cheng.bole.databinding.FragmentFeedbackBinding -import com.cheng.bole.ui.fragment.photo.AddImageAdapter -import com.cheng.bole.utils.PermissionUtils import okhttp3.RequestBody.Companion.toRequestBody class FeedbackFragment : BaseFragment() { @@ -25,8 +26,8 @@ class FeedbackFragment : BaseFragment = ArrayList() - private var selectImg: ArrayList = ArrayList() - private var deletedImg: ArrayList = ArrayList() + private var selectImg: ArrayList = ArrayList() + private var deletedImg: ArrayList = ArrayList() companion object { const val TYPE_SUGGESTION = 0 diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/mine/feedback/FeedbackViewModel.kt b/app/src/main/java/com/cheng/bole/ui/fragment/mine/feedback/FeedbackViewModel.kt index 01b5eb9..cf3e17f 100644 --- a/app/src/main/java/com/cheng/bole/ui/fragment/mine/feedback/FeedbackViewModel.kt +++ b/app/src/main/java/com/cheng/bole/ui/fragment/mine/feedback/FeedbackViewModel.kt @@ -2,20 +2,21 @@ package com.cheng.bole.ui.fragment.mine.feedback import android.content.Context import androidx.lifecycle.MutableLiveData +import com.cheng.bole.bean.UploadFileEntity +import com.cheng.bole.net.ApiFactory +import com.cheng.bole.utils.BitmapUtils import com.example.base.extensions.toast import com.example.base.utils.L import com.example.base.viewmodel.BaseViewModel import com.huantansheng.easyphotos.models.album.entity.Photo -import com.cheng.bole.net.ApiFactory -import com.cheng.bole.utils.BitmapUtils import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.MultipartBody import okhttp3.RequestBody class FeedbackViewModel : BaseViewModel() { val feedbackLiveData = MutableLiveData() - val uploadSuccessLiveData = MutableLiveData>() - val imgList = ArrayList() + val uploadSuccessLiveData = MutableLiveData>() + val imgList = ArrayList() fun feedback(requestBody: RequestBody) { showDialog() @@ -31,12 +32,12 @@ class FeedbackViewModel : BaseViewModel() { }) } - fun delete(list: ArrayList) { + fun delete(list: ArrayList) { list.forEachIndexed { index, photo -> if (index == 0) { delStoreImg(photo) { list.remove(photo) - if (list.size > 0) { + if (list.isNotEmpty()) { delete(list) } } @@ -45,7 +46,7 @@ class FeedbackViewModel : BaseViewModel() { } //删除文件 - fun delStoreImg(img: com.cheng.bole.bean.UploadImgEntity, delBack: (() -> Unit)?) { + fun delStoreImg(img: UploadFileEntity, delBack: (() -> Unit)?) { showDialog() launchOnUiTryCatch({ val response = ApiFactory.apiService.delUserFile(img.id) @@ -65,7 +66,7 @@ class FeedbackViewModel : BaseViewModel() { if (index == 0) { uploadImg(context, photo) { list.remove(photo) - if (list.size > 0) { + if (list.isNotEmpty()) { upload(context, list) } else { uploadSuccessLiveData.postValue(imgList) diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/mine/user/UserSettingFragment.kt b/app/src/main/java/com/cheng/bole/ui/fragment/mine/user/UserSettingFragment.kt index 212721a..94b8ad1 100644 --- a/app/src/main/java/com/cheng/bole/ui/fragment/mine/user/UserSettingFragment.kt +++ b/app/src/main/java/com/cheng/bole/ui/fragment/mine/user/UserSettingFragment.kt @@ -14,6 +14,8 @@ import com.huantansheng.easyphotos.EasyPhotos import com.huantansheng.easyphotos.callback.SelectCallback import com.huantansheng.easyphotos.models.album.entity.Photo import com.cheng.bole.R +import com.cheng.bole.bean.UploadFileEntity +import com.cheng.bole.bean.UserEntity import com.cheng.bole.common.Constants import com.cheng.bole.databinding.FragmentUserSettingBinding import com.cheng.bole.event.UserInfoEvent @@ -22,9 +24,9 @@ import com.cheng.bole.utils.PermissionUtils import okhttp3.RequestBody.Companion.toRequestBody class UserSettingFragment : BaseFragment() { - private var userInfo: com.cheng.bole.bean.UserEntity? = null + private var userInfo: UserEntity? = null private var selectedPhoto: Photo? = null - private var selectedImg: com.cheng.bole.bean.UploadImgEntity? = null + private var selectedImg: UploadFileEntity? = null override fun initView() { super.initView() diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/mine/user/UserSettingViewModel.kt b/app/src/main/java/com/cheng/bole/ui/fragment/mine/user/UserSettingViewModel.kt index 95c13f1..c4be339 100644 --- a/app/src/main/java/com/cheng/bole/ui/fragment/mine/user/UserSettingViewModel.kt +++ b/app/src/main/java/com/cheng/bole/ui/fragment/mine/user/UserSettingViewModel.kt @@ -2,19 +2,21 @@ package com.cheng.bole.ui.fragment.mine.user import android.content.Context import androidx.lifecycle.MutableLiveData +import com.cheng.bole.bean.UploadFileEntity +import com.cheng.bole.bean.UserEntity +import com.cheng.bole.net.ApiFactory +import com.cheng.bole.utils.BitmapUtils import com.example.base.extensions.toast import com.example.base.utils.L import com.example.base.viewmodel.BaseViewModel import com.huantansheng.easyphotos.models.album.entity.Photo -import com.cheng.bole.net.ApiFactory -import com.cheng.bole.utils.BitmapUtils import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.MultipartBody import okhttp3.RequestBody class UserSettingViewModel : BaseViewModel() { - val userInfoLiveData = MutableLiveData() - val uploadImgLiveData = MutableLiveData() + val userInfoLiveData = MutableLiveData() + val uploadImgLiveData = MutableLiveData() val uploadUserinfoLiveData = MutableLiveData() val deleteImageLiveData = MutableLiveData() diff --git a/app/src/main/java/com/cheng/bole/ui/fragment/search/list/SearchListFragment.kt b/app/src/main/java/com/cheng/bole/ui/fragment/search/list/SearchListFragment.kt index bdb6334..41a1942 100644 --- a/app/src/main/java/com/cheng/bole/ui/fragment/search/list/SearchListFragment.kt +++ b/app/src/main/java/com/cheng/bole/ui/fragment/search/list/SearchListFragment.kt @@ -160,6 +160,7 @@ class SearchListFragment : ListFragment item.id }.joinToString(",") firstLoad() diff --git a/app/src/main/java/com/cheng/bole/utils/BidTypeUtils.kt b/app/src/main/java/com/cheng/bole/utils/BidTypeUtils.kt index b45f3b7..09f61dd 100644 --- a/app/src/main/java/com/cheng/bole/utils/BidTypeUtils.kt +++ b/app/src/main/java/com/cheng/bole/utils/BidTypeUtils.kt @@ -5,9 +5,9 @@ import android.graphics.Color object BidTypeUtils { fun getShortName(typeName: String): String { return when (typeName) { - "招标计划" -> "招标" + "招标公告" -> "招标" + "招标计划" -> "预告" "采购公告" -> "采购" - "招标公告" -> "预告" "合同公告" -> "合同" "中标公告" -> "中标" "竞争性磋商" -> "竞争性磋商" @@ -19,9 +19,9 @@ object BidTypeUtils { fun getTypeColor(typeName: String): Int { return when (typeName) { - "招标计划" -> Color.parseColor("#2B88F9") + "招标公告" -> Color.parseColor("#2B88F9") + "招标计划" -> Color.parseColor("#14CEB3") "采购公告" -> Color.parseColor("#FF7344") - "招标公告" -> Color.parseColor("#14CEB3") "合同公告" -> Color.parseColor("#FFA91D") "中标公告" -> Color.parseColor("#FF1B1B") "竞争性磋商" -> Color.parseColor("#0DA9FF") diff --git a/app/src/main/java/com/cheng/bole/utils/FileProviderUtils.kt b/app/src/main/java/com/cheng/bole/utils/FileProviderUtils.kt new file mode 100644 index 0000000..bb7d4d1 --- /dev/null +++ b/app/src/main/java/com/cheng/bole/utils/FileProviderUtils.kt @@ -0,0 +1,403 @@ +package com.cheng.bole.utils + +import android.annotation.SuppressLint +import android.content.ContentResolver +import android.content.ContentUris +import android.content.Context +import android.database.Cursor +import android.net.Uri +import android.os.Build +import android.os.Environment +import android.os.FileUtils +import android.os.StatFs +import android.provider.DocumentsContract +import android.provider.MediaStore +import android.provider.OpenableColumns +import android.text.TextUtils +import androidx.annotation.RequiresApi +import com.example.base.extensions.toast +import com.example.base.utils.L +import java.io.File +import java.io.FileOutputStream +import java.io.IOException +import java.io.InputStream + +object FileProviderUtils { + //文件夹的名称 + private const val dirName = "UploadFile" + + /** + * 根据Uri获取文件绝对路径,解决Android4.4以上版本Uri转换 兼容Android 10 + * + * @param context + * @param uri + * @param fileName 自定义沙盒的文件名,避免沙盒中同名的情况,另外要注意的一点是沙盒中的文件记得要删除 + */ + fun getFileAbsolutePath(context: Context, uri: Uri, fileName: String = ""): String? { + //大于等于Android 19,小于Android 29 + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q && DocumentsContract.isDocumentUri(context, uri)) { + if (isExternalStorageDocument(uri)) { + val docId: String = DocumentsContract.getDocumentId(uri) + val split = docId.split(":") + val type = split[0] + if ("primary" == type) { + return "${Environment.getExternalStorageDirectory()}/${split[1]}" + } + } else if (isDownloadsDocument(uri)) { + val id = DocumentsContract.getDocumentId(uri) + return if (!TextUtils.isEmpty(id)) { + if (id.startsWith("raw:")) { + id.replaceFirst("raw:", "") + } else { + try { + getContentPath(context, id) + } catch (exception: NumberFormatException) { + null + } + } + } else { + null + } + } else if (isMediaDocument(uri)) { + val docId = DocumentsContract.getDocumentId(uri) + val split = docId.split(":") + val type = split[0] + var contentUri: Uri? = null + when (type) { + "image" -> { + contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI + } + + "video" -> { + contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI + } + + "audio" -> { + contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI + } + + else -> {} + } + val selection = "${MediaStore.Images.Media._ID}=?" + val selectionArgs = arrayOf(split[1]) + return getDataColumn(context, contentUri, selection, selectionArgs); + } + } + + // MediaStore (and general) + //大于Android 29 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + return if (fileName.isNotEmpty()) { + uriToFileApiQCustomFileName(context, uri, fileName) + } else { + uriToFileApiQ(context, uri) + } + } else if ("content" == uri.scheme) { + // Return the remote address + if (isGooglePhotosUri(uri)) { + return uri.lastPathSegment; + } + return getDataColumn(context, uri, null, null); + } + // File + else if ("file" == uri.scheme) { + return uri.path + } + return null + } + + /** + * 获取download文件夹存储内容的路径 + */ + private fun getContentPath(context: Context, id: String): String? { + val contentUriPrefixesToTry = arrayOf( + "content://downloads/public_downloads", + "content://downloads/my_downloads", + "content://downloads/all_downloads" + ) + + for (contentUriPrefix in contentUriPrefixesToTry) { + val contentUri = + ContentUris.withAppendedId(Uri.parse(contentUriPrefix), id.toLong()) + try { + val path = getDataColumn(context, contentUri, null, null) + if (path != null) { + return path + } + } catch (_: java.lang.Exception) { + + } + } + return null + } + + /** + * @param uri The Uri to check. + * @return Whether the Uri authority is ExternalStorageProvider. + */ + private fun isExternalStorageDocument(uri: Uri): Boolean { + return "com.android.externalstorage.documents" == uri.authority + } + + /** + * @param uri The Uri to check. + * @return Whether the Uri authority is DownloadsProvider. + */ + private fun isDownloadsDocument(uri: Uri): Boolean { + return "com.android.providers.downloads.documents" == uri.authority + } + + private fun getDataColumn( + context: Context, + uri: Uri?, + selection: String?, + selectionArgs: Array? + ): String? { + var cursor: Cursor? = null + val column: String = MediaStore.Images.Media.DATA + val projection = arrayOf(column) + if (uri != null) { + try { + cursor = + context.contentResolver.query(uri, projection, selection, selectionArgs, null) + if (cursor != null && cursor.moveToFirst()) { + val index: Int = cursor.getColumnIndexOrThrow(column) + return cursor.getString(index); + } + } catch (exception: IllegalArgumentException) { + return getFilePathFromURI(context, uri) + } finally { + cursor?.close() + } + } + return null + } + + /** + * 获取文件路径 + */ + private fun getFilePathFromURI(context: Context, uri: Uri): String? { + val fileName = getFileName(uri) + if (!TextUtils.isEmpty(fileName)) { + val copyFile = File(context.cacheDir, fileName!!) + copyCacheFile(context, uri, copyFile) + return copyFile.absolutePath + } + return null + } + + /** + * 获取文件名 + */ + private fun getFileName(uri: Uri): String? { + var fileName: String? = null + uri.path?.let { path -> + path.lastIndexOf('/').also { + if (it != -1) { + fileName = path.substring(it + 1) + } + } + } + return fileName + } + + /** + * 复制文件 + */ + private fun copyCacheFile(context: Context, uri: Uri, copyFile: File) { + try { + val inputStream = context.contentResolver.openInputStream(uri) + val outputStream = FileOutputStream(copyFile) + val buffer = ByteArray(1024) + var length: Int + + if (inputStream != null) { + while (inputStream.read(buffer).also { length = it } > 0) { + outputStream.write(buffer, 0, length) + } + outputStream.flush() + inputStream.close() + outputStream.close() + } + } catch (exception: IOException) { + L.e(exception.message) + } + } + + + /** + * @param uri The Uri to check. + * @return Whether the Uri authority is MediaProvider. + */ + private fun isMediaDocument(uri: Uri): Boolean { + return "com.android.providers.media.documents" == uri.authority + } + + /** + * @param uri The Uri to check. + * @return Whether the Uri authority is Google Photos. + */ + private fun isGooglePhotosUri(uri: Uri): Boolean { + return "com.google.android.apps.photos.content" == uri.authority + } + + + /** + * Android 10 以上适配 另一种写法 + * @param context + * @param uri + * @return + */ + @SuppressLint("Range") + private fun getFileFromContentUri(context: Context, uri: Uri): String? { + val filePath: String? + val filePathColumn = + arrayOf(MediaStore.MediaColumns.DATA, MediaStore.MediaColumns.DISPLAY_NAME) + val contentResolver: ContentResolver = context.contentResolver + val cursor: Cursor? = contentResolver.query( + uri, filePathColumn, null, + null, null + ) + if (cursor != null) { + cursor.moveToFirst() + try { + filePath = cursor.getString(cursor.getColumnIndex(filePathColumn[0])) + return filePath + } catch (e: Exception) { + L.d(e.message) + } finally { + cursor.close() + } + } + return "" + } + + /** + * Android 10 以上适配 + * @param context + * @param uri + * @return + */ + @SuppressLint("Range") + @RequiresApi(api = Build.VERSION_CODES.Q) + private fun uriToFileApiQ(context: Context, uri: Uri): String? { + var file: File? = null + //android10以上转换 + if (uri.scheme.equals(ContentResolver.SCHEME_FILE)) { + file = File(uri.path!!) + } else if (uri.scheme.equals(ContentResolver.SCHEME_CONTENT)) { + val contentResolver: ContentResolver = context.contentResolver + val cursor: Cursor? = contentResolver.query(uri, null, null, null, null) + try { + //把文件复制到沙盒目录 + if (cursor != null) { + if (cursor.moveToFirst()) { + //通过Cursor获取真实的文件名 + val displayName: String = cursor.getString( + cursor.getColumnIndex( + OpenableColumns.DISPLAY_NAME + ) + ) + val fileSize = cursor.getLong(cursor.getColumnIndex(OpenableColumns.SIZE)) + //判断存储空间是否足够 + if (getRemainingStorageSpace() <= fileSize) { + toast("空间不足") + return null + } + + val inputStream: InputStream? = contentResolver.openInputStream(uri) + //在沙盒中存储也是用的真实的文件名 + val pathFile = File(context.getExternalFilesDir(null), dirName) + if (!pathFile.exists()) { + pathFile.mkdir() + } + val cache = File(pathFile, displayName) + val fos = FileOutputStream(cache) + if (inputStream != null) { + FileUtils.copy(inputStream, fos) + } + file = cache + fos.close() + inputStream?.close() + } + + } + } catch (e: Exception) { + e.printStackTrace(); + } finally { + cursor?.close() + } + + } + return file?.absolutePath + } + + /** + * Android 10 以上适配 + * @param context + * @param uri + * @return + */ + @SuppressLint("Range") + @RequiresApi(api = Build.VERSION_CODES.Q) + private fun uriToFileApiQCustomFileName(context: Context, uri: Uri, fileName: String): String? { + var file: File? = null + //android10以上转换 + if (uri.scheme.equals(ContentResolver.SCHEME_FILE)) { + file = File(uri.path!!) + } else if (uri.scheme.equals(ContentResolver.SCHEME_CONTENT)) { + //把文件复制到沙盒目录 + val contentResolver: ContentResolver = context.contentResolver + val cursor: Cursor? = contentResolver.query(uri, null, null, null, null) + try { + if (cursor != null) { + if (cursor.moveToFirst()) { + val fileSize = cursor.getLong(cursor.getColumnIndex(OpenableColumns.SIZE)) + //判断存储空间是否足够 + if (getRemainingStorageSpace() <= fileSize) { + toast("空间不足") + return null + } + + val inputStream: InputStream? = contentResolver.openInputStream(uri) + val pathFile = File(context.getExternalFilesDir(null), dirName) + if (!pathFile.exists()) { + pathFile.mkdirs() + } + val cache = File(pathFile, fileName) + val fos = FileOutputStream(cache) + if (inputStream != null) { + FileUtils.copy(inputStream, fos) + } + file = cache + fos.close() + inputStream?.close() + } + } + } catch (e: Exception) { + e.printStackTrace() + } finally { + cursor?.close() + } + } + return file?.absolutePath + } + + /** + * 获取剩余的存储空间 + */ + private fun getRemainingStorageSpace(): Long { + runCatching { + val iPath: File = Environment.getDataDirectory() + val iStat = StatFs(iPath.path) + val iBlockSize = iStat.blockSizeLong + val iAvailableBlocks = iStat.availableBlocksLong + iAvailableBlocks * iBlockSize + }.onSuccess { + return it + }.onFailure { + return 0 + } + return 0 + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable/selector_zzdb_type_bg.xml b/app/src/main/res/drawable/selector_zzdb_type_bg.xml new file mode 100644 index 0000000..259dd0d --- /dev/null +++ b/app/src/main/res/drawable/selector_zzdb_type_bg.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/selector_zzdb_type_text_color.xml b/app/src/main/res/drawable/selector_zzdb_type_text_color.xml new file mode 100644 index 0000000..dda01ee --- /dev/null +++ b/app/src/main/res/drawable/selector_zzdb_type_text_color.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_2a80fc_cor16.xml b/app/src/main/res/drawable/shape_2a80fc_cor16.xml new file mode 100644 index 0000000..5a43da2 --- /dev/null +++ b/app/src/main/res/drawable/shape_2a80fc_cor16.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_c3e7ff_cor16.xml b/app/src/main/res/drawable/shape_c3e7ff_cor16.xml new file mode 100644 index 0000000..a8553cb --- /dev/null +++ b/app/src/main/res/drawable/shape_c3e7ff_cor16.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_cccccc_line.xml b/app/src/main/res/drawable/shape_cccccc_line.xml new file mode 100644 index 0000000..c2b7925 --- /dev/null +++ b/app/src/main/res/drawable/shape_cccccc_line.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_dljz_bg.xml b/app/src/main/res/drawable/shape_dljz_bg.xml new file mode 100644 index 0000000..43789c3 --- /dev/null +++ b/app/src/main/res/drawable/shape_dljz_bg.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_dljz_tag.xml b/app/src/main/res/drawable/shape_dljz_tag.xml new file mode 100644 index 0000000..49cbda9 --- /dev/null +++ b/app/src/main/res/drawable/shape_dljz_tag.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_ebebeb_line_cor10.xml b/app/src/main/res/drawable/shape_ebebeb_line_cor10.xml new file mode 100644 index 0000000..2b9a684 --- /dev/null +++ b/app/src/main/res/drawable/shape_ebebeb_line_cor10.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_eff8fd_cor10.xml b/app/src/main/res/drawable/shape_eff8fd_cor10.xml new file mode 100644 index 0000000..8faabf5 --- /dev/null +++ b/app/src/main/res/drawable/shape_eff8fd_cor10.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_qyzc_company_bg.xml b/app/src/main/res/drawable/shape_qyzc_company_bg.xml new file mode 100644 index 0000000..21cb797 --- /dev/null +++ b/app/src/main/res/drawable/shape_qyzc_company_bg.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_trans_bg.xml b/app/src/main/res/drawable/shape_trans_bg.xml new file mode 100644 index 0000000..04a05c7 --- /dev/null +++ b/app/src/main/res/drawable/shape_trans_bg.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_trans_top_cor20.xml b/app/src/main/res/drawable/shape_trans_top_cor20.xml new file mode 100644 index 0000000..f6ceb95 --- /dev/null +++ b/app/src/main/res/drawable/shape_trans_top_cor20.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_white_bottom_cor16.xml b/app/src/main/res/drawable/shape_white_bottom_cor16.xml new file mode 100644 index 0000000..32be35a --- /dev/null +++ b/app/src/main/res/drawable/shape_white_bottom_cor16.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_zzdb_device_bg.xml b/app/src/main/res/drawable/shape_zzdb_device_bg.xml new file mode 100644 index 0000000..7cf895d --- /dev/null +++ b/app/src/main/res/drawable/shape_zzdb_device_bg.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_account_list.xml b/app/src/main/res/layout/dialog_account_list.xml index eb3b955..864b115 100644 --- a/app/src/main/res/layout/dialog_account_list.xml +++ b/app/src/main/res/layout/dialog_account_list.xml @@ -8,7 +8,6 @@ @@ -26,9 +25,8 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/dp_20" android:text="温馨提示" - android:textColor="@color/color_212226" - android:textSize="@dimen/sp_22" - android:textStyle="bold" + android:textColor="@color/color_1a1a1a" + android:textSize="@dimen/sp_17" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -47,12 +45,12 @@ android:id="@+id/tv_tip" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/dp_20" - android:layout_marginTop="@dimen/dp_10" - android:layout_marginEnd="@dimen/dp_20" + android:layout_marginStart="@dimen/dp_10" + android:layout_marginTop="@dimen/dp_12" + android:layout_marginEnd="@dimen/dp_10" android:gravity="center" android:text="系统检测到您已有账号" - android:textColor="@color/color_727686" + android:textColor="@color/color_333333" android:textSize="@dimen/sp_14" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -63,9 +61,9 @@ android:id="@+id/mRecyclerView" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/dp_20" - android:layout_marginTop="@dimen/dp_14" - android:layout_marginEnd="@dimen/dp_20" + android:layout_marginStart="@dimen/dp_10" + android:layout_marginTop="@dimen/dp_18" + android:layout_marginEnd="@dimen/dp_10" android:maxHeight="@dimen/dp_300" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layout_constraintTop_toBottomOf="@id/tv_tip" @@ -74,7 +72,7 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_select_area.xml b/app/src/main/res/layout/dialog_select_area.xml new file mode 100644 index 0000000..68ea53f --- /dev/null +++ b/app/src/main/res/layout/dialog_select_area.xml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_vip_login_tip.xml b/app/src/main/res/layout/dialog_vip_login_tip.xml index 9e6a9f5..54ea931 100644 --- a/app/src/main/res/layout/dialog_vip_login_tip.xml +++ b/app/src/main/res/layout/dialog_vip_login_tip.xml @@ -33,7 +33,7 @@ android:layout_marginEnd="@dimen/dp_30" android:gravity="center" android:text="系统检测到您目前尚未登录,但您已成为我们尊贵的会员,为了防止您的会员账号丢失,建议您立即前往登录" - android:textColor="@color/color_727686" + android:textColor="@color/color_1a1a1a" android:textSize="@dimen/sp_14" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/layout/fragment_bszz.xml b/app/src/main/res/layout/fragment_bszz.xml new file mode 100644 index 0000000..5db4833 --- /dev/null +++ b/app/src/main/res/layout/fragment_bszz.xml @@ -0,0 +1,332 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_dljz.xml b/app/src/main/res/layout/fragment_dljz.xml new file mode 100644 index 0000000..f588014 --- /dev/null +++ b/app/src/main/res/layout/fragment_dljz.xml @@ -0,0 +1,340 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 59c8da9..ce12158 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -139,6 +139,13 @@ app:layout_constraintDimensionRatio="h,1125:354" app:layout_constraintTop_toTopOf="parent" /> + + diff --git a/app/src/main/res/layout/fragment_qyzc.xml b/app/src/main/res/layout/fragment_qyzc.xml new file mode 100644 index 0000000..444a295 --- /dev/null +++ b/app/src/main/res/layout/fragment_qyzc.xml @@ -0,0 +1,303 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_search_list.xml b/app/src/main/res/layout/fragment_search_list.xml index e8d4d0c..c779d4e 100644 --- a/app/src/main/res/layout/fragment_search_list.xml +++ b/app/src/main/res/layout/fragment_search_list.xml @@ -66,10 +66,7 @@ @@ -77,7 +74,7 @@ @@ -144,6 +137,7 @@ android:id="@+id/mRecyclerView" android:layout_width="match_parent" android:layout_height="match_parent" + android:layout_marginTop="@dimen/dp_7" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" tools:listitem="@layout/listitem_bid" /> diff --git a/app/src/main/res/layout/fragment_zzdb.xml b/app/src/main/res/layout/fragment_zzdb.xml new file mode 100644 index 0000000..81e3f9d --- /dev/null +++ b/app/src/main/res/layout/fragment_zzdb.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_zzdb_detail.xml b/app/src/main/res/layout/fragment_zzdb_detail.xml new file mode 100644 index 0000000..7469c72 --- /dev/null +++ b/app/src/main/res/layout/fragment_zzdb_detail.xml @@ -0,0 +1,715 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/listitem_account_login_tip.xml b/app/src/main/res/layout/listitem_account_login_tip.xml index e58dfb1..5c1e095 100644 --- a/app/src/main/res/layout/listitem_account_login_tip.xml +++ b/app/src/main/res/layout/listitem_account_login_tip.xml @@ -3,7 +3,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@drawable/shape_f3f5f9_cor10" + android:background="@drawable/shape_f6f6f6_cor10" android:paddingStart="@dimen/dp_12" android:paddingEnd="@dimen/dp_12"> @@ -17,24 +17,17 @@ android:maxWidth="@dimen/dp_150" android:ellipsize="end" android:textColor="@color/color_1a1a1a" - android:textSize="@dimen/sp_14" - android:textStyle="bold" + android:textSize="@dimen/sp_13" + android:fontFamily="sans-serif-medium" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> - @@ -47,7 +40,7 @@ android:layout_marginBottom="@dimen/dp_12" android:text="2025.02.28 注册" android:textColor="@color/color_999999" - android:textSize="@dimen/sp_12" + android:textSize="@dimen/sp_10" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tv_username" /> @@ -77,8 +70,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="153****5642" - android:textColor="@color/color_50ffffff" - android:textSize="@dimen/sp_12" + android:textColor="@color/color_666666" + android:textSize="@dimen/sp_10" app:layout_constraintBottom_toBottomOf="@id/tv_create_time" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="@id/tv_create_time" /> diff --git a/app/src/main/res/layout/listitem_qyzc_company.xml b/app/src/main/res/layout/listitem_qyzc_company.xml new file mode 100644 index 0000000..e09d664 --- /dev/null +++ b/app/src/main/res/layout/listitem_qyzc_company.xml @@ -0,0 +1,23 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/listitem_zzdb_device.xml b/app/src/main/res/layout/listitem_zzdb_device.xml new file mode 100644 index 0000000..3c31b9d --- /dev/null +++ b/app/src/main/res/layout/listitem_zzdb_device.xml @@ -0,0 +1,37 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/listitem_zzdb_info.xml b/app/src/main/res/layout/listitem_zzdb_info.xml new file mode 100644 index 0000000..e3c79dc --- /dev/null +++ b/app/src/main/res/layout/listitem_zzdb_info.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/popup_search_options.xml b/app/src/main/res/layout/popup_search_options.xml index d86e5cd..86d5f33 100644 --- a/app/src/main/res/layout/popup_search_options.xml +++ b/app/src/main/res/layout/popup_search_options.xml @@ -10,7 +10,6 @@ android:id="@+id/nestedScrollView" android:layout_width="match_parent" android:layout_height="wrap_content" - app:layout_constraintHeight_max="@dimen/dp_400" app:layout_constraintTop_toTopOf="parent"> #FF493C #FFB92D #DDDDDD + #EBEBEB + #FF7522 + #4A53D5 + #0391F5 + #2A80FC \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 3929030..3ec0c1d 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -86,5 +86,6 @@ 42dp 170dp 132dp + 116dp \ No newline at end of file