zengjiebin лет назад: 7
Родитель
Сommit
a46e825eb2

+ 37 - 49
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtSmallSheep.java

@@ -40,7 +40,6 @@ import android.widget.TextView;
 
 import com.alibaba.fastjson.JSONArray;
 import com.bumptech.glide.Glide;
-import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
 import com.bumptech.glide.request.RequestOptions;
 import com.kfzs.duanduan.utils.NumberFormatUtils;
 import com.scwang.smartrefresh.layout.SmartRefreshLayout;
@@ -68,7 +67,6 @@ import com.sheep.gamegroup.model.entity.UserEntity;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.model.util.ShowRedDot;
 import com.sheep.gamegroup.module.home.adapter.AdpHomeList;
-import com.sheep.gamegroup.module.plugin.model.Plugin;
 import com.sheep.gamegroup.module.skin.util.SkinUtil;
 import com.sheep.gamegroup.presenter.SmallSheepContract;
 import com.sheep.gamegroup.presenter.SmallSheepPresenter;
@@ -311,6 +309,12 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
     public void toActMsg() {
         startActivity(new Intent(activity, ActMsg.class));
     }
+    @OnClick(R.id.homepage_item_notice_info_tv)
+    public void toNoticeInfo() {
+        BulletinEnty item = ListUtil.getItem(bulletinEntyList, homepageItemNoticeMv.getPosition());
+        if(item != null)
+            onClickNotice(item);
+    }
 
     /**
      * 兑换红包
@@ -566,7 +570,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
     private int bannerHeight;
 
     private void initBannerHeight(){
-        bannerHeight = (G.WIDTH - G.getRealPix(24)) * 17 / 40;
+        bannerHeight = G.WIDTH  * 17 / 40;
     }
     public void initView() {
         try {
@@ -586,7 +590,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
 //        bannerLayoutParams.height = bannerHeight;//图片比例发生变化 :306*720
 //        bannerLayoutParams.height = G.WIDTH * 25 / 72;
 //        banner.setLayoutParams(bannerLayoutParams);
-        LayoutParamsUtil.resetLayoutParams(banner, new Lp().setHeight(bannerHeight).setLrMargin(G.getRealPix(13)));
+        LayoutParamsUtil.resetLayoutParams(banner, new Lp().setHeight(bannerHeight));
 
         /**
          * tablayout
@@ -814,6 +818,8 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
             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++) {
@@ -941,11 +947,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
                 return;
             }
             UMConfigUtils.IdEvent.HOME_LIST.commit(item.getId());
-            if ("-2".equals(item.getJump())) {
-                setValueList(!item.isSelect());
-            } else {
-                CommonUtil.getInstance().goWhere(activity, item, "首页");
-            }
+            CommonUtil.getInstance().goWhere(activity, item, "首页");
         });
     }
 
@@ -1266,7 +1268,8 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
             public void displayImage(Context context, Object o, ImageView imageView) {
                 try {
                     if (o instanceof SlideshowEty && activity != null && !activity.isDestroyed())
-                        Glide.with(context).load(((SlideshowEty) o).getUrl()).apply(new RequestOptions().centerCrop().transform(new RoundedCorners(G.getRealPix(10)))).into(imageView);
+                        Glide.with(context).load(((SlideshowEty) o).getUrl()).apply(new RequestOptions().centerCrop()).into(imageView);
+//                        Glide.with(context).load(((SlideshowEty) o).getUrl()).apply(new RequestOptions().centerCrop().transform(new RoundedCorners(G.getRealPix(10)))).into(imageView);
 //                        Glide.with(context).load(((SlideshowEty) o).getUrl()).apply(new RequestOptions().transform(new RoundedCornersTransformation(G.getRealPix(10), 0))).into(imageView);
                 } catch (Exception e) {
                     e.printStackTrace();
@@ -1310,12 +1313,14 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
 //        banner.start();
     }
 
+    private List<BulletinEnty> bulletinEntyList;
     /**
      * 公共
      */
     private void inviteNotice(final List<BulletinEnty> bulletinEntyList) {
         ViewUtil.setVisibility(homepageItemNoticeLayout, false);
         homepageItemNoticeMv.removeAllViews();
+        this.bulletinEntyList = bulletinEntyList;
         for (final BulletinEnty entity : bulletinEntyList) {
             StringBuilder sb = new StringBuilder();
             sb.append(entity.getContent()).append("   ");
@@ -1495,63 +1500,46 @@ 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展开或者收缩
+        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();
+    }
+    private boolean isHomeListExtend = false;//homeList是否已经展开
     /**
      * 新手任务
      */
     private void addNewTask() {
-        boolean isNewYear = SkinUtil.isLoadNewYearSkin();
-
         if (CommonUtil.getInstance().addNewTask(activity, userEntity) && homeListList != null) {
             HomeListEntity homeListEntityNewTask = new HomeListEntity();
             homeListEntityNewTask.setTitle(SheepApp.getInstance().getString(R.string.fresh_task));
             homeListEntityNewTask.setDesc(SheepApp.getInstance().getString(R.string.fresh_task));
             homeListEntityNewTask.setJump("-1");
-            homeListEntityNewTask.setIcon(ViewUtil.getNetImgByName((isNewYear ? "ic_new_year_" : "") + "homepage_xinshourw"));
+            homeListEntityNewTask.setIcon(ViewUtil.getNetImgByName("homepage_xinshourw"));
             homeListEntitys.add(0, homeListEntityNewTask);
         }
-        if (homeListEntitys.size() > 8) {
-            HomeListEntity homeListEntity = new HomeListEntity();
-            homeListEntity.setTitle("更多");
-            homeListEntity.setDesc("查看更多");
-            homeListEntity.setJump("-2");
-            homeListEntity.setIcon(ViewUtil.getNetImgByName((isNewYear ? "ic_new_year_" : "") + "homepage_chakangd"));
-            homeListEntitys.add(7, homeListEntity);
-        }
-        setValueList(false);
+        ViewUtil.setVisibility(home_list_more_iv, ListUtil.size(homeListEntitys) > 8);
+        getHomeList();
+        adpHomeList.notifyDataSetChanged();
     }
-
-    private void setValueList(boolean flag) {
-        boolean isNewYear = SkinUtil.isLoadNewYearSkin();
+    private void getHomeList() {
         homeListList.clear();
         for (int i = 0; i < homeListEntitys.size(); i++) {
-            if (flag) {
+            if (i < 8) {
                 homeListList.add(homeListEntitys.get(i));
             } else {
-                if (i < 8) {
-                    homeListList.add(homeListEntitys.get(i));
-                }
-            }
-        }
-        if (homeListList.size() > 8) {
-            HomeListEntity homeListEntity = new HomeListEntity();
-            homeListEntity.setJump("-2");
-            homeListEntity.setSelect(flag);
-            if (flag) {
-                homeListEntity.setTitle("收起");
-                homeListEntity.setDesc("收起模块");
-                homeListEntity.setIcon(ViewUtil.getNetImgByName(isNewYear ? "ic_new_year_homepage_chakangd" : "homepage_chakangd_click"));
-            } else {
-                homeListEntity.setTitle("更多");
-                homeListEntity.setDesc("查看更多");
-                homeListEntity.setIcon(ViewUtil.getNetImgByName((isNewYear ? "ic_new_year_" : "") + "homepage_chakangd"));
+                break;
             }
-            homeListList.set(7, homeListEntity);
         }
-        /* 为了避免第一次点击时网络图片未加载到本地导致UI混乱,第一次点击不执行此动画,转而使用View自带的变换动画 */
-//        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && clickCount > 1) {
-//            TransitionManager.beginDelayedTransition(home_list_gridview_gv, new ChangeBounds());
-//        }
-        adpHomeList.notifyDataSetChanged();
     }
 
     @BindView(R.id.home_search_sbd_tv)

+ 31 - 23
app/src/main/res/layout/homepage_act_layout.xml

@@ -43,62 +43,70 @@
                     android:layout_height="wrap_content"
                     android:layout_below="@id/check_net_ll" />
 
-
-                <android.support.v7.widget.RecyclerView
-                    android:id="@+id/home_list_rv"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_marginStart="@dimen/content_padding"
-                    android:layout_marginTop="13dp"
-                    android:layout_marginEnd="@dimen/content_padding"
-                    android:background="@drawable/x_shap_shadow_bg_rectgangle_white"
-                    android:layout_below="@id/banner" />
-
                 <LinearLayout
                     android:id="@+id/home_notice_ll"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:layout_marginStart="@dimen/content_padding"
                     android:layout_marginTop="@dimen/content_padding"
-                    android:layout_marginEnd="@dimen/content_padding"
-                    android:background="@drawable/x_shap_shadow_bg_rectgangle_white"
+                    android:background="@android:color/white"
                     android:orientation="vertical"
-                    android:layout_below="@id/full_home_list_rv">
+                    android:layout_below="@id/banner">
 
                     <include layout="@layout/homepage_item_notice_and_currenttime" />
 
                     <View
                         android:layout_width="match_parent"
                         android:layout_height="1dp"
+                        android:visibility="gone"
                         android:background="@color/color_bg_line_home" />
 
-                    <include layout="@layout/homepage_item_get_award" />
-
                     <include
                         layout="@layout/homepage_item_notice"
                         android:visibility="gone" />
-
                     <include
                         layout="@layout/homepage_item_currenttime_reward"
                         android:visibility="gone" />
                 </LinearLayout>
 
+                <android.support.v7.widget.RecyclerView
+                    android:id="@+id/home_list_rv"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="13dp"
+                    android:background="@android:color/white"
+                    android:layout_below="@id/home_notice_ll" />
+
                 <!--超维对决HomeList-->
                 <android.support.v7.widget.RecyclerView
                     android:id="@+id/full_home_list_rv"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:layout_below="@id/home_list_rv" />
+                    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_marginTop="-1dp"
+                    android:layout_centerHorizontal="true"
+                    android:src="@drawable/bg_to_bottom"
+                    android:layout_below="@id/home_list_rv"/>
+
+                <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:background="@color/white">
+                    <include layout="@layout/homepage_item_get_award" />
+                </LinearLayout>
                 <LinearLayout
                     android:id="@+id/home_vp_ll"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:layout_marginStart="@dimen/content_padding"
                     android:layout_marginTop="@dimen/content_padding"
-                    android:layout_marginEnd="@dimen/content_padding"
-                    android:background="@drawable/x_shap_shadow_bg_rectgangle_white"
+                    android:background="@android:color/white"
                     android:orientation="vertical"
-                    android:layout_below="@id/home_notice_ll">
+                    android:layout_below="@id/home_award_container">
 
                     <android.support.v7.widget.RecyclerView
                         android:id="@+id/recyclerview"

+ 3 - 0
app/src/main/res/layout/homepage_item_get_award.xml

@@ -10,6 +10,8 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginStart="5dp"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
         android:src="@mipmap/homepage_jianglilq" />
 
     <TextView
@@ -18,6 +20,7 @@
         android:layout_height="wrap_content"
         android:text="@string/homepage_award"
         android:textColor="@color/black_333333"
+        app:layout_constraintTop_toTopOf="parent"
         android:textSize="@dimen/text_size_3"
         app:layout_constraintLeft_toRightOf="@id/homepage_item_get_award_iv"
         app:layout_constraintEnd_toEndOf="parent"

+ 10 - 1
app/src/main/res/layout/homepage_item_notice_and_currenttime.xml

@@ -31,7 +31,8 @@
 
         <com.sunfusheng.marqueeview.MarqueeView
             android:id="@+id/homepage_item_notice_mv"
-            android:layout_width="match_parent"
+            android:layout_width="0dp"
+            android:layout_weight="1"
             android:layout_height="wrap_content"
             android:minHeight="20dp"
             android:paddingEnd="@dimen/content_padding_10"
@@ -42,6 +43,14 @@
             app:mvSingleLine="true"
             app:mvTextColor="@color/white"
             app:mvTextSize="11sp" />
+        <TextView
+            android:id="@+id/homepage_item_notice_info_tv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textSize="10sp"
+            android:textColor="#37C1F3"
+            android:layout_marginEnd="9dp"
+            android:text="详情"/>
     </LinearLayout>
 
     <LinearLayout

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

@@ -58,6 +58,7 @@
         android:minWidth="14dp"
         android:paddingStart="4dp"
         android:paddingEnd="4dp"
+        android:visibility="invisible"
         android:text="0"
         android:textColor="@color/white"
         android:textSize="9sp" />

+ 1 - 1
app/src/main/res/values/colors.xml

@@ -18,7 +18,7 @@
     <color name="tc_dialog_gtg_name">#272727</color>
     <color name="tc_dialog_gtg_amout">#ffff2d4b</color>
     <color name="red_FD2D54">#FD2D54</color>
-    <color name="bg_home_color">#ffffff</color>
+    <color name="bg_home_color">#F5F5F5</color>
     <color name="color_bg_line_home">#fff5f5f5</color>
     <color name="tc_home_search_1">#8f8f8f</color>
     <color name="tc_home_search_2">#333333</color>