Explorar o código

SelectableInput兼容更多场景;完善异常上报页面

Frankensteinly hai 8 meses
pai
achega
76a0c94f7d

+ 3 - 1
app/src/main/java/com/grkj/iscs_mc/model/vo/material/MaterialInstructionListRespVO.kt

@@ -31,6 +31,8 @@ data class MaterialInstructionListRespVO(
 
         val status: String?,
 
-        val orderNum: Int?
+        val orderNum: Int?,
+
+        val remark: String?
     )
 }

+ 5 - 0
app/src/main/java/com/grkj/iscs_mc/util/CommonUtils.kt

@@ -23,6 +23,11 @@ object CommonUtils {
         return (dpValue * density + 0.5f).toInt()
     }
 
+    fun px2dip(pxValue: Float): Float {
+        val density = MyApplication.instance!!.resources.displayMetrics.density
+        return pxValue / density
+    }
+
     fun checkPermission(activity: AppCompatActivity, permissions: Array<String>, callBack: () -> Unit) {
         val isPermission = EasyPermissions.hasPermissions(activity, *permissions)
         if (isPermission) {

+ 0 - 1
app/src/main/java/com/grkj/iscs_mc/view/fragment/ExceptionReportFragment.kt

@@ -12,7 +12,6 @@ import com.grkj.iscs_mc.view.presenter.ExceptionReportPresenter
 class ExceptionReportFragment :
     BaseMvpFragment<IExceptionReportView, ExceptionReportPresenter, FragmentExceptionReportBinding>() {
 
-
     override val viewBinding: FragmentExceptionReportBinding
         get() = FragmentExceptionReportBinding.inflate(layoutInflater)
 

+ 14 - 0
app/src/main/java/com/grkj/iscs_mc/view/widget/SelectableInput.kt

@@ -15,6 +15,7 @@ import androidx.appcompat.content.res.AppCompatResources
 import com.grkj.iscs_mc.R
 import com.grkj.iscs_mc.databinding.LayoutSelectableInputBinding
 import com.grkj.iscs_mc.databinding.LayoutSelectableinputSpinnerBinding
+import com.grkj.iscs_mc.util.CommonUtils
 import com.manu.mdatepicker.MDatePicker
 import com.zhy.adapter.recyclerview.CommonAdapter
 import com.zhy.adapter.recyclerview.base.ViewHolder
@@ -57,11 +58,24 @@ class SelectableInput(private val ctx: Context, attrs: AttributeSet) : LinearLay
         mBinding.tvName.text = attrSet.getString(R.styleable.SelectableInput_name)
         mBinding.et.hint = attrSet.getString(R.styleable.SelectableInput_edittext_hint)
 
+        val textSize = attrSet.getDimension(R.styleable.SelectableInput_text_size, -1f)
+        if (textSize != -1f) {
+            mBinding.tvPrefix.textSize = CommonUtils.px2dip(textSize)
+            mBinding.tvName.textSize = CommonUtils.px2dip(textSize)
+            mBinding.et.textSize = CommonUtils.px2dip(textSize)
+        }
+
         val editWidth = attrSet.getDimensionPixelSize(R.styleable.SelectableInput_edit_width, -1)
         if (editWidth != -1) {
             mBinding.et.width = editWidth
         }
 
+        val editHeight = attrSet.getDimensionPixelSize(R.styleable.SelectableInput_edit_height, -1)
+        if (editHeight != -1) {
+            mBinding.et.height = editHeight
+            mBinding.et.gravity = Gravity.LEFT
+        }
+
         attrSet.recycle()
     }
 

+ 36 - 3
app/src/main/res/layout/fragment_exception_report.xml

@@ -32,14 +32,47 @@
         app:btn_bg="@drawable/common_btn_red_bg"
         app:btn_name="@string/submit" />
 
-    <RelativeLayout
+    <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_above="@id/cb_back"
         android:layout_below="@id/tb"
         android:layout_marginVertical="@dimen/common_spacing"
         android:background="@drawable/item_rv_technology_sop_bg_normal"
-        android:padding="@dimen/common_spacing_small">
+        android:orientation="vertical"
+        android:padding="@dimen/common_spacing">
 
-    </RelativeLayout>
+        <com.grkj.iscs_mc.view.widget.SelectableInput
+            android:id="@+id/ci_type"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginVertical="@dimen/common_spacing"
+            app:edit_width="200dp"
+            app:mode="select"
+            app:name="@string/exception_report_type"
+            app:required="true"
+            app:text_size="@dimen/common_text_size" />
+
+        <com.grkj.iscs_mc.view.widget.SelectableInput
+            android:id="@+id/ci_level"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginVertical="@dimen/common_spacing"
+            app:edit_width="200dp"
+            app:mode="select"
+            app:name="@string/exception_report_level"
+            app:required="true"
+            app:text_size="@dimen/common_text_size" />
+
+        <com.grkj.iscs_mc.view.widget.SelectableInput
+            android:id="@+id/ci_description"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginVertical="@dimen/common_spacing"
+            app:edit_height="200dp"
+            app:mode="input"
+            app:name="@string/exception_report_description"
+            app:required="false"
+            app:text_size="@dimen/common_text_size" />
+    </LinearLayout>
 </RelativeLayout>

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

@@ -17,6 +17,8 @@
         <attr name="edittext_hint" format="string" />
         <attr name="enabled" format="boolean" />
         <attr name="edit_width" format="dimension" />
+        <attr name="edit_height" format="dimension" />
+        <attr name="text_size" format="dimension" />
     </declare-styleable>
 
     <declare-styleable name="CommonBtn">

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

@@ -123,4 +123,8 @@
     <string name="auto_replacement_tip">请取出要被替换的物资,并放入新物资……</string>
 
     <string name="manual_replacement_submit_confirm_tip">确定要手动更换记录吗?</string>
+    
+    <string name="exception_report_type">异常类型:</string>
+    <string name="exception_report_level">严重等级:</string>
+    <string name="exception_report_description">异常描述:</string>
 </resources>