Переглянути джерело

优化信用卡首页界面;主页功能模块的隐藏支持直接注释枚举中相应代码

zengjiebin 8 роки тому
батько
коміт
f4d4cb3287

+ 32 - 6
app/src/main/java/com/kfzs/duanduan/react/MainTab.java

@@ -19,12 +19,26 @@ import com.kfzs.duanduan.fragment.FgtMainGame;
  */
 
 public enum MainTab {
+    FgtSmallSheep(R.string.mine_hoggerel) {
+        @Override
+        public Fragment getFragment() {
+            return new FgtSmallSheep();
+        }
+        @Override
+        public int getDrawableId() {
+            return R.drawable.drawable_selector_task;
+        }
+    },
     FgtMainGame(R.string.tab_viewpager_gamestore) {
         @Override
         public Fragment getFragment() {
             return new FgtMainGame();
         }
 
+        @Override
+        public int getDrawableId() {
+            return R.drawable.drawable_selector_game;
+        }
     },
     FgtMainCategory(R.string.tab_viewpager_classification) {
         @Override
@@ -32,19 +46,21 @@ public enum MainTab {
             return new FgtMainCategory();
         }
 
-    },
-    FgtSmallSheep(R.string.mine_hoggerel) {
         @Override
-        public Fragment getFragment() {
-            return new FgtSmallSheep();
+        public int getDrawableId() {
+            return R.drawable.drawable_selector_class;
         }
-
     },
-//    Bp(R.string.tab_viewpager_borrowplay) {
+    //    Bp(R.string.tab_viewpager_borrowplay) {
 //        @Override
 //        public Fragment getFragment() {
 //            return new FgtBorrowPlay();
 //        }
+//
+//        @Override
+//        public int getDrawableId() {
+//            return R.drawable.drawable_selector_bp;
+//        }
 //    },
     CreditCard(R.string.tab_viewpager_credit_card) {
         @Override
@@ -52,6 +68,11 @@ public enum MainTab {
             return new FgtCreditCard();
         }
 
+        @Override
+        public int getDrawableId() {
+            return R.drawable.drawable_selector_credit;
+        }
+
     };
     private int stringId;
 
@@ -66,4 +87,9 @@ public enum MainTab {
         return activity.getString(this.stringId);
     }
 
+    public int getStringId() {
+        return stringId;
+    }
+
+    public abstract int getDrawableId();
 }

+ 9 - 0
app/src/main/java/com/kfzs/duanduan/react/TabsHelper.java

@@ -12,6 +12,7 @@ import com.kfzs.duanduan.ActMain;
 import com.kfzs.duanduan.KFZSApp;
 import com.kfzs.duanduan.adp.ViewPagerFragmentAdapter;
 import com.kfzs.duanduan.fragment.FgtSmallSheep;
+import com.kfzs.libs.utils.DrawablesHelper;
 import com.sheep.gamegroup.util.UMConfigUtils;
 import com.sheep.jiuyan.samllsheep.R;
 
@@ -84,6 +85,10 @@ public class TabsHelper {
             fragmentList.add(mainTab.getFragment());
 
             View view = tab_container.getChildAt(index*2+1);
+            if(view instanceof TextView){
+                ((TextView) view).setText(mainTab.getStringId());
+                new DrawablesHelper((TextView) view).direction(DrawablesHelper.TOP).drawable(mainTab.getDrawableId()).commit();
+            }
             tabs.add(view);
             final int position = index;
             view.setOnClickListener(new View.OnClickListener() {
@@ -103,6 +108,10 @@ public class TabsHelper {
             });
             index++;
         }
+        //隐藏不显示的控件
+        for (int i = index * 2 + 1; i < tab_container.getChildCount(); i++) {
+           tab_container.getChildAt(i).setVisibility(View.GONE);
+        }
     }
 
     /**

+ 7 - 7
app/src/main/res/layout/activity_main.xml

@@ -49,7 +49,7 @@
                 android:layout_width="@dimen/tab_width"
                 android:layout_height="@dimen/tab_height"
                 android:drawableTop="@drawable/drawable_selector_game"
-                android:textSize="12sp"
+                android:textSize="10sp"
                 android:gravity="center"
                 android:textColor="@color/selector_color_main_tab"
                 android:text="@string/tab_viewpager_gamestore"/>
@@ -60,7 +60,7 @@
                 android:layout_width="@dimen/tab_width"
                 android:layout_height="@dimen/tab_height"
                 android:drawableTop="@drawable/drawable_selector_class"
-                android:textSize="12sp"
+                android:textSize="10sp"
                 android:gravity="center"
                 android:textColor="@color/selector_color_main_tab"
                 android:text="@string/tab_viewpager_classification"/>
@@ -71,29 +71,29 @@
                 android:layout_width="@dimen/tab_width"
                 android:layout_height="@dimen/tab_height"
                 android:drawableTop="@drawable/drawable_selector_task"
-                android:textSize="12sp"
+                android:textSize="10sp"
                 android:gravity="center"
                 android:textColor="@color/selector_color_main_tab"
                 android:text="@string/mine_hoggerel"/>
             <View android:layout_weight="2"
                 android:layout_width="0dp"
                 android:layout_height="@dimen/tab_height"/>
-            <!--<TextView
+            <TextView
                 android:layout_width="@dimen/tab_width"
                 android:layout_height="@dimen/tab_height"
                 android:drawableTop="@drawable/drawable_selector_bp"
-                android:textSize="12sp"
+                android:textSize="10sp"
                 android:gravity="center"
                 android:textColor="@color/selector_color_main_tab"
                 android:text="@string/tab_viewpager_borrowplay"/>
             <View android:layout_weight="2"
                 android:layout_width="0dp"
-                android:layout_height="@dimen/tab_height"/>-->
+                android:layout_height="@dimen/tab_height"/>
             <TextView
                 android:layout_width="@dimen/tab_width"
                 android:layout_height="@dimen/tab_height"
                 android:drawableTop="@drawable/drawable_selector_credit"
-                android:textSize="12sp"
+                android:textSize="10sp"
                 android:gravity="center"
                 android:textColor="@color/selector_color_main_tab"
                 android:text="@string/tab_viewpager_credit_card"/>

+ 1 - 13
app/src/main/res/layout/fgt_main_category.xml

@@ -3,19 +3,7 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="vertical">
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="vertical">
-        <TextView
-            android:layout_width="match_parent"
-            android:layout_height="1px"
-            android:background="@color/white_ededed"/>
-        <TextView
-            android:layout_width="match_parent"
-            android:layout_height="1px"
-            android:background="@color/white_FFF7F7F7"/>
-    </LinearLayout>
+    <include layout="@layout/title_bottom_line"/>
     <ScrollView
         android:layout_width="match_parent"
         android:layout_height="match_parent"

+ 15 - 8
app/src/main/res/layout/ftg_credit_card.xml

@@ -8,18 +8,19 @@
     <com.kfzs.libs.widget.navigation.NavigationBar
         android:id="@+id/navigationbar"
         android:layout_width="match_parent"
-        android:layout_height="45dp"
+        android:layout_height="@dimen/layout_heigh_default"
         android:background="#ffffff" />
+    <include layout="@layout/title_bottom_line"/>
 
     <ScrollView
         android:layout_width="match_parent"
         android:layout_height="0dp"
         android:layout_weight="1">
 
-
        <LinearLayout
            android:layout_width="match_parent"
-           android:layout_height="match_parent"
+           android:layout_height="wrap_content"
+           android:layout_marginBottom="@dimen/content_padding_13"
            android:orientation="vertical"
            >
            <LinearLayout style="@style/creditCardTypeItemStyle">
@@ -52,14 +53,16 @@
 
                <Button
                    android:id="@+id/btn_ms"
-                   style="@style/creditCardTypeBtnStyle"
+                   style="@style/style_button"
+                   android:layout_width="wrap_content"
+                   android:layout_gravity="center_horizontal"
+                   android:paddingLeft="@dimen/content_padding_40"
+                   android:paddingRight="@dimen/content_padding_40"
                    android:text="立即申请" />
 
            </LinearLayout>
 
-           <LinearLayout style="@style/creditCardTypeItemStyle"
-               android:layout_marginTop="16dp"
-               >
+           <LinearLayout style="@style/creditCardTypeItemStyle">
 
                <RelativeLayout style="@style/creditCardTypeHeadStyle">
 
@@ -89,7 +92,11 @@
 
                <Button
                    android:id="@+id/btn_zx"
-                   style="@style/creditCardTypeBtnStyle"
+                   style="@style/style_button"
+                   android:layout_width="wrap_content"
+                   android:layout_gravity="center_horizontal"
+                   android:paddingLeft="@dimen/content_padding_40"
+                   android:paddingRight="@dimen/content_padding_40"
                    android:text="立即申请" />
 
            </LinearLayout>

+ 1 - 14
app/src/main/res/layout/title.xml

@@ -89,18 +89,5 @@
             android:layout_height="12dp"
             android:src="@mipmap/triangle_popup_nomal"/>
     </LinearLayout>
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="vertical"
-        android:layout_alignParentBottom="true">
-        <TextView
-            android:layout_width="match_parent"
-            android:layout_height="1px"
-            android:background="@color/white_ededed"/>
-        <TextView
-            android:layout_width="match_parent"
-            android:layout_height="1px"
-            android:background="@color/white_FFF7F7F7"/>
-    </LinearLayout>
+    <include layout="@layout/title_bottom_line"/>
 </RelativeLayout>

+ 16 - 0
app/src/main/res/layout/title_bottom_line.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical">
+
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="1px"
+        android:background="@color/white_ededed" />
+
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="1px"
+        android:background="@color/white_FFF7F7F7" />
+</LinearLayout>

+ 4 - 1
app/src/main/res/values/styles.xml

@@ -274,7 +274,10 @@
         <item name="android:layout_width">match_parent</item>
         <item name="android:layout_height">wrap_content</item>
         <item name="android:orientation">vertical</item>
-        <item name="android:background">@android:color/white</item>
+        <item name="android:layout_marginTop">12dp</item>
+        <item name="android:layout_marginLeft">10dp</item>
+        <item name="android:layout_marginRight">10dp</item>
+        <item name="android:background">@drawable/x_shap_shadow_bg_rectgangle_white</item>
     </style>
 
     <style name="creditCardTypeHeadStyle">