Browse Source

调整ExpandableTabLayout显示样式

Frankensteinly 8 tháng trước cách đây
mục cha
commit
5c804506b9

+ 2 - 1
app/src/main/java/com/grkj/iscs_mc/view/presenter/MaterialFetchReturnPresenter.kt

@@ -1,5 +1,6 @@
 package com.grkj.iscs_mc.view.presenter
 
+import com.grkj.iscs_mc.extentions.serialNo
 import com.grkj.iscs_mc.model.vo.material.MaterialDetailRespVO
 import com.grkj.iscs_mc.model.vo.material.MaterialListRespVO
 import com.grkj.iscs_mc.util.Executor
@@ -10,7 +11,7 @@ import com.grkj.iscs_mc.view.iview.IMaterialFetchReturnView
 class MaterialFetchReturnPresenter : BasePresenter<IMaterialFetchReturnView>() {
 
     fun getMaterialList(callBack: (MutableList<MaterialListRespVO>?) -> Unit) {
-        NetApi.getMaterialList(1) {
+        NetApi.getMaterialList(mContext!!.serialNo()) {
             val rfidList = it?.flatMap { it.materials.orEmpty() }
                 ?.filter { !it.materialsRfid.isNullOrBlank() }
                 ?.map { it.materialsRfid!! }

+ 2 - 0
app/src/main/java/com/grkj/iscs_mc/view/widget/ExpandableTabLayout.kt

@@ -7,6 +7,7 @@ import android.view.View
 import android.widget.ImageView
 import android.widget.LinearLayout
 import android.widget.RelativeLayout
+import androidx.appcompat.content.res.AppCompatResources
 import androidx.recyclerview.widget.GridLayoutManager
 import androidx.recyclerview.widget.LinearLayoutManager
 import com.grkj.iscs_mc.R
@@ -42,6 +43,7 @@ class ExpandableTabLayout(private val ctx: Context, attrs: AttributeSet) :
         val direction = attrSet.getInt(R.styleable.ExpandableTabLayout_expand_direction, 0)
         if (direction == 1) {
             mBinding.ivAction.rotation = 180f
+            mBinding.root.background = AppCompatResources.getDrawable(ctx, R.drawable.expandable_tab_bg_bottom)
         }
 
         // 是否要联动下划线

+ 6 - 0
app/src/main/res/drawable/expandable_tab_bg_bottom.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">
+    <solid android:color="#3e6aa5" />
+    <corners android:radius="@dimen/common_radius_big" />
+</shape>

+ 8 - 0
app/src/main/res/drawable/expandable_tab_bg_top.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <solid android:color="#3e6aa5" />
+    <corners
+        android:topLeftRadius="@dimen/common_radius_big"
+        android:topRightRadius="@dimen/common_radius_big" />
+</shape>

+ 31 - 44
app/src/main/res/layout/layout_expandable_tab_layout.xml

@@ -1,53 +1,40 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/root"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content">
+    android:layout_height="wrap_content"
+    android:background="@drawable/expandable_tab_bg_top">
 
-    <com.google.android.material.card.MaterialCardView
-        app:cardBackgroundColor="#3e6aa5"
-        app:cardCornerRadius="@dimen/common_radius_big"
-        app:strokeColor="@color/common_transparent"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content">
-
-        <RelativeLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content">
+    <ImageView
+        android:id="@+id/iv_action"
+        android:layout_width="@dimen/common_icon_size"
+        android:layout_height="@dimen/common_icon_size"
+        android:layout_alignParentRight="true"
+        android:layout_marginVertical="@dimen/common_spacing"
+        android:layout_marginRight="@dimen/common_spacing"
+        android:background="@mipmap/expand" />
 
-            <ImageView
-                android:id="@+id/iv_action"
-                android:layout_width="@dimen/common_icon_size"
-                android:layout_height="@dimen/common_icon_size"
-                android:layout_alignParentRight="true"
-                android:layout_marginVertical="@dimen/common_spacing"
-                android:layout_marginRight="@dimen/common_spacing"
-                android:background="@mipmap/expand" />
-
-            <LinearLayout
-                android:id="@+id/ll_container"
-                android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                android:layout_toLeftOf="@id/iv_action"
-                android:orientation="horizontal">
+    <LinearLayout
+        android:id="@+id/ll_container"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_toLeftOf="@id/iv_action"
+        android:orientation="horizontal">
 
-                <TextView
-                    android:id="@+id/tv_title"
-                    style="@style/CommonTextView"
-                    android:layout_marginLeft="@dimen/common_spacing_small"
-                    android:layout_marginTop="12dp"
-                    android:layout_marginBottom="@dimen/common_spacing_small" />
+        <TextView
+            android:id="@+id/tv_title"
+            style="@style/CommonTextView"
+            android:layout_marginLeft="@dimen/common_spacing_small"
+            android:layout_marginTop="12dp"
+            android:layout_marginBottom="@dimen/common_spacing_small" />
 
-                <androidx.recyclerview.widget.RecyclerView
-                    android:id="@+id/rv_tab"
-                    style="@style/CommonRecyclerView"
-                    android:layout_height="wrap_content"
-                    android:layout_marginLeft="@dimen/common_spacing_small"
-                    android:layout_marginTop="@dimen/common_spacing_small"
-                    android:layout_marginRight="@dimen/common_spacing"
-                    android:orientation="horizontal" />
-            </LinearLayout>
-        </RelativeLayout>
-    </com.google.android.material.card.MaterialCardView>
+        <androidx.recyclerview.widget.RecyclerView
+            android:id="@+id/rv_tab"
+            style="@style/CommonRecyclerView"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/common_spacing_small"
+            android:layout_marginTop="@dimen/common_spacing_small"
+            android:layout_marginRight="@dimen/common_spacing"
+            android:orientation="horizontal" />
+    </LinearLayout>
 </RelativeLayout>