Explorar el Código

修改标签游戏列表中标签顺序不变;
修改排行榜中游戏名称与来源的间隔

zengjiebin hace 7 años
padre
commit
77f84d2b3c

+ 5 - 0
app/src/main/java/com/sheep/gamegroup/module/game/adapter/AdpGameCenterTypeList.java

@@ -10,9 +10,12 @@ import com.sheep.gamegroup.helper.FindAppHelper;
 import com.sheep.gamegroup.model.api.IDownload;
 import com.sheep.gamegroup.model.entity.Applications;
 import com.sheep.gamegroup.model.entity.GameEntity;
+import com.sheep.gamegroup.model.entity.Lp;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.gamegroup.util.string.SpannableSb;
+import com.sheep.gamegroup.util.viewHelper.LayoutParamsUtil;
 import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.utils.G;
 
 import java.util.List;
 import java.util.Locale;
@@ -35,6 +38,8 @@ public class AdpGameCenterTypeList extends BaseQuickAdapter<GameEntity, BaseView
         TextView item_dm_info_tv = helper.getView(R.id.item_dm_info_tv);
         TextView item_dm_btn_tv = helper.getView(R.id.item_dm_btn_tv);
 
+        LayoutParamsUtil.resetLayoutParams(item_dm_name_tv, new Lp(G.DENSITY).setTopMargin(0));
+        LayoutParamsUtil.resetLayoutParams(item_dm_info_tv, new Lp(G.DENSITY).setBottomMargin(12));
         IDownload download = item.getDownload();
         if(download == null){
             ViewUtil.setDefaultText(item_dm_name_tv);

+ 15 - 4
app/src/main/java/com/sheep/gamegroup/module/game/fragment/FgtGameGroupMore.java

@@ -1,16 +1,14 @@
 package com.sheep.gamegroup.module.game.fragment;
 
 import android.os.Bundle;
-import android.support.annotation.NonNull;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
+import android.util.SparseIntArray;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 
 import com.scwang.smartrefresh.layout.SmartRefreshLayout;
-import com.scwang.smartrefresh.layout.api.RefreshLayout;
-import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
 import com.sheep.gamegroup.absBase.AbsObserver;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.GameEntity;
@@ -28,6 +26,8 @@ import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.base.BaseFragment;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
 import butterknife.BindView;
@@ -82,7 +82,15 @@ public class FgtGameGroupMore extends BaseFragment {
         //其它tag
         SheepApp.getInstance().getNetComponent().getApiService().getGameTagList()
                 .subscribeOn(Schedulers.io())
-                .flatMap((Function<BaseMessage, Observable<GameListTag>>) baseMessage -> Observable.fromIterable(baseMessage.getDataList(GameListTag.class)))
+                .flatMap((Function<BaseMessage, Observable<GameListTag>>) baseMessage -> {
+                    ArrayList<GameListTag> gameListTagList = baseMessage.getDataList(GameListTag.class);
+                    int i = 0;
+                    for (GameListTag item : gameListTagList) {
+                        sortSparseIntArray.put(i, item.getId());
+                        i ++;
+                    }
+                    return Observable.fromIterable(gameListTagList);
+                })
                 .filter(gameListTag -> gameListTag != null)
                 .subscribe(new AbsObserver<GameListTag>() {
 
@@ -113,6 +121,8 @@ public class FgtGameGroupMore extends BaseFragment {
         return rootView;
     }
 
+    private SparseIntArray sortSparseIntArray = new SparseIntArray();
+    private Comparator<ListTypeList<GameEntity, GameListType>> comparator = (item1, item2) -> sortSparseIntArray.get(item1.getType().getPort_type()) - sortSparseIntArray.get(item2.getType().getPort_type());
     private void initGameList(final RecyclerView playGameListRv, final List<ListTypeList<GameEntity, GameListType>> gameEntityListList, final GameListType gameListType) {
         if (gameListType == null) {
             return;
@@ -126,6 +136,7 @@ public class FgtGameGroupMore extends BaseFragment {
                         List<GameEntity> newList = baseMessage.getDatas(GameEntity.class);
                         if (!ListUtil.isEmpty(newList)) {
                             gameEntityListList.add(new ListTypeList<>(gameListType, newList));
+                            Collections.sort(gameEntityListList, comparator);//排序
                             ViewUtil.notifyDataSetChanged(playGameListRv);
                         }
                         notifyDataSetChanged();

+ 0 - 2
app/src/main/java/com/sheep/gamegroup/module/game/fragment/FgtPlayGame.java

@@ -23,7 +23,6 @@ import com.sheep.gamegroup.module.game.adapter.AdpGameCenter4_3List;
 import com.sheep.gamegroup.module.game.adapter.AdpGameCenterType;
 import com.sheep.gamegroup.module.game.model.GameCenterType;
 import com.sheep.gamegroup.module.game.model.GamePortTypes;
-import com.sheep.gamegroup.module.game.model.PackageTypes;
 import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.util.Jump2View;
@@ -37,7 +36,6 @@ import com.sheep.jiuyan.samllsheep.base.BaseFragment;
 import com.sheep.jiuyan.samllsheep.utils.G;
 import com.youth.banner.Banner;
 import com.youth.banner.BannerConfig;
-import com.youth.banner.listener.OnBannerListener;
 import com.youth.banner.loader.ImageLoader;
 
 import org.afinal.simplecache.ApiKey;

+ 3 - 1
app/src/main/res/layout/item_game_center_type_list.xml

@@ -23,13 +23,15 @@
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_marginStart="11dp"
+        android:layout_marginTop="5dp"
         android:text="永恒仙域"
+        android:gravity="top"
         android:textColor="#ff333333"
         android:textSize="18sp"
         android:layout_marginEnd="5dp"
         app:layout_constraintEnd_toStartOf="@id/item_dm_btn_tv"
         app:layout_constraintStart_toEndOf="@id/item_dm_icon_iv"
-        app:layout_constraintTop_toTopOf="@id/item_dm_icon_iv" />
+        app:layout_constraintTop_toTopOf="parent" />
 
     <TextView
         android:id="@+id/item_dm_info_tv"