ソースを参照

调整主页显示

Frankensteinly 1 年間 前
コミット
c82d3adab9

+ 14 - 0
app/src/main/java/com/grkj/iscs/activity/HomeActivity.kt

@@ -1,5 +1,6 @@
 package com.grkj.iscs.activity
 
+import android.content.Intent
 import com.grkj.iscs.base.BaseMvpActivity
 import com.grkj.iscs.databinding.ActivityHomeBinding
 import com.grkj.iscs.iview.IHomeView
@@ -11,7 +12,20 @@ class HomeActivity : BaseMvpActivity<IHomeView, HomePresenter, ActivityHomeBindi
         get() = ActivityHomeBinding.inflate(layoutInflater)
 
     override fun initView() {
+        mBinding?.tvCreate?.setOnClickListener {
+            startActivity(Intent(this, CreateTicketActivity::class.java))
+        }
+        mBinding?.tvCurrent?.setOnClickListener {
 
+        }
+        mBinding?.tvHistory?.setOnClickListener {
+
+        }
+
+        mBinding?.tvExit?.setOnClickListener {
+            // TODO 退出登录,清除token
+            finish()
+        }
     }
 
     override fun initPresenter(): HomePresenter {

+ 47 - 37
app/src/main/res/layout/activity_home.xml

@@ -5,7 +5,6 @@
     android:id="@+id/main"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    tools:background="@color/main_color"
     tools:context=".activity.HomeActivity">
 
     <!--    <com.grkj.iscs.widget.TitleBar-->
@@ -16,6 +15,15 @@
     <!--        app:layout_constraintTop_toTopOf="parent"-->
     <!--        app:title="@string/home_page" />-->
 
+    <TextView
+        android:id="@+id/tv_exit"
+        style="@style/CommonTextView"
+        android:layout_margin="@dimen/home_module_margin"
+        android:text="@string/exit"
+        android:textColor="@color/main_color"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
     <androidx.constraintlayout.widget.ConstraintLayout
         android:layout_width="0dp"
         android:layout_height="0dp"
@@ -32,7 +40,8 @@
             android:layout_width="0dp"
             android:layout_height="0dp"
             android:layout_margin="3dp"
-            android:background="@color/colorPrimary"
+            android:background="@color/main_color"
+            android:gravity="center"
             android:orientation="vertical"
             app:layout_constraintBottom_toTopOf="@id/ll_sop"
             app:layout_constraintLeft_toLeftOf="@id/barrier"
@@ -44,7 +53,10 @@
                 style="@style/CommonTextView"
                 android:text="@string/current_time" />
 
-            <TextClock style="@style/CommonTextView" />
+            <TextClock
+                style="@style/CommonTextView"
+                android:format12Hour="HH:mm"
+                android:format24Hour="HH:mm" />
         </LinearLayout>
 
         <!--   当前作业票     -->
@@ -53,7 +65,8 @@
             android:layout_width="0dp"
             android:layout_height="0dp"
             android:layout_margin="3dp"
-            android:background="@color/colorPrimary"
+            android:background="@color/main_color"
+            android:gravity="center"
             android:orientation="vertical"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintLeft_toLeftOf="@id/barrier"
@@ -92,7 +105,7 @@
                 android:layout_height="match_parent"
                 android:layout_margin="3dp"
                 android:layout_weight="1"
-                android:background="@color/colorPrimary"
+                android:background="@color/main_color"
                 android:orientation="vertical">
 
             </LinearLayout>
@@ -103,7 +116,7 @@
                 android:layout_height="match_parent"
                 android:layout_margin="3dp"
                 android:layout_weight="1"
-                android:background="@color/colorPrimary"
+                android:background="@color/main_color"
                 android:orientation="vertical">
 
             </LinearLayout>
@@ -114,47 +127,44 @@
             android:id="@+id/ll_type_four"
             android:layout_width="0dp"
             android:layout_height="match_parent"
-            android:orientation="vertical"
+            android:orientation="horizontal"
             app:layout_constraintHorizontal_weight="1"
             app:layout_constraintLeft_toLeftOf="parent"
             app:layout_constraintRight_toLeftOf="@id/barrier"
             app:layout_constraintTop_toTopOf="parent">
 
-            <androidx.constraintlayout.widget.ConstraintLayout
-                android:layout_width="match_parent"
-                android:layout_height="0dp"
-                android:layout_margin="3dp"
-                android:layout_weight="1"
-                android:background="@color/colorPrimary">
-
-            </androidx.constraintlayout.widget.ConstraintLayout>
-
-            <androidx.constraintlayout.widget.ConstraintLayout
-                android:layout_width="match_parent"
-                android:layout_height="0dp"
-                android:layout_margin="3dp"
+            <TextView
+                android:id="@+id/tv_create"
+                style="@style/CommonTextView"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_margin="@dimen/home_module_margin"
                 android:layout_weight="1"
-                android:background="@color/colorPrimary">
-
-            </androidx.constraintlayout.widget.ConstraintLayout>
+                android:background="@color/main_color"
+                android:orientation="vertical"
+                android:text="@string/create_ticket" />
 
-            <androidx.constraintlayout.widget.ConstraintLayout
-                android:layout_width="match_parent"
-                android:layout_height="0dp"
-                android:layout_margin="3dp"
+            <TextView
+                android:id="@+id/tv_current"
+                style="@style/CommonTextView"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_margin="@dimen/home_module_margin"
                 android:layout_weight="1"
-                android:background="@color/colorPrimary">
+                android:background="@color/main_color"
+                android:orientation="vertical"
+                android:text="@string/current_tickets" />
 
-            </androidx.constraintlayout.widget.ConstraintLayout>
-
-            <androidx.constraintlayout.widget.ConstraintLayout
-                android:layout_width="match_parent"
-                android:layout_height="0dp"
-                android:layout_margin="3dp"
+            <TextView
+                android:id="@+id/tv_history"
+                style="@style/CommonTextView"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_margin="@dimen/home_module_margin"
                 android:layout_weight="1"
-                android:background="@color/colorPrimary">
-
-            </androidx.constraintlayout.widget.ConstraintLayout>
+                android:background="@color/main_color"
+                android:orientation="vertical"
+                android:text="@string/history_tickets" />
         </LinearLayout>
     </androidx.constraintlayout.widget.ConstraintLayout>
 

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

@@ -36,4 +36,6 @@
     <dimen name="common_common_btn_elevation">10dp</dimen>
     <dimen name="login_btn_margin_top">20dp</dimen>
     <dimen name="login_btn_text_size">13dp</dimen>
+
+    <dimen name="home_module_margin">3dp</dimen>
 </resources>

+ 6 - 1
app/src/main/res/values/strings.xml

@@ -22,7 +22,7 @@
     <string name="start_time">开始时间</string>
     <string name="end_time">结束时间</string>
     <string name="current_time">当前时间</string>
-    <string name="current_sop_number">当前作业票</string>
+    <string name="current_sop_number">当前作业票数量</string>
 
     <string name="ble_no_device_found">没有扫描到设备</string>
     <string name="ble_connecting">连接中,请稍后...</string>
@@ -42,6 +42,11 @@
     <string name="account_or_password_error">账号或密码错误</string>
     <string name="confirm">确定</string>
     <string name="device_is_initializing">正在初始化设备……</string>
+    <string name="create_ticket">开作业票</string>
+    <string name="current_tickets">当前作业票</string>
+    <string name="history_tickets">历史作业票</string>
+
+    <string name="exit">退出</string>
 
 
     <!--  演示页  -->