优化我的页面、开始回采功能
This commit is contained in:
@@ -54,6 +54,7 @@
|
||||
<activity android:name=".ui.tunneling.activity.TunnelingActivity" />
|
||||
<activity android:name=".ui.tunneling.activity.AddWorkingFaceActivity"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity android:name=".ui.mining.activity.MiningActivity" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.bean.UserMenuBean
|
||||
import com.zmkg.coaloperation.databinding.ListItemUserMenuBinding
|
||||
|
||||
class UserMenuAdapter(list: MutableList<UserMenuBean>) :
|
||||
BaseQuickAdapter<UserMenuBean, UserMenuAdapter.VH>(R.layout.list_item_user_menu, list) {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ListItemUserMenuBinding.inflate(
|
||||
LayoutInflater.from(context), parent, false
|
||||
)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun convert(
|
||||
holder: VH,
|
||||
item: UserMenuBean
|
||||
) {
|
||||
holder.binding.let {
|
||||
it.ivUserMenu.run {
|
||||
setImageResource(item.iconResId)
|
||||
setBackgroundResource(item.iconBgResId)
|
||||
}
|
||||
it.tvUserMenu.text = item.menuName
|
||||
}
|
||||
}
|
||||
|
||||
inner class VH(var binding: ListItemUserMenuBinding) : BaseViewHolder(binding.root)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.zmkg.coaloperation.bean
|
||||
|
||||
data class UserMenuBean(
|
||||
var menuName: String,
|
||||
var iconResId:Int,
|
||||
var iconBgResId: Int,
|
||||
val click:()-> Unit
|
||||
)
|
||||
+2
-2
@@ -6,6 +6,7 @@ import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.databinding.FragmentPageLeftBinding
|
||||
import com.zmkg.coaloperation.ui.mining.activity.MiningActivity
|
||||
|
||||
class PagerLeftFragment :
|
||||
BaseVMBFragment<TestViewModel, FragmentPageLeftBinding>(R.layout.fragment_page_left) {
|
||||
@@ -24,8 +25,7 @@ class PagerLeftFragment :
|
||||
mBinding.rootView.setOnClickListener {
|
||||
// val pagerViewClickDialog = PagerViewClickDialog(requireContext())
|
||||
// pagerViewClickDialog.show()
|
||||
|
||||
|
||||
toActivity(MiningActivity::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.zmkg.coaloperation.ui.mining
|
||||
|
||||
class MiningViewModel {
|
||||
}
|
||||
+6
-5
@@ -1,4 +1,4 @@
|
||||
package com.zmkg.coaloperation.ui.mining
|
||||
package com.zmkg.coaloperation.ui.mining.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
@@ -7,22 +7,23 @@ import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.databinding.ActivityMiningBinding
|
||||
|
||||
/**
|
||||
* 回采首页列表
|
||||
*/
|
||||
class MiningActivity :
|
||||
BaseVMBActivity<TestViewModel, ActivityMiningBinding>(R.layout.activity_mining) {
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
TODO("Not yet implemented")
|
||||
mBinding.toolbarLay.title = "回采上报"
|
||||
mBinding.toolbarLay.rightText = "新增工作面"
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
}
|
||||
+106
-88
@@ -7,9 +7,12 @@ import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.UserMenuAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||
import com.zmkg.coaloperation.bean.TunnelSubmitData
|
||||
import com.zmkg.coaloperation.bean.UserMenuBean
|
||||
import com.zmkg.coaloperation.databinding.FragmentUserBinding
|
||||
import com.zmkg.coaloperation.db.viewmodel.TunnelRoofLithologyViewModel
|
||||
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceRecordViewModel
|
||||
@@ -62,105 +65,29 @@ class UserFragment :
|
||||
}
|
||||
}
|
||||
|
||||
private var userMenuList: MutableList<UserMenuBean> = mutableListOf()
|
||||
private val userMenuAdapter: UserMenuAdapter by lazy {
|
||||
UserMenuAdapter(userMenuList).apply {
|
||||
setOnItemClickListener { adapter, view, position ->
|
||||
userMenuList[position].click()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||
mBinding.apply {
|
||||
networkConfig.setOrderStateInfo(
|
||||
"网络配置",
|
||||
R.mipmap.network,
|
||||
R.drawable.bg_icon_network_config
|
||||
)
|
||||
dataPull.setOrderStateInfo(
|
||||
"数据拉取",
|
||||
R.drawable.ic_data_pull,
|
||||
R.drawable.bg_icon_data_pull
|
||||
)
|
||||
dataPush.setOrderStateInfo(
|
||||
"数据推送",
|
||||
R.drawable.ic_data_push,
|
||||
R.drawable.bg_icon_data_push
|
||||
)
|
||||
cacheManage.setOrderStateInfo(
|
||||
"缓存管理",
|
||||
R.mipmap.buffer,
|
||||
R.drawable.bg_icon_cache_manage
|
||||
)
|
||||
checkUpdate.setOrderStateInfo(
|
||||
"检查更新",
|
||||
R.mipmap.checkupdate,
|
||||
R.drawable.bg_icon_check_update
|
||||
)
|
||||
systemExit.setOrderStateInfo(
|
||||
"系统退出",
|
||||
R.mipmap.systemexit,
|
||||
R.drawable.bg_icon_system_exit
|
||||
)
|
||||
aboutUs.setOrderStateInfo("关于我们", R.mipmap.about_us, R.drawable.bg_icon_about_us)
|
||||
initMenuList()
|
||||
mBinding.rvMenuList.let {
|
||||
it.layoutManager = LinearLayoutManager(it.context)
|
||||
it.adapter = userMenuAdapter
|
||||
}
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
mBinding.apply {
|
||||
addClickViews(
|
||||
networkConfig,
|
||||
dataPull,
|
||||
dataPush,
|
||||
cacheManage,
|
||||
checkUpdate,
|
||||
systemExit,
|
||||
aboutUs
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
when (v?.id) {
|
||||
R.id.network_config -> {
|
||||
toActivity(NetworkConfigActivity::class.java)
|
||||
}
|
||||
|
||||
R.id.data_pull -> {
|
||||
checkDataState { state ->
|
||||
if (state) {
|
||||
showToast("本地存在待提交的数据")
|
||||
return@checkDataState
|
||||
}
|
||||
showLoading("加载中")
|
||||
workingFaceViewModel.deleteAll {
|
||||
workingFaceRecordViewModel.deleteAll {
|
||||
roofLithologyViewModel.deleteAll {
|
||||
mViewModel.getTunnelFaceAndRecordList()
|
||||
mViewModel.getTunnelAllDict()
|
||||
mBinding.dataPull.postDelayed({
|
||||
hideLoading()
|
||||
}, 3000)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
R.id.data_push -> {
|
||||
dataPush()
|
||||
}
|
||||
|
||||
R.id.cache_manage -> {
|
||||
toActivity(CacheManageActivity::class.java)
|
||||
}
|
||||
|
||||
R.id.check_update -> {
|
||||
updateDialog.show("提示", "已经是最新版本了")
|
||||
}
|
||||
|
||||
R.id.system_exit -> {
|
||||
exitDialog.show("退出", "确定要退出当前用户?")
|
||||
}
|
||||
|
||||
R.id.about_us -> {
|
||||
toActivity(AboutUsActivity::class.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun createObserve() {
|
||||
@@ -260,4 +187,95 @@ class UserFragment :
|
||||
}
|
||||
}
|
||||
|
||||
private fun initMenuList() {
|
||||
userMenuList.clear()
|
||||
userMenuList.add(
|
||||
UserMenuBean(
|
||||
menuName = "网络配置",
|
||||
iconResId = R.mipmap.network,
|
||||
iconBgResId = R.drawable.bg_icon_network_config,
|
||||
click = {
|
||||
toActivity(NetworkConfigActivity::class.java)
|
||||
}
|
||||
)
|
||||
)
|
||||
userMenuList.add(
|
||||
UserMenuBean(
|
||||
menuName = "数据拉取",
|
||||
iconResId = R.drawable.ic_data_pull,
|
||||
iconBgResId = R.drawable.bg_icon_data_pull,
|
||||
click = { dataPull() }
|
||||
)
|
||||
)
|
||||
userMenuList.add(
|
||||
UserMenuBean(
|
||||
menuName = "数据推送",
|
||||
iconResId = R.drawable.ic_data_push,
|
||||
iconBgResId = R.drawable.bg_icon_data_push,
|
||||
click = { dataPush() }
|
||||
)
|
||||
)
|
||||
userMenuList.add(
|
||||
UserMenuBean(
|
||||
menuName = "缓存管理",
|
||||
iconResId = R.mipmap.buffer,
|
||||
iconBgResId = R.drawable.bg_icon_cache_manage,
|
||||
click = {
|
||||
toActivity(CacheManageActivity::class.java)
|
||||
}
|
||||
)
|
||||
)
|
||||
userMenuList.add(
|
||||
UserMenuBean(
|
||||
menuName = "检查更新",
|
||||
iconResId = R.mipmap.checkupdate,
|
||||
iconBgResId = R.drawable.bg_icon_check_update,
|
||||
click = {
|
||||
updateDialog.show("提示", "已经是最新版本了")
|
||||
}
|
||||
)
|
||||
)
|
||||
userMenuList.add(
|
||||
UserMenuBean(
|
||||
menuName = "系统退出",
|
||||
iconResId = R.mipmap.systemexit,
|
||||
iconBgResId = R.drawable.bg_icon_system_exit,
|
||||
click = {
|
||||
exitDialog.show("退出", "确定要退出当前用户?")
|
||||
}
|
||||
)
|
||||
)
|
||||
userMenuList.add(
|
||||
UserMenuBean(
|
||||
menuName = "关于我们",
|
||||
iconResId = R.mipmap.about_us,
|
||||
iconBgResId = R.drawable.bg_icon_about_us,
|
||||
click = {
|
||||
toActivity(AboutUsActivity::class.java)
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private fun dataPull() {
|
||||
checkDataState { state ->
|
||||
if (state) {
|
||||
showToast("本地存在待提交的数据")
|
||||
return@checkDataState
|
||||
}
|
||||
showLoading("加载中")
|
||||
workingFaceViewModel.deleteAll {
|
||||
workingFaceRecordViewModel.deleteAll {
|
||||
roofLithologyViewModel.deleteAll {
|
||||
mViewModel.getTunnelFaceAndRecordList()
|
||||
mViewModel.getTunnelAllDict()
|
||||
mBinding.root.postDelayed({
|
||||
hideLoading()
|
||||
}, 3000)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 448 B |
@@ -10,8 +10,19 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="@color/black_bg">
|
||||
<include
|
||||
android:id="@+id/toolbar_lay"
|
||||
layout="@layout/lay_title_right_bar" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:overScrollMode="never"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/list_item_tunnel_working_face" />
|
||||
</LinearLayout>
|
||||
|
||||
</layout>
|
||||
@@ -10,7 +10,7 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black"
|
||||
android:background="@color/black_bg"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:orientation="vertical">
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
app:title="@{@string/title_tunneling}" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_list"
|
||||
android:id="@+id/rvMiningList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:overScrollMode="never"
|
||||
|
||||
@@ -45,6 +45,6 @@
|
||||
android:id="@+id/custom_info_iv_right"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@mipmap/arrow_right" />
|
||||
android:src="@drawable/ic_arrow_right_white2"/>
|
||||
</com.allen.library.shape.ShapeLinearLayout>
|
||||
</layout>
|
||||
@@ -7,28 +7,29 @@
|
||||
|
||||
</data>
|
||||
|
||||
<RelativeLayout
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black">
|
||||
android:background="@color/black_bg">
|
||||
|
||||
|
||||
<com.allen.library.shape.ShapeLinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:paddingBottom="25dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:layout_marginTop="94dp"
|
||||
android:orientation="vertical"
|
||||
app:shapeCornersRadius="32dp"
|
||||
app:shapeSolidColor="#17181C">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvUserName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="55dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="账号昵称"
|
||||
android:text="小助手"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="24sp" />
|
||||
|
||||
@@ -42,59 +43,27 @@
|
||||
android:textColor="#6A6F87"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<com.zmkg.coaloperation.view.CustomInfoView
|
||||
android:id="@+id/network_config"
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvMenuList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp" />
|
||||
|
||||
<com.zmkg.coaloperation.view.CustomInfoView
|
||||
android:id="@+id/data_pull"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp" />
|
||||
|
||||
<com.zmkg.coaloperation.view.CustomInfoView
|
||||
android:id="@+id/data_push"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp" />
|
||||
|
||||
<com.zmkg.coaloperation.view.CustomInfoView
|
||||
android:id="@+id/cache_manage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp" />
|
||||
|
||||
<com.zmkg.coaloperation.view.CustomInfoView
|
||||
android:id="@+id/check_update"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp" />
|
||||
|
||||
<com.zmkg.coaloperation.view.CustomInfoView
|
||||
android:id="@+id/system_exit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp" />
|
||||
|
||||
<com.zmkg.coaloperation.view.CustomInfoView
|
||||
android:id="@+id/about_us"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp" />
|
||||
android:layout_height="match_parent"
|
||||
tools:itemCount="6"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="7dp"
|
||||
android:clipToPadding="true"
|
||||
tools:listitem="@layout/list_item_user_menu"/>
|
||||
|
||||
</com.allen.library.shape.ShapeLinearLayout>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/header_icon"
|
||||
android:id="@+id/ivHeadPic"
|
||||
android:layout_width="68dp"
|
||||
android:layout_height="68dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="60dp"
|
||||
app:srcCompat="@drawable/ic_avatar"/>
|
||||
<!-- android:background="#e3e3e3"-->
|
||||
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
||||
</layout>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
|
||||
</data>
|
||||
|
||||
|
||||
<com.allen.library.shape.ShapeLinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="68dp"
|
||||
android:layout_marginTop="7dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginHorizontal="30dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
app:shapeSolidColor="#20222B"
|
||||
app:shapeCornersRadius="16dp"
|
||||
android:paddingHorizontal="15dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivUserMenu"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:padding="11dp"
|
||||
tools:src="@mipmap/network"
|
||||
tools:background="@drawable/bg_icon_network_config"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvUserMenu"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
tools:text="菜单"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_arrow_right_white2" />
|
||||
</com.allen.library.shape.ShapeLinearLayout>
|
||||
</layout>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 255 B |
Reference in New Issue
Block a user