Sfoglia il codice sorgente

home page ui tune up

billyyoyo 6 anni fa
parent
commit
277052cfd1

+ 69 - 100
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtSmallSheep.java

@@ -90,6 +90,7 @@ import com.sheep.gamegroup.util.DeviceUtil;
 import com.sheep.gamegroup.util.GlideImageLoader;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.ListUtil;
+import com.sheep.gamegroup.util.LogUtil;
 import com.sheep.gamegroup.util.MainTab;
 import com.sheep.gamegroup.util.RefreshUtil;
 import com.sheep.gamegroup.util.StringUtils;
@@ -144,6 +145,10 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
 
     public static WeakReference<View> listRef;
 
+    @BindView(R.id.home_list_progress_block)
+    View home_list_progress_block;
+    @BindView(R.id.home_list_progress_bar)
+    View home_list_progress_bar;
     @BindView(R.id.upview1)
     MarqueeView upview1;
     @BindView(R.id.homepage_item_notice_mv)
@@ -160,6 +165,8 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
     RecyclerView recyclerview;
     @BindView(R.id.home_list_rv)
     RecyclerView home_list_rv;
+    @BindView(R.id.bar_list_rv)
+    RecyclerView bar_list_rv;
     @BindView(R.id.home_notice_ll)
     View home_notice_ll;
     @BindView(R.id.check_net_ll)
@@ -176,8 +183,6 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
     TextView homepage_item_juan_tv;
     @BindView(R.id.recyclerview_line)
     View recyclerview_line;
-    @BindView(R.id.full_home_list_rv)
-    RecyclerView full_home_list_rv;
     @BindView(R.id.test_change)
     TextView test_change;
     @BindView(R.id.test_change_user)
@@ -209,9 +214,8 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
     private List<String> slideshowTitleList = new ArrayList<>();
     private List<BulletinEnty> bulletinEntyLists = new ArrayList<>();
 
-    private List<HomeListEntity> homeListEntitys = new ArrayList<>();
-    private List<HomeListEntity> fullHomeList = new ArrayList<>();
     private List<HomeListEntity> homeListList = new ArrayList<>();
+    private List<HomeListEntity> barListList = new ArrayList<>();
     private AdpHomeList<HomeListEntity> adpHomeList;
     private AdpTryMakemoney mAdapter;
 
@@ -247,7 +251,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
                     tryMakeMoneyAdp.notifyDataSetChanged();
                     break;
                 case WHAT_TRY_SHOW_HB:
-                    ((ActMain)getActivity()).switchFragment(0);
+                    ((ActMain) getActivity()).switchFragment(0);
                     showRedPackage(activity);
                     break;
                 case WHAT_TRY_SHOW_NEWBIE_GUIDE:
@@ -635,29 +639,6 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
             }
         });
         CommonUtil.getInstance().reflex(tabLayout, activity);
-        //只显示图片并且充满的homeList
-        fullHomeList.clear();
-        full_home_list_rv.setHasFixedSize(true);
-        full_home_list_rv.setNestedScrollingEnabled(false);
-        full_home_list_rv.setLayoutManager(new LinearLayoutManager(activity));
-        full_home_list_rv.setAdapter(new AdbCommonRecycler<HomeListEntity>(activity, fullHomeList) {
-            @Override
-            public int getViewIdByType(int type) {
-                return R.layout.item_image_full_home_list;
-            }
-
-            @Override
-            public void convert(ViewHolder holder, final HomeListEntity item) {
-                ImageView imageView = holder.getView(R.id.image);
-                GlideImageLoader.setImage(imageView, item.getIcon());
-                imageView.setOnClickListener(new View.OnClickListener() {
-                    @Override
-                    public void onClick(View view) {
-                        CommonUtil.getInstance().goWhere(activity, item, "首页");
-                    }
-                });
-            }
-        });
         new GoodsRecommendsBarHelper(getContext(), goods_recommends_bar);
     }
 
@@ -815,44 +796,29 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
 
     //添加homeList数据
     private void addHomeList(List<HomeListEntity> cacheHomeListEtyList) {
-        if (ListUtil.isEmpty(cacheHomeListEtyList)) {
-            ViewUtil.setVisibility(home_list_rv, false);
-        } else {
-            ViewUtil.setVisibility(home_list_rv, true);
-            homeListEntitys.clear();
-            homeListList.clear();
-            fullHomeList.clear();
-            CommonUtil.getInstance().splitHomeList(cacheHomeListEtyList, homeListEntitys, fullHomeList);
-//            if(TestUtil.isDev())
-//                homeListEntitys = homeListEntitys.subList(0, 7);
-            boolean isShowQB = false;
-            boolean isShowMd = false;
-            for (int i = 0; i < homeListEntitys.size(); i++) {
-                homeListList.add(homeListEntitys.get(i));
-                if (homeListEntitys.get(i).getJump().equals("6")) {//6Q币充值
-                    isShowQB = !isShowQB;
-                }
-                if (homeListEntitys.get(i).getJump().equals("14")) {//幂动科技
-                    isShowMd = !isShowMd;
-                }
+        barListList.clear();
+        homeListList.clear();
+        boolean isShowQB = false;
+        boolean isShowMd = false;
+        for (int i = 0; i < cacheHomeListEtyList.size(); i++) {
+            HomeListEntity item = cacheHomeListEtyList.get(i);
+            if ("1024".equals(item.getDesc()) || "17".equals(item.getJump())) {
+                barListList.add(item);
+            } else {
+                homeListList.add(item);
+            }
+            if (item.getJump().equals("6")) {//6Q币充值
+                isShowQB = !isShowQB;
+            }
+            if (item.getJump().equals("14")) {//幂动科技
+                isShowMd = !isShowMd;
             }
-            addNewTask();
-            SheepApp.getInstance().setShowQB(isShowQB);
-            ViewUtil.notifyDataSetChanged(full_home_list_rv);
-            adpHomeList.notifyDataSetChanged();
-        }
-        checkFullHomeList();
-    }
-
-    //fullHomeList有数据时,要让fullHomeList上下遮盖相邻组件
-    private void checkFullHomeList() {
-        if (!fullHomeList.isEmpty()) {
-            LayoutParamsUtil.resetLayoutParams(full_home_list_rv, new Lp(G.DENSITY).setTopMargin(-3).setBottomMargin(0));
-            LayoutParamsUtil.resetLayoutParams(home_notice_ll, new Lp().setTopMargin(0));
-        } else {
-            LayoutParamsUtil.resetLayoutParams(full_home_list_rv, new Lp().setTopMargin(G.getRealPix(6)).setBottomMargin(0));
-            LayoutParamsUtil.resetLayoutParams(home_notice_ll, new Lp(G.DENSITY).setTopMargin(12));
         }
+        addNewTask();
+        SheepApp.getInstance().setShowQB(isShowQB);
+        ViewUtil.notifyDataSetChanged(home_list_rv);
+        ViewUtil.notifyDataSetChanged(bar_list_rv);
+        ViewUtil.setVisibility(home_list_progress_bar, homeListList.size() > 8);
     }
 
     /**
@@ -938,9 +904,30 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
         tryMakeMoneyAdp.addPresenter(tryMakeMoneyPresenter);
         recyclerview.setAdapter(tryMakeMoneyAdp);
 
-        adpHomeList = new AdpHomeList<>(R.layout.item_my_list_but, homeListList);
+        bar_list_rv.setHasFixedSize(true);
+        bar_list_rv.setNestedScrollingEnabled(false);
+        bar_list_rv.setLayoutManager(new LinearLayoutManager(activity));
+        bar_list_rv.setAdapter(new AdbCommonRecycler<HomeListEntity>(activity, barListList) {
+            @Override
+            public int getViewIdByType(int type) {
+                return R.layout.item_image_full_home_list;
+            }
+
+            @Override
+            public void convert(ViewHolder holder, final HomeListEntity item) {
+                ImageView imageView = holder.getView(R.id.image);
+                GlideImageLoader.setImage(imageView, item.getIcon());
+                imageView.setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View view) {
+                        CommonUtil.getInstance().goWhere(activity, item, "首页");
+                    }
+                });
+            }
+        });
 
-        GridLayoutManager manager = new GridLayoutManager(SheepApp.getInstance(), 4);
+        adpHomeList = new AdpHomeList<>(R.layout.item_my_list_but, ScreenUtil.getScreenWidth(getContext()) / 4, homeListList);
+        GridLayoutManager manager = new GridLayoutManager(SheepApp.getInstance(), 2, LinearLayoutManager.HORIZONTAL, false);
         home_list_rv.setHasFixedSize(true);
         home_list_rv.setNestedScrollingEnabled(false);
         home_list_rv.setLayoutManager(manager);
@@ -957,6 +944,20 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
                 CommonUtil.getInstance().goWhere(activity, item, "首页");
             }
         });
+        home_list_rv.addOnScrollListener(new RecyclerView.OnScrollListener() {
+
+            float distance = getResources().getDimension(R.dimen.radius_25);
+
+            @Override
+            public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
+                int extent = recyclerView.computeHorizontalScrollExtent();
+                int range = recyclerView.computeHorizontalScrollRange();
+                int offset = recyclerView.computeHorizontalScrollOffset();
+                float percentage = (offset / (float) (range - extent));
+                float move = percentage * distance;
+                home_list_progress_block.setX(move);
+            }
+        });
     }
 
     private void refreshTaskList() {
@@ -1177,8 +1178,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
     public void failhomeList(BaseMessage baseMessage) {
         if (this.getActivity() != null && this.getActivity().isDestroyed() || this.isDetached())
             return;
-        ViewUtil.setVisibility(home_list_rv, !homeListList.isEmpty());
-        ViewUtil.setVisibility(full_home_list_rv, !fullHomeList.isEmpty());
+        ViewUtil.setVisibility(home_list_rv, true);
     }
 
     private int onResumeCount = 0;
@@ -1513,23 +1513,6 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
                 });
     }
 
-    @BindView(R.id.home_list_more_iv)
-    ImageView home_list_more_iv;
-
-    @OnClick(R.id.home_list_more_iv)
-    public void toggleHomeList() {//homeList展开或者收缩
-        boolean isHomeListExtend = homeListList.size() > 8;
-        isHomeListExtend = !isHomeListExtend;
-        ViewUtil.setImage(home_list_more_iv, isHomeListExtend ? R.drawable.bg_to_top : R.drawable.bg_to_bottom);
-        if (isHomeListExtend) {
-            homeListList.clear();
-            homeListList.addAll(homeListEntitys);
-        } else {
-            getHomeList();
-        }
-        adpHomeList.notifyDataSetChanged();
-    }
-
     /**
      * 新手任务
      */
@@ -1540,21 +1523,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
             homeListEntityNewTask.setDesc(SheepApp.getInstance().getString(R.string.fresh_task));
             homeListEntityNewTask.setJump("-1");
             homeListEntityNewTask.setIcon(ViewUtil.getNetImgByName("homepage_xinshourw"));
-            homeListEntitys.add(0, homeListEntityNewTask);
-        }
-        ViewUtil.setVisibility(home_list_more_iv, ListUtil.size(homeListEntitys) > 8);
-        getHomeList();
-        adpHomeList.notifyDataSetChanged();
-    }
-
-    private void getHomeList() {
-        homeListList.clear();
-        for (int i = 0; i < homeListEntitys.size(); i++) {
-            if (i < 8) {
-                homeListList.add(homeListEntitys.get(i));
-            } else {
-                break;
-            }
+            homeListList.add(0, homeListEntityNewTask);
         }
     }
 

+ 2 - 2
app/src/main/res/drawable/shape_blue_stroke_withe_radius_5.xml

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

+ 2 - 0
app/src/main/res/layout/fgt_personalcenter_item_center_one.xml

@@ -129,9 +129,11 @@
 
     <View
         android:id="@+id/fgt_pc_item_vip_v"
+        android:visibility="gone"
         style="@style/style_item_line_new" />
 
     <LinearLayout
+        android:visibility="gone"
         android:id="@+id/fgt_pc_item_vip_ll"
         style="@style/style_item_container">
 

+ 43 - 30
app/src/main/res/layout/homepage_act_layout.xml

@@ -8,9 +8,9 @@
 
     <com.scwang.smartrefresh.layout.SmartRefreshLayout
         android:id="@+id/refresh"
-        app:srlAccentColor="@color/gray_CBCBCB"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content">
+        android:layout_height="wrap_content"
+        app:srlAccentColor="@color/gray_CBCBCB">
 
         <android.support.v4.widget.NestedScrollView
             android:id="@+id/scrollView"
@@ -68,7 +68,7 @@
                     android:layout_width="match_parent"
                     android:layout_height="13dp"
                     android:layout_below="@id/home_notice_ll"
-                    android:background="@color/bg_home_color"/>
+                    android:background="@color/bg_home_color" />
 
                 <android.support.v7.widget.RecyclerView
                     android:id="@+id/home_list_rv"
@@ -78,38 +78,51 @@
                     android:layout_marginTop="13dp"
                     android:background="@android:color/white" />
 
-                <View
+                <LinearLayout
+                    android:id="@+id/home_list_progress"
                     android:layout_width="match_parent"
-                    android:layout_height="18dp"
+                    android:layout_height="12dp"
                     android:layout_below="@+id/home_list_rv"
-                    android:background="@color/bg_home_color"/>
+                    android:layout_centerHorizontal="true"
+                    android:gravity="center_horizontal"
+                    android:background="#ffffff"
+                    android:orientation="horizontal">
+
+                    <LinearLayout
+                        android:id="@+id/home_list_progress_bar"
+                        android:layout_width="50dp"
+                        android:layout_height="3dp"
+                        android:background="@drawable/shape_grey_stroke_withe_radius_5">
+
+                        <View
+                            android:id="@+id/home_list_progress_block"
+                            android:layout_width="25dp"
+                            android:layout_height="3dp"
+                            android:background="@drawable/shape_blue_stroke_withe_radius_5" />
+                    </LinearLayout>
+                </LinearLayout>
 
-                <!--超维对决HomeList-->
                 <android.support.v7.widget.RecyclerView
-                    android:id="@+id/full_home_list_rv"
+                    android:id="@+id/bar_list_rv"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:background="@color/bg_home_color"
-                    android:layout_marginTop="6dp"
-                    android:layout_below="@id/home_list_more_iv" />
-
-                <ImageView
-                    android:id="@+id/home_list_more_iv"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_below="@id/home_list_rv"
-                    android:layout_centerHorizontal="true"
-                    android:layout_marginTop="-1dp"
-                    android:src="@drawable/bg_to_bottom" />
+                    android:layout_below="@id/home_list_progress"
+                    android:layout_marginTop="13dp"
+                    android:background="@android:color/white" />
 
+                <View
+                    android:layout_width="match_parent"
+                    android:layout_height="18dp"
+                    android:layout_below="@+id/bar_list_rv"
+                    android:background="@color/bg_home_color" />
 
                 <LinearLayout
                     android:id="@+id/home_award_container"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:layout_below="@id/full_home_list_rv"
-                    android:visibility="gone"
-                    android:background="@color/white">
+                    android:layout_below="@id/bar_list_rv"
+                    android:background="@color/white"
+                    android:visibility="gone">
 
                     <include layout="@layout/homepage_item_get_award" />
                 </LinearLayout>
@@ -117,17 +130,17 @@
                 <include
                     android:id="@+id/goods_recommends_bar"
                     layout="@layout/goods_recommends_bar"
-                    android:layout_below="@+id/home_award_container"
                     android:layout_width="match_parent"
-                    android:layout_height="wrap_content"/>
+                    android:layout_height="wrap_content"
+                    android:layout_below="@+id/home_award_container" />
 
                 <include
                     android:id="@+id/hp_refresh_welfare_box"
+                    layout="@layout/inclue_hp_refresh_welfare_box"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:visibility="gone"
-                    layout="@layout/inclue_hp_refresh_welfare_box"
-                    android:layout_below="@id/goods_recommends_bar" />
+                    android:layout_below="@id/goods_recommends_bar"
+                    android:visibility="gone" />
 
                 <LinearLayout
                     android:id="@+id/home_vp_ll"
@@ -211,8 +224,8 @@
 
     <include
         layout="@layout/view_float_title_card"
-        android:visibility="gone"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content" />
+        android:layout_height="wrap_content"
+        android:visibility="gone" />
 
 </RelativeLayout>

+ 8 - 10
app/src/main/res/layout/item_my_list_but.xml

@@ -3,14 +3,14 @@
     android:id="@+id/my_item_but"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:paddingTop="10dp"
-    android:paddingBottom="10dp">
+    android:paddingTop="12dp"
+    android:paddingBottom="12dp">
 
     <ImageView
         android:id="@+id/my_item_img"
-        android:layout_width="match_parent"
-        android:layout_marginEnd="5dp"
-        android:layout_height="47dp"
+        android:layout_width="50dp"
+        android:layout_height="50dp"
+        android:layout_centerHorizontal="true"
         android:scaleType="fitCenter"
         android:src="@drawable/icon" />
 
@@ -19,13 +19,12 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_below="@id/my_item_img"
-        android:layout_marginTop="5dp"
-        android:layout_marginEnd="5dp"
+        android:layout_marginTop="8dp"
         android:singleLine="true"
         android:gravity="center"
         android:text="试玩赚钱"
         android:textColor="@color/black_6_3"
-        android:textSize="13sp" />
+        android:textSize="14sp" />
     <TextView
         android:id="@+id/my_item_text2"
         android:layout_width="match_parent"
@@ -34,8 +33,7 @@
         android:textColor="#fff02155"
         android:textSize="10sp"
         android:layout_below="@id/my_item_text"
-        android:layout_marginTop="3dp"
-        android:layout_marginEnd="5dp"
+        android:layout_marginTop="8dp"
         android:singleLine="true"
         android:gravity="center"
         />