浏览代码

调整分配人员页效果

Frankensteinly 10 月之前
父节点
当前提交
f9dcd73f5b

+ 55 - 1
app/src/main/java/com/grkj/iscs/view/fragment/WorkerFragment.kt

@@ -1,22 +1,76 @@
 package com.grkj.iscs.view.fragment
 
+import android.view.View
+import android.widget.ImageView
+import com.grkj.iscs.R
 import com.grkj.iscs.databinding.FragmentWorkerBinding
 import com.grkj.iscs.view.base.BaseMvpFragment
 import com.grkj.iscs.view.iview.IWorkerView
 import com.grkj.iscs.view.presenter.WorkerPresenter
+import com.zhy.adapter.recyclerview.CommonAdapter
+import com.zhy.adapter.recyclerview.base.ViewHolder
 
 /**
  * 分配人员页
  */
-class WorkerFragment(val goBack: () -> Unit, val changePage: (Int) -> Unit) : BaseMvpFragment<IWorkerView, WorkerPresenter, FragmentWorkerBinding>() {
+class WorkerFragment(val goBack: () -> Unit, val changePage: (Int) -> Unit) :
+    BaseMvpFragment<IWorkerView, WorkerPresenter, FragmentWorkerBinding>() {
 
     override val viewBinding: FragmentWorkerBinding
         get() = FragmentWorkerBinding.inflate(layoutInflater)
 
     override fun initView() {
+        mBinding?.layoutLocker?.ivPhoto?.isSelected = true
         mBinding?.cbBack?.setOnClickListener {
             goBack()
         }
+
+        // TODO 测试数据
+        val list = mutableListOf<String>()
+        for (i in 0..25) {
+            list.add("$i")
+        }
+
+        mBinding?.rvWorkerSelected?.adapter =
+            object : CommonAdapter<String>(requireActivity(), R.layout.item_rv_worker, list) {
+                override fun convert(holder: ViewHolder, t: String, position: Int) {
+                    holder.getView<ImageView>(R.id.iv_photo).isSelected = true
+                    holder.setText(R.id.tv_name, t)
+                }
+            }
+
+        mBinding?.tvLockerSelect?.setOnClickListener {
+            mBinding?.llLocker?.visibility = View.VISIBLE
+            mBinding?.llColockerInside?.visibility = View.GONE
+            mBinding?.llColockerOutside?.visibility = View.GONE
+        }
+
+        mBinding?.tvColockerSelect?.setOnClickListener {
+            mBinding?.llLocker?.visibility = View.GONE
+            mBinding?.llColockerInside?.visibility = View.VISIBLE
+            mBinding?.llColockerOutside?.visibility = View.VISIBLE
+        }
+
+        mBinding?.rvLockerList?.adapter =
+            object : CommonAdapter<String>(requireActivity(), R.layout.item_rv_worker, list) {
+                override fun convert(holder: ViewHolder, t: String, position: Int) {
+                    holder.setText(R.id.tv_name, t)
+                }
+            }
+
+        mBinding?.rvLockerInside?.adapter =
+            object : CommonAdapter<String>(requireActivity(), R.layout.item_rv_worker, list) {
+                override fun convert(holder: ViewHolder, t: String, position: Int) {
+                    holder.setText(R.id.tv_name, t)
+                }
+            }
+
+        mBinding?.rvLockerOutside?.adapter =
+            object : CommonAdapter<String>(requireActivity(), R.layout.item_rv_worker, list) {
+                override fun convert(holder: ViewHolder, t: String, position: Int) {
+                    holder.setText(R.id.tv_name, t)
+                }
+            }
     }
 
     override fun initPresenter(): WorkerPresenter {

+ 2 - 2
app/src/main/res/layout/dialog_tip.xml

@@ -30,7 +30,7 @@
             android:layout_height="wrap_content"
             android:layout_alignParentBottom="true"
             android:layout_centerHorizontal="true"
-            android:layout_marginBottom="@dimen/common_padding"
+            android:layout_marginBottom="@dimen/common_spacing"
             android:orientation="horizontal">
 
             <TextView
@@ -46,7 +46,7 @@
                 style="@style/CommonBtnBlue"
                 android:layout_width="80dp"
                 android:layout_height="25dp"
-                android:layout_marginLeft="@dimen/common_padding"
+                android:layout_marginLeft="@dimen/common_spacing"
                 android:backgroundTint="#99FF0000"
                 android:text="@string/cancel" />
         </LinearLayout>

+ 2 - 2
app/src/main/res/layout/fragment_step.xml

@@ -21,7 +21,7 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_alignParentBottom="true"
-        android:layout_marginRight="@dimen/common_padding"
+        android:layout_marginRight="@dimen/common_spacing"
         android:layout_toLeftOf="@id/cb_back"
         app:btn_bg="@drawable/common_btn_red_bg"
         app:btn_icon="@mipmap/stop"
@@ -31,7 +31,7 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_above="@id/cb_cancel"
-        android:layout_marginBottom="@dimen/common_padding"
+        android:layout_marginBottom="@dimen/common_spacing"
         android:background="@drawable/item_rv_technology_sop_bg_normal"
         android:padding="5dp">
 

+ 4 - 4
app/src/main/res/layout/fragment_technology_sop.xml

@@ -24,21 +24,21 @@
         android:layout_toLeftOf="@id/cb_start"
         android:gravity="left|center_vertical"
         android:text="@string/current_sop"
-        android:layout_marginRight="@dimen/common_padding"/>
+        android:layout_marginRight="@dimen/common_spacing"/>
 
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_above="@id/tv_selected"
-        android:layout_marginBottom="@dimen/common_padding"
+        android:layout_marginBottom="@dimen/common_spacing"
         android:background="@drawable/item_rv_technology_sop_bg_normal"
         android:orientation="vertical"
-        android:padding="@dimen/common_padding">
+        android:padding="@dimen/common_spacing">
 
         <TextView
             android:id="@+id/tv_title"
             style="@style/CommonTextView"
-            android:layout_marginLeft="@dimen/common_padding" />
+            android:layout_marginLeft="@dimen/common_spacing" />
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/rv_technology"

+ 71 - 13
app/src/main/res/layout/fragment_worker.xml

@@ -21,7 +21,7 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_alignParentBottom="true"
-        android:layout_marginRight="@dimen/common_padding"
+        android:layout_marginRight="@dimen/common_spacing"
         android:layout_toLeftOf="@id/cb_back"
         app:btn_bg="@drawable/common_btn_red_bg"
         app:btn_icon="@mipmap/stop"
@@ -31,9 +31,10 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_above="@id/cb_cancel"
+        android:layout_marginBottom="@dimen/common_spacing"
         android:background="@drawable/item_rv_technology_sop_bg_normal"
         android:orientation="horizontal"
-        android:padding="@dimen/common_padding">
+        android:padding="@dimen/common_spacing">
 
         <TextView
             android:id="@+id/tv_title"
@@ -74,13 +75,13 @@
             android:id="@+id/ll_selected"
             android:layout_width="0dp"
             android:layout_height="0dp"
-            android:layout_marginRight="@dimen/common_padding"
+            android:layout_marginRight="@dimen/common_spacing"
             android:background="@drawable/item_rv_technology_sop_bg_normal"
             android:gravity="center_horizontal"
             android:orientation="vertical"
             android:padding="5dp"
             app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintHorizontal_weight="300"
+            app:layout_constraintHorizontal_weight="380"
             app:layout_constraintLeft_toLeftOf="parent"
             app:layout_constraintRight_toLeftOf="@id/ll_list"
             app:layout_constraintTop_toBottomOf="@id/tv_title">
@@ -89,7 +90,7 @@
             <com.google.android.material.card.MaterialCardView
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_marginBottom="@dimen/common_padding"
+                android:layout_marginBottom="@dimen/common_spacing"
                 app:cardBackgroundColor="@color/common_bg_white_10"
                 app:cardCornerRadius="@dimen/common_radius"
                 app:cardElevation="0dp"
@@ -117,7 +118,7 @@
                         android:id="@+id/tv_locker_select"
                         style="@style/CommonTextView"
                         android:background="@drawable/select_btn_bg"
-                        android:paddingHorizontal="@dimen/common_padding"
+                        android:paddingHorizontal="@dimen/common_spacing"
                         android:paddingVertical="3dp"
                         android:text="@string/select"
                         android:textSize="@dimen/common_text_size_small"
@@ -136,7 +137,7 @@
             <com.google.android.material.card.MaterialCardView
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_marginTop="@dimen/common_padding"
+                android:layout_marginVertical="@dimen/common_spacing"
                 app:cardBackgroundColor="@color/common_bg_white_10"
                 app:cardCornerRadius="@dimen/common_radius"
                 app:cardElevation="0dp"
@@ -164,7 +165,7 @@
                         android:id="@+id/tv_colocker_select"
                         style="@style/CommonTextView"
                         android:background="@drawable/select_btn_bg"
-                        android:paddingHorizontal="@dimen/common_padding"
+                        android:paddingHorizontal="@dimen/common_spacing"
                         android:paddingVertical="3dp"
                         android:text="@string/select"
                         android:textSize="@dimen/common_text_size_small"
@@ -188,17 +189,74 @@
             android:layout_height="0dp"
             android:background="@drawable/item_rv_technology_sop_bg_normal"
             android:orientation="vertical"
+            android:padding="@dimen/common_spacing"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintHorizontal_weight="1150"
             app:layout_constraintLeft_toRightOf="@id/ll_selected"
             app:layout_constraintRight_toRightOf="parent"
             app:layout_constraintTop_toTopOf="@id/ll_selected">
 
-            <androidx.recyclerview.widget.RecyclerView
-                android:id="@+id/rv_worker_list"
-                style="@style/CommonRecyclerView"
-                app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
-                app:spanCount="10" />
+            <LinearLayout
+                android:id="@+id/ll_locker"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:orientation="vertical"
+                android:visibility="gone">
+
+                <TextView
+                    style="@style/CommonTextView"
+                    android:layout_marginBottom="@dimen/common_spacing_small"
+                    android:text="@string/select_locker" />
+
+                <androidx.recyclerview.widget.RecyclerView
+                    android:id="@+id/rv_locker_list"
+                    style="@style/CommonRecyclerView"
+                    android:layout_height="wrap_content"
+                    app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
+                    app:spanCount="10" />
+            </LinearLayout>
+
+            <LinearLayout
+                android:id="@+id/ll_colocker_inside"
+                android:layout_width="match_parent"
+                android:layout_height="0dp"
+                android:layout_weight="1"
+                android:orientation="vertical"
+                android:visibility="gone">
+
+                <TextView
+                    style="@style/CommonTextView"
+                    android:layout_marginBottom="@dimen/common_spacing_small"
+                    android:text="@string/select_coloker_mars" />
+
+                <androidx.recyclerview.widget.RecyclerView
+                    android:id="@+id/rv_locker_inside"
+                    style="@style/CommonRecyclerView"
+                    android:layout_height="wrap_content"
+                    app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
+                    app:spanCount="10" />
+            </LinearLayout>
+
+            <LinearLayout
+                android:id="@+id/ll_colocker_outside"
+                android:layout_width="match_parent"
+                android:layout_height="0dp"
+                android:layout_weight="1"
+                android:orientation="vertical"
+                android:visibility="gone">
+
+                <TextView
+                    style="@style/CommonTextView"
+                    android:layout_marginVertical="@dimen/common_spacing_small"
+                    android:text="@string/select_coloker_outside" />
+
+                <androidx.recyclerview.widget.RecyclerView
+                    android:id="@+id/rv_locker_outside"
+                    style="@style/CommonRecyclerView"
+                    android:layout_height="wrap_content"
+                    app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
+                    app:spanCount="10" />
+            </LinearLayout>
         </LinearLayout>
     </androidx.constraintlayout.widget.ConstraintLayout>
 </RelativeLayout>

+ 1 - 1
app/src/main/res/layout/item_rv_step.xml

@@ -12,7 +12,7 @@
         android:background="@drawable/item_rv_technology_sop_bg_normal"
         android:gravity="center"
         android:orientation="vertical"
-        android:padding="@dimen/common_padding">
+        android:padding="@dimen/common_spacing">
 
         <LinearLayout
             android:layout_width="wrap_content"

+ 1 - 0
app/src/main/res/layout/item_rv_worker.xml

@@ -3,6 +3,7 @@
     android:id="@+id/root"
     android:layout_width="30dp"
     android:layout_height="31dp"
+    android:layout_margin="2dp"
     android:background="@drawable/item_rv_technology_sop_bg_normal"
     android:gravity="center"
     android:orientation="vertical">

+ 2 - 2
app/src/main/res/values/dimens.xml

@@ -7,8 +7,8 @@
     <dimen name="common_font_txt_size_page_title">14dp</dimen>
     <dimen name="common_radius">10dp</dimen>
     <dimen name="common_radius_small">5dp</dimen>
-    <dimen name="common_padding">10dp</dimen>
-    <dimen name="common_padding_small">5dp</dimen>
+    <dimen name="common_spacing">10dp</dimen>
+    <dimen name="common_spacing_small">5dp</dimen>
     <dimen name="common_icon_size_small">12dp</dimen>
 
     <dimen name="common_btn_width">150dp</dimen>

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

@@ -143,4 +143,7 @@
     <string name="locker">上锁人</string>
     <string name="colocker">共锁人</string>
     <string name="select">选择</string>
+    <string name="select_locker">选择上锁人</string>
+    <string name="select_coloker_mars">选择共锁人(玛氏)</string>
+    <string name="select_coloker_outside">选择共锁人(外部)</string>
 </resources>