diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/overtime.svg b/app/src/main/assets/svg/overtime.svg
new file mode 100644
index 0000000..32f5e01
--- /dev/null
+++ b/app/src/main/assets/svg/overtime.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/overtime.svg b/app/src/main/assets/svg/overtime.svg
new file mode 100644
index 0000000..32f5e01
--- /dev/null
+++ b/app/src/main/assets/svg/overtime.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/well.svg b/app/src/main/assets/svg/well.svg
new file mode 100644
index 0000000..ad0a5db
--- /dev/null
+++ b/app/src/main/assets/svg/well.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/overtime.svg b/app/src/main/assets/svg/overtime.svg
new file mode 100644
index 0000000..32f5e01
--- /dev/null
+++ b/app/src/main/assets/svg/overtime.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/well.svg b/app/src/main/assets/svg/well.svg
new file mode 100644
index 0000000..ad0a5db
--- /dev/null
+++ b/app/src/main/assets/svg/well.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
index cf15d6b..d1d455f 100644
--- a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
+++ b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
@@ -20,7 +20,7 @@
}
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
- holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.imageView.setImageResource(Constant.HOME_ICONS[position])
holder.textView.text = Constant.HOME_ITEMS[position]
if (clickListener != null) {
holder.itemView.setOnClickListener {
diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/overtime.svg b/app/src/main/assets/svg/overtime.svg
new file mode 100644
index 0000000..32f5e01
--- /dev/null
+++ b/app/src/main/assets/svg/overtime.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/well.svg b/app/src/main/assets/svg/well.svg
new file mode 100644
index 0000000..ad0a5db
--- /dev/null
+++ b/app/src/main/assets/svg/well.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
index cf15d6b..d1d455f 100644
--- a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
+++ b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
@@ -20,7 +20,7 @@
}
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
- holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.imageView.setImageResource(Constant.HOME_ICONS[position])
holder.textView.text = Constant.HOME_ITEMS[position]
if (clickListener != null) {
holder.itemView.setOnClickListener {
diff --git a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
index c342334..537cb90 100644
--- a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
+++ b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
@@ -41,7 +41,8 @@
const val USER_DETAIL_MODEL = "userDetailModel"
const val INTENT_PARAM = "intentParam"
- val HOME_ICONS = arrayOf(R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher)
+ val HOME_ICONS = arrayOf(R.drawable.ic_well, R.drawable.ic_overtime, R.drawable.ic_bfcf)
val HOME_ITEMS = arrayOf("闸井管理", "超时工单", "布防撤防")
val SUB_PAGE_TITLES = arrayOf("待处理", "待确认", "处理中", "已完成")
+ val OVER_TIME_PAGE_TITLES = arrayOf("超时未接单", "超时未处理")
}
\ No newline at end of file
diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/overtime.svg b/app/src/main/assets/svg/overtime.svg
new file mode 100644
index 0000000..32f5e01
--- /dev/null
+++ b/app/src/main/assets/svg/overtime.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/well.svg b/app/src/main/assets/svg/well.svg
new file mode 100644
index 0000000..ad0a5db
--- /dev/null
+++ b/app/src/main/assets/svg/well.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
index cf15d6b..d1d455f 100644
--- a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
+++ b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
@@ -20,7 +20,7 @@
}
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
- holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.imageView.setImageResource(Constant.HOME_ICONS[position])
holder.textView.text = Constant.HOME_ITEMS[position]
if (clickListener != null) {
holder.itemView.setOnClickListener {
diff --git a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
index c342334..537cb90 100644
--- a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
+++ b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
@@ -41,7 +41,8 @@
const val USER_DETAIL_MODEL = "userDetailModel"
const val INTENT_PARAM = "intentParam"
- val HOME_ICONS = arrayOf(R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher)
+ val HOME_ICONS = arrayOf(R.drawable.ic_well, R.drawable.ic_overtime, R.drawable.ic_bfcf)
val HOME_ITEMS = arrayOf("闸井管理", "超时工单", "布防撤防")
val SUB_PAGE_TITLES = arrayOf("待处理", "待确认", "处理中", "已完成")
+ val OVER_TIME_PAGE_TITLES = arrayOf("超时未接单", "超时未处理")
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
index 453a2c9..d3d1890 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
@@ -1,18 +1,45 @@
package com.casic.app.smartwell.view
+import android.view.View
+import androidx.fragment.app.Fragment
import com.casic.app.smartwell.R
+import com.casic.app.smartwell.adapter.TopViewPagerAdapter
import com.casic.app.smartwell.base.BaseActivity
+import com.casic.app.smartwell.utils.Constant
+import com.casic.app.smartwell.view.fragment.UnAcceptOrderFragment
+import com.casic.app.smartwell.view.fragment.UnHandleOrderFragment
+import kotlinx.android.synthetic.main.activity_order_overtime.*
+import kotlinx.android.synthetic.main.include_base_title.*
+import java.util.*
class OvertimeOrderActivity : BaseActivity() {
+ private var fragmentList: ArrayList = ArrayList()
+
+ init {
+ fragmentList.add(UnAcceptOrderFragment())
+ fragmentList.add(UnHandleOrderFragment())
+ }
+
override fun initLayoutView(): Int = R.layout.activity_order_overtime
override fun setupTopBarLayout() {
-
+ titleView.text = "工单管理"
+ leftBackView.visibility = View.VISIBLE
+ leftBackView.setOnClickListener { finish() }
}
override fun initData() {
-
+ val topViewPagerAdapter =
+ TopViewPagerAdapter(
+ supportFragmentManager,
+ Constant.OVER_TIME_PAGE_TITLES,
+ fragmentList
+ )
+ //页面永不销毁
+ overTimeViewPager.offscreenPageLimit = fragmentList.size
+ overTimeViewPager.adapter = topViewPagerAdapter
+ overTimeTabLayout.setupWithViewPager(overTimeViewPager)
}
override fun initEvent() {
diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/overtime.svg b/app/src/main/assets/svg/overtime.svg
new file mode 100644
index 0000000..32f5e01
--- /dev/null
+++ b/app/src/main/assets/svg/overtime.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/well.svg b/app/src/main/assets/svg/well.svg
new file mode 100644
index 0000000..ad0a5db
--- /dev/null
+++ b/app/src/main/assets/svg/well.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
index cf15d6b..d1d455f 100644
--- a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
+++ b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
@@ -20,7 +20,7 @@
}
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
- holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.imageView.setImageResource(Constant.HOME_ICONS[position])
holder.textView.text = Constant.HOME_ITEMS[position]
if (clickListener != null) {
holder.itemView.setOnClickListener {
diff --git a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
index c342334..537cb90 100644
--- a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
+++ b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
@@ -41,7 +41,8 @@
const val USER_DETAIL_MODEL = "userDetailModel"
const val INTENT_PARAM = "intentParam"
- val HOME_ICONS = arrayOf(R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher)
+ val HOME_ICONS = arrayOf(R.drawable.ic_well, R.drawable.ic_overtime, R.drawable.ic_bfcf)
val HOME_ITEMS = arrayOf("闸井管理", "超时工单", "布防撤防")
val SUB_PAGE_TITLES = arrayOf("待处理", "待确认", "处理中", "已完成")
+ val OVER_TIME_PAGE_TITLES = arrayOf("超时未接单", "超时未处理")
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
index 453a2c9..d3d1890 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
@@ -1,18 +1,45 @@
package com.casic.app.smartwell.view
+import android.view.View
+import androidx.fragment.app.Fragment
import com.casic.app.smartwell.R
+import com.casic.app.smartwell.adapter.TopViewPagerAdapter
import com.casic.app.smartwell.base.BaseActivity
+import com.casic.app.smartwell.utils.Constant
+import com.casic.app.smartwell.view.fragment.UnAcceptOrderFragment
+import com.casic.app.smartwell.view.fragment.UnHandleOrderFragment
+import kotlinx.android.synthetic.main.activity_order_overtime.*
+import kotlinx.android.synthetic.main.include_base_title.*
+import java.util.*
class OvertimeOrderActivity : BaseActivity() {
+ private var fragmentList: ArrayList = ArrayList()
+
+ init {
+ fragmentList.add(UnAcceptOrderFragment())
+ fragmentList.add(UnHandleOrderFragment())
+ }
+
override fun initLayoutView(): Int = R.layout.activity_order_overtime
override fun setupTopBarLayout() {
-
+ titleView.text = "工单管理"
+ leftBackView.visibility = View.VISIBLE
+ leftBackView.setOnClickListener { finish() }
}
override fun initData() {
-
+ val topViewPagerAdapter =
+ TopViewPagerAdapter(
+ supportFragmentManager,
+ Constant.OVER_TIME_PAGE_TITLES,
+ fragmentList
+ )
+ //页面永不销毁
+ overTimeViewPager.offscreenPageLimit = fragmentList.size
+ overTimeViewPager.adapter = topViewPagerAdapter
+ overTimeTabLayout.setupWithViewPager(overTimeViewPager)
}
override fun initEvent() {
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
index 04654dc..5402091 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
@@ -1,7 +1,16 @@
package com.casic.app.smartwell.view.fragment
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
+import com.amap.api.maps.AMap
+import com.amap.api.maps.AMapOptions
+import com.amap.api.maps.CameraUpdateFactory
+import com.amap.api.maps.model.MyLocationStyle
import com.casic.app.smartwell.R
import com.casic.app.smartwell.adapter.HomeRecycleAdapter
import com.casic.app.smartwell.extensions.navigatePageTo
@@ -10,23 +19,42 @@
import com.casic.app.smartwell.view.WellOperationActivity
import com.casic.app.smartwell.vm.WellCountViewModel
import com.casic.app.smartwell.vm.WorkOrderViewModel
-import com.pengxh.app.multilib.base.BaseFragment
-import kotlinx.android.synthetic.main.fragment_home.*
-import kotlinx.android.synthetic.main.include_base_title.*
+import kotlinx.android.synthetic.main.fragment_home.view.*
+import kotlinx.android.synthetic.main.include_base_title.view.*
-class HomePageFragment : BaseFragment() {
+class HomePageFragment : Fragment() {
+ private lateinit var homeView: View
private lateinit var wellCountViewModel: WellCountViewModel
private lateinit var workOrderViewModel: WorkOrderViewModel
+ private lateinit var aMap: AMap
+ private lateinit var locationStyle: MyLocationStyle
- override fun initLayoutView(): Int = R.layout.fragment_home
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ homeView = inflater.inflate(R.layout.fragment_home, container, false)
+ homeView.titleView.text = "首页"
+ //地图初始化
+ homeView.mapView.onCreate(savedInstanceState)
+ aMap = homeView.mapView.map
+ val uiSettings = aMap.uiSettings
+ uiSettings.zoomPosition = AMapOptions.ZOOM_POSITION_RIGHT_CENTER
+ uiSettings.isRotateGesturesEnabled = false//不许地图随手势旋转角度
+ //显示定位小蓝点
+ locationStyle = MyLocationStyle()
+ locationStyle
+ locationStyle.showMyLocation(true)//设置是否显示定位小蓝点
+ locationStyle.interval(10 * 1000)////设置连续定位模式下的定位间隔,只在连续定位模式下生效。单位为毫秒
+ aMap.myLocationStyle = locationStyle
+ aMap.isMyLocationEnabled = true
+ aMap.moveCamera(CameraUpdateFactory.zoomTo(14.toFloat()))
- override fun initData() {
- titleView.text = "首页"
//首页功能块
val homeRecycleAdapter = HomeRecycleAdapter(requireContext())
- homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
- homeRecyclerView.adapter = homeRecycleAdapter
+ homeView.homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
+ homeView.homeRecyclerView.adapter = homeRecycleAdapter
homeRecycleAdapter.setOnGridItemClickListener(object :
HomeRecycleAdapter.OnGridItemClickListener {
override fun onClick(position: Int) {
@@ -39,34 +67,51 @@
})
wellCountViewModel = ViewModelProvider(this).get(WellCountViewModel::class.java)
workOrderViewModel = ViewModelProvider(this).get(WorkOrderViewModel::class.java)
- }
- override fun initEvent() {
- wellCountViewModel.resultModel.observe(this, {
- unDeployedWellView.text = it["bfWell"]
- deployedWellView.text = it["cfWell"]
- allWellDataView.text = it["total"]
+ wellCountViewModel.resultModel.observe(viewLifecycleOwner, {
+ homeView.unDeployedWellView.text = it["bfWell"]
+ homeView.deployedWellView.text = it["cfWell"]
+ homeView.allWellDataView.text = it["total"]
})
- workOrderViewModel.resultModel.observe(this, {
+ workOrderViewModel.resultModel.observe(viewLifecycleOwner, {
if (it["beforeGet"]!!.length > 4 || it["beforeConfirm"]!!.length > 4 ||
it["inHandle"]!!.length > 4 || it["over"]!!.length > 4
) {
- todoDataView.textSize = 36f
- undeterminedDataView.textSize = 36f
- inHandleDataView.textSize = 36f
- completedDataView.textSize = 36f
+ homeView.todoDataView.textSize = 36f
+ homeView.undeterminedDataView.textSize = 36f
+ homeView.inHandleDataView.textSize = 36f
+ homeView.completedDataView.textSize = 36f
}
- todoDataView.text = it["beforeGet"]
- undeterminedDataView.text = it["beforeConfirm"]
- inHandleDataView.text = it["inHandle"]
- completedDataView.text = it["over"]
+ homeView.todoDataView.text = it["beforeGet"]
+ homeView.undeterminedDataView.text = it["beforeConfirm"]
+ homeView.inHandleDataView.text = it["inHandle"]
+ homeView.completedDataView.text = it["over"]
})
+ return homeView
}
override fun onResume() {
super.onResume()
+ homeView.mapView.onResume()
//每次页面切换都需要重新刷新不同状态的窨井数量
wellCountViewModel.countWellByState()
workOrderViewModel.countWorkOrderByState()
}
+
+ /***以下是地图生命周期管理************************************************************************/
+
+ override fun onPause() {
+ super.onPause()
+ homeView.mapView.onPause()
+ }
+
+ override fun onSaveInstanceState(outState: Bundle) {
+ super.onSaveInstanceState(outState)
+ homeView.mapView.onSaveInstanceState(outState)
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ homeView.mapView.onDestroy()
+ }
}
\ No newline at end of file
diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/overtime.svg b/app/src/main/assets/svg/overtime.svg
new file mode 100644
index 0000000..32f5e01
--- /dev/null
+++ b/app/src/main/assets/svg/overtime.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/well.svg b/app/src/main/assets/svg/well.svg
new file mode 100644
index 0000000..ad0a5db
--- /dev/null
+++ b/app/src/main/assets/svg/well.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
index cf15d6b..d1d455f 100644
--- a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
+++ b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
@@ -20,7 +20,7 @@
}
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
- holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.imageView.setImageResource(Constant.HOME_ICONS[position])
holder.textView.text = Constant.HOME_ITEMS[position]
if (clickListener != null) {
holder.itemView.setOnClickListener {
diff --git a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
index c342334..537cb90 100644
--- a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
+++ b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
@@ -41,7 +41,8 @@
const val USER_DETAIL_MODEL = "userDetailModel"
const val INTENT_PARAM = "intentParam"
- val HOME_ICONS = arrayOf(R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher)
+ val HOME_ICONS = arrayOf(R.drawable.ic_well, R.drawable.ic_overtime, R.drawable.ic_bfcf)
val HOME_ITEMS = arrayOf("闸井管理", "超时工单", "布防撤防")
val SUB_PAGE_TITLES = arrayOf("待处理", "待确认", "处理中", "已完成")
+ val OVER_TIME_PAGE_TITLES = arrayOf("超时未接单", "超时未处理")
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
index 453a2c9..d3d1890 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
@@ -1,18 +1,45 @@
package com.casic.app.smartwell.view
+import android.view.View
+import androidx.fragment.app.Fragment
import com.casic.app.smartwell.R
+import com.casic.app.smartwell.adapter.TopViewPagerAdapter
import com.casic.app.smartwell.base.BaseActivity
+import com.casic.app.smartwell.utils.Constant
+import com.casic.app.smartwell.view.fragment.UnAcceptOrderFragment
+import com.casic.app.smartwell.view.fragment.UnHandleOrderFragment
+import kotlinx.android.synthetic.main.activity_order_overtime.*
+import kotlinx.android.synthetic.main.include_base_title.*
+import java.util.*
class OvertimeOrderActivity : BaseActivity() {
+ private var fragmentList: ArrayList = ArrayList()
+
+ init {
+ fragmentList.add(UnAcceptOrderFragment())
+ fragmentList.add(UnHandleOrderFragment())
+ }
+
override fun initLayoutView(): Int = R.layout.activity_order_overtime
override fun setupTopBarLayout() {
-
+ titleView.text = "工单管理"
+ leftBackView.visibility = View.VISIBLE
+ leftBackView.setOnClickListener { finish() }
}
override fun initData() {
-
+ val topViewPagerAdapter =
+ TopViewPagerAdapter(
+ supportFragmentManager,
+ Constant.OVER_TIME_PAGE_TITLES,
+ fragmentList
+ )
+ //页面永不销毁
+ overTimeViewPager.offscreenPageLimit = fragmentList.size
+ overTimeViewPager.adapter = topViewPagerAdapter
+ overTimeTabLayout.setupWithViewPager(overTimeViewPager)
}
override fun initEvent() {
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
index 04654dc..5402091 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
@@ -1,7 +1,16 @@
package com.casic.app.smartwell.view.fragment
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
+import com.amap.api.maps.AMap
+import com.amap.api.maps.AMapOptions
+import com.amap.api.maps.CameraUpdateFactory
+import com.amap.api.maps.model.MyLocationStyle
import com.casic.app.smartwell.R
import com.casic.app.smartwell.adapter.HomeRecycleAdapter
import com.casic.app.smartwell.extensions.navigatePageTo
@@ -10,23 +19,42 @@
import com.casic.app.smartwell.view.WellOperationActivity
import com.casic.app.smartwell.vm.WellCountViewModel
import com.casic.app.smartwell.vm.WorkOrderViewModel
-import com.pengxh.app.multilib.base.BaseFragment
-import kotlinx.android.synthetic.main.fragment_home.*
-import kotlinx.android.synthetic.main.include_base_title.*
+import kotlinx.android.synthetic.main.fragment_home.view.*
+import kotlinx.android.synthetic.main.include_base_title.view.*
-class HomePageFragment : BaseFragment() {
+class HomePageFragment : Fragment() {
+ private lateinit var homeView: View
private lateinit var wellCountViewModel: WellCountViewModel
private lateinit var workOrderViewModel: WorkOrderViewModel
+ private lateinit var aMap: AMap
+ private lateinit var locationStyle: MyLocationStyle
- override fun initLayoutView(): Int = R.layout.fragment_home
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ homeView = inflater.inflate(R.layout.fragment_home, container, false)
+ homeView.titleView.text = "首页"
+ //地图初始化
+ homeView.mapView.onCreate(savedInstanceState)
+ aMap = homeView.mapView.map
+ val uiSettings = aMap.uiSettings
+ uiSettings.zoomPosition = AMapOptions.ZOOM_POSITION_RIGHT_CENTER
+ uiSettings.isRotateGesturesEnabled = false//不许地图随手势旋转角度
+ //显示定位小蓝点
+ locationStyle = MyLocationStyle()
+ locationStyle
+ locationStyle.showMyLocation(true)//设置是否显示定位小蓝点
+ locationStyle.interval(10 * 1000)////设置连续定位模式下的定位间隔,只在连续定位模式下生效。单位为毫秒
+ aMap.myLocationStyle = locationStyle
+ aMap.isMyLocationEnabled = true
+ aMap.moveCamera(CameraUpdateFactory.zoomTo(14.toFloat()))
- override fun initData() {
- titleView.text = "首页"
//首页功能块
val homeRecycleAdapter = HomeRecycleAdapter(requireContext())
- homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
- homeRecyclerView.adapter = homeRecycleAdapter
+ homeView.homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
+ homeView.homeRecyclerView.adapter = homeRecycleAdapter
homeRecycleAdapter.setOnGridItemClickListener(object :
HomeRecycleAdapter.OnGridItemClickListener {
override fun onClick(position: Int) {
@@ -39,34 +67,51 @@
})
wellCountViewModel = ViewModelProvider(this).get(WellCountViewModel::class.java)
workOrderViewModel = ViewModelProvider(this).get(WorkOrderViewModel::class.java)
- }
- override fun initEvent() {
- wellCountViewModel.resultModel.observe(this, {
- unDeployedWellView.text = it["bfWell"]
- deployedWellView.text = it["cfWell"]
- allWellDataView.text = it["total"]
+ wellCountViewModel.resultModel.observe(viewLifecycleOwner, {
+ homeView.unDeployedWellView.text = it["bfWell"]
+ homeView.deployedWellView.text = it["cfWell"]
+ homeView.allWellDataView.text = it["total"]
})
- workOrderViewModel.resultModel.observe(this, {
+ workOrderViewModel.resultModel.observe(viewLifecycleOwner, {
if (it["beforeGet"]!!.length > 4 || it["beforeConfirm"]!!.length > 4 ||
it["inHandle"]!!.length > 4 || it["over"]!!.length > 4
) {
- todoDataView.textSize = 36f
- undeterminedDataView.textSize = 36f
- inHandleDataView.textSize = 36f
- completedDataView.textSize = 36f
+ homeView.todoDataView.textSize = 36f
+ homeView.undeterminedDataView.textSize = 36f
+ homeView.inHandleDataView.textSize = 36f
+ homeView.completedDataView.textSize = 36f
}
- todoDataView.text = it["beforeGet"]
- undeterminedDataView.text = it["beforeConfirm"]
- inHandleDataView.text = it["inHandle"]
- completedDataView.text = it["over"]
+ homeView.todoDataView.text = it["beforeGet"]
+ homeView.undeterminedDataView.text = it["beforeConfirm"]
+ homeView.inHandleDataView.text = it["inHandle"]
+ homeView.completedDataView.text = it["over"]
})
+ return homeView
}
override fun onResume() {
super.onResume()
+ homeView.mapView.onResume()
//每次页面切换都需要重新刷新不同状态的窨井数量
wellCountViewModel.countWellByState()
workOrderViewModel.countWorkOrderByState()
}
+
+ /***以下是地图生命周期管理************************************************************************/
+
+ override fun onPause() {
+ super.onPause()
+ homeView.mapView.onPause()
+ }
+
+ override fun onSaveInstanceState(outState: Bundle) {
+ super.onSaveInstanceState(outState)
+ homeView.mapView.onSaveInstanceState(outState)
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ homeView.mapView.onDestroy()
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
new file mode 100644
index 0000000..e7a664a
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnAcceptOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_accept
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/overtime.svg b/app/src/main/assets/svg/overtime.svg
new file mode 100644
index 0000000..32f5e01
--- /dev/null
+++ b/app/src/main/assets/svg/overtime.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/well.svg b/app/src/main/assets/svg/well.svg
new file mode 100644
index 0000000..ad0a5db
--- /dev/null
+++ b/app/src/main/assets/svg/well.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
index cf15d6b..d1d455f 100644
--- a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
+++ b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
@@ -20,7 +20,7 @@
}
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
- holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.imageView.setImageResource(Constant.HOME_ICONS[position])
holder.textView.text = Constant.HOME_ITEMS[position]
if (clickListener != null) {
holder.itemView.setOnClickListener {
diff --git a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
index c342334..537cb90 100644
--- a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
+++ b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
@@ -41,7 +41,8 @@
const val USER_DETAIL_MODEL = "userDetailModel"
const val INTENT_PARAM = "intentParam"
- val HOME_ICONS = arrayOf(R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher)
+ val HOME_ICONS = arrayOf(R.drawable.ic_well, R.drawable.ic_overtime, R.drawable.ic_bfcf)
val HOME_ITEMS = arrayOf("闸井管理", "超时工单", "布防撤防")
val SUB_PAGE_TITLES = arrayOf("待处理", "待确认", "处理中", "已完成")
+ val OVER_TIME_PAGE_TITLES = arrayOf("超时未接单", "超时未处理")
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
index 453a2c9..d3d1890 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
@@ -1,18 +1,45 @@
package com.casic.app.smartwell.view
+import android.view.View
+import androidx.fragment.app.Fragment
import com.casic.app.smartwell.R
+import com.casic.app.smartwell.adapter.TopViewPagerAdapter
import com.casic.app.smartwell.base.BaseActivity
+import com.casic.app.smartwell.utils.Constant
+import com.casic.app.smartwell.view.fragment.UnAcceptOrderFragment
+import com.casic.app.smartwell.view.fragment.UnHandleOrderFragment
+import kotlinx.android.synthetic.main.activity_order_overtime.*
+import kotlinx.android.synthetic.main.include_base_title.*
+import java.util.*
class OvertimeOrderActivity : BaseActivity() {
+ private var fragmentList: ArrayList = ArrayList()
+
+ init {
+ fragmentList.add(UnAcceptOrderFragment())
+ fragmentList.add(UnHandleOrderFragment())
+ }
+
override fun initLayoutView(): Int = R.layout.activity_order_overtime
override fun setupTopBarLayout() {
-
+ titleView.text = "工单管理"
+ leftBackView.visibility = View.VISIBLE
+ leftBackView.setOnClickListener { finish() }
}
override fun initData() {
-
+ val topViewPagerAdapter =
+ TopViewPagerAdapter(
+ supportFragmentManager,
+ Constant.OVER_TIME_PAGE_TITLES,
+ fragmentList
+ )
+ //页面永不销毁
+ overTimeViewPager.offscreenPageLimit = fragmentList.size
+ overTimeViewPager.adapter = topViewPagerAdapter
+ overTimeTabLayout.setupWithViewPager(overTimeViewPager)
}
override fun initEvent() {
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
index 04654dc..5402091 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
@@ -1,7 +1,16 @@
package com.casic.app.smartwell.view.fragment
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
+import com.amap.api.maps.AMap
+import com.amap.api.maps.AMapOptions
+import com.amap.api.maps.CameraUpdateFactory
+import com.amap.api.maps.model.MyLocationStyle
import com.casic.app.smartwell.R
import com.casic.app.smartwell.adapter.HomeRecycleAdapter
import com.casic.app.smartwell.extensions.navigatePageTo
@@ -10,23 +19,42 @@
import com.casic.app.smartwell.view.WellOperationActivity
import com.casic.app.smartwell.vm.WellCountViewModel
import com.casic.app.smartwell.vm.WorkOrderViewModel
-import com.pengxh.app.multilib.base.BaseFragment
-import kotlinx.android.synthetic.main.fragment_home.*
-import kotlinx.android.synthetic.main.include_base_title.*
+import kotlinx.android.synthetic.main.fragment_home.view.*
+import kotlinx.android.synthetic.main.include_base_title.view.*
-class HomePageFragment : BaseFragment() {
+class HomePageFragment : Fragment() {
+ private lateinit var homeView: View
private lateinit var wellCountViewModel: WellCountViewModel
private lateinit var workOrderViewModel: WorkOrderViewModel
+ private lateinit var aMap: AMap
+ private lateinit var locationStyle: MyLocationStyle
- override fun initLayoutView(): Int = R.layout.fragment_home
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ homeView = inflater.inflate(R.layout.fragment_home, container, false)
+ homeView.titleView.text = "首页"
+ //地图初始化
+ homeView.mapView.onCreate(savedInstanceState)
+ aMap = homeView.mapView.map
+ val uiSettings = aMap.uiSettings
+ uiSettings.zoomPosition = AMapOptions.ZOOM_POSITION_RIGHT_CENTER
+ uiSettings.isRotateGesturesEnabled = false//不许地图随手势旋转角度
+ //显示定位小蓝点
+ locationStyle = MyLocationStyle()
+ locationStyle
+ locationStyle.showMyLocation(true)//设置是否显示定位小蓝点
+ locationStyle.interval(10 * 1000)////设置连续定位模式下的定位间隔,只在连续定位模式下生效。单位为毫秒
+ aMap.myLocationStyle = locationStyle
+ aMap.isMyLocationEnabled = true
+ aMap.moveCamera(CameraUpdateFactory.zoomTo(14.toFloat()))
- override fun initData() {
- titleView.text = "首页"
//首页功能块
val homeRecycleAdapter = HomeRecycleAdapter(requireContext())
- homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
- homeRecyclerView.adapter = homeRecycleAdapter
+ homeView.homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
+ homeView.homeRecyclerView.adapter = homeRecycleAdapter
homeRecycleAdapter.setOnGridItemClickListener(object :
HomeRecycleAdapter.OnGridItemClickListener {
override fun onClick(position: Int) {
@@ -39,34 +67,51 @@
})
wellCountViewModel = ViewModelProvider(this).get(WellCountViewModel::class.java)
workOrderViewModel = ViewModelProvider(this).get(WorkOrderViewModel::class.java)
- }
- override fun initEvent() {
- wellCountViewModel.resultModel.observe(this, {
- unDeployedWellView.text = it["bfWell"]
- deployedWellView.text = it["cfWell"]
- allWellDataView.text = it["total"]
+ wellCountViewModel.resultModel.observe(viewLifecycleOwner, {
+ homeView.unDeployedWellView.text = it["bfWell"]
+ homeView.deployedWellView.text = it["cfWell"]
+ homeView.allWellDataView.text = it["total"]
})
- workOrderViewModel.resultModel.observe(this, {
+ workOrderViewModel.resultModel.observe(viewLifecycleOwner, {
if (it["beforeGet"]!!.length > 4 || it["beforeConfirm"]!!.length > 4 ||
it["inHandle"]!!.length > 4 || it["over"]!!.length > 4
) {
- todoDataView.textSize = 36f
- undeterminedDataView.textSize = 36f
- inHandleDataView.textSize = 36f
- completedDataView.textSize = 36f
+ homeView.todoDataView.textSize = 36f
+ homeView.undeterminedDataView.textSize = 36f
+ homeView.inHandleDataView.textSize = 36f
+ homeView.completedDataView.textSize = 36f
}
- todoDataView.text = it["beforeGet"]
- undeterminedDataView.text = it["beforeConfirm"]
- inHandleDataView.text = it["inHandle"]
- completedDataView.text = it["over"]
+ homeView.todoDataView.text = it["beforeGet"]
+ homeView.undeterminedDataView.text = it["beforeConfirm"]
+ homeView.inHandleDataView.text = it["inHandle"]
+ homeView.completedDataView.text = it["over"]
})
+ return homeView
}
override fun onResume() {
super.onResume()
+ homeView.mapView.onResume()
//每次页面切换都需要重新刷新不同状态的窨井数量
wellCountViewModel.countWellByState()
workOrderViewModel.countWorkOrderByState()
}
+
+ /***以下是地图生命周期管理************************************************************************/
+
+ override fun onPause() {
+ super.onPause()
+ homeView.mapView.onPause()
+ }
+
+ override fun onSaveInstanceState(outState: Bundle) {
+ super.onSaveInstanceState(outState)
+ homeView.mapView.onSaveInstanceState(outState)
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ homeView.mapView.onDestroy()
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
new file mode 100644
index 0000000..e7a664a
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnAcceptOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_accept
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
new file mode 100644
index 0000000..8589260
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnHandleOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_handle
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/overtime.svg b/app/src/main/assets/svg/overtime.svg
new file mode 100644
index 0000000..32f5e01
--- /dev/null
+++ b/app/src/main/assets/svg/overtime.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/well.svg b/app/src/main/assets/svg/well.svg
new file mode 100644
index 0000000..ad0a5db
--- /dev/null
+++ b/app/src/main/assets/svg/well.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
index cf15d6b..d1d455f 100644
--- a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
+++ b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
@@ -20,7 +20,7 @@
}
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
- holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.imageView.setImageResource(Constant.HOME_ICONS[position])
holder.textView.text = Constant.HOME_ITEMS[position]
if (clickListener != null) {
holder.itemView.setOnClickListener {
diff --git a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
index c342334..537cb90 100644
--- a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
+++ b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
@@ -41,7 +41,8 @@
const val USER_DETAIL_MODEL = "userDetailModel"
const val INTENT_PARAM = "intentParam"
- val HOME_ICONS = arrayOf(R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher)
+ val HOME_ICONS = arrayOf(R.drawable.ic_well, R.drawable.ic_overtime, R.drawable.ic_bfcf)
val HOME_ITEMS = arrayOf("闸井管理", "超时工单", "布防撤防")
val SUB_PAGE_TITLES = arrayOf("待处理", "待确认", "处理中", "已完成")
+ val OVER_TIME_PAGE_TITLES = arrayOf("超时未接单", "超时未处理")
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
index 453a2c9..d3d1890 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
@@ -1,18 +1,45 @@
package com.casic.app.smartwell.view
+import android.view.View
+import androidx.fragment.app.Fragment
import com.casic.app.smartwell.R
+import com.casic.app.smartwell.adapter.TopViewPagerAdapter
import com.casic.app.smartwell.base.BaseActivity
+import com.casic.app.smartwell.utils.Constant
+import com.casic.app.smartwell.view.fragment.UnAcceptOrderFragment
+import com.casic.app.smartwell.view.fragment.UnHandleOrderFragment
+import kotlinx.android.synthetic.main.activity_order_overtime.*
+import kotlinx.android.synthetic.main.include_base_title.*
+import java.util.*
class OvertimeOrderActivity : BaseActivity() {
+ private var fragmentList: ArrayList = ArrayList()
+
+ init {
+ fragmentList.add(UnAcceptOrderFragment())
+ fragmentList.add(UnHandleOrderFragment())
+ }
+
override fun initLayoutView(): Int = R.layout.activity_order_overtime
override fun setupTopBarLayout() {
-
+ titleView.text = "工单管理"
+ leftBackView.visibility = View.VISIBLE
+ leftBackView.setOnClickListener { finish() }
}
override fun initData() {
-
+ val topViewPagerAdapter =
+ TopViewPagerAdapter(
+ supportFragmentManager,
+ Constant.OVER_TIME_PAGE_TITLES,
+ fragmentList
+ )
+ //页面永不销毁
+ overTimeViewPager.offscreenPageLimit = fragmentList.size
+ overTimeViewPager.adapter = topViewPagerAdapter
+ overTimeTabLayout.setupWithViewPager(overTimeViewPager)
}
override fun initEvent() {
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
index 04654dc..5402091 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
@@ -1,7 +1,16 @@
package com.casic.app.smartwell.view.fragment
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
+import com.amap.api.maps.AMap
+import com.amap.api.maps.AMapOptions
+import com.amap.api.maps.CameraUpdateFactory
+import com.amap.api.maps.model.MyLocationStyle
import com.casic.app.smartwell.R
import com.casic.app.smartwell.adapter.HomeRecycleAdapter
import com.casic.app.smartwell.extensions.navigatePageTo
@@ -10,23 +19,42 @@
import com.casic.app.smartwell.view.WellOperationActivity
import com.casic.app.smartwell.vm.WellCountViewModel
import com.casic.app.smartwell.vm.WorkOrderViewModel
-import com.pengxh.app.multilib.base.BaseFragment
-import kotlinx.android.synthetic.main.fragment_home.*
-import kotlinx.android.synthetic.main.include_base_title.*
+import kotlinx.android.synthetic.main.fragment_home.view.*
+import kotlinx.android.synthetic.main.include_base_title.view.*
-class HomePageFragment : BaseFragment() {
+class HomePageFragment : Fragment() {
+ private lateinit var homeView: View
private lateinit var wellCountViewModel: WellCountViewModel
private lateinit var workOrderViewModel: WorkOrderViewModel
+ private lateinit var aMap: AMap
+ private lateinit var locationStyle: MyLocationStyle
- override fun initLayoutView(): Int = R.layout.fragment_home
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ homeView = inflater.inflate(R.layout.fragment_home, container, false)
+ homeView.titleView.text = "首页"
+ //地图初始化
+ homeView.mapView.onCreate(savedInstanceState)
+ aMap = homeView.mapView.map
+ val uiSettings = aMap.uiSettings
+ uiSettings.zoomPosition = AMapOptions.ZOOM_POSITION_RIGHT_CENTER
+ uiSettings.isRotateGesturesEnabled = false//不许地图随手势旋转角度
+ //显示定位小蓝点
+ locationStyle = MyLocationStyle()
+ locationStyle
+ locationStyle.showMyLocation(true)//设置是否显示定位小蓝点
+ locationStyle.interval(10 * 1000)////设置连续定位模式下的定位间隔,只在连续定位模式下生效。单位为毫秒
+ aMap.myLocationStyle = locationStyle
+ aMap.isMyLocationEnabled = true
+ aMap.moveCamera(CameraUpdateFactory.zoomTo(14.toFloat()))
- override fun initData() {
- titleView.text = "首页"
//首页功能块
val homeRecycleAdapter = HomeRecycleAdapter(requireContext())
- homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
- homeRecyclerView.adapter = homeRecycleAdapter
+ homeView.homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
+ homeView.homeRecyclerView.adapter = homeRecycleAdapter
homeRecycleAdapter.setOnGridItemClickListener(object :
HomeRecycleAdapter.OnGridItemClickListener {
override fun onClick(position: Int) {
@@ -39,34 +67,51 @@
})
wellCountViewModel = ViewModelProvider(this).get(WellCountViewModel::class.java)
workOrderViewModel = ViewModelProvider(this).get(WorkOrderViewModel::class.java)
- }
- override fun initEvent() {
- wellCountViewModel.resultModel.observe(this, {
- unDeployedWellView.text = it["bfWell"]
- deployedWellView.text = it["cfWell"]
- allWellDataView.text = it["total"]
+ wellCountViewModel.resultModel.observe(viewLifecycleOwner, {
+ homeView.unDeployedWellView.text = it["bfWell"]
+ homeView.deployedWellView.text = it["cfWell"]
+ homeView.allWellDataView.text = it["total"]
})
- workOrderViewModel.resultModel.observe(this, {
+ workOrderViewModel.resultModel.observe(viewLifecycleOwner, {
if (it["beforeGet"]!!.length > 4 || it["beforeConfirm"]!!.length > 4 ||
it["inHandle"]!!.length > 4 || it["over"]!!.length > 4
) {
- todoDataView.textSize = 36f
- undeterminedDataView.textSize = 36f
- inHandleDataView.textSize = 36f
- completedDataView.textSize = 36f
+ homeView.todoDataView.textSize = 36f
+ homeView.undeterminedDataView.textSize = 36f
+ homeView.inHandleDataView.textSize = 36f
+ homeView.completedDataView.textSize = 36f
}
- todoDataView.text = it["beforeGet"]
- undeterminedDataView.text = it["beforeConfirm"]
- inHandleDataView.text = it["inHandle"]
- completedDataView.text = it["over"]
+ homeView.todoDataView.text = it["beforeGet"]
+ homeView.undeterminedDataView.text = it["beforeConfirm"]
+ homeView.inHandleDataView.text = it["inHandle"]
+ homeView.completedDataView.text = it["over"]
})
+ return homeView
}
override fun onResume() {
super.onResume()
+ homeView.mapView.onResume()
//每次页面切换都需要重新刷新不同状态的窨井数量
wellCountViewModel.countWellByState()
workOrderViewModel.countWorkOrderByState()
}
+
+ /***以下是地图生命周期管理************************************************************************/
+
+ override fun onPause() {
+ super.onPause()
+ homeView.mapView.onPause()
+ }
+
+ override fun onSaveInstanceState(outState: Bundle) {
+ super.onSaveInstanceState(outState)
+ homeView.mapView.onSaveInstanceState(outState)
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ homeView.mapView.onDestroy()
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
new file mode 100644
index 0000000..e7a664a
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnAcceptOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_accept
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
new file mode 100644
index 0000000..8589260
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnHandleOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_handle
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_image_view.xml b/app/src/main/res/drawable/bg_image_view.xml
new file mode 100644
index 0000000..f7eca2c
--- /dev/null
+++ b/app/src/main/res/drawable/bg_image_view.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/overtime.svg b/app/src/main/assets/svg/overtime.svg
new file mode 100644
index 0000000..32f5e01
--- /dev/null
+++ b/app/src/main/assets/svg/overtime.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/well.svg b/app/src/main/assets/svg/well.svg
new file mode 100644
index 0000000..ad0a5db
--- /dev/null
+++ b/app/src/main/assets/svg/well.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
index cf15d6b..d1d455f 100644
--- a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
+++ b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
@@ -20,7 +20,7 @@
}
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
- holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.imageView.setImageResource(Constant.HOME_ICONS[position])
holder.textView.text = Constant.HOME_ITEMS[position]
if (clickListener != null) {
holder.itemView.setOnClickListener {
diff --git a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
index c342334..537cb90 100644
--- a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
+++ b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
@@ -41,7 +41,8 @@
const val USER_DETAIL_MODEL = "userDetailModel"
const val INTENT_PARAM = "intentParam"
- val HOME_ICONS = arrayOf(R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher)
+ val HOME_ICONS = arrayOf(R.drawable.ic_well, R.drawable.ic_overtime, R.drawable.ic_bfcf)
val HOME_ITEMS = arrayOf("闸井管理", "超时工单", "布防撤防")
val SUB_PAGE_TITLES = arrayOf("待处理", "待确认", "处理中", "已完成")
+ val OVER_TIME_PAGE_TITLES = arrayOf("超时未接单", "超时未处理")
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
index 453a2c9..d3d1890 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
@@ -1,18 +1,45 @@
package com.casic.app.smartwell.view
+import android.view.View
+import androidx.fragment.app.Fragment
import com.casic.app.smartwell.R
+import com.casic.app.smartwell.adapter.TopViewPagerAdapter
import com.casic.app.smartwell.base.BaseActivity
+import com.casic.app.smartwell.utils.Constant
+import com.casic.app.smartwell.view.fragment.UnAcceptOrderFragment
+import com.casic.app.smartwell.view.fragment.UnHandleOrderFragment
+import kotlinx.android.synthetic.main.activity_order_overtime.*
+import kotlinx.android.synthetic.main.include_base_title.*
+import java.util.*
class OvertimeOrderActivity : BaseActivity() {
+ private var fragmentList: ArrayList = ArrayList()
+
+ init {
+ fragmentList.add(UnAcceptOrderFragment())
+ fragmentList.add(UnHandleOrderFragment())
+ }
+
override fun initLayoutView(): Int = R.layout.activity_order_overtime
override fun setupTopBarLayout() {
-
+ titleView.text = "工单管理"
+ leftBackView.visibility = View.VISIBLE
+ leftBackView.setOnClickListener { finish() }
}
override fun initData() {
-
+ val topViewPagerAdapter =
+ TopViewPagerAdapter(
+ supportFragmentManager,
+ Constant.OVER_TIME_PAGE_TITLES,
+ fragmentList
+ )
+ //页面永不销毁
+ overTimeViewPager.offscreenPageLimit = fragmentList.size
+ overTimeViewPager.adapter = topViewPagerAdapter
+ overTimeTabLayout.setupWithViewPager(overTimeViewPager)
}
override fun initEvent() {
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
index 04654dc..5402091 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
@@ -1,7 +1,16 @@
package com.casic.app.smartwell.view.fragment
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
+import com.amap.api.maps.AMap
+import com.amap.api.maps.AMapOptions
+import com.amap.api.maps.CameraUpdateFactory
+import com.amap.api.maps.model.MyLocationStyle
import com.casic.app.smartwell.R
import com.casic.app.smartwell.adapter.HomeRecycleAdapter
import com.casic.app.smartwell.extensions.navigatePageTo
@@ -10,23 +19,42 @@
import com.casic.app.smartwell.view.WellOperationActivity
import com.casic.app.smartwell.vm.WellCountViewModel
import com.casic.app.smartwell.vm.WorkOrderViewModel
-import com.pengxh.app.multilib.base.BaseFragment
-import kotlinx.android.synthetic.main.fragment_home.*
-import kotlinx.android.synthetic.main.include_base_title.*
+import kotlinx.android.synthetic.main.fragment_home.view.*
+import kotlinx.android.synthetic.main.include_base_title.view.*
-class HomePageFragment : BaseFragment() {
+class HomePageFragment : Fragment() {
+ private lateinit var homeView: View
private lateinit var wellCountViewModel: WellCountViewModel
private lateinit var workOrderViewModel: WorkOrderViewModel
+ private lateinit var aMap: AMap
+ private lateinit var locationStyle: MyLocationStyle
- override fun initLayoutView(): Int = R.layout.fragment_home
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ homeView = inflater.inflate(R.layout.fragment_home, container, false)
+ homeView.titleView.text = "首页"
+ //地图初始化
+ homeView.mapView.onCreate(savedInstanceState)
+ aMap = homeView.mapView.map
+ val uiSettings = aMap.uiSettings
+ uiSettings.zoomPosition = AMapOptions.ZOOM_POSITION_RIGHT_CENTER
+ uiSettings.isRotateGesturesEnabled = false//不许地图随手势旋转角度
+ //显示定位小蓝点
+ locationStyle = MyLocationStyle()
+ locationStyle
+ locationStyle.showMyLocation(true)//设置是否显示定位小蓝点
+ locationStyle.interval(10 * 1000)////设置连续定位模式下的定位间隔,只在连续定位模式下生效。单位为毫秒
+ aMap.myLocationStyle = locationStyle
+ aMap.isMyLocationEnabled = true
+ aMap.moveCamera(CameraUpdateFactory.zoomTo(14.toFloat()))
- override fun initData() {
- titleView.text = "首页"
//首页功能块
val homeRecycleAdapter = HomeRecycleAdapter(requireContext())
- homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
- homeRecyclerView.adapter = homeRecycleAdapter
+ homeView.homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
+ homeView.homeRecyclerView.adapter = homeRecycleAdapter
homeRecycleAdapter.setOnGridItemClickListener(object :
HomeRecycleAdapter.OnGridItemClickListener {
override fun onClick(position: Int) {
@@ -39,34 +67,51 @@
})
wellCountViewModel = ViewModelProvider(this).get(WellCountViewModel::class.java)
workOrderViewModel = ViewModelProvider(this).get(WorkOrderViewModel::class.java)
- }
- override fun initEvent() {
- wellCountViewModel.resultModel.observe(this, {
- unDeployedWellView.text = it["bfWell"]
- deployedWellView.text = it["cfWell"]
- allWellDataView.text = it["total"]
+ wellCountViewModel.resultModel.observe(viewLifecycleOwner, {
+ homeView.unDeployedWellView.text = it["bfWell"]
+ homeView.deployedWellView.text = it["cfWell"]
+ homeView.allWellDataView.text = it["total"]
})
- workOrderViewModel.resultModel.observe(this, {
+ workOrderViewModel.resultModel.observe(viewLifecycleOwner, {
if (it["beforeGet"]!!.length > 4 || it["beforeConfirm"]!!.length > 4 ||
it["inHandle"]!!.length > 4 || it["over"]!!.length > 4
) {
- todoDataView.textSize = 36f
- undeterminedDataView.textSize = 36f
- inHandleDataView.textSize = 36f
- completedDataView.textSize = 36f
+ homeView.todoDataView.textSize = 36f
+ homeView.undeterminedDataView.textSize = 36f
+ homeView.inHandleDataView.textSize = 36f
+ homeView.completedDataView.textSize = 36f
}
- todoDataView.text = it["beforeGet"]
- undeterminedDataView.text = it["beforeConfirm"]
- inHandleDataView.text = it["inHandle"]
- completedDataView.text = it["over"]
+ homeView.todoDataView.text = it["beforeGet"]
+ homeView.undeterminedDataView.text = it["beforeConfirm"]
+ homeView.inHandleDataView.text = it["inHandle"]
+ homeView.completedDataView.text = it["over"]
})
+ return homeView
}
override fun onResume() {
super.onResume()
+ homeView.mapView.onResume()
//每次页面切换都需要重新刷新不同状态的窨井数量
wellCountViewModel.countWellByState()
workOrderViewModel.countWorkOrderByState()
}
+
+ /***以下是地图生命周期管理************************************************************************/
+
+ override fun onPause() {
+ super.onPause()
+ homeView.mapView.onPause()
+ }
+
+ override fun onSaveInstanceState(outState: Bundle) {
+ super.onSaveInstanceState(outState)
+ homeView.mapView.onSaveInstanceState(outState)
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ homeView.mapView.onDestroy()
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
new file mode 100644
index 0000000..e7a664a
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnAcceptOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_accept
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
new file mode 100644
index 0000000..8589260
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnHandleOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_handle
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_image_view.xml b/app/src/main/res/drawable/bg_image_view.xml
new file mode 100644
index 0000000..f7eca2c
--- /dev/null
+++ b/app/src/main/res/drawable/bg_image_view.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_layout_radius_20.xml b/app/src/main/res/drawable/bg_layout_radius_20.xml
new file mode 100644
index 0000000..ba81626
--- /dev/null
+++ b/app/src/main/res/drawable/bg_layout_radius_20.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/overtime.svg b/app/src/main/assets/svg/overtime.svg
new file mode 100644
index 0000000..32f5e01
--- /dev/null
+++ b/app/src/main/assets/svg/overtime.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/well.svg b/app/src/main/assets/svg/well.svg
new file mode 100644
index 0000000..ad0a5db
--- /dev/null
+++ b/app/src/main/assets/svg/well.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
index cf15d6b..d1d455f 100644
--- a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
+++ b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
@@ -20,7 +20,7 @@
}
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
- holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.imageView.setImageResource(Constant.HOME_ICONS[position])
holder.textView.text = Constant.HOME_ITEMS[position]
if (clickListener != null) {
holder.itemView.setOnClickListener {
diff --git a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
index c342334..537cb90 100644
--- a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
+++ b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
@@ -41,7 +41,8 @@
const val USER_DETAIL_MODEL = "userDetailModel"
const val INTENT_PARAM = "intentParam"
- val HOME_ICONS = arrayOf(R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher)
+ val HOME_ICONS = arrayOf(R.drawable.ic_well, R.drawable.ic_overtime, R.drawable.ic_bfcf)
val HOME_ITEMS = arrayOf("闸井管理", "超时工单", "布防撤防")
val SUB_PAGE_TITLES = arrayOf("待处理", "待确认", "处理中", "已完成")
+ val OVER_TIME_PAGE_TITLES = arrayOf("超时未接单", "超时未处理")
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
index 453a2c9..d3d1890 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
@@ -1,18 +1,45 @@
package com.casic.app.smartwell.view
+import android.view.View
+import androidx.fragment.app.Fragment
import com.casic.app.smartwell.R
+import com.casic.app.smartwell.adapter.TopViewPagerAdapter
import com.casic.app.smartwell.base.BaseActivity
+import com.casic.app.smartwell.utils.Constant
+import com.casic.app.smartwell.view.fragment.UnAcceptOrderFragment
+import com.casic.app.smartwell.view.fragment.UnHandleOrderFragment
+import kotlinx.android.synthetic.main.activity_order_overtime.*
+import kotlinx.android.synthetic.main.include_base_title.*
+import java.util.*
class OvertimeOrderActivity : BaseActivity() {
+ private var fragmentList: ArrayList = ArrayList()
+
+ init {
+ fragmentList.add(UnAcceptOrderFragment())
+ fragmentList.add(UnHandleOrderFragment())
+ }
+
override fun initLayoutView(): Int = R.layout.activity_order_overtime
override fun setupTopBarLayout() {
-
+ titleView.text = "工单管理"
+ leftBackView.visibility = View.VISIBLE
+ leftBackView.setOnClickListener { finish() }
}
override fun initData() {
-
+ val topViewPagerAdapter =
+ TopViewPagerAdapter(
+ supportFragmentManager,
+ Constant.OVER_TIME_PAGE_TITLES,
+ fragmentList
+ )
+ //页面永不销毁
+ overTimeViewPager.offscreenPageLimit = fragmentList.size
+ overTimeViewPager.adapter = topViewPagerAdapter
+ overTimeTabLayout.setupWithViewPager(overTimeViewPager)
}
override fun initEvent() {
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
index 04654dc..5402091 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
@@ -1,7 +1,16 @@
package com.casic.app.smartwell.view.fragment
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
+import com.amap.api.maps.AMap
+import com.amap.api.maps.AMapOptions
+import com.amap.api.maps.CameraUpdateFactory
+import com.amap.api.maps.model.MyLocationStyle
import com.casic.app.smartwell.R
import com.casic.app.smartwell.adapter.HomeRecycleAdapter
import com.casic.app.smartwell.extensions.navigatePageTo
@@ -10,23 +19,42 @@
import com.casic.app.smartwell.view.WellOperationActivity
import com.casic.app.smartwell.vm.WellCountViewModel
import com.casic.app.smartwell.vm.WorkOrderViewModel
-import com.pengxh.app.multilib.base.BaseFragment
-import kotlinx.android.synthetic.main.fragment_home.*
-import kotlinx.android.synthetic.main.include_base_title.*
+import kotlinx.android.synthetic.main.fragment_home.view.*
+import kotlinx.android.synthetic.main.include_base_title.view.*
-class HomePageFragment : BaseFragment() {
+class HomePageFragment : Fragment() {
+ private lateinit var homeView: View
private lateinit var wellCountViewModel: WellCountViewModel
private lateinit var workOrderViewModel: WorkOrderViewModel
+ private lateinit var aMap: AMap
+ private lateinit var locationStyle: MyLocationStyle
- override fun initLayoutView(): Int = R.layout.fragment_home
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ homeView = inflater.inflate(R.layout.fragment_home, container, false)
+ homeView.titleView.text = "首页"
+ //地图初始化
+ homeView.mapView.onCreate(savedInstanceState)
+ aMap = homeView.mapView.map
+ val uiSettings = aMap.uiSettings
+ uiSettings.zoomPosition = AMapOptions.ZOOM_POSITION_RIGHT_CENTER
+ uiSettings.isRotateGesturesEnabled = false//不许地图随手势旋转角度
+ //显示定位小蓝点
+ locationStyle = MyLocationStyle()
+ locationStyle
+ locationStyle.showMyLocation(true)//设置是否显示定位小蓝点
+ locationStyle.interval(10 * 1000)////设置连续定位模式下的定位间隔,只在连续定位模式下生效。单位为毫秒
+ aMap.myLocationStyle = locationStyle
+ aMap.isMyLocationEnabled = true
+ aMap.moveCamera(CameraUpdateFactory.zoomTo(14.toFloat()))
- override fun initData() {
- titleView.text = "首页"
//首页功能块
val homeRecycleAdapter = HomeRecycleAdapter(requireContext())
- homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
- homeRecyclerView.adapter = homeRecycleAdapter
+ homeView.homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
+ homeView.homeRecyclerView.adapter = homeRecycleAdapter
homeRecycleAdapter.setOnGridItemClickListener(object :
HomeRecycleAdapter.OnGridItemClickListener {
override fun onClick(position: Int) {
@@ -39,34 +67,51 @@
})
wellCountViewModel = ViewModelProvider(this).get(WellCountViewModel::class.java)
workOrderViewModel = ViewModelProvider(this).get(WorkOrderViewModel::class.java)
- }
- override fun initEvent() {
- wellCountViewModel.resultModel.observe(this, {
- unDeployedWellView.text = it["bfWell"]
- deployedWellView.text = it["cfWell"]
- allWellDataView.text = it["total"]
+ wellCountViewModel.resultModel.observe(viewLifecycleOwner, {
+ homeView.unDeployedWellView.text = it["bfWell"]
+ homeView.deployedWellView.text = it["cfWell"]
+ homeView.allWellDataView.text = it["total"]
})
- workOrderViewModel.resultModel.observe(this, {
+ workOrderViewModel.resultModel.observe(viewLifecycleOwner, {
if (it["beforeGet"]!!.length > 4 || it["beforeConfirm"]!!.length > 4 ||
it["inHandle"]!!.length > 4 || it["over"]!!.length > 4
) {
- todoDataView.textSize = 36f
- undeterminedDataView.textSize = 36f
- inHandleDataView.textSize = 36f
- completedDataView.textSize = 36f
+ homeView.todoDataView.textSize = 36f
+ homeView.undeterminedDataView.textSize = 36f
+ homeView.inHandleDataView.textSize = 36f
+ homeView.completedDataView.textSize = 36f
}
- todoDataView.text = it["beforeGet"]
- undeterminedDataView.text = it["beforeConfirm"]
- inHandleDataView.text = it["inHandle"]
- completedDataView.text = it["over"]
+ homeView.todoDataView.text = it["beforeGet"]
+ homeView.undeterminedDataView.text = it["beforeConfirm"]
+ homeView.inHandleDataView.text = it["inHandle"]
+ homeView.completedDataView.text = it["over"]
})
+ return homeView
}
override fun onResume() {
super.onResume()
+ homeView.mapView.onResume()
//每次页面切换都需要重新刷新不同状态的窨井数量
wellCountViewModel.countWellByState()
workOrderViewModel.countWorkOrderByState()
}
+
+ /***以下是地图生命周期管理************************************************************************/
+
+ override fun onPause() {
+ super.onPause()
+ homeView.mapView.onPause()
+ }
+
+ override fun onSaveInstanceState(outState: Bundle) {
+ super.onSaveInstanceState(outState)
+ homeView.mapView.onSaveInstanceState(outState)
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ homeView.mapView.onDestroy()
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
new file mode 100644
index 0000000..e7a664a
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnAcceptOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_accept
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
new file mode 100644
index 0000000..8589260
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnHandleOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_handle
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_image_view.xml b/app/src/main/res/drawable/bg_image_view.xml
new file mode 100644
index 0000000..f7eca2c
--- /dev/null
+++ b/app/src/main/res/drawable/bg_image_view.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_layout_radius_20.xml b/app/src/main/res/drawable/bg_layout_radius_20.xml
new file mode 100644
index 0000000..ba81626
--- /dev/null
+++ b/app/src/main/res/drawable/bg_layout_radius_20.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dash_line_horizontal.xml b/app/src/main/res/drawable/dash_line_horizontal.xml
deleted file mode 100644
index 3b9b146..0000000
--- a/app/src/main/res/drawable/dash_line_horizontal.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/overtime.svg b/app/src/main/assets/svg/overtime.svg
new file mode 100644
index 0000000..32f5e01
--- /dev/null
+++ b/app/src/main/assets/svg/overtime.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/well.svg b/app/src/main/assets/svg/well.svg
new file mode 100644
index 0000000..ad0a5db
--- /dev/null
+++ b/app/src/main/assets/svg/well.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
index cf15d6b..d1d455f 100644
--- a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
+++ b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
@@ -20,7 +20,7 @@
}
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
- holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.imageView.setImageResource(Constant.HOME_ICONS[position])
holder.textView.text = Constant.HOME_ITEMS[position]
if (clickListener != null) {
holder.itemView.setOnClickListener {
diff --git a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
index c342334..537cb90 100644
--- a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
+++ b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
@@ -41,7 +41,8 @@
const val USER_DETAIL_MODEL = "userDetailModel"
const val INTENT_PARAM = "intentParam"
- val HOME_ICONS = arrayOf(R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher)
+ val HOME_ICONS = arrayOf(R.drawable.ic_well, R.drawable.ic_overtime, R.drawable.ic_bfcf)
val HOME_ITEMS = arrayOf("闸井管理", "超时工单", "布防撤防")
val SUB_PAGE_TITLES = arrayOf("待处理", "待确认", "处理中", "已完成")
+ val OVER_TIME_PAGE_TITLES = arrayOf("超时未接单", "超时未处理")
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
index 453a2c9..d3d1890 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
@@ -1,18 +1,45 @@
package com.casic.app.smartwell.view
+import android.view.View
+import androidx.fragment.app.Fragment
import com.casic.app.smartwell.R
+import com.casic.app.smartwell.adapter.TopViewPagerAdapter
import com.casic.app.smartwell.base.BaseActivity
+import com.casic.app.smartwell.utils.Constant
+import com.casic.app.smartwell.view.fragment.UnAcceptOrderFragment
+import com.casic.app.smartwell.view.fragment.UnHandleOrderFragment
+import kotlinx.android.synthetic.main.activity_order_overtime.*
+import kotlinx.android.synthetic.main.include_base_title.*
+import java.util.*
class OvertimeOrderActivity : BaseActivity() {
+ private var fragmentList: ArrayList = ArrayList()
+
+ init {
+ fragmentList.add(UnAcceptOrderFragment())
+ fragmentList.add(UnHandleOrderFragment())
+ }
+
override fun initLayoutView(): Int = R.layout.activity_order_overtime
override fun setupTopBarLayout() {
-
+ titleView.text = "工单管理"
+ leftBackView.visibility = View.VISIBLE
+ leftBackView.setOnClickListener { finish() }
}
override fun initData() {
-
+ val topViewPagerAdapter =
+ TopViewPagerAdapter(
+ supportFragmentManager,
+ Constant.OVER_TIME_PAGE_TITLES,
+ fragmentList
+ )
+ //页面永不销毁
+ overTimeViewPager.offscreenPageLimit = fragmentList.size
+ overTimeViewPager.adapter = topViewPagerAdapter
+ overTimeTabLayout.setupWithViewPager(overTimeViewPager)
}
override fun initEvent() {
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
index 04654dc..5402091 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
@@ -1,7 +1,16 @@
package com.casic.app.smartwell.view.fragment
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
+import com.amap.api.maps.AMap
+import com.amap.api.maps.AMapOptions
+import com.amap.api.maps.CameraUpdateFactory
+import com.amap.api.maps.model.MyLocationStyle
import com.casic.app.smartwell.R
import com.casic.app.smartwell.adapter.HomeRecycleAdapter
import com.casic.app.smartwell.extensions.navigatePageTo
@@ -10,23 +19,42 @@
import com.casic.app.smartwell.view.WellOperationActivity
import com.casic.app.smartwell.vm.WellCountViewModel
import com.casic.app.smartwell.vm.WorkOrderViewModel
-import com.pengxh.app.multilib.base.BaseFragment
-import kotlinx.android.synthetic.main.fragment_home.*
-import kotlinx.android.synthetic.main.include_base_title.*
+import kotlinx.android.synthetic.main.fragment_home.view.*
+import kotlinx.android.synthetic.main.include_base_title.view.*
-class HomePageFragment : BaseFragment() {
+class HomePageFragment : Fragment() {
+ private lateinit var homeView: View
private lateinit var wellCountViewModel: WellCountViewModel
private lateinit var workOrderViewModel: WorkOrderViewModel
+ private lateinit var aMap: AMap
+ private lateinit var locationStyle: MyLocationStyle
- override fun initLayoutView(): Int = R.layout.fragment_home
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ homeView = inflater.inflate(R.layout.fragment_home, container, false)
+ homeView.titleView.text = "首页"
+ //地图初始化
+ homeView.mapView.onCreate(savedInstanceState)
+ aMap = homeView.mapView.map
+ val uiSettings = aMap.uiSettings
+ uiSettings.zoomPosition = AMapOptions.ZOOM_POSITION_RIGHT_CENTER
+ uiSettings.isRotateGesturesEnabled = false//不许地图随手势旋转角度
+ //显示定位小蓝点
+ locationStyle = MyLocationStyle()
+ locationStyle
+ locationStyle.showMyLocation(true)//设置是否显示定位小蓝点
+ locationStyle.interval(10 * 1000)////设置连续定位模式下的定位间隔,只在连续定位模式下生效。单位为毫秒
+ aMap.myLocationStyle = locationStyle
+ aMap.isMyLocationEnabled = true
+ aMap.moveCamera(CameraUpdateFactory.zoomTo(14.toFloat()))
- override fun initData() {
- titleView.text = "首页"
//首页功能块
val homeRecycleAdapter = HomeRecycleAdapter(requireContext())
- homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
- homeRecyclerView.adapter = homeRecycleAdapter
+ homeView.homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
+ homeView.homeRecyclerView.adapter = homeRecycleAdapter
homeRecycleAdapter.setOnGridItemClickListener(object :
HomeRecycleAdapter.OnGridItemClickListener {
override fun onClick(position: Int) {
@@ -39,34 +67,51 @@
})
wellCountViewModel = ViewModelProvider(this).get(WellCountViewModel::class.java)
workOrderViewModel = ViewModelProvider(this).get(WorkOrderViewModel::class.java)
- }
- override fun initEvent() {
- wellCountViewModel.resultModel.observe(this, {
- unDeployedWellView.text = it["bfWell"]
- deployedWellView.text = it["cfWell"]
- allWellDataView.text = it["total"]
+ wellCountViewModel.resultModel.observe(viewLifecycleOwner, {
+ homeView.unDeployedWellView.text = it["bfWell"]
+ homeView.deployedWellView.text = it["cfWell"]
+ homeView.allWellDataView.text = it["total"]
})
- workOrderViewModel.resultModel.observe(this, {
+ workOrderViewModel.resultModel.observe(viewLifecycleOwner, {
if (it["beforeGet"]!!.length > 4 || it["beforeConfirm"]!!.length > 4 ||
it["inHandle"]!!.length > 4 || it["over"]!!.length > 4
) {
- todoDataView.textSize = 36f
- undeterminedDataView.textSize = 36f
- inHandleDataView.textSize = 36f
- completedDataView.textSize = 36f
+ homeView.todoDataView.textSize = 36f
+ homeView.undeterminedDataView.textSize = 36f
+ homeView.inHandleDataView.textSize = 36f
+ homeView.completedDataView.textSize = 36f
}
- todoDataView.text = it["beforeGet"]
- undeterminedDataView.text = it["beforeConfirm"]
- inHandleDataView.text = it["inHandle"]
- completedDataView.text = it["over"]
+ homeView.todoDataView.text = it["beforeGet"]
+ homeView.undeterminedDataView.text = it["beforeConfirm"]
+ homeView.inHandleDataView.text = it["inHandle"]
+ homeView.completedDataView.text = it["over"]
})
+ return homeView
}
override fun onResume() {
super.onResume()
+ homeView.mapView.onResume()
//每次页面切换都需要重新刷新不同状态的窨井数量
wellCountViewModel.countWellByState()
workOrderViewModel.countWorkOrderByState()
}
+
+ /***以下是地图生命周期管理************************************************************************/
+
+ override fun onPause() {
+ super.onPause()
+ homeView.mapView.onPause()
+ }
+
+ override fun onSaveInstanceState(outState: Bundle) {
+ super.onSaveInstanceState(outState)
+ homeView.mapView.onSaveInstanceState(outState)
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ homeView.mapView.onDestroy()
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
new file mode 100644
index 0000000..e7a664a
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnAcceptOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_accept
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
new file mode 100644
index 0000000..8589260
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnHandleOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_handle
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_image_view.xml b/app/src/main/res/drawable/bg_image_view.xml
new file mode 100644
index 0000000..f7eca2c
--- /dev/null
+++ b/app/src/main/res/drawable/bg_image_view.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_layout_radius_20.xml b/app/src/main/res/drawable/bg_layout_radius_20.xml
new file mode 100644
index 0000000..ba81626
--- /dev/null
+++ b/app/src/main/res/drawable/bg_layout_radius_20.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dash_line_horizontal.xml b/app/src/main/res/drawable/dash_line_horizontal.xml
deleted file mode 100644
index 3b9b146..0000000
--- a/app/src/main/res/drawable/dash_line_horizontal.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dash_line_vertical.xml b/app/src/main/res/drawable/dash_line_vertical.xml
deleted file mode 100644
index 1892dff..0000000
--- a/app/src/main/res/drawable/dash_line_vertical.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
- -
-
-
-
\ No newline at end of file
diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/overtime.svg b/app/src/main/assets/svg/overtime.svg
new file mode 100644
index 0000000..32f5e01
--- /dev/null
+++ b/app/src/main/assets/svg/overtime.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/well.svg b/app/src/main/assets/svg/well.svg
new file mode 100644
index 0000000..ad0a5db
--- /dev/null
+++ b/app/src/main/assets/svg/well.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
index cf15d6b..d1d455f 100644
--- a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
+++ b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
@@ -20,7 +20,7 @@
}
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
- holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.imageView.setImageResource(Constant.HOME_ICONS[position])
holder.textView.text = Constant.HOME_ITEMS[position]
if (clickListener != null) {
holder.itemView.setOnClickListener {
diff --git a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
index c342334..537cb90 100644
--- a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
+++ b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
@@ -41,7 +41,8 @@
const val USER_DETAIL_MODEL = "userDetailModel"
const val INTENT_PARAM = "intentParam"
- val HOME_ICONS = arrayOf(R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher)
+ val HOME_ICONS = arrayOf(R.drawable.ic_well, R.drawable.ic_overtime, R.drawable.ic_bfcf)
val HOME_ITEMS = arrayOf("闸井管理", "超时工单", "布防撤防")
val SUB_PAGE_TITLES = arrayOf("待处理", "待确认", "处理中", "已完成")
+ val OVER_TIME_PAGE_TITLES = arrayOf("超时未接单", "超时未处理")
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
index 453a2c9..d3d1890 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
@@ -1,18 +1,45 @@
package com.casic.app.smartwell.view
+import android.view.View
+import androidx.fragment.app.Fragment
import com.casic.app.smartwell.R
+import com.casic.app.smartwell.adapter.TopViewPagerAdapter
import com.casic.app.smartwell.base.BaseActivity
+import com.casic.app.smartwell.utils.Constant
+import com.casic.app.smartwell.view.fragment.UnAcceptOrderFragment
+import com.casic.app.smartwell.view.fragment.UnHandleOrderFragment
+import kotlinx.android.synthetic.main.activity_order_overtime.*
+import kotlinx.android.synthetic.main.include_base_title.*
+import java.util.*
class OvertimeOrderActivity : BaseActivity() {
+ private var fragmentList: ArrayList = ArrayList()
+
+ init {
+ fragmentList.add(UnAcceptOrderFragment())
+ fragmentList.add(UnHandleOrderFragment())
+ }
+
override fun initLayoutView(): Int = R.layout.activity_order_overtime
override fun setupTopBarLayout() {
-
+ titleView.text = "工单管理"
+ leftBackView.visibility = View.VISIBLE
+ leftBackView.setOnClickListener { finish() }
}
override fun initData() {
-
+ val topViewPagerAdapter =
+ TopViewPagerAdapter(
+ supportFragmentManager,
+ Constant.OVER_TIME_PAGE_TITLES,
+ fragmentList
+ )
+ //页面永不销毁
+ overTimeViewPager.offscreenPageLimit = fragmentList.size
+ overTimeViewPager.adapter = topViewPagerAdapter
+ overTimeTabLayout.setupWithViewPager(overTimeViewPager)
}
override fun initEvent() {
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
index 04654dc..5402091 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
@@ -1,7 +1,16 @@
package com.casic.app.smartwell.view.fragment
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
+import com.amap.api.maps.AMap
+import com.amap.api.maps.AMapOptions
+import com.amap.api.maps.CameraUpdateFactory
+import com.amap.api.maps.model.MyLocationStyle
import com.casic.app.smartwell.R
import com.casic.app.smartwell.adapter.HomeRecycleAdapter
import com.casic.app.smartwell.extensions.navigatePageTo
@@ -10,23 +19,42 @@
import com.casic.app.smartwell.view.WellOperationActivity
import com.casic.app.smartwell.vm.WellCountViewModel
import com.casic.app.smartwell.vm.WorkOrderViewModel
-import com.pengxh.app.multilib.base.BaseFragment
-import kotlinx.android.synthetic.main.fragment_home.*
-import kotlinx.android.synthetic.main.include_base_title.*
+import kotlinx.android.synthetic.main.fragment_home.view.*
+import kotlinx.android.synthetic.main.include_base_title.view.*
-class HomePageFragment : BaseFragment() {
+class HomePageFragment : Fragment() {
+ private lateinit var homeView: View
private lateinit var wellCountViewModel: WellCountViewModel
private lateinit var workOrderViewModel: WorkOrderViewModel
+ private lateinit var aMap: AMap
+ private lateinit var locationStyle: MyLocationStyle
- override fun initLayoutView(): Int = R.layout.fragment_home
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ homeView = inflater.inflate(R.layout.fragment_home, container, false)
+ homeView.titleView.text = "首页"
+ //地图初始化
+ homeView.mapView.onCreate(savedInstanceState)
+ aMap = homeView.mapView.map
+ val uiSettings = aMap.uiSettings
+ uiSettings.zoomPosition = AMapOptions.ZOOM_POSITION_RIGHT_CENTER
+ uiSettings.isRotateGesturesEnabled = false//不许地图随手势旋转角度
+ //显示定位小蓝点
+ locationStyle = MyLocationStyle()
+ locationStyle
+ locationStyle.showMyLocation(true)//设置是否显示定位小蓝点
+ locationStyle.interval(10 * 1000)////设置连续定位模式下的定位间隔,只在连续定位模式下生效。单位为毫秒
+ aMap.myLocationStyle = locationStyle
+ aMap.isMyLocationEnabled = true
+ aMap.moveCamera(CameraUpdateFactory.zoomTo(14.toFloat()))
- override fun initData() {
- titleView.text = "首页"
//首页功能块
val homeRecycleAdapter = HomeRecycleAdapter(requireContext())
- homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
- homeRecyclerView.adapter = homeRecycleAdapter
+ homeView.homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
+ homeView.homeRecyclerView.adapter = homeRecycleAdapter
homeRecycleAdapter.setOnGridItemClickListener(object :
HomeRecycleAdapter.OnGridItemClickListener {
override fun onClick(position: Int) {
@@ -39,34 +67,51 @@
})
wellCountViewModel = ViewModelProvider(this).get(WellCountViewModel::class.java)
workOrderViewModel = ViewModelProvider(this).get(WorkOrderViewModel::class.java)
- }
- override fun initEvent() {
- wellCountViewModel.resultModel.observe(this, {
- unDeployedWellView.text = it["bfWell"]
- deployedWellView.text = it["cfWell"]
- allWellDataView.text = it["total"]
+ wellCountViewModel.resultModel.observe(viewLifecycleOwner, {
+ homeView.unDeployedWellView.text = it["bfWell"]
+ homeView.deployedWellView.text = it["cfWell"]
+ homeView.allWellDataView.text = it["total"]
})
- workOrderViewModel.resultModel.observe(this, {
+ workOrderViewModel.resultModel.observe(viewLifecycleOwner, {
if (it["beforeGet"]!!.length > 4 || it["beforeConfirm"]!!.length > 4 ||
it["inHandle"]!!.length > 4 || it["over"]!!.length > 4
) {
- todoDataView.textSize = 36f
- undeterminedDataView.textSize = 36f
- inHandleDataView.textSize = 36f
- completedDataView.textSize = 36f
+ homeView.todoDataView.textSize = 36f
+ homeView.undeterminedDataView.textSize = 36f
+ homeView.inHandleDataView.textSize = 36f
+ homeView.completedDataView.textSize = 36f
}
- todoDataView.text = it["beforeGet"]
- undeterminedDataView.text = it["beforeConfirm"]
- inHandleDataView.text = it["inHandle"]
- completedDataView.text = it["over"]
+ homeView.todoDataView.text = it["beforeGet"]
+ homeView.undeterminedDataView.text = it["beforeConfirm"]
+ homeView.inHandleDataView.text = it["inHandle"]
+ homeView.completedDataView.text = it["over"]
})
+ return homeView
}
override fun onResume() {
super.onResume()
+ homeView.mapView.onResume()
//每次页面切换都需要重新刷新不同状态的窨井数量
wellCountViewModel.countWellByState()
workOrderViewModel.countWorkOrderByState()
}
+
+ /***以下是地图生命周期管理************************************************************************/
+
+ override fun onPause() {
+ super.onPause()
+ homeView.mapView.onPause()
+ }
+
+ override fun onSaveInstanceState(outState: Bundle) {
+ super.onSaveInstanceState(outState)
+ homeView.mapView.onSaveInstanceState(outState)
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ homeView.mapView.onDestroy()
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
new file mode 100644
index 0000000..e7a664a
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnAcceptOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_accept
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
new file mode 100644
index 0000000..8589260
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnHandleOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_handle
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_image_view.xml b/app/src/main/res/drawable/bg_image_view.xml
new file mode 100644
index 0000000..f7eca2c
--- /dev/null
+++ b/app/src/main/res/drawable/bg_image_view.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_layout_radius_20.xml b/app/src/main/res/drawable/bg_layout_radius_20.xml
new file mode 100644
index 0000000..ba81626
--- /dev/null
+++ b/app/src/main/res/drawable/bg_layout_radius_20.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dash_line_horizontal.xml b/app/src/main/res/drawable/dash_line_horizontal.xml
deleted file mode 100644
index 3b9b146..0000000
--- a/app/src/main/res/drawable/dash_line_horizontal.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dash_line_vertical.xml b/app/src/main/res/drawable/dash_line_vertical.xml
deleted file mode 100644
index 1892dff..0000000
--- a/app/src/main/res/drawable/dash_line_vertical.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
- -
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_bfcf.xml b/app/src/main/res/drawable/ic_bfcf.xml
new file mode 100644
index 0000000..d122e93
--- /dev/null
+++ b/app/src/main/res/drawable/ic_bfcf.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/overtime.svg b/app/src/main/assets/svg/overtime.svg
new file mode 100644
index 0000000..32f5e01
--- /dev/null
+++ b/app/src/main/assets/svg/overtime.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/well.svg b/app/src/main/assets/svg/well.svg
new file mode 100644
index 0000000..ad0a5db
--- /dev/null
+++ b/app/src/main/assets/svg/well.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
index cf15d6b..d1d455f 100644
--- a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
+++ b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
@@ -20,7 +20,7 @@
}
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
- holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.imageView.setImageResource(Constant.HOME_ICONS[position])
holder.textView.text = Constant.HOME_ITEMS[position]
if (clickListener != null) {
holder.itemView.setOnClickListener {
diff --git a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
index c342334..537cb90 100644
--- a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
+++ b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
@@ -41,7 +41,8 @@
const val USER_DETAIL_MODEL = "userDetailModel"
const val INTENT_PARAM = "intentParam"
- val HOME_ICONS = arrayOf(R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher)
+ val HOME_ICONS = arrayOf(R.drawable.ic_well, R.drawable.ic_overtime, R.drawable.ic_bfcf)
val HOME_ITEMS = arrayOf("闸井管理", "超时工单", "布防撤防")
val SUB_PAGE_TITLES = arrayOf("待处理", "待确认", "处理中", "已完成")
+ val OVER_TIME_PAGE_TITLES = arrayOf("超时未接单", "超时未处理")
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
index 453a2c9..d3d1890 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
@@ -1,18 +1,45 @@
package com.casic.app.smartwell.view
+import android.view.View
+import androidx.fragment.app.Fragment
import com.casic.app.smartwell.R
+import com.casic.app.smartwell.adapter.TopViewPagerAdapter
import com.casic.app.smartwell.base.BaseActivity
+import com.casic.app.smartwell.utils.Constant
+import com.casic.app.smartwell.view.fragment.UnAcceptOrderFragment
+import com.casic.app.smartwell.view.fragment.UnHandleOrderFragment
+import kotlinx.android.synthetic.main.activity_order_overtime.*
+import kotlinx.android.synthetic.main.include_base_title.*
+import java.util.*
class OvertimeOrderActivity : BaseActivity() {
+ private var fragmentList: ArrayList = ArrayList()
+
+ init {
+ fragmentList.add(UnAcceptOrderFragment())
+ fragmentList.add(UnHandleOrderFragment())
+ }
+
override fun initLayoutView(): Int = R.layout.activity_order_overtime
override fun setupTopBarLayout() {
-
+ titleView.text = "工单管理"
+ leftBackView.visibility = View.VISIBLE
+ leftBackView.setOnClickListener { finish() }
}
override fun initData() {
-
+ val topViewPagerAdapter =
+ TopViewPagerAdapter(
+ supportFragmentManager,
+ Constant.OVER_TIME_PAGE_TITLES,
+ fragmentList
+ )
+ //页面永不销毁
+ overTimeViewPager.offscreenPageLimit = fragmentList.size
+ overTimeViewPager.adapter = topViewPagerAdapter
+ overTimeTabLayout.setupWithViewPager(overTimeViewPager)
}
override fun initEvent() {
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
index 04654dc..5402091 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
@@ -1,7 +1,16 @@
package com.casic.app.smartwell.view.fragment
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
+import com.amap.api.maps.AMap
+import com.amap.api.maps.AMapOptions
+import com.amap.api.maps.CameraUpdateFactory
+import com.amap.api.maps.model.MyLocationStyle
import com.casic.app.smartwell.R
import com.casic.app.smartwell.adapter.HomeRecycleAdapter
import com.casic.app.smartwell.extensions.navigatePageTo
@@ -10,23 +19,42 @@
import com.casic.app.smartwell.view.WellOperationActivity
import com.casic.app.smartwell.vm.WellCountViewModel
import com.casic.app.smartwell.vm.WorkOrderViewModel
-import com.pengxh.app.multilib.base.BaseFragment
-import kotlinx.android.synthetic.main.fragment_home.*
-import kotlinx.android.synthetic.main.include_base_title.*
+import kotlinx.android.synthetic.main.fragment_home.view.*
+import kotlinx.android.synthetic.main.include_base_title.view.*
-class HomePageFragment : BaseFragment() {
+class HomePageFragment : Fragment() {
+ private lateinit var homeView: View
private lateinit var wellCountViewModel: WellCountViewModel
private lateinit var workOrderViewModel: WorkOrderViewModel
+ private lateinit var aMap: AMap
+ private lateinit var locationStyle: MyLocationStyle
- override fun initLayoutView(): Int = R.layout.fragment_home
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ homeView = inflater.inflate(R.layout.fragment_home, container, false)
+ homeView.titleView.text = "首页"
+ //地图初始化
+ homeView.mapView.onCreate(savedInstanceState)
+ aMap = homeView.mapView.map
+ val uiSettings = aMap.uiSettings
+ uiSettings.zoomPosition = AMapOptions.ZOOM_POSITION_RIGHT_CENTER
+ uiSettings.isRotateGesturesEnabled = false//不许地图随手势旋转角度
+ //显示定位小蓝点
+ locationStyle = MyLocationStyle()
+ locationStyle
+ locationStyle.showMyLocation(true)//设置是否显示定位小蓝点
+ locationStyle.interval(10 * 1000)////设置连续定位模式下的定位间隔,只在连续定位模式下生效。单位为毫秒
+ aMap.myLocationStyle = locationStyle
+ aMap.isMyLocationEnabled = true
+ aMap.moveCamera(CameraUpdateFactory.zoomTo(14.toFloat()))
- override fun initData() {
- titleView.text = "首页"
//首页功能块
val homeRecycleAdapter = HomeRecycleAdapter(requireContext())
- homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
- homeRecyclerView.adapter = homeRecycleAdapter
+ homeView.homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
+ homeView.homeRecyclerView.adapter = homeRecycleAdapter
homeRecycleAdapter.setOnGridItemClickListener(object :
HomeRecycleAdapter.OnGridItemClickListener {
override fun onClick(position: Int) {
@@ -39,34 +67,51 @@
})
wellCountViewModel = ViewModelProvider(this).get(WellCountViewModel::class.java)
workOrderViewModel = ViewModelProvider(this).get(WorkOrderViewModel::class.java)
- }
- override fun initEvent() {
- wellCountViewModel.resultModel.observe(this, {
- unDeployedWellView.text = it["bfWell"]
- deployedWellView.text = it["cfWell"]
- allWellDataView.text = it["total"]
+ wellCountViewModel.resultModel.observe(viewLifecycleOwner, {
+ homeView.unDeployedWellView.text = it["bfWell"]
+ homeView.deployedWellView.text = it["cfWell"]
+ homeView.allWellDataView.text = it["total"]
})
- workOrderViewModel.resultModel.observe(this, {
+ workOrderViewModel.resultModel.observe(viewLifecycleOwner, {
if (it["beforeGet"]!!.length > 4 || it["beforeConfirm"]!!.length > 4 ||
it["inHandle"]!!.length > 4 || it["over"]!!.length > 4
) {
- todoDataView.textSize = 36f
- undeterminedDataView.textSize = 36f
- inHandleDataView.textSize = 36f
- completedDataView.textSize = 36f
+ homeView.todoDataView.textSize = 36f
+ homeView.undeterminedDataView.textSize = 36f
+ homeView.inHandleDataView.textSize = 36f
+ homeView.completedDataView.textSize = 36f
}
- todoDataView.text = it["beforeGet"]
- undeterminedDataView.text = it["beforeConfirm"]
- inHandleDataView.text = it["inHandle"]
- completedDataView.text = it["over"]
+ homeView.todoDataView.text = it["beforeGet"]
+ homeView.undeterminedDataView.text = it["beforeConfirm"]
+ homeView.inHandleDataView.text = it["inHandle"]
+ homeView.completedDataView.text = it["over"]
})
+ return homeView
}
override fun onResume() {
super.onResume()
+ homeView.mapView.onResume()
//每次页面切换都需要重新刷新不同状态的窨井数量
wellCountViewModel.countWellByState()
workOrderViewModel.countWorkOrderByState()
}
+
+ /***以下是地图生命周期管理************************************************************************/
+
+ override fun onPause() {
+ super.onPause()
+ homeView.mapView.onPause()
+ }
+
+ override fun onSaveInstanceState(outState: Bundle) {
+ super.onSaveInstanceState(outState)
+ homeView.mapView.onSaveInstanceState(outState)
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ homeView.mapView.onDestroy()
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
new file mode 100644
index 0000000..e7a664a
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnAcceptOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_accept
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
new file mode 100644
index 0000000..8589260
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnHandleOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_handle
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_image_view.xml b/app/src/main/res/drawable/bg_image_view.xml
new file mode 100644
index 0000000..f7eca2c
--- /dev/null
+++ b/app/src/main/res/drawable/bg_image_view.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_layout_radius_20.xml b/app/src/main/res/drawable/bg_layout_radius_20.xml
new file mode 100644
index 0000000..ba81626
--- /dev/null
+++ b/app/src/main/res/drawable/bg_layout_radius_20.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dash_line_horizontal.xml b/app/src/main/res/drawable/dash_line_horizontal.xml
deleted file mode 100644
index 3b9b146..0000000
--- a/app/src/main/res/drawable/dash_line_horizontal.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dash_line_vertical.xml b/app/src/main/res/drawable/dash_line_vertical.xml
deleted file mode 100644
index 1892dff..0000000
--- a/app/src/main/res/drawable/dash_line_vertical.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
- -
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_bfcf.xml b/app/src/main/res/drawable/ic_bfcf.xml
new file mode 100644
index 0000000..d122e93
--- /dev/null
+++ b/app/src/main/res/drawable/ic_bfcf.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_overtime.xml b/app/src/main/res/drawable/ic_overtime.xml
new file mode 100644
index 0000000..6ae8fe8
--- /dev/null
+++ b/app/src/main/res/drawable/ic_overtime.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/overtime.svg b/app/src/main/assets/svg/overtime.svg
new file mode 100644
index 0000000..32f5e01
--- /dev/null
+++ b/app/src/main/assets/svg/overtime.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/well.svg b/app/src/main/assets/svg/well.svg
new file mode 100644
index 0000000..ad0a5db
--- /dev/null
+++ b/app/src/main/assets/svg/well.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
index cf15d6b..d1d455f 100644
--- a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
+++ b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
@@ -20,7 +20,7 @@
}
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
- holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.imageView.setImageResource(Constant.HOME_ICONS[position])
holder.textView.text = Constant.HOME_ITEMS[position]
if (clickListener != null) {
holder.itemView.setOnClickListener {
diff --git a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
index c342334..537cb90 100644
--- a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
+++ b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
@@ -41,7 +41,8 @@
const val USER_DETAIL_MODEL = "userDetailModel"
const val INTENT_PARAM = "intentParam"
- val HOME_ICONS = arrayOf(R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher)
+ val HOME_ICONS = arrayOf(R.drawable.ic_well, R.drawable.ic_overtime, R.drawable.ic_bfcf)
val HOME_ITEMS = arrayOf("闸井管理", "超时工单", "布防撤防")
val SUB_PAGE_TITLES = arrayOf("待处理", "待确认", "处理中", "已完成")
+ val OVER_TIME_PAGE_TITLES = arrayOf("超时未接单", "超时未处理")
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
index 453a2c9..d3d1890 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
@@ -1,18 +1,45 @@
package com.casic.app.smartwell.view
+import android.view.View
+import androidx.fragment.app.Fragment
import com.casic.app.smartwell.R
+import com.casic.app.smartwell.adapter.TopViewPagerAdapter
import com.casic.app.smartwell.base.BaseActivity
+import com.casic.app.smartwell.utils.Constant
+import com.casic.app.smartwell.view.fragment.UnAcceptOrderFragment
+import com.casic.app.smartwell.view.fragment.UnHandleOrderFragment
+import kotlinx.android.synthetic.main.activity_order_overtime.*
+import kotlinx.android.synthetic.main.include_base_title.*
+import java.util.*
class OvertimeOrderActivity : BaseActivity() {
+ private var fragmentList: ArrayList = ArrayList()
+
+ init {
+ fragmentList.add(UnAcceptOrderFragment())
+ fragmentList.add(UnHandleOrderFragment())
+ }
+
override fun initLayoutView(): Int = R.layout.activity_order_overtime
override fun setupTopBarLayout() {
-
+ titleView.text = "工单管理"
+ leftBackView.visibility = View.VISIBLE
+ leftBackView.setOnClickListener { finish() }
}
override fun initData() {
-
+ val topViewPagerAdapter =
+ TopViewPagerAdapter(
+ supportFragmentManager,
+ Constant.OVER_TIME_PAGE_TITLES,
+ fragmentList
+ )
+ //页面永不销毁
+ overTimeViewPager.offscreenPageLimit = fragmentList.size
+ overTimeViewPager.adapter = topViewPagerAdapter
+ overTimeTabLayout.setupWithViewPager(overTimeViewPager)
}
override fun initEvent() {
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
index 04654dc..5402091 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
@@ -1,7 +1,16 @@
package com.casic.app.smartwell.view.fragment
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
+import com.amap.api.maps.AMap
+import com.amap.api.maps.AMapOptions
+import com.amap.api.maps.CameraUpdateFactory
+import com.amap.api.maps.model.MyLocationStyle
import com.casic.app.smartwell.R
import com.casic.app.smartwell.adapter.HomeRecycleAdapter
import com.casic.app.smartwell.extensions.navigatePageTo
@@ -10,23 +19,42 @@
import com.casic.app.smartwell.view.WellOperationActivity
import com.casic.app.smartwell.vm.WellCountViewModel
import com.casic.app.smartwell.vm.WorkOrderViewModel
-import com.pengxh.app.multilib.base.BaseFragment
-import kotlinx.android.synthetic.main.fragment_home.*
-import kotlinx.android.synthetic.main.include_base_title.*
+import kotlinx.android.synthetic.main.fragment_home.view.*
+import kotlinx.android.synthetic.main.include_base_title.view.*
-class HomePageFragment : BaseFragment() {
+class HomePageFragment : Fragment() {
+ private lateinit var homeView: View
private lateinit var wellCountViewModel: WellCountViewModel
private lateinit var workOrderViewModel: WorkOrderViewModel
+ private lateinit var aMap: AMap
+ private lateinit var locationStyle: MyLocationStyle
- override fun initLayoutView(): Int = R.layout.fragment_home
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ homeView = inflater.inflate(R.layout.fragment_home, container, false)
+ homeView.titleView.text = "首页"
+ //地图初始化
+ homeView.mapView.onCreate(savedInstanceState)
+ aMap = homeView.mapView.map
+ val uiSettings = aMap.uiSettings
+ uiSettings.zoomPosition = AMapOptions.ZOOM_POSITION_RIGHT_CENTER
+ uiSettings.isRotateGesturesEnabled = false//不许地图随手势旋转角度
+ //显示定位小蓝点
+ locationStyle = MyLocationStyle()
+ locationStyle
+ locationStyle.showMyLocation(true)//设置是否显示定位小蓝点
+ locationStyle.interval(10 * 1000)////设置连续定位模式下的定位间隔,只在连续定位模式下生效。单位为毫秒
+ aMap.myLocationStyle = locationStyle
+ aMap.isMyLocationEnabled = true
+ aMap.moveCamera(CameraUpdateFactory.zoomTo(14.toFloat()))
- override fun initData() {
- titleView.text = "首页"
//首页功能块
val homeRecycleAdapter = HomeRecycleAdapter(requireContext())
- homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
- homeRecyclerView.adapter = homeRecycleAdapter
+ homeView.homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
+ homeView.homeRecyclerView.adapter = homeRecycleAdapter
homeRecycleAdapter.setOnGridItemClickListener(object :
HomeRecycleAdapter.OnGridItemClickListener {
override fun onClick(position: Int) {
@@ -39,34 +67,51 @@
})
wellCountViewModel = ViewModelProvider(this).get(WellCountViewModel::class.java)
workOrderViewModel = ViewModelProvider(this).get(WorkOrderViewModel::class.java)
- }
- override fun initEvent() {
- wellCountViewModel.resultModel.observe(this, {
- unDeployedWellView.text = it["bfWell"]
- deployedWellView.text = it["cfWell"]
- allWellDataView.text = it["total"]
+ wellCountViewModel.resultModel.observe(viewLifecycleOwner, {
+ homeView.unDeployedWellView.text = it["bfWell"]
+ homeView.deployedWellView.text = it["cfWell"]
+ homeView.allWellDataView.text = it["total"]
})
- workOrderViewModel.resultModel.observe(this, {
+ workOrderViewModel.resultModel.observe(viewLifecycleOwner, {
if (it["beforeGet"]!!.length > 4 || it["beforeConfirm"]!!.length > 4 ||
it["inHandle"]!!.length > 4 || it["over"]!!.length > 4
) {
- todoDataView.textSize = 36f
- undeterminedDataView.textSize = 36f
- inHandleDataView.textSize = 36f
- completedDataView.textSize = 36f
+ homeView.todoDataView.textSize = 36f
+ homeView.undeterminedDataView.textSize = 36f
+ homeView.inHandleDataView.textSize = 36f
+ homeView.completedDataView.textSize = 36f
}
- todoDataView.text = it["beforeGet"]
- undeterminedDataView.text = it["beforeConfirm"]
- inHandleDataView.text = it["inHandle"]
- completedDataView.text = it["over"]
+ homeView.todoDataView.text = it["beforeGet"]
+ homeView.undeterminedDataView.text = it["beforeConfirm"]
+ homeView.inHandleDataView.text = it["inHandle"]
+ homeView.completedDataView.text = it["over"]
})
+ return homeView
}
override fun onResume() {
super.onResume()
+ homeView.mapView.onResume()
//每次页面切换都需要重新刷新不同状态的窨井数量
wellCountViewModel.countWellByState()
workOrderViewModel.countWorkOrderByState()
}
+
+ /***以下是地图生命周期管理************************************************************************/
+
+ override fun onPause() {
+ super.onPause()
+ homeView.mapView.onPause()
+ }
+
+ override fun onSaveInstanceState(outState: Bundle) {
+ super.onSaveInstanceState(outState)
+ homeView.mapView.onSaveInstanceState(outState)
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ homeView.mapView.onDestroy()
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
new file mode 100644
index 0000000..e7a664a
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnAcceptOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_accept
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
new file mode 100644
index 0000000..8589260
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnHandleOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_handle
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_image_view.xml b/app/src/main/res/drawable/bg_image_view.xml
new file mode 100644
index 0000000..f7eca2c
--- /dev/null
+++ b/app/src/main/res/drawable/bg_image_view.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_layout_radius_20.xml b/app/src/main/res/drawable/bg_layout_radius_20.xml
new file mode 100644
index 0000000..ba81626
--- /dev/null
+++ b/app/src/main/res/drawable/bg_layout_radius_20.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dash_line_horizontal.xml b/app/src/main/res/drawable/dash_line_horizontal.xml
deleted file mode 100644
index 3b9b146..0000000
--- a/app/src/main/res/drawable/dash_line_horizontal.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dash_line_vertical.xml b/app/src/main/res/drawable/dash_line_vertical.xml
deleted file mode 100644
index 1892dff..0000000
--- a/app/src/main/res/drawable/dash_line_vertical.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
- -
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_bfcf.xml b/app/src/main/res/drawable/ic_bfcf.xml
new file mode 100644
index 0000000..d122e93
--- /dev/null
+++ b/app/src/main/res/drawable/ic_bfcf.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_overtime.xml b/app/src/main/res/drawable/ic_overtime.xml
new file mode 100644
index 0000000..6ae8fe8
--- /dev/null
+++ b/app/src/main/res/drawable/ic_overtime.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_well.xml b/app/src/main/res/drawable/ic_well.xml
new file mode 100644
index 0000000..472662e
--- /dev/null
+++ b/app/src/main/res/drawable/ic_well.xml
@@ -0,0 +1,12 @@
+
+
+
+
diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/overtime.svg b/app/src/main/assets/svg/overtime.svg
new file mode 100644
index 0000000..32f5e01
--- /dev/null
+++ b/app/src/main/assets/svg/overtime.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/well.svg b/app/src/main/assets/svg/well.svg
new file mode 100644
index 0000000..ad0a5db
--- /dev/null
+++ b/app/src/main/assets/svg/well.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
index cf15d6b..d1d455f 100644
--- a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
+++ b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
@@ -20,7 +20,7 @@
}
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
- holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.imageView.setImageResource(Constant.HOME_ICONS[position])
holder.textView.text = Constant.HOME_ITEMS[position]
if (clickListener != null) {
holder.itemView.setOnClickListener {
diff --git a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
index c342334..537cb90 100644
--- a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
+++ b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
@@ -41,7 +41,8 @@
const val USER_DETAIL_MODEL = "userDetailModel"
const val INTENT_PARAM = "intentParam"
- val HOME_ICONS = arrayOf(R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher)
+ val HOME_ICONS = arrayOf(R.drawable.ic_well, R.drawable.ic_overtime, R.drawable.ic_bfcf)
val HOME_ITEMS = arrayOf("闸井管理", "超时工单", "布防撤防")
val SUB_PAGE_TITLES = arrayOf("待处理", "待确认", "处理中", "已完成")
+ val OVER_TIME_PAGE_TITLES = arrayOf("超时未接单", "超时未处理")
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
index 453a2c9..d3d1890 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
@@ -1,18 +1,45 @@
package com.casic.app.smartwell.view
+import android.view.View
+import androidx.fragment.app.Fragment
import com.casic.app.smartwell.R
+import com.casic.app.smartwell.adapter.TopViewPagerAdapter
import com.casic.app.smartwell.base.BaseActivity
+import com.casic.app.smartwell.utils.Constant
+import com.casic.app.smartwell.view.fragment.UnAcceptOrderFragment
+import com.casic.app.smartwell.view.fragment.UnHandleOrderFragment
+import kotlinx.android.synthetic.main.activity_order_overtime.*
+import kotlinx.android.synthetic.main.include_base_title.*
+import java.util.*
class OvertimeOrderActivity : BaseActivity() {
+ private var fragmentList: ArrayList = ArrayList()
+
+ init {
+ fragmentList.add(UnAcceptOrderFragment())
+ fragmentList.add(UnHandleOrderFragment())
+ }
+
override fun initLayoutView(): Int = R.layout.activity_order_overtime
override fun setupTopBarLayout() {
-
+ titleView.text = "工单管理"
+ leftBackView.visibility = View.VISIBLE
+ leftBackView.setOnClickListener { finish() }
}
override fun initData() {
-
+ val topViewPagerAdapter =
+ TopViewPagerAdapter(
+ supportFragmentManager,
+ Constant.OVER_TIME_PAGE_TITLES,
+ fragmentList
+ )
+ //页面永不销毁
+ overTimeViewPager.offscreenPageLimit = fragmentList.size
+ overTimeViewPager.adapter = topViewPagerAdapter
+ overTimeTabLayout.setupWithViewPager(overTimeViewPager)
}
override fun initEvent() {
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
index 04654dc..5402091 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
@@ -1,7 +1,16 @@
package com.casic.app.smartwell.view.fragment
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
+import com.amap.api.maps.AMap
+import com.amap.api.maps.AMapOptions
+import com.amap.api.maps.CameraUpdateFactory
+import com.amap.api.maps.model.MyLocationStyle
import com.casic.app.smartwell.R
import com.casic.app.smartwell.adapter.HomeRecycleAdapter
import com.casic.app.smartwell.extensions.navigatePageTo
@@ -10,23 +19,42 @@
import com.casic.app.smartwell.view.WellOperationActivity
import com.casic.app.smartwell.vm.WellCountViewModel
import com.casic.app.smartwell.vm.WorkOrderViewModel
-import com.pengxh.app.multilib.base.BaseFragment
-import kotlinx.android.synthetic.main.fragment_home.*
-import kotlinx.android.synthetic.main.include_base_title.*
+import kotlinx.android.synthetic.main.fragment_home.view.*
+import kotlinx.android.synthetic.main.include_base_title.view.*
-class HomePageFragment : BaseFragment() {
+class HomePageFragment : Fragment() {
+ private lateinit var homeView: View
private lateinit var wellCountViewModel: WellCountViewModel
private lateinit var workOrderViewModel: WorkOrderViewModel
+ private lateinit var aMap: AMap
+ private lateinit var locationStyle: MyLocationStyle
- override fun initLayoutView(): Int = R.layout.fragment_home
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ homeView = inflater.inflate(R.layout.fragment_home, container, false)
+ homeView.titleView.text = "首页"
+ //地图初始化
+ homeView.mapView.onCreate(savedInstanceState)
+ aMap = homeView.mapView.map
+ val uiSettings = aMap.uiSettings
+ uiSettings.zoomPosition = AMapOptions.ZOOM_POSITION_RIGHT_CENTER
+ uiSettings.isRotateGesturesEnabled = false//不许地图随手势旋转角度
+ //显示定位小蓝点
+ locationStyle = MyLocationStyle()
+ locationStyle
+ locationStyle.showMyLocation(true)//设置是否显示定位小蓝点
+ locationStyle.interval(10 * 1000)////设置连续定位模式下的定位间隔,只在连续定位模式下生效。单位为毫秒
+ aMap.myLocationStyle = locationStyle
+ aMap.isMyLocationEnabled = true
+ aMap.moveCamera(CameraUpdateFactory.zoomTo(14.toFloat()))
- override fun initData() {
- titleView.text = "首页"
//首页功能块
val homeRecycleAdapter = HomeRecycleAdapter(requireContext())
- homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
- homeRecyclerView.adapter = homeRecycleAdapter
+ homeView.homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
+ homeView.homeRecyclerView.adapter = homeRecycleAdapter
homeRecycleAdapter.setOnGridItemClickListener(object :
HomeRecycleAdapter.OnGridItemClickListener {
override fun onClick(position: Int) {
@@ -39,34 +67,51 @@
})
wellCountViewModel = ViewModelProvider(this).get(WellCountViewModel::class.java)
workOrderViewModel = ViewModelProvider(this).get(WorkOrderViewModel::class.java)
- }
- override fun initEvent() {
- wellCountViewModel.resultModel.observe(this, {
- unDeployedWellView.text = it["bfWell"]
- deployedWellView.text = it["cfWell"]
- allWellDataView.text = it["total"]
+ wellCountViewModel.resultModel.observe(viewLifecycleOwner, {
+ homeView.unDeployedWellView.text = it["bfWell"]
+ homeView.deployedWellView.text = it["cfWell"]
+ homeView.allWellDataView.text = it["total"]
})
- workOrderViewModel.resultModel.observe(this, {
+ workOrderViewModel.resultModel.observe(viewLifecycleOwner, {
if (it["beforeGet"]!!.length > 4 || it["beforeConfirm"]!!.length > 4 ||
it["inHandle"]!!.length > 4 || it["over"]!!.length > 4
) {
- todoDataView.textSize = 36f
- undeterminedDataView.textSize = 36f
- inHandleDataView.textSize = 36f
- completedDataView.textSize = 36f
+ homeView.todoDataView.textSize = 36f
+ homeView.undeterminedDataView.textSize = 36f
+ homeView.inHandleDataView.textSize = 36f
+ homeView.completedDataView.textSize = 36f
}
- todoDataView.text = it["beforeGet"]
- undeterminedDataView.text = it["beforeConfirm"]
- inHandleDataView.text = it["inHandle"]
- completedDataView.text = it["over"]
+ homeView.todoDataView.text = it["beforeGet"]
+ homeView.undeterminedDataView.text = it["beforeConfirm"]
+ homeView.inHandleDataView.text = it["inHandle"]
+ homeView.completedDataView.text = it["over"]
})
+ return homeView
}
override fun onResume() {
super.onResume()
+ homeView.mapView.onResume()
//每次页面切换都需要重新刷新不同状态的窨井数量
wellCountViewModel.countWellByState()
workOrderViewModel.countWorkOrderByState()
}
+
+ /***以下是地图生命周期管理************************************************************************/
+
+ override fun onPause() {
+ super.onPause()
+ homeView.mapView.onPause()
+ }
+
+ override fun onSaveInstanceState(outState: Bundle) {
+ super.onSaveInstanceState(outState)
+ homeView.mapView.onSaveInstanceState(outState)
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ homeView.mapView.onDestroy()
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
new file mode 100644
index 0000000..e7a664a
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnAcceptOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_accept
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
new file mode 100644
index 0000000..8589260
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnHandleOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_handle
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_image_view.xml b/app/src/main/res/drawable/bg_image_view.xml
new file mode 100644
index 0000000..f7eca2c
--- /dev/null
+++ b/app/src/main/res/drawable/bg_image_view.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_layout_radius_20.xml b/app/src/main/res/drawable/bg_layout_radius_20.xml
new file mode 100644
index 0000000..ba81626
--- /dev/null
+++ b/app/src/main/res/drawable/bg_layout_radius_20.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dash_line_horizontal.xml b/app/src/main/res/drawable/dash_line_horizontal.xml
deleted file mode 100644
index 3b9b146..0000000
--- a/app/src/main/res/drawable/dash_line_horizontal.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dash_line_vertical.xml b/app/src/main/res/drawable/dash_line_vertical.xml
deleted file mode 100644
index 1892dff..0000000
--- a/app/src/main/res/drawable/dash_line_vertical.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
- -
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_bfcf.xml b/app/src/main/res/drawable/ic_bfcf.xml
new file mode 100644
index 0000000..d122e93
--- /dev/null
+++ b/app/src/main/res/drawable/ic_bfcf.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_overtime.xml b/app/src/main/res/drawable/ic_overtime.xml
new file mode 100644
index 0000000..6ae8fe8
--- /dev/null
+++ b/app/src/main/res/drawable/ic_overtime.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_well.xml b/app/src/main/res/drawable/ic_well.xml
new file mode 100644
index 0000000..472662e
--- /dev/null
+++ b/app/src/main/res/drawable/ic_well.xml
@@ -0,0 +1,12 @@
+
+
+
+
diff --git a/app/src/main/res/layout/activity_order_overtime.xml b/app/src/main/res/layout/activity_order_overtime.xml
index d829e29..fdc1aab 100644
--- a/app/src/main/res/layout/activity_order_overtime.xml
+++ b/app/src/main/res/layout/activity_order_overtime.xml
@@ -1,7 +1,33 @@
+ android:layout_height="match_parent"
+ android:background="@color/mainBackground"
+ android:orientation="vertical"
+ tools:context=".view.OvertimeOrderActivity">
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/overtime.svg b/app/src/main/assets/svg/overtime.svg
new file mode 100644
index 0000000..32f5e01
--- /dev/null
+++ b/app/src/main/assets/svg/overtime.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/well.svg b/app/src/main/assets/svg/well.svg
new file mode 100644
index 0000000..ad0a5db
--- /dev/null
+++ b/app/src/main/assets/svg/well.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
index cf15d6b..d1d455f 100644
--- a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
+++ b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
@@ -20,7 +20,7 @@
}
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
- holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.imageView.setImageResource(Constant.HOME_ICONS[position])
holder.textView.text = Constant.HOME_ITEMS[position]
if (clickListener != null) {
holder.itemView.setOnClickListener {
diff --git a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
index c342334..537cb90 100644
--- a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
+++ b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
@@ -41,7 +41,8 @@
const val USER_DETAIL_MODEL = "userDetailModel"
const val INTENT_PARAM = "intentParam"
- val HOME_ICONS = arrayOf(R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher)
+ val HOME_ICONS = arrayOf(R.drawable.ic_well, R.drawable.ic_overtime, R.drawable.ic_bfcf)
val HOME_ITEMS = arrayOf("闸井管理", "超时工单", "布防撤防")
val SUB_PAGE_TITLES = arrayOf("待处理", "待确认", "处理中", "已完成")
+ val OVER_TIME_PAGE_TITLES = arrayOf("超时未接单", "超时未处理")
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
index 453a2c9..d3d1890 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
@@ -1,18 +1,45 @@
package com.casic.app.smartwell.view
+import android.view.View
+import androidx.fragment.app.Fragment
import com.casic.app.smartwell.R
+import com.casic.app.smartwell.adapter.TopViewPagerAdapter
import com.casic.app.smartwell.base.BaseActivity
+import com.casic.app.smartwell.utils.Constant
+import com.casic.app.smartwell.view.fragment.UnAcceptOrderFragment
+import com.casic.app.smartwell.view.fragment.UnHandleOrderFragment
+import kotlinx.android.synthetic.main.activity_order_overtime.*
+import kotlinx.android.synthetic.main.include_base_title.*
+import java.util.*
class OvertimeOrderActivity : BaseActivity() {
+ private var fragmentList: ArrayList = ArrayList()
+
+ init {
+ fragmentList.add(UnAcceptOrderFragment())
+ fragmentList.add(UnHandleOrderFragment())
+ }
+
override fun initLayoutView(): Int = R.layout.activity_order_overtime
override fun setupTopBarLayout() {
-
+ titleView.text = "工单管理"
+ leftBackView.visibility = View.VISIBLE
+ leftBackView.setOnClickListener { finish() }
}
override fun initData() {
-
+ val topViewPagerAdapter =
+ TopViewPagerAdapter(
+ supportFragmentManager,
+ Constant.OVER_TIME_PAGE_TITLES,
+ fragmentList
+ )
+ //页面永不销毁
+ overTimeViewPager.offscreenPageLimit = fragmentList.size
+ overTimeViewPager.adapter = topViewPagerAdapter
+ overTimeTabLayout.setupWithViewPager(overTimeViewPager)
}
override fun initEvent() {
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
index 04654dc..5402091 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
@@ -1,7 +1,16 @@
package com.casic.app.smartwell.view.fragment
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
+import com.amap.api.maps.AMap
+import com.amap.api.maps.AMapOptions
+import com.amap.api.maps.CameraUpdateFactory
+import com.amap.api.maps.model.MyLocationStyle
import com.casic.app.smartwell.R
import com.casic.app.smartwell.adapter.HomeRecycleAdapter
import com.casic.app.smartwell.extensions.navigatePageTo
@@ -10,23 +19,42 @@
import com.casic.app.smartwell.view.WellOperationActivity
import com.casic.app.smartwell.vm.WellCountViewModel
import com.casic.app.smartwell.vm.WorkOrderViewModel
-import com.pengxh.app.multilib.base.BaseFragment
-import kotlinx.android.synthetic.main.fragment_home.*
-import kotlinx.android.synthetic.main.include_base_title.*
+import kotlinx.android.synthetic.main.fragment_home.view.*
+import kotlinx.android.synthetic.main.include_base_title.view.*
-class HomePageFragment : BaseFragment() {
+class HomePageFragment : Fragment() {
+ private lateinit var homeView: View
private lateinit var wellCountViewModel: WellCountViewModel
private lateinit var workOrderViewModel: WorkOrderViewModel
+ private lateinit var aMap: AMap
+ private lateinit var locationStyle: MyLocationStyle
- override fun initLayoutView(): Int = R.layout.fragment_home
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ homeView = inflater.inflate(R.layout.fragment_home, container, false)
+ homeView.titleView.text = "首页"
+ //地图初始化
+ homeView.mapView.onCreate(savedInstanceState)
+ aMap = homeView.mapView.map
+ val uiSettings = aMap.uiSettings
+ uiSettings.zoomPosition = AMapOptions.ZOOM_POSITION_RIGHT_CENTER
+ uiSettings.isRotateGesturesEnabled = false//不许地图随手势旋转角度
+ //显示定位小蓝点
+ locationStyle = MyLocationStyle()
+ locationStyle
+ locationStyle.showMyLocation(true)//设置是否显示定位小蓝点
+ locationStyle.interval(10 * 1000)////设置连续定位模式下的定位间隔,只在连续定位模式下生效。单位为毫秒
+ aMap.myLocationStyle = locationStyle
+ aMap.isMyLocationEnabled = true
+ aMap.moveCamera(CameraUpdateFactory.zoomTo(14.toFloat()))
- override fun initData() {
- titleView.text = "首页"
//首页功能块
val homeRecycleAdapter = HomeRecycleAdapter(requireContext())
- homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
- homeRecyclerView.adapter = homeRecycleAdapter
+ homeView.homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
+ homeView.homeRecyclerView.adapter = homeRecycleAdapter
homeRecycleAdapter.setOnGridItemClickListener(object :
HomeRecycleAdapter.OnGridItemClickListener {
override fun onClick(position: Int) {
@@ -39,34 +67,51 @@
})
wellCountViewModel = ViewModelProvider(this).get(WellCountViewModel::class.java)
workOrderViewModel = ViewModelProvider(this).get(WorkOrderViewModel::class.java)
- }
- override fun initEvent() {
- wellCountViewModel.resultModel.observe(this, {
- unDeployedWellView.text = it["bfWell"]
- deployedWellView.text = it["cfWell"]
- allWellDataView.text = it["total"]
+ wellCountViewModel.resultModel.observe(viewLifecycleOwner, {
+ homeView.unDeployedWellView.text = it["bfWell"]
+ homeView.deployedWellView.text = it["cfWell"]
+ homeView.allWellDataView.text = it["total"]
})
- workOrderViewModel.resultModel.observe(this, {
+ workOrderViewModel.resultModel.observe(viewLifecycleOwner, {
if (it["beforeGet"]!!.length > 4 || it["beforeConfirm"]!!.length > 4 ||
it["inHandle"]!!.length > 4 || it["over"]!!.length > 4
) {
- todoDataView.textSize = 36f
- undeterminedDataView.textSize = 36f
- inHandleDataView.textSize = 36f
- completedDataView.textSize = 36f
+ homeView.todoDataView.textSize = 36f
+ homeView.undeterminedDataView.textSize = 36f
+ homeView.inHandleDataView.textSize = 36f
+ homeView.completedDataView.textSize = 36f
}
- todoDataView.text = it["beforeGet"]
- undeterminedDataView.text = it["beforeConfirm"]
- inHandleDataView.text = it["inHandle"]
- completedDataView.text = it["over"]
+ homeView.todoDataView.text = it["beforeGet"]
+ homeView.undeterminedDataView.text = it["beforeConfirm"]
+ homeView.inHandleDataView.text = it["inHandle"]
+ homeView.completedDataView.text = it["over"]
})
+ return homeView
}
override fun onResume() {
super.onResume()
+ homeView.mapView.onResume()
//每次页面切换都需要重新刷新不同状态的窨井数量
wellCountViewModel.countWellByState()
workOrderViewModel.countWorkOrderByState()
}
+
+ /***以下是地图生命周期管理************************************************************************/
+
+ override fun onPause() {
+ super.onPause()
+ homeView.mapView.onPause()
+ }
+
+ override fun onSaveInstanceState(outState: Bundle) {
+ super.onSaveInstanceState(outState)
+ homeView.mapView.onSaveInstanceState(outState)
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ homeView.mapView.onDestroy()
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
new file mode 100644
index 0000000..e7a664a
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnAcceptOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_accept
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
new file mode 100644
index 0000000..8589260
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnHandleOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_handle
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_image_view.xml b/app/src/main/res/drawable/bg_image_view.xml
new file mode 100644
index 0000000..f7eca2c
--- /dev/null
+++ b/app/src/main/res/drawable/bg_image_view.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_layout_radius_20.xml b/app/src/main/res/drawable/bg_layout_radius_20.xml
new file mode 100644
index 0000000..ba81626
--- /dev/null
+++ b/app/src/main/res/drawable/bg_layout_radius_20.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dash_line_horizontal.xml b/app/src/main/res/drawable/dash_line_horizontal.xml
deleted file mode 100644
index 3b9b146..0000000
--- a/app/src/main/res/drawable/dash_line_horizontal.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dash_line_vertical.xml b/app/src/main/res/drawable/dash_line_vertical.xml
deleted file mode 100644
index 1892dff..0000000
--- a/app/src/main/res/drawable/dash_line_vertical.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
- -
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_bfcf.xml b/app/src/main/res/drawable/ic_bfcf.xml
new file mode 100644
index 0000000..d122e93
--- /dev/null
+++ b/app/src/main/res/drawable/ic_bfcf.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_overtime.xml b/app/src/main/res/drawable/ic_overtime.xml
new file mode 100644
index 0000000..6ae8fe8
--- /dev/null
+++ b/app/src/main/res/drawable/ic_overtime.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_well.xml b/app/src/main/res/drawable/ic_well.xml
new file mode 100644
index 0000000..472662e
--- /dev/null
+++ b/app/src/main/res/drawable/ic_well.xml
@@ -0,0 +1,12 @@
+
+
+
+
diff --git a/app/src/main/res/layout/activity_order_overtime.xml b/app/src/main/res/layout/activity_order_overtime.xml
index d829e29..fdc1aab 100644
--- a/app/src/main/res/layout/activity_order_overtime.xml
+++ b/app/src/main/res/layout/activity_order_overtime.xml
@@ -1,7 +1,33 @@
+ android:layout_height="match_parent"
+ android:background="@color/mainBackground"
+ android:orientation="vertical"
+ tools:context=".view.OvertimeOrderActivity">
+
+
+
+
+
+
+
\ 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 fa627da..62e42fd 100644
--- a/app/src/main/res/layout/fragment_home.xml
+++ b/app/src/main/res/layout/fragment_home.xml
@@ -4,169 +4,207 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/mainBackColor"
- android:orientation="vertical"
- android:weightSum="4">
+ android:orientation="vertical">
-
+ android:layout_height="match_parent">
-
+
+ android:background="@drawable/bg_layout_radius_20"
+ android:orientation="vertical"
+ app:behavior_fitToContents="false"
+ app:behavior_halfExpandedRatio="0.25"
+ app:behavior_hideable="false"
+ app:behavior_peekHeight="@dimen/titleViewHeight"
+ app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
-
+
+
+
+
+
+
+
+
+ android:layout_marginHorizontal="@dimen/dp_10" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_marginHorizontal="@dimen/dp_10"
+ android:layout_marginTop="@dimen/dp_10"
+ app:cardCornerRadius="@dimen/dp_5">
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:layout_height="wrap_content"
+ android:layout_marginHorizontal="@dimen/dp_10"
+ android:layout_marginTop="@dimen/dp_10"
+ app:cardCornerRadius="@dimen/dp_5">
-
+
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:paddingVertical="@dimen/dp_5"
+ android:text="工\u3000\u3000单"
+ android:textColor="@color/mainTextColor"
+ android:textSize="@dimen/titleFontSize" />
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/overtime.svg b/app/src/main/assets/svg/overtime.svg
new file mode 100644
index 0000000..32f5e01
--- /dev/null
+++ b/app/src/main/assets/svg/overtime.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/well.svg b/app/src/main/assets/svg/well.svg
new file mode 100644
index 0000000..ad0a5db
--- /dev/null
+++ b/app/src/main/assets/svg/well.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
index cf15d6b..d1d455f 100644
--- a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
+++ b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
@@ -20,7 +20,7 @@
}
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
- holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.imageView.setImageResource(Constant.HOME_ICONS[position])
holder.textView.text = Constant.HOME_ITEMS[position]
if (clickListener != null) {
holder.itemView.setOnClickListener {
diff --git a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
index c342334..537cb90 100644
--- a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
+++ b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
@@ -41,7 +41,8 @@
const val USER_DETAIL_MODEL = "userDetailModel"
const val INTENT_PARAM = "intentParam"
- val HOME_ICONS = arrayOf(R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher)
+ val HOME_ICONS = arrayOf(R.drawable.ic_well, R.drawable.ic_overtime, R.drawable.ic_bfcf)
val HOME_ITEMS = arrayOf("闸井管理", "超时工单", "布防撤防")
val SUB_PAGE_TITLES = arrayOf("待处理", "待确认", "处理中", "已完成")
+ val OVER_TIME_PAGE_TITLES = arrayOf("超时未接单", "超时未处理")
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
index 453a2c9..d3d1890 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
@@ -1,18 +1,45 @@
package com.casic.app.smartwell.view
+import android.view.View
+import androidx.fragment.app.Fragment
import com.casic.app.smartwell.R
+import com.casic.app.smartwell.adapter.TopViewPagerAdapter
import com.casic.app.smartwell.base.BaseActivity
+import com.casic.app.smartwell.utils.Constant
+import com.casic.app.smartwell.view.fragment.UnAcceptOrderFragment
+import com.casic.app.smartwell.view.fragment.UnHandleOrderFragment
+import kotlinx.android.synthetic.main.activity_order_overtime.*
+import kotlinx.android.synthetic.main.include_base_title.*
+import java.util.*
class OvertimeOrderActivity : BaseActivity() {
+ private var fragmentList: ArrayList = ArrayList()
+
+ init {
+ fragmentList.add(UnAcceptOrderFragment())
+ fragmentList.add(UnHandleOrderFragment())
+ }
+
override fun initLayoutView(): Int = R.layout.activity_order_overtime
override fun setupTopBarLayout() {
-
+ titleView.text = "工单管理"
+ leftBackView.visibility = View.VISIBLE
+ leftBackView.setOnClickListener { finish() }
}
override fun initData() {
-
+ val topViewPagerAdapter =
+ TopViewPagerAdapter(
+ supportFragmentManager,
+ Constant.OVER_TIME_PAGE_TITLES,
+ fragmentList
+ )
+ //页面永不销毁
+ overTimeViewPager.offscreenPageLimit = fragmentList.size
+ overTimeViewPager.adapter = topViewPagerAdapter
+ overTimeTabLayout.setupWithViewPager(overTimeViewPager)
}
override fun initEvent() {
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
index 04654dc..5402091 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
@@ -1,7 +1,16 @@
package com.casic.app.smartwell.view.fragment
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
+import com.amap.api.maps.AMap
+import com.amap.api.maps.AMapOptions
+import com.amap.api.maps.CameraUpdateFactory
+import com.amap.api.maps.model.MyLocationStyle
import com.casic.app.smartwell.R
import com.casic.app.smartwell.adapter.HomeRecycleAdapter
import com.casic.app.smartwell.extensions.navigatePageTo
@@ -10,23 +19,42 @@
import com.casic.app.smartwell.view.WellOperationActivity
import com.casic.app.smartwell.vm.WellCountViewModel
import com.casic.app.smartwell.vm.WorkOrderViewModel
-import com.pengxh.app.multilib.base.BaseFragment
-import kotlinx.android.synthetic.main.fragment_home.*
-import kotlinx.android.synthetic.main.include_base_title.*
+import kotlinx.android.synthetic.main.fragment_home.view.*
+import kotlinx.android.synthetic.main.include_base_title.view.*
-class HomePageFragment : BaseFragment() {
+class HomePageFragment : Fragment() {
+ private lateinit var homeView: View
private lateinit var wellCountViewModel: WellCountViewModel
private lateinit var workOrderViewModel: WorkOrderViewModel
+ private lateinit var aMap: AMap
+ private lateinit var locationStyle: MyLocationStyle
- override fun initLayoutView(): Int = R.layout.fragment_home
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ homeView = inflater.inflate(R.layout.fragment_home, container, false)
+ homeView.titleView.text = "首页"
+ //地图初始化
+ homeView.mapView.onCreate(savedInstanceState)
+ aMap = homeView.mapView.map
+ val uiSettings = aMap.uiSettings
+ uiSettings.zoomPosition = AMapOptions.ZOOM_POSITION_RIGHT_CENTER
+ uiSettings.isRotateGesturesEnabled = false//不许地图随手势旋转角度
+ //显示定位小蓝点
+ locationStyle = MyLocationStyle()
+ locationStyle
+ locationStyle.showMyLocation(true)//设置是否显示定位小蓝点
+ locationStyle.interval(10 * 1000)////设置连续定位模式下的定位间隔,只在连续定位模式下生效。单位为毫秒
+ aMap.myLocationStyle = locationStyle
+ aMap.isMyLocationEnabled = true
+ aMap.moveCamera(CameraUpdateFactory.zoomTo(14.toFloat()))
- override fun initData() {
- titleView.text = "首页"
//首页功能块
val homeRecycleAdapter = HomeRecycleAdapter(requireContext())
- homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
- homeRecyclerView.adapter = homeRecycleAdapter
+ homeView.homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
+ homeView.homeRecyclerView.adapter = homeRecycleAdapter
homeRecycleAdapter.setOnGridItemClickListener(object :
HomeRecycleAdapter.OnGridItemClickListener {
override fun onClick(position: Int) {
@@ -39,34 +67,51 @@
})
wellCountViewModel = ViewModelProvider(this).get(WellCountViewModel::class.java)
workOrderViewModel = ViewModelProvider(this).get(WorkOrderViewModel::class.java)
- }
- override fun initEvent() {
- wellCountViewModel.resultModel.observe(this, {
- unDeployedWellView.text = it["bfWell"]
- deployedWellView.text = it["cfWell"]
- allWellDataView.text = it["total"]
+ wellCountViewModel.resultModel.observe(viewLifecycleOwner, {
+ homeView.unDeployedWellView.text = it["bfWell"]
+ homeView.deployedWellView.text = it["cfWell"]
+ homeView.allWellDataView.text = it["total"]
})
- workOrderViewModel.resultModel.observe(this, {
+ workOrderViewModel.resultModel.observe(viewLifecycleOwner, {
if (it["beforeGet"]!!.length > 4 || it["beforeConfirm"]!!.length > 4 ||
it["inHandle"]!!.length > 4 || it["over"]!!.length > 4
) {
- todoDataView.textSize = 36f
- undeterminedDataView.textSize = 36f
- inHandleDataView.textSize = 36f
- completedDataView.textSize = 36f
+ homeView.todoDataView.textSize = 36f
+ homeView.undeterminedDataView.textSize = 36f
+ homeView.inHandleDataView.textSize = 36f
+ homeView.completedDataView.textSize = 36f
}
- todoDataView.text = it["beforeGet"]
- undeterminedDataView.text = it["beforeConfirm"]
- inHandleDataView.text = it["inHandle"]
- completedDataView.text = it["over"]
+ homeView.todoDataView.text = it["beforeGet"]
+ homeView.undeterminedDataView.text = it["beforeConfirm"]
+ homeView.inHandleDataView.text = it["inHandle"]
+ homeView.completedDataView.text = it["over"]
})
+ return homeView
}
override fun onResume() {
super.onResume()
+ homeView.mapView.onResume()
//每次页面切换都需要重新刷新不同状态的窨井数量
wellCountViewModel.countWellByState()
workOrderViewModel.countWorkOrderByState()
}
+
+ /***以下是地图生命周期管理************************************************************************/
+
+ override fun onPause() {
+ super.onPause()
+ homeView.mapView.onPause()
+ }
+
+ override fun onSaveInstanceState(outState: Bundle) {
+ super.onSaveInstanceState(outState)
+ homeView.mapView.onSaveInstanceState(outState)
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ homeView.mapView.onDestroy()
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
new file mode 100644
index 0000000..e7a664a
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnAcceptOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_accept
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
new file mode 100644
index 0000000..8589260
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnHandleOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_handle
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_image_view.xml b/app/src/main/res/drawable/bg_image_view.xml
new file mode 100644
index 0000000..f7eca2c
--- /dev/null
+++ b/app/src/main/res/drawable/bg_image_view.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_layout_radius_20.xml b/app/src/main/res/drawable/bg_layout_radius_20.xml
new file mode 100644
index 0000000..ba81626
--- /dev/null
+++ b/app/src/main/res/drawable/bg_layout_radius_20.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dash_line_horizontal.xml b/app/src/main/res/drawable/dash_line_horizontal.xml
deleted file mode 100644
index 3b9b146..0000000
--- a/app/src/main/res/drawable/dash_line_horizontal.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dash_line_vertical.xml b/app/src/main/res/drawable/dash_line_vertical.xml
deleted file mode 100644
index 1892dff..0000000
--- a/app/src/main/res/drawable/dash_line_vertical.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
- -
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_bfcf.xml b/app/src/main/res/drawable/ic_bfcf.xml
new file mode 100644
index 0000000..d122e93
--- /dev/null
+++ b/app/src/main/res/drawable/ic_bfcf.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_overtime.xml b/app/src/main/res/drawable/ic_overtime.xml
new file mode 100644
index 0000000..6ae8fe8
--- /dev/null
+++ b/app/src/main/res/drawable/ic_overtime.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_well.xml b/app/src/main/res/drawable/ic_well.xml
new file mode 100644
index 0000000..472662e
--- /dev/null
+++ b/app/src/main/res/drawable/ic_well.xml
@@ -0,0 +1,12 @@
+
+
+
+
diff --git a/app/src/main/res/layout/activity_order_overtime.xml b/app/src/main/res/layout/activity_order_overtime.xml
index d829e29..fdc1aab 100644
--- a/app/src/main/res/layout/activity_order_overtime.xml
+++ b/app/src/main/res/layout/activity_order_overtime.xml
@@ -1,7 +1,33 @@
+ android:layout_height="match_parent"
+ android:background="@color/mainBackground"
+ android:orientation="vertical"
+ tools:context=".view.OvertimeOrderActivity">
+
+
+
+
+
+
+
\ 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 fa627da..62e42fd 100644
--- a/app/src/main/res/layout/fragment_home.xml
+++ b/app/src/main/res/layout/fragment_home.xml
@@ -4,169 +4,207 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/mainBackColor"
- android:orientation="vertical"
- android:weightSum="4">
+ android:orientation="vertical">
-
+ android:layout_height="match_parent">
-
+
+ android:background="@drawable/bg_layout_radius_20"
+ android:orientation="vertical"
+ app:behavior_fitToContents="false"
+ app:behavior_halfExpandedRatio="0.25"
+ app:behavior_hideable="false"
+ app:behavior_peekHeight="@dimen/titleViewHeight"
+ app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
-
+
+
+
+
+
+
+
+
+ android:layout_marginHorizontal="@dimen/dp_10" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_marginHorizontal="@dimen/dp_10"
+ android:layout_marginTop="@dimen/dp_10"
+ app:cardCornerRadius="@dimen/dp_5">
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:layout_height="wrap_content"
+ android:layout_marginHorizontal="@dimen/dp_10"
+ android:layout_marginTop="@dimen/dp_10"
+ app:cardCornerRadius="@dimen/dp_5">
-
+
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:paddingVertical="@dimen/dp_5"
+ android:text="工\u3000\u3000单"
+ android:textColor="@color/mainTextColor"
+ android:textSize="@dimen/titleFontSize" />
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_over_time_un_accept.xml b/app/src/main/res/layout/fragment_over_time_un_accept.xml
new file mode 100644
index 0000000..77d9ef6
--- /dev/null
+++ b/app/src/main/res/layout/fragment_over_time_un_accept.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/overtime.svg b/app/src/main/assets/svg/overtime.svg
new file mode 100644
index 0000000..32f5e01
--- /dev/null
+++ b/app/src/main/assets/svg/overtime.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/well.svg b/app/src/main/assets/svg/well.svg
new file mode 100644
index 0000000..ad0a5db
--- /dev/null
+++ b/app/src/main/assets/svg/well.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
index cf15d6b..d1d455f 100644
--- a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
+++ b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
@@ -20,7 +20,7 @@
}
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
- holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.imageView.setImageResource(Constant.HOME_ICONS[position])
holder.textView.text = Constant.HOME_ITEMS[position]
if (clickListener != null) {
holder.itemView.setOnClickListener {
diff --git a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
index c342334..537cb90 100644
--- a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
+++ b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
@@ -41,7 +41,8 @@
const val USER_DETAIL_MODEL = "userDetailModel"
const val INTENT_PARAM = "intentParam"
- val HOME_ICONS = arrayOf(R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher)
+ val HOME_ICONS = arrayOf(R.drawable.ic_well, R.drawable.ic_overtime, R.drawable.ic_bfcf)
val HOME_ITEMS = arrayOf("闸井管理", "超时工单", "布防撤防")
val SUB_PAGE_TITLES = arrayOf("待处理", "待确认", "处理中", "已完成")
+ val OVER_TIME_PAGE_TITLES = arrayOf("超时未接单", "超时未处理")
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
index 453a2c9..d3d1890 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
@@ -1,18 +1,45 @@
package com.casic.app.smartwell.view
+import android.view.View
+import androidx.fragment.app.Fragment
import com.casic.app.smartwell.R
+import com.casic.app.smartwell.adapter.TopViewPagerAdapter
import com.casic.app.smartwell.base.BaseActivity
+import com.casic.app.smartwell.utils.Constant
+import com.casic.app.smartwell.view.fragment.UnAcceptOrderFragment
+import com.casic.app.smartwell.view.fragment.UnHandleOrderFragment
+import kotlinx.android.synthetic.main.activity_order_overtime.*
+import kotlinx.android.synthetic.main.include_base_title.*
+import java.util.*
class OvertimeOrderActivity : BaseActivity() {
+ private var fragmentList: ArrayList = ArrayList()
+
+ init {
+ fragmentList.add(UnAcceptOrderFragment())
+ fragmentList.add(UnHandleOrderFragment())
+ }
+
override fun initLayoutView(): Int = R.layout.activity_order_overtime
override fun setupTopBarLayout() {
-
+ titleView.text = "工单管理"
+ leftBackView.visibility = View.VISIBLE
+ leftBackView.setOnClickListener { finish() }
}
override fun initData() {
-
+ val topViewPagerAdapter =
+ TopViewPagerAdapter(
+ supportFragmentManager,
+ Constant.OVER_TIME_PAGE_TITLES,
+ fragmentList
+ )
+ //页面永不销毁
+ overTimeViewPager.offscreenPageLimit = fragmentList.size
+ overTimeViewPager.adapter = topViewPagerAdapter
+ overTimeTabLayout.setupWithViewPager(overTimeViewPager)
}
override fun initEvent() {
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
index 04654dc..5402091 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
@@ -1,7 +1,16 @@
package com.casic.app.smartwell.view.fragment
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
+import com.amap.api.maps.AMap
+import com.amap.api.maps.AMapOptions
+import com.amap.api.maps.CameraUpdateFactory
+import com.amap.api.maps.model.MyLocationStyle
import com.casic.app.smartwell.R
import com.casic.app.smartwell.adapter.HomeRecycleAdapter
import com.casic.app.smartwell.extensions.navigatePageTo
@@ -10,23 +19,42 @@
import com.casic.app.smartwell.view.WellOperationActivity
import com.casic.app.smartwell.vm.WellCountViewModel
import com.casic.app.smartwell.vm.WorkOrderViewModel
-import com.pengxh.app.multilib.base.BaseFragment
-import kotlinx.android.synthetic.main.fragment_home.*
-import kotlinx.android.synthetic.main.include_base_title.*
+import kotlinx.android.synthetic.main.fragment_home.view.*
+import kotlinx.android.synthetic.main.include_base_title.view.*
-class HomePageFragment : BaseFragment() {
+class HomePageFragment : Fragment() {
+ private lateinit var homeView: View
private lateinit var wellCountViewModel: WellCountViewModel
private lateinit var workOrderViewModel: WorkOrderViewModel
+ private lateinit var aMap: AMap
+ private lateinit var locationStyle: MyLocationStyle
- override fun initLayoutView(): Int = R.layout.fragment_home
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ homeView = inflater.inflate(R.layout.fragment_home, container, false)
+ homeView.titleView.text = "首页"
+ //地图初始化
+ homeView.mapView.onCreate(savedInstanceState)
+ aMap = homeView.mapView.map
+ val uiSettings = aMap.uiSettings
+ uiSettings.zoomPosition = AMapOptions.ZOOM_POSITION_RIGHT_CENTER
+ uiSettings.isRotateGesturesEnabled = false//不许地图随手势旋转角度
+ //显示定位小蓝点
+ locationStyle = MyLocationStyle()
+ locationStyle
+ locationStyle.showMyLocation(true)//设置是否显示定位小蓝点
+ locationStyle.interval(10 * 1000)////设置连续定位模式下的定位间隔,只在连续定位模式下生效。单位为毫秒
+ aMap.myLocationStyle = locationStyle
+ aMap.isMyLocationEnabled = true
+ aMap.moveCamera(CameraUpdateFactory.zoomTo(14.toFloat()))
- override fun initData() {
- titleView.text = "首页"
//首页功能块
val homeRecycleAdapter = HomeRecycleAdapter(requireContext())
- homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
- homeRecyclerView.adapter = homeRecycleAdapter
+ homeView.homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
+ homeView.homeRecyclerView.adapter = homeRecycleAdapter
homeRecycleAdapter.setOnGridItemClickListener(object :
HomeRecycleAdapter.OnGridItemClickListener {
override fun onClick(position: Int) {
@@ -39,34 +67,51 @@
})
wellCountViewModel = ViewModelProvider(this).get(WellCountViewModel::class.java)
workOrderViewModel = ViewModelProvider(this).get(WorkOrderViewModel::class.java)
- }
- override fun initEvent() {
- wellCountViewModel.resultModel.observe(this, {
- unDeployedWellView.text = it["bfWell"]
- deployedWellView.text = it["cfWell"]
- allWellDataView.text = it["total"]
+ wellCountViewModel.resultModel.observe(viewLifecycleOwner, {
+ homeView.unDeployedWellView.text = it["bfWell"]
+ homeView.deployedWellView.text = it["cfWell"]
+ homeView.allWellDataView.text = it["total"]
})
- workOrderViewModel.resultModel.observe(this, {
+ workOrderViewModel.resultModel.observe(viewLifecycleOwner, {
if (it["beforeGet"]!!.length > 4 || it["beforeConfirm"]!!.length > 4 ||
it["inHandle"]!!.length > 4 || it["over"]!!.length > 4
) {
- todoDataView.textSize = 36f
- undeterminedDataView.textSize = 36f
- inHandleDataView.textSize = 36f
- completedDataView.textSize = 36f
+ homeView.todoDataView.textSize = 36f
+ homeView.undeterminedDataView.textSize = 36f
+ homeView.inHandleDataView.textSize = 36f
+ homeView.completedDataView.textSize = 36f
}
- todoDataView.text = it["beforeGet"]
- undeterminedDataView.text = it["beforeConfirm"]
- inHandleDataView.text = it["inHandle"]
- completedDataView.text = it["over"]
+ homeView.todoDataView.text = it["beforeGet"]
+ homeView.undeterminedDataView.text = it["beforeConfirm"]
+ homeView.inHandleDataView.text = it["inHandle"]
+ homeView.completedDataView.text = it["over"]
})
+ return homeView
}
override fun onResume() {
super.onResume()
+ homeView.mapView.onResume()
//每次页面切换都需要重新刷新不同状态的窨井数量
wellCountViewModel.countWellByState()
workOrderViewModel.countWorkOrderByState()
}
+
+ /***以下是地图生命周期管理************************************************************************/
+
+ override fun onPause() {
+ super.onPause()
+ homeView.mapView.onPause()
+ }
+
+ override fun onSaveInstanceState(outState: Bundle) {
+ super.onSaveInstanceState(outState)
+ homeView.mapView.onSaveInstanceState(outState)
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ homeView.mapView.onDestroy()
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
new file mode 100644
index 0000000..e7a664a
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnAcceptOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_accept
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
new file mode 100644
index 0000000..8589260
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnHandleOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_handle
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_image_view.xml b/app/src/main/res/drawable/bg_image_view.xml
new file mode 100644
index 0000000..f7eca2c
--- /dev/null
+++ b/app/src/main/res/drawable/bg_image_view.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_layout_radius_20.xml b/app/src/main/res/drawable/bg_layout_radius_20.xml
new file mode 100644
index 0000000..ba81626
--- /dev/null
+++ b/app/src/main/res/drawable/bg_layout_radius_20.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dash_line_horizontal.xml b/app/src/main/res/drawable/dash_line_horizontal.xml
deleted file mode 100644
index 3b9b146..0000000
--- a/app/src/main/res/drawable/dash_line_horizontal.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dash_line_vertical.xml b/app/src/main/res/drawable/dash_line_vertical.xml
deleted file mode 100644
index 1892dff..0000000
--- a/app/src/main/res/drawable/dash_line_vertical.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
- -
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_bfcf.xml b/app/src/main/res/drawable/ic_bfcf.xml
new file mode 100644
index 0000000..d122e93
--- /dev/null
+++ b/app/src/main/res/drawable/ic_bfcf.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_overtime.xml b/app/src/main/res/drawable/ic_overtime.xml
new file mode 100644
index 0000000..6ae8fe8
--- /dev/null
+++ b/app/src/main/res/drawable/ic_overtime.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_well.xml b/app/src/main/res/drawable/ic_well.xml
new file mode 100644
index 0000000..472662e
--- /dev/null
+++ b/app/src/main/res/drawable/ic_well.xml
@@ -0,0 +1,12 @@
+
+
+
+
diff --git a/app/src/main/res/layout/activity_order_overtime.xml b/app/src/main/res/layout/activity_order_overtime.xml
index d829e29..fdc1aab 100644
--- a/app/src/main/res/layout/activity_order_overtime.xml
+++ b/app/src/main/res/layout/activity_order_overtime.xml
@@ -1,7 +1,33 @@
+ android:layout_height="match_parent"
+ android:background="@color/mainBackground"
+ android:orientation="vertical"
+ tools:context=".view.OvertimeOrderActivity">
+
+
+
+
+
+
+
\ 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 fa627da..62e42fd 100644
--- a/app/src/main/res/layout/fragment_home.xml
+++ b/app/src/main/res/layout/fragment_home.xml
@@ -4,169 +4,207 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/mainBackColor"
- android:orientation="vertical"
- android:weightSum="4">
+ android:orientation="vertical">
-
+ android:layout_height="match_parent">
-
+
+ android:background="@drawable/bg_layout_radius_20"
+ android:orientation="vertical"
+ app:behavior_fitToContents="false"
+ app:behavior_halfExpandedRatio="0.25"
+ app:behavior_hideable="false"
+ app:behavior_peekHeight="@dimen/titleViewHeight"
+ app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
-
+
+
+
+
+
+
+
+
+ android:layout_marginHorizontal="@dimen/dp_10" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_marginHorizontal="@dimen/dp_10"
+ android:layout_marginTop="@dimen/dp_10"
+ app:cardCornerRadius="@dimen/dp_5">
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:layout_height="wrap_content"
+ android:layout_marginHorizontal="@dimen/dp_10"
+ android:layout_marginTop="@dimen/dp_10"
+ app:cardCornerRadius="@dimen/dp_5">
-
+
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:paddingVertical="@dimen/dp_5"
+ android:text="工\u3000\u3000单"
+ android:textColor="@color/mainTextColor"
+ android:textSize="@dimen/titleFontSize" />
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_over_time_un_accept.xml b/app/src/main/res/layout/fragment_over_time_un_accept.xml
new file mode 100644
index 0000000..77d9ef6
--- /dev/null
+++ b/app/src/main/res/layout/fragment_over_time_un_accept.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_over_time_un_handle.xml b/app/src/main/res/layout/fragment_over_time_un_handle.xml
new file mode 100644
index 0000000..77d9ef6
--- /dev/null
+++ b/app/src/main/res/layout/fragment_over_time_un_handle.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/bfcf.svg b/app/src/main/assets/svg/bfcf.svg
new file mode 100644
index 0000000..c6ce9d5
--- /dev/null
+++ b/app/src/main/assets/svg/bfcf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/overtime.svg b/app/src/main/assets/svg/overtime.svg
new file mode 100644
index 0000000..32f5e01
--- /dev/null
+++ b/app/src/main/assets/svg/overtime.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/svg/well.svg b/app/src/main/assets/svg/well.svg
new file mode 100644
index 0000000..ad0a5db
--- /dev/null
+++ b/app/src/main/assets/svg/well.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
index cf15d6b..d1d455f 100644
--- a/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
+++ b/app/src/main/java/com/casic/app/smartwell/adapter/HomeRecycleAdapter.kt
@@ -20,7 +20,7 @@
}
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
- holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.imageView.setImageResource(Constant.HOME_ICONS[position])
holder.textView.text = Constant.HOME_ITEMS[position]
if (clickListener != null) {
holder.itemView.setOnClickListener {
diff --git a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
index c342334..537cb90 100644
--- a/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
+++ b/app/src/main/java/com/casic/app/smartwell/utils/Constant.kt
@@ -41,7 +41,8 @@
const val USER_DETAIL_MODEL = "userDetailModel"
const val INTENT_PARAM = "intentParam"
- val HOME_ICONS = arrayOf(R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher)
+ val HOME_ICONS = arrayOf(R.drawable.ic_well, R.drawable.ic_overtime, R.drawable.ic_bfcf)
val HOME_ITEMS = arrayOf("闸井管理", "超时工单", "布防撤防")
val SUB_PAGE_TITLES = arrayOf("待处理", "待确认", "处理中", "已完成")
+ val OVER_TIME_PAGE_TITLES = arrayOf("超时未接单", "超时未处理")
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
index 453a2c9..d3d1890 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/OvertimeOrderActivity.kt
@@ -1,18 +1,45 @@
package com.casic.app.smartwell.view
+import android.view.View
+import androidx.fragment.app.Fragment
import com.casic.app.smartwell.R
+import com.casic.app.smartwell.adapter.TopViewPagerAdapter
import com.casic.app.smartwell.base.BaseActivity
+import com.casic.app.smartwell.utils.Constant
+import com.casic.app.smartwell.view.fragment.UnAcceptOrderFragment
+import com.casic.app.smartwell.view.fragment.UnHandleOrderFragment
+import kotlinx.android.synthetic.main.activity_order_overtime.*
+import kotlinx.android.synthetic.main.include_base_title.*
+import java.util.*
class OvertimeOrderActivity : BaseActivity() {
+ private var fragmentList: ArrayList = ArrayList()
+
+ init {
+ fragmentList.add(UnAcceptOrderFragment())
+ fragmentList.add(UnHandleOrderFragment())
+ }
+
override fun initLayoutView(): Int = R.layout.activity_order_overtime
override fun setupTopBarLayout() {
-
+ titleView.text = "工单管理"
+ leftBackView.visibility = View.VISIBLE
+ leftBackView.setOnClickListener { finish() }
}
override fun initData() {
-
+ val topViewPagerAdapter =
+ TopViewPagerAdapter(
+ supportFragmentManager,
+ Constant.OVER_TIME_PAGE_TITLES,
+ fragmentList
+ )
+ //页面永不销毁
+ overTimeViewPager.offscreenPageLimit = fragmentList.size
+ overTimeViewPager.adapter = topViewPagerAdapter
+ overTimeTabLayout.setupWithViewPager(overTimeViewPager)
}
override fun initEvent() {
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
index 04654dc..5402091 100644
--- a/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/HomePageFragment.kt
@@ -1,7 +1,16 @@
package com.casic.app.smartwell.view.fragment
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
+import com.amap.api.maps.AMap
+import com.amap.api.maps.AMapOptions
+import com.amap.api.maps.CameraUpdateFactory
+import com.amap.api.maps.model.MyLocationStyle
import com.casic.app.smartwell.R
import com.casic.app.smartwell.adapter.HomeRecycleAdapter
import com.casic.app.smartwell.extensions.navigatePageTo
@@ -10,23 +19,42 @@
import com.casic.app.smartwell.view.WellOperationActivity
import com.casic.app.smartwell.vm.WellCountViewModel
import com.casic.app.smartwell.vm.WorkOrderViewModel
-import com.pengxh.app.multilib.base.BaseFragment
-import kotlinx.android.synthetic.main.fragment_home.*
-import kotlinx.android.synthetic.main.include_base_title.*
+import kotlinx.android.synthetic.main.fragment_home.view.*
+import kotlinx.android.synthetic.main.include_base_title.view.*
-class HomePageFragment : BaseFragment() {
+class HomePageFragment : Fragment() {
+ private lateinit var homeView: View
private lateinit var wellCountViewModel: WellCountViewModel
private lateinit var workOrderViewModel: WorkOrderViewModel
+ private lateinit var aMap: AMap
+ private lateinit var locationStyle: MyLocationStyle
- override fun initLayoutView(): Int = R.layout.fragment_home
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ homeView = inflater.inflate(R.layout.fragment_home, container, false)
+ homeView.titleView.text = "首页"
+ //地图初始化
+ homeView.mapView.onCreate(savedInstanceState)
+ aMap = homeView.mapView.map
+ val uiSettings = aMap.uiSettings
+ uiSettings.zoomPosition = AMapOptions.ZOOM_POSITION_RIGHT_CENTER
+ uiSettings.isRotateGesturesEnabled = false//不许地图随手势旋转角度
+ //显示定位小蓝点
+ locationStyle = MyLocationStyle()
+ locationStyle
+ locationStyle.showMyLocation(true)//设置是否显示定位小蓝点
+ locationStyle.interval(10 * 1000)////设置连续定位模式下的定位间隔,只在连续定位模式下生效。单位为毫秒
+ aMap.myLocationStyle = locationStyle
+ aMap.isMyLocationEnabled = true
+ aMap.moveCamera(CameraUpdateFactory.zoomTo(14.toFloat()))
- override fun initData() {
- titleView.text = "首页"
//首页功能块
val homeRecycleAdapter = HomeRecycleAdapter(requireContext())
- homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
- homeRecyclerView.adapter = homeRecycleAdapter
+ homeView.homeRecyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
+ homeView.homeRecyclerView.adapter = homeRecycleAdapter
homeRecycleAdapter.setOnGridItemClickListener(object :
HomeRecycleAdapter.OnGridItemClickListener {
override fun onClick(position: Int) {
@@ -39,34 +67,51 @@
})
wellCountViewModel = ViewModelProvider(this).get(WellCountViewModel::class.java)
workOrderViewModel = ViewModelProvider(this).get(WorkOrderViewModel::class.java)
- }
- override fun initEvent() {
- wellCountViewModel.resultModel.observe(this, {
- unDeployedWellView.text = it["bfWell"]
- deployedWellView.text = it["cfWell"]
- allWellDataView.text = it["total"]
+ wellCountViewModel.resultModel.observe(viewLifecycleOwner, {
+ homeView.unDeployedWellView.text = it["bfWell"]
+ homeView.deployedWellView.text = it["cfWell"]
+ homeView.allWellDataView.text = it["total"]
})
- workOrderViewModel.resultModel.observe(this, {
+ workOrderViewModel.resultModel.observe(viewLifecycleOwner, {
if (it["beforeGet"]!!.length > 4 || it["beforeConfirm"]!!.length > 4 ||
it["inHandle"]!!.length > 4 || it["over"]!!.length > 4
) {
- todoDataView.textSize = 36f
- undeterminedDataView.textSize = 36f
- inHandleDataView.textSize = 36f
- completedDataView.textSize = 36f
+ homeView.todoDataView.textSize = 36f
+ homeView.undeterminedDataView.textSize = 36f
+ homeView.inHandleDataView.textSize = 36f
+ homeView.completedDataView.textSize = 36f
}
- todoDataView.text = it["beforeGet"]
- undeterminedDataView.text = it["beforeConfirm"]
- inHandleDataView.text = it["inHandle"]
- completedDataView.text = it["over"]
+ homeView.todoDataView.text = it["beforeGet"]
+ homeView.undeterminedDataView.text = it["beforeConfirm"]
+ homeView.inHandleDataView.text = it["inHandle"]
+ homeView.completedDataView.text = it["over"]
})
+ return homeView
}
override fun onResume() {
super.onResume()
+ homeView.mapView.onResume()
//每次页面切换都需要重新刷新不同状态的窨井数量
wellCountViewModel.countWellByState()
workOrderViewModel.countWorkOrderByState()
}
+
+ /***以下是地图生命周期管理************************************************************************/
+
+ override fun onPause() {
+ super.onPause()
+ homeView.mapView.onPause()
+ }
+
+ override fun onSaveInstanceState(outState: Bundle) {
+ super.onSaveInstanceState(outState)
+ homeView.mapView.onSaveInstanceState(outState)
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ homeView.mapView.onDestroy()
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
new file mode 100644
index 0000000..e7a664a
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnAcceptOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnAcceptOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_accept
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
new file mode 100644
index 0000000..8589260
--- /dev/null
+++ b/app/src/main/java/com/casic/app/smartwell/view/fragment/UnHandleOrderFragment.kt
@@ -0,0 +1,16 @@
+package com.casic.app.smartwell.view.fragment
+
+import com.casic.app.smartwell.R
+import com.pengxh.app.multilib.base.BaseFragment
+
+class UnHandleOrderFragment : BaseFragment() {
+ override fun initLayoutView(): Int = R.layout.fragment_over_time_un_handle
+
+ override fun initData() {
+
+ }
+
+ override fun initEvent() {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_image_view.xml b/app/src/main/res/drawable/bg_image_view.xml
new file mode 100644
index 0000000..f7eca2c
--- /dev/null
+++ b/app/src/main/res/drawable/bg_image_view.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_layout_radius_20.xml b/app/src/main/res/drawable/bg_layout_radius_20.xml
new file mode 100644
index 0000000..ba81626
--- /dev/null
+++ b/app/src/main/res/drawable/bg_layout_radius_20.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dash_line_horizontal.xml b/app/src/main/res/drawable/dash_line_horizontal.xml
deleted file mode 100644
index 3b9b146..0000000
--- a/app/src/main/res/drawable/dash_line_horizontal.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dash_line_vertical.xml b/app/src/main/res/drawable/dash_line_vertical.xml
deleted file mode 100644
index 1892dff..0000000
--- a/app/src/main/res/drawable/dash_line_vertical.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
- -
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_bfcf.xml b/app/src/main/res/drawable/ic_bfcf.xml
new file mode 100644
index 0000000..d122e93
--- /dev/null
+++ b/app/src/main/res/drawable/ic_bfcf.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_overtime.xml b/app/src/main/res/drawable/ic_overtime.xml
new file mode 100644
index 0000000..6ae8fe8
--- /dev/null
+++ b/app/src/main/res/drawable/ic_overtime.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_well.xml b/app/src/main/res/drawable/ic_well.xml
new file mode 100644
index 0000000..472662e
--- /dev/null
+++ b/app/src/main/res/drawable/ic_well.xml
@@ -0,0 +1,12 @@
+
+
+
+
diff --git a/app/src/main/res/layout/activity_order_overtime.xml b/app/src/main/res/layout/activity_order_overtime.xml
index d829e29..fdc1aab 100644
--- a/app/src/main/res/layout/activity_order_overtime.xml
+++ b/app/src/main/res/layout/activity_order_overtime.xml
@@ -1,7 +1,33 @@
+ android:layout_height="match_parent"
+ android:background="@color/mainBackground"
+ android:orientation="vertical"
+ tools:context=".view.OvertimeOrderActivity">
+
+
+
+
+
+
+
\ 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 fa627da..62e42fd 100644
--- a/app/src/main/res/layout/fragment_home.xml
+++ b/app/src/main/res/layout/fragment_home.xml
@@ -4,169 +4,207 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/mainBackColor"
- android:orientation="vertical"
- android:weightSum="4">
+ android:orientation="vertical">
-
+ android:layout_height="match_parent">
-
+
+ android:background="@drawable/bg_layout_radius_20"
+ android:orientation="vertical"
+ app:behavior_fitToContents="false"
+ app:behavior_halfExpandedRatio="0.25"
+ app:behavior_hideable="false"
+ app:behavior_peekHeight="@dimen/titleViewHeight"
+ app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
-
+
+
+
+
+
+
+
+
+ android:layout_marginHorizontal="@dimen/dp_10" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_marginHorizontal="@dimen/dp_10"
+ android:layout_marginTop="@dimen/dp_10"
+ app:cardCornerRadius="@dimen/dp_5">
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:layout_height="wrap_content"
+ android:layout_marginHorizontal="@dimen/dp_10"
+ android:layout_marginTop="@dimen/dp_10"
+ app:cardCornerRadius="@dimen/dp_5">
-
+
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:paddingVertical="@dimen/dp_5"
+ android:text="工\u3000\u3000单"
+ android:textColor="@color/mainTextColor"
+ android:textSize="@dimen/titleFontSize" />
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_over_time_un_accept.xml b/app/src/main/res/layout/fragment_over_time_un_accept.xml
new file mode 100644
index 0000000..77d9ef6
--- /dev/null
+++ b/app/src/main/res/layout/fragment_over_time_un_accept.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_over_time_un_handle.xml b/app/src/main/res/layout/fragment_over_time_un_handle.xml
new file mode 100644
index 0000000..77d9ef6
--- /dev/null
+++ b/app/src/main/res/layout/fragment_over_time_un_handle.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_home_recycleview.xml b/app/src/main/res/layout/item_home_recycleview.xml
index af30be8..069d7f7 100644
--- a/app/src/main/res/layout/item_home_recycleview.xml
+++ b/app/src/main/res/layout/item_home_recycleview.xml
@@ -1,32 +1,26 @@
-
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:orientation="vertical"
+ android:padding="@dimen/dp_10">
-
+ android:layout_marginBottom="@dimen/dp_5"
+ android:background="@drawable/bg_image_view"
+ android:padding="@dimen/dp_10"
+ android:src="@drawable/ic_well" />
-
-
-
-
-
\ No newline at end of file
+
+
\ No newline at end of file