Преглед изворни кода

物资管理页首页添加模块;增大栈空间

Frankensteinly пре 9 месеци
родитељ
комит
8fabbc4391

+ 1 - 0
app/src/main/AndroidManifest.xml

@@ -16,6 +16,7 @@
         android:roundIcon="@mipmap/ic_launcher_round"
         android:supportsRtl="true"
         android:theme="@style/Theme.ISCS_MC"
+        android:largeHeap="true"
         tools:targetApi="31">
 
         <meta-data

+ 17 - 1
app/src/main/java/com/grkj/iscs_mc/view/fragment/MaterialHomeFragment.kt

@@ -1,6 +1,7 @@
 package com.grkj.iscs_mc.view.fragment
 
 import com.grkj.iscs_mc.databinding.FragmentMaterialHomeBinding
+import com.grkj.iscs_mc.extentions.navigateTo
 import com.grkj.iscs_mc.view.base.BaseMvpFragment
 import com.grkj.iscs_mc.view.iview.IMaterialHomeView
 import com.grkj.iscs_mc.view.presenter.MaterialHomePresenter
@@ -8,13 +9,28 @@ import com.grkj.iscs_mc.view.presenter.MaterialHomePresenter
 /**
  * 物资管理 - 首页
  */
-class MaterialHomeFragment : BaseMvpFragment<IMaterialHomeView, MaterialHomePresenter, FragmentMaterialHomeBinding>() {
+class MaterialHomeFragment :
+    BaseMvpFragment<IMaterialHomeView, MaterialHomePresenter, FragmentMaterialHomeBinding>() {
 
     override val viewBinding: FragmentMaterialHomeBinding
         get() = FragmentMaterialHomeBinding.inflate(layoutInflater)
 
     override fun initView() {
+        mBinding?.rlModuleFetchReturn?.setOnClickListener {
+            navigateTo(MaterialHomeFragmentDirections.actionHomeFragmentToFetchReturnFragment())
+        }
 
+        mBinding?.rlModuleInstruction?.setOnClickListener {
+            navigateTo(MaterialHomeFragmentDirections.actionHomeFragmentToInstructionFragment())
+        }
+
+        mBinding?.rlModuleInspection?.setOnClickListener {
+            navigateTo(MaterialHomeFragmentDirections.actionHomeFragmentToInspectionFragment())
+        }
+
+        mBinding?.rlModuleReplacement?.setOnClickListener {
+            navigateTo(MaterialHomeFragmentDirections.actionHomeFragmentToReplacementFragment())
+        }
     }
 
     override fun initPresenter(): MaterialHomePresenter {

+ 5 - 0
app/src/main/res/drawable/item_rv_technology_sop_bg_normal.xml

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

+ 10 - 0
app/src/main/res/drawable/module_fetch_return_bg.xml

@@ -0,0 +1,10 @@
+<?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_big" />
+    <gradient
+        android:angle="315"
+        android:endColor="#2758d4"
+        android:startColor="#17b3cb"
+        android:type="linear" />
+</shape>

+ 10 - 0
app/src/main/res/drawable/module_inspection_bg.xml

@@ -0,0 +1,10 @@
+<?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_big" />
+    <gradient
+        android:angle="315"
+        android:endColor="#268473"
+        android:startColor="#4ab077"
+        android:type="linear" />
+</shape>

+ 10 - 0
app/src/main/res/drawable/module_instruction_bg.xml

@@ -0,0 +1,10 @@
+<?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_big" />
+    <gradient
+        android:angle="315"
+        android:endColor="#a03048"
+        android:startColor="#aa683f"
+        android:type="linear" />
+</shape>

+ 10 - 0
app/src/main/res/drawable/module_replacement_bg.xml

@@ -0,0 +1,10 @@
+<?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_big" />
+    <gradient
+        android:angle="315"
+        android:endColor="#a3875f"
+        android:startColor="#a6b047"
+        android:type="linear" />
+</shape>

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

@@ -5,6 +5,7 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:padding="@dimen/page_padding"
+    android:background="@mipmap/login_bg"
     tools:context=".view.activity.LoginActivity">
 
     <androidx.recyclerview.widget.RecyclerView

+ 159 - 2
app/src/main/res/layout/fragment_material_home.xml

@@ -1,8 +1,165 @@
 <?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.MaterialHomeFragment">
 
-</FrameLayout>
+    <RelativeLayout
+        android:id="@+id/rl_status"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true"
+        android:background="@drawable/item_rv_technology_sop_bg_normal"
+        android:padding="@dimen/common_spacing_small">
+
+    </RelativeLayout>
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_above="@id/rl_status"
+        android:background="@drawable/item_rv_technology_sop_bg_normal">
+
+        <RelativeLayout
+            android:id="@+id/rl_module_fetch_return"
+            android:layout_width="@dimen/home_module_width"
+            android:layout_height="@dimen/home_module_height"
+            android:background="@drawable/module_fetch_return_bg"
+            android:padding="@dimen/common_spacing"
+            app:layout_constraintBottom_toTopOf="@id/rl_module_inspection"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintRight_toLeftOf="@id/rl_module_instruction"
+            app:layout_constraintTop_toTopOf="parent">
+
+            <ImageView
+                android:layout_width="@dimen/home_module_icon_size"
+                android:layout_height="@dimen/home_module_icon_size"
+                android:layout_centerVertical="true"
+                android:src="@mipmap/material_fetch_return" />
+
+            <TextView
+                android:id="@+id/tv_fetch_return_name"
+                style="@style/CommonTextView"
+                android:layout_alignParentRight="true"
+                android:layout_centerVertical="true"
+                android:text="@string/material_fetch_return"
+                android:textSize="@dimen/common_text_size_big" />
+
+            <TextView
+                style="@style/CommonTextView"
+                android:layout_below="@id/tv_fetch_return_name"
+                android:layout_alignParentRight="true"
+                android:layout_centerVertical="true"
+                android:layout_marginTop="@dimen/common_spacing_small"
+                android:text="@string/material_fetch_return_english"
+                android:textSize="@dimen/common_text_size_small" />
+        </RelativeLayout>
+
+        <RelativeLayout
+            android:id="@+id/rl_module_instruction"
+            android:layout_width="@dimen/home_module_width"
+            android:layout_height="@dimen/home_module_height"
+            android:background="@drawable/module_instruction_bg"
+            android:padding="@dimen/common_spacing"
+            app:layout_constraintBottom_toTopOf="@id/rl_module_replacement"
+            app:layout_constraintLeft_toRightOf="@id/rl_module_fetch_return"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toTopOf="parent">
+
+            <ImageView
+                android:layout_width="@dimen/home_module_icon_size"
+                android:layout_height="@dimen/home_module_icon_size"
+                android:layout_centerVertical="true"
+                android:src="@mipmap/material_instruction" />
+
+            <TextView
+                android:id="@+id/tv_instruction_name"
+                style="@style/CommonTextView"
+                android:layout_alignParentRight="true"
+                android:layout_centerVertical="true"
+                android:text="@string/material_instruction"
+                android:textSize="@dimen/common_text_size_big" />
+
+            <TextView
+                style="@style/CommonTextView"
+                android:layout_below="@id/tv_instruction_name"
+                android:layout_alignParentRight="true"
+                android:layout_centerVertical="true"
+                android:layout_marginTop="@dimen/common_spacing_small"
+                android:text="@string/material_instruction_english"
+                android:textSize="@dimen/common_text_size_small" />
+        </RelativeLayout>
+
+        <RelativeLayout
+            android:id="@+id/rl_module_inspection"
+            android:layout_width="@dimen/home_module_width"
+            android:layout_height="@dimen/home_module_height"
+            android:background="@drawable/module_inspection_bg"
+            android:padding="@dimen/common_spacing"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintRight_toLeftOf="@id/rl_module_replacement"
+            app:layout_constraintTop_toBottomOf="@id/rl_module_fetch_return">
+
+            <ImageView
+                android:layout_width="@dimen/home_module_icon_size"
+                android:layout_height="@dimen/home_module_icon_size"
+                android:layout_centerVertical="true"
+                android:src="@mipmap/material_inspection" />
+
+            <TextView
+                android:id="@+id/tv_inspection_name"
+                style="@style/CommonTextView"
+                android:layout_alignParentRight="true"
+                android:layout_centerVertical="true"
+                android:text="@string/material_inspection"
+                android:textSize="@dimen/common_text_size_big" />
+
+            <TextView
+                style="@style/CommonTextView"
+                android:layout_below="@id/tv_inspection_name"
+                android:layout_alignParentRight="true"
+                android:layout_centerVertical="true"
+                android:layout_marginTop="@dimen/common_spacing_small"
+                android:text="@string/material_inspection_english"
+                android:textSize="@dimen/common_text_size_small" />
+        </RelativeLayout>
+
+        <RelativeLayout
+            android:id="@+id/rl_module_replacement"
+            android:layout_width="@dimen/home_module_width"
+            android:layout_height="@dimen/home_module_height"
+            android:background="@drawable/module_replacement_bg"
+            android:padding="@dimen/common_spacing"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintLeft_toRightOf="@id/rl_module_inspection"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toBottomOf="@id/rl_module_instruction">
+
+            <ImageView
+                android:layout_width="@dimen/home_module_icon_size"
+                android:layout_height="@dimen/home_module_icon_size"
+                android:layout_centerVertical="true"
+                android:src="@mipmap/material_replacement" />
+
+            <TextView
+                android:id="@+id/tv_replacement_name"
+                style="@style/CommonTextView"
+                android:layout_alignParentRight="true"
+                android:layout_centerVertical="true"
+                android:text="@string/material_replacement"
+                android:textSize="@dimen/common_text_size_big" />
+
+            <TextView
+                style="@style/CommonTextView"
+                android:layout_below="@id/tv_replacement_name"
+                android:layout_alignParentRight="true"
+                android:layout_centerVertical="true"
+                android:layout_marginTop="@dimen/common_spacing_small"
+                android:text="@string/material_replacement_english"
+                android:textSize="@dimen/common_text_size_small" />
+        </RelativeLayout>
+    </androidx.constraintlayout.widget.ConstraintLayout>
+</RelativeLayout>

+ 45 - 2
app/src/main/res/layout/fragment_material_management.xml

@@ -1,8 +1,51 @@
 <?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout 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"
+    android:orientation="vertical"
+    android:padding="@dimen/common_spacing"
     tools:context=".view.fragment.MaterialManagementFragment">
 
-</FrameLayout>
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <ImageView
+            android:id="@+id/iv_icon"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerVertical="true" />
+
+        <TextView
+            android:id="@+id/tv_module_name"
+            style="@style/CommonTextView"
+            android:layout_centerVertical="true"
+            android:layout_marginLeft="@dimen/common_spacing_small"
+            android:layout_toRightOf="@id/iv_icon" />
+
+        <TextView
+            android:id="@+id/tv_user"
+            style="@style/CommonTextView"
+            android:layout_alignParentRight="true"
+            android:layout_centerVertical="true" />
+
+        <ImageView
+            android:layout_width="@dimen/common_icon_size"
+            android:layout_height="@dimen/common_icon_size"
+            android:layout_centerVertical="true"
+            android:layout_marginRight="@dimen/common_spacing_small"
+            android:layout_toLeftOf="@id/tv_user"
+            android:background="@mipmap/avatar" />
+    </RelativeLayout>
+
+    <androidx.fragment.app.FragmentContainerView
+        android:id="@+id/nav_host"
+        android:name="androidx.navigation.fragment.NavHostFragment"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_marginTop="@dimen/common_spacing"
+        app:defaultNavHost="true"
+        app:navGraph="@navigation/nav_graph" />
+</LinearLayout>

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


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


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


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


+ 28 - 21
app/src/main/res/navigation/nav_graph.xml

@@ -10,48 +10,55 @@
         tools:layout="@layout/fragment_material_home">
 
         <action
-            android:id="@+id/action_home_fragment_to_instruction_fragment"
-            app:destination="@id/material_instruction_fragment"
+            android:id="@+id/action_home_fragment_to_fetch_return_fragment"
+            app:destination="@id/material_fetch_return_fragment"
             app:enterAnim="@anim/slide_in_right"
             app:exitAnim="@anim/slide_out_left"
             app:popEnterAnim="@anim/slide_in_left"
             app:popExitAnim="@anim/slide_out_right" />
 
         <action
-            android:id="@+id/action_home_fragment_to_replacement_fragment"
-            app:destination="@id/material_replacement_fragment"
+            android:id="@+id/action_home_fragment_to_instruction_fragment"
+            app:destination="@id/material_instruction_fragment"
             app:enterAnim="@anim/slide_in_right"
             app:exitAnim="@anim/slide_out_left"
             app:popEnterAnim="@anim/slide_in_left"
             app:popExitAnim="@anim/slide_out_right" />
 
-    </fragment>
-
-    <fragment
-        android:id="@+id/material_instruction_fragment"
-        android:name="com.grkj.iscs_mc.view.fragment.MaterialInstructionFragment"
-        tools:layout="@layout/fragment_material_instruction">
-        <!--        <argument android:name="url" app:argType="string" />-->
         <action
-            android:id="@+id/action_instruction_fragment_to_home_fragment"
-            app:destination="@id/home_fragment"
+            android:id="@+id/action_home_fragment_to_inspection_fragment"
+            app:destination="@id/material_inspection_fragment"
             app:enterAnim="@anim/slide_in_right"
             app:exitAnim="@anim/slide_out_left"
             app:popEnterAnim="@anim/slide_in_left"
             app:popExitAnim="@anim/slide_out_right" />
-    </fragment>
 
-    <fragment
-        android:id="@+id/material_replacement_fragment"
-        android:name="com.grkj.iscs_mc.view.fragment.MaterialReplacementFragment"
-        tools:layout="@layout/fragment_material_replacement">
-        <!--        <argument android:name="url" app:argType="string"/>-->
         <action
-            android:id="@+id/action_replacement_fragment_to_home_fragment"
-            app:destination="@id/home_fragment"
+            android:id="@+id/action_home_fragment_to_replacement_fragment"
+            app:destination="@id/material_replacement_fragment"
             app:enterAnim="@anim/slide_in_right"
             app:exitAnim="@anim/slide_out_left"
             app:popEnterAnim="@anim/slide_in_left"
             app:popExitAnim="@anim/slide_out_right" />
     </fragment>
+
+    <fragment
+        android:id="@+id/material_fetch_return_fragment"
+        android:name="com.grkj.iscs_mc.view.fragment.MaterialFetchReturnFragment"
+        tools:layout="@layout/fragment_material_fetch_return" />
+
+    <fragment
+        android:id="@+id/material_instruction_fragment"
+        android:name="com.grkj.iscs_mc.view.fragment.MaterialInstructionFragment"
+        tools:layout="@layout/fragment_material_instruction" />
+
+    <fragment
+        android:id="@+id/material_inspection_fragment"
+        android:name="com.grkj.iscs_mc.view.fragment.MaterialInspectionFragment"
+        tools:layout="@layout/fragment_material_inspection" />
+
+    <fragment
+        android:id="@+id/material_replacement_fragment"
+        android:name="com.grkj.iscs_mc.view.fragment.MaterialReplacementFragment"
+        tools:layout="@layout/fragment_material_replacement" />
 </navigation>

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

@@ -5,6 +5,7 @@
     <dimen name="common_text_size_small">8dp</dimen>
     <dimen name="common_text_padding">5dp</dimen>
     <dimen name="common_font_txt_size_page_title">14dp</dimen>
+    <dimen name="common_radius_big">15dp</dimen>
     <dimen name="common_radius">10dp</dimen>
     <dimen name="common_radius_small">5dp</dimen>
     <dimen name="common_spacing">10dp</dimen>
@@ -35,4 +36,8 @@
 
     <dimen name="item_rv_menu_size">58dp</dimen>
     <dimen name="item_rv_menu_icon_size">20dp</dimen>
+
+    <dimen name="home_module_width">200dp</dimen>
+    <dimen name="home_module_height">110dp</dimen>
+    <dimen name="home_module_icon_size">66dp</dimen>
 </resources>

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

@@ -23,4 +23,13 @@
     <string name="please_login">请登录</string>
     <string name="logout">退出登录</string>
     <string name="settings">设置</string>
+
+    <string name="material_fetch_return">物资取还</string>
+    <string name="material_fetch_return_english">Materials Fetch And Return</string>
+    <string name="material_instruction">物资使用说明</string>
+    <string name="material_instruction_english">Materials Instructions</string>
+    <string name="material_inspection">物资检查</string>
+    <string name="material_inspection_english">Materials Inspection</string>
+    <string name="material_replacement">物资更换</string>
+    <string name="material_replacement_english">Materials Replacement</string>
 </resources>