瀏覽代碼

物资检查计划表页措施改成可填写

Frankensteinly 8 月之前
父節點
當前提交
e306acaf28

+ 1 - 1
app/src/main/java/com/grkj/iscs_mc/model/vo/inspection/InspectionCheckTableDataRespVO.kt

@@ -36,7 +36,7 @@ class InspectionCheckTableDataRespVO(
 
         val reason: String?,
 
-        val measure: String?,
+        var measure: String?,
 
         val delFlag: String?
     )

+ 29 - 1
app/src/main/java/com/grkj/iscs_mc/view/fragment/MaterialInspectionTableFragment.kt

@@ -1,5 +1,10 @@
 package com.grkj.iscs_mc.view.fragment
 
+import android.content.Context
+import android.text.Editable
+import android.text.TextWatcher
+import android.view.inputmethod.InputMethodManager
+import android.widget.EditText
 import androidx.navigation.fragment.navArgs
 import com.bumptech.glide.Glide
 import com.grkj.iscs_mc.R
@@ -57,7 +62,30 @@ class MaterialInspectionTableFragment :
                     vo.status = "2"
                     mBinding?.rvMaterial?.adapter?.notifyItemChanged(position)
                 }
-                holder.setText(R.id.tv_measure, vo.measure ?: "")
+//                holder.setText(R.id.tv_measure, vo.measure ?: "")
+                val et = holder.getView<EditText>(R.id.et_measure)
+                et.setText(vo.measure ?: "")
+                val textWatcher = object : TextWatcher {
+                    override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {}
+
+                    override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
+                        if (et.hasFocus()) {
+                            vo.measure = p0.toString()
+                        }
+                    }
+
+                    override fun afterTextChanged(p0: Editable?) {}
+
+                }
+                et.setOnFocusChangeListener { view, b ->
+                    if (b) {
+                        et.addTextChangedListener(textWatcher)
+                    } else {
+                        et.removeTextChangedListener(textWatcher)
+                        val imm = requireContext().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
+                        imm.hideSoftInputFromWindow(view.windowToken, 0)
+                    }
+                }
             }
         }
 

+ 14 - 4
app/src/main/res/layout/item_rv_inspection_table.xml

@@ -130,12 +130,22 @@
             android:layout_height="match_parent"
             android:background="@color/main_color" />
 
-        <TextView
-            android:id="@+id/tv_measure"
-            style="@style/CommonTextView"
+        <!--        <TextView-->
+        <!--            android:id="@+id/tv_measure"-->
+        <!--            style="@style/CommonTextView"-->
+        <!--            android:layout_width="0dp"-->
+        <!--            android:layout_weight="5"-->
+        <!--            android:paddingVertical="@dimen/common_spacing" />-->
+
+        <EditText
+            android:id="@+id/et_measure"
             android:layout_width="0dp"
+            android:layout_height="wrap_content"
             android:layout_weight="5"
-            android:paddingVertical="@dimen/common_spacing" />
+            android:background="@color/common_transparent"
+            android:paddingVertical="@dimen/common_spacing"
+            android:textColor="@color/white"
+            android:textSize="@dimen/common_text_size"/>
     </LinearLayout>
 
     <View