浏览代码

添加物资更换item布局

Frankensteinly 9 月之前
父节点
当前提交
1dd3d3ba1f

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

@@ -1,9 +1,13 @@
 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.navigateUp
 import com.grkj.iscs_mc.view.base.BaseMvpFragment
 import com.grkj.iscs_mc.view.iview.IMaterialReplacementView
 import com.grkj.iscs_mc.view.presenter.MaterialReplacementPresenter
+import com.zhy.adapter.recyclerview.CommonAdapter
+import com.zhy.adapter.recyclerview.base.ViewHolder
 
 /**
  * 物资管理 - 物资更换
@@ -15,7 +19,14 @@ class MaterialReplacementFragment :
         get() = FragmentMaterialReplacementBinding.inflate(layoutInflater)
 
     override fun initView() {
+        mBinding?.cbBack?.setOnClickListener { navigateUp() }
 
+        mBinding?.rvMaterial?.adapter = object :
+            CommonAdapter<String>(requireContext(), R.layout.item_rv_replacement, mutableListOf()) {
+            override fun convert(holder: ViewHolder, t: String, position: Int) {
+
+            }
+        }
     }
 
     override fun initPresenter(): MaterialReplacementPresenter {

+ 6 - 0
app/src/main/res/drawable/common_btn_green_bg.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <corners android:radius="@dimen/common_radius_small" />
+    <solid android:color="@color/common_btn_green_bg" />
+</shape>

+ 52 - 2
app/src/main/res/layout/fragment_material_replacement.xml

@@ -1,8 +1,58 @@
 <?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<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.MaterialReplacementFragment">
 
-</FrameLayout>
+    <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_replacement"
+        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.grkj.iscs_mc.view.widget.CommonBtn
+        android:id="@+id/cb_auto_replace"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true"
+        android:layout_marginHorizontal="@dimen/common_spacing"
+        android:layout_toLeftOf="@id/cb_back"
+        app:btn_bg="@drawable/common_btn_red_bg"
+        app:btn_name="@string/auto_replace" />
+
+    <com.grkj.iscs_mc.view.widget.CommonBtn
+        android:id="@+id/cb_manual_replace"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true"
+        android:layout_toLeftOf="@id/cb_auto_replace"
+        app:btn_bg="@drawable/common_btn_green_bg"
+        app:btn_name="@string/manual_replace" />
+
+    <RelativeLayout
+        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">
+
+        <androidx.recyclerview.widget.RecyclerView
+            android:id="@+id/rv_material"
+            style="@style/CommonRecyclerView"
+            app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
+            app:spanCount="6" />
+    </RelativeLayout>
+</RelativeLayout>

+ 53 - 0
app/src/main/res/layout/item_rv_replacement.xml

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/root"
+    android:layout_width="@dimen/item_rv_material_base_width"
+    android:layout_height="@dimen/item_rv_material_base_height"
+    android:layout_margin="@dimen/item_rv_login_margin">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:gravity="center"
+        android:orientation="vertical"
+        android:padding="@dimen/common_spacing_small">
+
+        <ImageView
+            android:id="@+id/iv_icon"
+            android:layout_width="@dimen/item_rv_login_icon_size"
+            android:layout_height="@dimen/item_rv_login_icon_size"/>
+
+        <TextView
+            android:id="@+id/tv_name"
+            style="@style/CommonTextView"
+            android:layout_marginTop="8dp" />
+
+        <TextView
+            android:id="@+id/tv_rfid"
+            style="@style/CommonTextView"
+            android:textSize="@dimen/common_text_size_small"
+            android:layout_marginTop="@dimen/common_spacing_small" />
+    </LinearLayout>
+    
+    <RelativeLayout
+        android:id="@+id/rv_tip"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="@color/common_bg_white_60">
+        
+        <LinearLayout
+            android:layout_width="@dimen/item_rv_material_base_tip_width"
+            android:layout_height="@dimen/item_rv_material_base_tip_height"
+            android:orientation="horizontal"
+            android:layout_centerInParent="true">
+            <ImageView
+                android:id="@+id/iv_tip"
+                android:layout_width="@dimen/common_icon_size"
+                android:layout_height="@dimen/common_icon_size"/>
+
+            <TextView
+                style="@style/CommonTextView"
+                android:layout_marginLeft="@dimen/common_spacing_small"/>
+        </LinearLayout>
+    </RelativeLayout>
+</RelativeLayout>

二进制
app/src/main/res/mipmap/damaged.png


二进制
app/src/main/res/mipmap/expired.png


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

@@ -27,6 +27,7 @@
     <color name="dialog_card_login_bg">#990E57EA</color>
     <color name="home_menu_bg">#4D2B7AE9</color>
     <color name="common_btn_red_bg">#80FF0000</color>
+    <color name="common_btn_green_bg">#80047b0f</color>
     <color name="lock_status_unlocked">#99008000</color>
     <color name="lock_status_locked">#CCFF0000</color>
     <color name="point_text_bg">#70b26f</color>

+ 5 - 0
app/src/main/res/values/dimens.xml

@@ -44,4 +44,9 @@
 
     <dimen name="dialog_tip_width">256dp</dimen>
     <dimen name="dialog_tip_height">144dp</dimen>
+    
+    <dimen name="item_rv_material_base_width">71dp</dimen>
+    <dimen name="item_rv_material_base_height">92dp</dimen>
+    <dimen name="item_rv_material_base_tip_width">53dp</dimen>
+    <dimen name="item_rv_material_base_tip_height">27dp</dimen>
 </resources>

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

@@ -37,4 +37,11 @@
     <string name="action_confirm">操作确认</string>
     <string name="confirm">确定</string>
     <string name="cancel_countdown">取消(%d秒)</string>
+
+    <string name="back">返回</string>
+    <string name="auto_replace">自动更换</string>
+    <string name="manual_replace">手动更换</string>
+
+    <string name="expired">过期</string>
+    <string name="damaged">损坏</string>
 </resources>