瀏覽代碼

添加物资更换记录页;删除冗余代码;物资检查表页Recyclerview添加scrollbar

Frankensteinly 9 月之前
父節點
當前提交
be92b4549e

+ 2 - 30
app/src/main/java/com/grkj/iscs_mc/util/SPUtils.kt

@@ -5,8 +5,7 @@ import com.grkj.iscs_mc.model.vo.card.CardInfoRespVO
 
 object SPUtils {
 
-    private const val SP_NAME = "iscs"
-    private const val SP_CONFIG_NAME = "iscs_config"
+    private const val SP_NAME = "iscs_mc"
 
     private const val KEY_LOGIN_USER_CARD_ID = "card_id"
     private const val KEY_LOGIN_USER_CARD_CODE = "card_code"
@@ -17,9 +16,6 @@ object SPUtils {
     private const val KEY_LOGIN_USER_USER_NAME = "user_name"
     private const val KEY_LOGIN_USER_ROLE_KEY = "role_key"
 
-    private const val KEY_DOCK_CONFIG = "dock_config"
-    private const val KEY_PORT_CONFIG = "port_config"
-
     fun getLoginUser(context: Context): CardInfoRespVO? {
         val sp = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE)
         if (sp.getString(KEY_LOGIN_USER_CARD_NFC, null) == null) {
@@ -67,7 +63,7 @@ object SPUtils {
         edit.commit()
     }
 
-    fun clearLoginUser(context: Context) : Boolean {
+    fun clearLoginUser(context: Context): Boolean {
         return try {
             val sp = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE)
             val edit = sp.edit()
@@ -78,28 +74,4 @@ object SPUtils {
             false
         }
     }
-
-    fun saveDockConfig(context: Context, config: String) {
-        val sp = context.getSharedPreferences(SP_CONFIG_NAME, Context.MODE_PRIVATE)
-        val edit = sp.edit()
-        edit.putString(KEY_DOCK_CONFIG, config)
-        edit.commit()
-    }
-
-    fun getDockConfig(context: Context): String? {
-        val sp = context.getSharedPreferences(SP_CONFIG_NAME, Context.MODE_PRIVATE)
-        return sp.getString(KEY_DOCK_CONFIG, null)
-    }
-
-    fun savePortConfig(context: Context, config: String) {
-        val sp = context.getSharedPreferences(SP_CONFIG_NAME, Context.MODE_PRIVATE)
-        val edit = sp.edit()
-        edit.putString(KEY_PORT_CONFIG, config)
-        edit.commit()
-    }
-
-    fun getPortConfig(context: Context): String? {
-        val sp = context.getSharedPreferences(SP_CONFIG_NAME, Context.MODE_PRIVATE)
-        return sp.getString(KEY_PORT_CONFIG, null)
-    }
 }

+ 3 - 0
app/src/main/java/com/grkj/iscs_mc/view/fragment/MaterialReplacementFragment.kt

@@ -2,6 +2,7 @@ package com.grkj.iscs_mc.view.fragment
 
 import com.grkj.iscs_mc.R
 import com.grkj.iscs_mc.databinding.FragmentMaterialReplacementBinding
+import com.grkj.iscs_mc.extentions.navigateTo
 import com.grkj.iscs_mc.extentions.navigateUp
 import com.grkj.iscs_mc.view.base.BaseMvpFragment
 import com.grkj.iscs_mc.view.iview.IMaterialReplacementView
@@ -27,6 +28,8 @@ class MaterialReplacementFragment :
 
             }
         }
+
+        navigateTo(MaterialReplacementFragmentDirections.actionReplacementFragmentToReplacementRecordFragment())
     }
 
     override fun initPresenter(): MaterialReplacementPresenter {

+ 48 - 0
app/src/main/java/com/grkj/iscs_mc/view/fragment/MaterialReplacementRecordFragment.kt

@@ -0,0 +1,48 @@
+package com.grkj.iscs_mc.view.fragment
+
+import com.grkj.iscs_mc.R
+import com.grkj.iscs_mc.databinding.FragmentMaterialReplacementRecordBinding
+import com.grkj.iscs_mc.extentions.navigateUp
+import com.grkj.iscs_mc.view.base.BaseMvpFragment
+import com.grkj.iscs_mc.view.iview.IMaterialReplacementRecordView
+import com.grkj.iscs_mc.view.presenter.MaterialReplacementRecordPresenter
+import com.zhy.adapter.recyclerview.CommonAdapter
+import com.zhy.adapter.recyclerview.base.ViewHolder
+
+/**
+ * 物资更换记录页
+ */
+class MaterialReplacementRecordFragment :
+    BaseMvpFragment<IMaterialReplacementRecordView, MaterialReplacementRecordPresenter, FragmentMaterialReplacementRecordBinding>() {
+
+    override val viewBinding: FragmentMaterialReplacementRecordBinding
+        get() = FragmentMaterialReplacementRecordBinding.inflate(layoutInflater)
+
+    override fun initView() {
+        mBinding?.cbBack?.setOnClickListener { navigateUp() }
+
+        mBinding?.rvRecord?.adapter = object : CommonAdapter<String>(
+            requireContext(),
+            R.layout.item_rv_replacement_record,
+            mutableListOf()
+        ) {
+            override fun convert(holder: ViewHolder, t: String, position: Int) {
+                val recyclerView =
+                    holder.getView<androidx.recyclerview.widget.RecyclerView>(R.id.rv_record_detail)
+                recyclerView.adapter = object : CommonAdapter<String>(
+                    requireContext(),
+                    R.layout.item_rv_replacement,
+                    mutableListOf()
+                ) {
+                    override fun convert(holder: ViewHolder, t: String, position: Int) {
+
+                    }
+                }
+            }
+        }
+    }
+
+    override fun initPresenter(): MaterialReplacementRecordPresenter {
+        return MaterialReplacementRecordPresenter()
+    }
+}

+ 6 - 0
app/src/main/java/com/grkj/iscs_mc/view/iview/IMaterialReplacementRecordView.kt

@@ -0,0 +1,6 @@
+package com.grkj.iscs_mc.view.iview
+
+import com.grkj.iscs_mc.view.base.IView
+
+interface IMaterialReplacementRecordView : IView {
+}

+ 7 - 0
app/src/main/java/com/grkj/iscs_mc/view/presenter/MaterialReplacementRecordPresenter.kt

@@ -0,0 +1,7 @@
+package com.grkj.iscs_mc.view.presenter
+
+import com.grkj.iscs_mc.view.base.BasePresenter
+import com.grkj.iscs_mc.view.iview.IMaterialReplacementRecordView
+
+class MaterialReplacementRecordPresenter : BasePresenter<IMaterialReplacementRecordView>() {
+}

+ 4 - 2
app/src/main/res/layout/fragment_material_inspection_table.xml

@@ -202,7 +202,8 @@
 
                 <androidx.recyclerview.widget.RecyclerView
                     android:id="@+id/rv_material"
-                    style="@style/CommonRecyclerView" />
+                    style="@style/CommonRecyclerView"
+                    android:scrollbars="vertical" />
             </LinearLayout>
         </com.google.android.material.card.MaterialCardView>
 
@@ -235,7 +236,8 @@
 
                 <androidx.recyclerview.widget.RecyclerView
                     android:id="@+id/rv_standard"
-                    style="@style/CommonRecyclerView" />
+                    style="@style/CommonRecyclerView"
+                    android:scrollbars="vertical" />
 
             </LinearLayout>
         </com.google.android.material.card.MaterialCardView>

+ 56 - 0
app/src/main/res/layout/fragment_material_replacement_record.xml

@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    tools:context=".view.fragment.MaterialReplacementRecordFragment">
+
+    <com.grkj.iscs_mc.view.widget.TitleBar
+        android:id="@+id/tb"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        app:bar_icon="@mipmap/material_inspection_plan"
+        app:bar_title="@string/material_replacement" />
+
+    <com.grkj.iscs_mc.view.widget.CommonBtn
+        android:id="@+id/cb_back"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentRight="true"
+        android:layout_alignParentBottom="true"
+        app:btn_bg="@drawable/common_btn_blue_bg"
+        app:btn_name="@string/back" />
+
+    <com.google.android.material.card.MaterialCardView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_above="@id/cb_back"
+        android:layout_below="@id/tb"
+        android:layout_marginVertical="@dimen/common_spacing"
+        app:cardBackgroundColor="@color/common_bg_white_10"
+        app:cardCornerRadius="@dimen/common_radius"
+        app:cardElevation="0dp"
+        app:strokeColor="@color/common_transparent">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="vertical">
+
+            <TextView
+                style="@style/CommonTextView"
+                android:layout_width="match_parent"
+                android:background="@color/bar_bg"
+                android:gravity="left"
+                android:paddingVertical="@dimen/common_spacing"
+                android:paddingLeft="@dimen/common_spacing"
+                android:text="@string/material_replacement_record_title" />
+
+            <androidx.recyclerview.widget.RecyclerView
+                android:id="@+id/rv_record"
+                style="@style/CommonRecyclerView"
+                android:layout_margin="@dimen/common_spacing" />
+        </LinearLayout>
+    </com.google.android.material.card.MaterialCardView>
+</RelativeLayout>

+ 21 - 0
app/src/main/res/layout/item_rv_replacement_record.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/root"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical">
+
+    <TextView
+        android:id="@+id/tv_detail"
+        style="@style/CommonTextView" />
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/rv_record_detail"
+        style="@style/CommonRecyclerView"
+        android:orientation="horizontal" />
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/divider_line_width"
+        android:background="@color/main_color" />
+</LinearLayout>

+ 14 - 1
app/src/main/res/navigation/nav_graph.xml

@@ -76,7 +76,20 @@
     <fragment
         android:id="@+id/material_replacement_fragment"
         android:name="com.grkj.iscs_mc.view.fragment.MaterialReplacementFragment"
-        tools:layout="@layout/fragment_material_replacement" />
+        tools:layout="@layout/fragment_material_replacement">
+        <action
+            android:id="@+id/action_replacement_fragment_to_replacement_record_fragment"
+            app:destination="@id/material_replacement_record_fragment"
+            app:enterAnim="@anim/slide_in_right"
+            app:exitAnim="@anim/slide_out_left"
+            app:popEnterAnim="@anim/slide_in_left"
+            app:popExitAnim="@anim/slide_out_right" />
+    </fragment>
+
+    <fragment
+        android:id="@+id/material_replacement_record_fragment"
+        android:name="com.grkj.iscs_mc.view.fragment.MaterialReplacementRecordFragment"
+        tools:layout="@layout/fragment_material_replacement_record" />
 
     <fragment
         android:id="@+id/material_instruction_detail_fragment"

+ 1 - 0
app/src/main/res/values/colors.xml

@@ -39,4 +39,5 @@
     <color name="item_rv_step_bg_done">#1d7153</color>
     <color name="item_rv_step_bg_doing">#838a53</color>
     <color name="item_rv_step_bg_ready">#B3FFFFFF</color>
+    <color name="bar_bg">#3E6AA5</color>
 </resources>

+ 2 - 0
app/src/main/res/values/strings.xml

@@ -71,4 +71,6 @@
     <string name="method">措施</string>
     <string name="inspection_standard">检查标准</string>
     <string name="inspection_dialog_tip">将待检查的%d件物资,全部标注为:</string>
+
+    <string name="material_replacement_record_title">本次物资取还记录如下:</string>
 </resources>