Pārlūkot izejas kodu

调整八大步骤页面

Frankensteinly 10 mēneši atpakaļ
vecāks
revīzija
d879ecabbd

+ 5 - 1
app/src/main/java/com/grkj/iscs/view/fragment/JobExecutionFragment.kt

@@ -20,7 +20,7 @@ class JobExecutionFragment :
 
     override fun initView() {
         mMenuList = mutableListOf(
-            Menu(fragment = StepFragment()),
+            Menu(fragment = StepFragment { refreshPage() }),
             Menu(fragment = WorkerFragment()),
             Menu(fragment = JobProgressFragment())
         )
@@ -32,4 +32,8 @@ class JobExecutionFragment :
     override fun initPresenter(): JobExecutionPresenter {
         return JobExecutionPresenter()
     }
+
+    fun refreshPage() {
+        mBinding?.vp?.currentItem = 0
+    }
 }

+ 26 - 11
app/src/main/java/com/grkj/iscs/view/fragment/StepFragment.kt

@@ -12,7 +12,7 @@ import com.zhy.adapter.recyclerview.base.ViewHolder
 /**
  * 作业票执行步骤页 - 八大步骤
  */
-class StepFragment : BaseMvpFragment<IStepView, StepPresenter, FragmentStepBinding>() {
+class StepFragment(val goBack: () -> Unit) : BaseMvpFragment<IStepView, StepPresenter, FragmentStepBinding>() {
 
     private lateinit var mStepList: MutableList<StepBO>
 
@@ -21,14 +21,14 @@ class StepFragment : BaseMvpFragment<IStepView, StepPresenter, FragmentStepBindi
 
     override fun initView() {
         mStepList = mutableListOf(
-            StepBO(R.mipmap.icon1, getString(R.string.recognize_work_content), false, 1),
-            StepBO(R.mipmap.icon1, getString(R.string.power_isolation_way), false, 2),
-            StepBO(R.mipmap.icon1, getString(R.string.notice_worker), false, 3),
-            StepBO(R.mipmap.icon1, getString(R.string.shutdown), false, 4),
-            StepBO(R.mipmap.icon1, getString(R.string.unlock_and_restore_switch), false, 8),
-            StepBO(R.mipmap.icon1, getString(R.string.check_before_unlocking), false, 7),
-            StepBO(R.mipmap.icon1, getString(R.string.ensure_power_isolation), false, 6),
-            StepBO(R.mipmap.icon1, getString(R.string.lock_and_hang_a_sign), false, 5)
+            StepBO(R.mipmap.step1, getString(R.string.recognize_work_content), false, 1, "①"),
+            StepBO(R.mipmap.step2, getString(R.string.power_isolation_way), false, 2, "②"),
+            StepBO(R.mipmap.step3, getString(R.string.notice_worker), false, 3, "③"),
+            StepBO(R.mipmap.step4, getString(R.string.shutdown), false, 4, "④"),
+            StepBO(R.mipmap.step5, getString(R.string.unlock_and_restore_switch), false, 8, "⑧"),
+            StepBO(R.mipmap.step6, getString(R.string.check_before_unlocking), false, 7, "⑦"),
+            StepBO(R.mipmap.step7, getString(R.string.ensure_power_isolation), false, 6, "⑥"),
+            StepBO(R.mipmap.step8, getString(R.string.lock_and_hang_a_sign), false, 5, "⑤")
         )
         mBinding?.rvStep?.adapter = object : CommonAdapter<StepBO>(requireContext(), R.layout.item_rv_step, mStepList) {
             override fun convert(holder: ViewHolder, step: StepBO, position: Int) {
@@ -40,15 +40,30 @@ class StepFragment : BaseMvpFragment<IStepView, StepPresenter, FragmentStepBindi
                 } else if (step.index > 5) {
                     holder.getView<ImageView>(R.id.iv_arrow_right).rotation = 180f
                 }
-                holder.setText(R.id.tv_index, step.index.toString())
+                holder.getView<ImageView>(R.id.iv_icon).setImageResource(step.pic)
+                holder.setText(R.id.tv_name, step.title)
+                holder.setText(R.id.tv_index, step.indexStr)
+                holder.getView<ImageView>(R.id.iv_status).setImageResource(if (step.isDone) R.mipmap.step_executed else R.mipmap.step_not_executed)
                 holder.setText(R.id.tv_status, if (step.isDone) getString(R.string.executed) else getString(R.string.not_executed))
             }
         }
+
+        mBinding?.cbBack?.setOnClickListener {
+            goBack()
+        }
+
+        mBinding?.cbCancel?.setOnClickListener {
+
+        }
+    }
+
+    fun refreshPage() {
+
     }
 
     override fun initPresenter(): StepPresenter {
         return StepPresenter()
     }
 
-    data class StepBO(val pic: Int, val title: String, val isDone: Boolean = false, val index: Int)
+    data class StepBO(val pic: Int, val title: String, val isDone: Boolean = false, val index: Int, val indexStr: String)
 }

+ 107 - 58
app/src/main/res/layout/fragment_step.xml

@@ -6,75 +6,124 @@
     android:layout_height="match_parent"
     tools:context=".view.fragment.StepFragment">
 
-    <TextView
-        android:id="@+id/tv_title"
-        style="@style/CommonTextView" />
-
-    <TextView
-        android:id="@+id/tv_worker"
-        style="@style/CommonTextView"
-        android:layout_alignParentRight="true" />
-
-    <ImageView
-        android:id="@+id/iv_worker"
+    <com.grkj.iscs.view.widget.CommonBtn
+        android:id="@+id/cb_back"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_toLeftOf="@id/tv_worker" />
-
-    <TextView
-        android:id="@+id/tv_lock"
-        style="@style/CommonTextView"
-        android:layout_toLeftOf="@id/iv_worker" />
+        android:layout_alignParentRight="true"
+        android:layout_alignParentBottom="true"
+        app:btn_bg="@drawable/common_btn_blue_bg"
+        app:btn_icon="@mipmap/go_back"
+        app:btn_name="@string/back" />
 
-    <ImageView
+    <com.grkj.iscs.view.widget.CommonBtn
+        android:id="@+id/cb_cancel"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_toLeftOf="@id/tv_lock" />
+        android:layout_alignParentBottom="true"
+        android:layout_marginRight="@dimen/common_padding"
+        android:layout_toLeftOf="@id/cb_back"
+        app:btn_bg="@drawable/common_btn_red_bg"
+        app:btn_icon="@mipmap/stop"
+        app:btn_name="@string/cancel_the_job" />
 
-    <LinearLayout
-        android:id="@+id/ll_container"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/tv_title"
-        android:orientation="vertical">
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_above="@id/cb_cancel"
+        android:layout_marginBottom="@dimen/common_padding"
+        android:background="@drawable/item_rv_technology_sop_bg_normal"
+        android:padding="5dp">
 
-        <!-- 工艺图 -->
-        <RelativeLayout
-            android:layout_width="match_parent"
-            android:layout_height="0dp"
-            android:layout_weight="1">
+        <TextView
+            android:id="@+id/tv_title"
+            style="@style/CommonTextView"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <TextView
+            android:id="@+id/tv_lock"
+            style="@style/CommonTextView"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
 
-        </RelativeLayout>
+        <ImageView
+            android:id="@+id/iv_lock"
+            android:layout_width="12dp"
+            android:layout_height="12dp"
+            android:src="@mipmap/ticket_lock"
+            app:layout_constraintRight_toLeftOf="@id/tv_lock"
+            app:layout_constraintTop_toTopOf="parent" />
 
-        <!-- 锁定站 -->
-        <RelativeLayout
-            android:layout_width="match_parent"
+        <TextView
+            android:id="@+id/tv_worker"
+            style="@style/CommonTextView"
+            app:layout_constraintRight_toLeftOf="@id/iv_lock"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <ImageView
+            android:id="@+id/iv_worker"
+            android:layout_width="12dp"
+            android:layout_height="12dp"
+            android:src="@mipmap/ticket_worker"
+            app:layout_constraintRight_toLeftOf="@id/tv_worker"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <LinearLayout
+            android:id="@+id/ll_container"
+            android:layout_width="0dp"
             android:layout_height="0dp"
-            android:layout_weight="2">
+            android:background="@drawable/item_rv_technology_sop_bg_normal"
+            android:orientation="vertical"
+            android:padding="2dp"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintHorizontal_weight="300"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintRight_toLeftOf="@id/rv_step"
+            app:layout_constraintTop_toBottomOf="@id/tv_title">
 
-        </RelativeLayout>
-    </LinearLayout>
+            <!-- 工艺图 -->
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="0dp"
+                android:layout_weight="1"
+                android:gravity="center_horizontal"
+                android:orientation="vertical">
 
-    <TextView
-        android:id="@+id/tv_back"
-        style="@style/CommonBtn"
-        android:layout_alignParentRight="true"
-        android:layout_alignParentBottom="true"
-        android:text="@string/back" />
+                <TextView
+                    style="@style/CommonTextView"
+                    android:background="@drawable/common_btn_blue_bg"
+                    android:text="@string/machinery_pic" />
 
-    <TextView
-        android:id="@+id/tv_cancel"
-        style="@style/CommonBtn"
-        android:layout_alignParentBottom="true"
-        android:layout_toLeftOf="@id/tv_back"
-        android:text="@string/cancel_the_job" />
-
-    <androidx.recyclerview.widget.RecyclerView
-        android:id="@+id/rv_step"
-        style="@style/CommonRecyclerView"
-        android:layout_above="@id/tv_cancel"
-        android:layout_below="@id/tv_title"
-        android:layout_toRightOf="@id/ll_container"
-        app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
-        app:spanCount="4" />
+            </LinearLayout>
+
+            <!-- 锁定站 -->
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="0dp"
+                android:layout_weight="1"
+                android:gravity="center_horizontal"
+                android:orientation="vertical">
+
+                <TextView
+                    style="@style/CommonTextView"
+                    android:background="@drawable/common_btn_blue_bg"
+                    android:text="@string/lock_station" />
+
+            </LinearLayout>
+        </LinearLayout>
+
+        <androidx.recyclerview.widget.RecyclerView
+            android:id="@+id/rv_step"
+            style="@style/CommonRecyclerView"
+            android:layout_width="0dp"
+            android:layout_height="0dp"
+            app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintHorizontal_weight="1150"
+            app:layout_constraintLeft_toRightOf="@id/ll_container"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toBottomOf="@id/tv_title"
+            app:spanCount="4" />
+    </androidx.constraintlayout.widget.ConstraintLayout>
 </RelativeLayout>

+ 36 - 16
app/src/main/res/layout/item_rv_step.xml

@@ -1,27 +1,45 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/root"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content">
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_marginLeft="5dp">
 
     <LinearLayout
         android:id="@+id/ll_step"
         android:layout_width="@dimen/item_rv_step_width"
         android:layout_height="@dimen/item_rv_step_height"
-        android:orientation="vertical">
+        android:background="@drawable/item_rv_technology_sop_bg_normal"
+        android:gravity="center"
+        android:orientation="vertical"
+        android:padding="@dimen/common_padding">
 
-        <TextView
-            android:id="@+id/tv_status"
-            style="@style/CommonTextView" />
+        <LinearLayout
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+
+            <ImageView
+                android:id="@+id/iv_status"
+                android:layout_width="12dp"
+                android:layout_height="12dp" />
+
+            <TextView
+                android:id="@+id/tv_status"
+                style="@style/CommonTextView"
+                android:layout_marginLeft="5dp" />
+        </LinearLayout>
 
         <ImageView
             android:id="@+id/iv_icon"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content" />
+            android:layout_width="58dp"
+            android:layout_height="34dp"
+            android:layout_marginTop="5dp" />
 
         <TextView
             android:id="@+id/tv_name"
-            style="@style/CommonTextView" />
+            style="@style/CommonTextView"
+            android:layout_marginVertical="5dp" />
 
         <TextView
             android:id="@+id/tv_index"
@@ -30,19 +48,21 @@
 
     <ImageView
         android:id="@+id/iv_arrow_right"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
+        android:layout_width="15dp"
+        android:layout_height="15dp"
         android:layout_centerVertical="true"
+        android:layout_marginLeft="5dp"
         android:layout_toRightOf="@id/ll_step"
-        android:background="@mipmap/back" />
+        android:src="@mipmap/arrow" />
 
     <ImageView
         android:id="@+id/iv_arrow_bottom"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
+        android:layout_width="13dp"
+        android:layout_height="13dp"
         android:layout_below="@id/ll_step"
         android:layout_centerHorizontal="true"
-        android:background="@mipmap/back"
-        android:rotation="270"
+        android:layout_marginVertical="5dp"
+        android:background="@mipmap/arrow"
+        android:rotation="90"
         android:visibility="gone" />
 </RelativeLayout>

+ 2 - 1
app/src/main/res/layout/layout_common_btn.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="wrap_content"
+    android:layout_width="80dp"
     android:layout_height="wrap_content"
     android:gravity="center_vertical"
     android:orientation="horizontal"
@@ -14,5 +14,6 @@
     <TextView
         android:id="@+id/tv_name"
         style="@style/CommonTextView"
+        android:layout_width="match_parent"
         android:layout_marginLeft="5dp" />
 </LinearLayout>

BIN
app/src/main/res/mipmap/arrow.png


BIN
app/src/main/res/mipmap/go_back.png


BIN
app/src/main/res/mipmap/step1.png


BIN
app/src/main/res/mipmap/step2.png


BIN
app/src/main/res/mipmap/step3.png


BIN
app/src/main/res/mipmap/step4.png


BIN
app/src/main/res/mipmap/step5.png


BIN
app/src/main/res/mipmap/step6.png


BIN
app/src/main/res/mipmap/step7.png


BIN
app/src/main/res/mipmap/step8.png


BIN
app/src/main/res/mipmap/step_executed.png


BIN
app/src/main/res/mipmap/step_not_executed.png


BIN
app/src/main/res/mipmap/stop.png


BIN
app/src/main/res/mipmap/ticket_lock.png


BIN
app/src/main/res/mipmap/ticket_worker.png


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

@@ -69,8 +69,8 @@
     <dimen name="dialog_tip_width">256dp</dimen>
     <dimen name="dialog_tip_height">144dp</dimen>
     
-    <dimen name="item_rv_step_width">45dp</dimen>
-    <dimen name="item_rv_step_height">80dp</dimen>
+    <dimen name="item_rv_step_width">80dp</dimen>
+    <dimen name="item_rv_step_height">108dp</dimen>
     <dimen name="item_rv_menu_size">58dp</dimen>
     <dimen name="item_rv_menu_icon_size">20dp</dimen>
     <dimen name="item_rv_login_width">100dp</dimen>

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

@@ -138,4 +138,6 @@
     <string name="please_scan_fingerprint">请刷指纹</string>
     <string name="login">登录</string>
     <string name="current_sop">当前SOP:%s</string>
+    <string name="machinery_pic">工艺图</string>
+    <string name="lock_station">锁定站</string>
 </resources>