ソースを参照

我的游戏列表界面 添加更多可以跳转主页游戏模块

zengjiebin 7 年 前
コミット
501720c3d6

+ 8 - 0
app/src/main/java/com/sheep/gamegroup/module/game/activity/ActMyGameList.java

@@ -4,6 +4,10 @@ import android.support.v4.app.Fragment;
 
 import com.sheep.gamegroup.absBase.BaseContainerActivity;
 import com.sheep.gamegroup.module.game.fragment.FgtMyGameList;
+import com.sheep.gamegroup.util.ActionUtil;
+import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.gamegroup.util.MainTab;
+import com.sheep.gamegroup.view.activity.ActMain;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
 
@@ -27,6 +31,10 @@ public class ActMyGameList extends BaseContainerActivity {
                 .getInstance()
                 .setShowOrHide(this, true)
                 .setTitle(this, getString(R.string.my_games))
+                .setRightBtn(this, "更多", 0, view -> {
+                    ActionUtil.getInstance().addNextAction(ActMain.class.getSimpleName(), MainTab.FgtGameCenter);
+                    Jump2View.getInstance().newTaskTopStartAct(ActMyGameList.this, ActMain.class, null);
+                })
                 .setTitleFinish(this);
     }
 

+ 6 - 5
app/src/main/java/com/sheep/gamegroup/module/game/fragment/FgtMyGameList.java

@@ -100,7 +100,7 @@ public class FgtMyGameList extends BaseListFragment6<MyGame> {
         };
         baseQuickAdapter.setOnItemClickListener((adapter, view, position) -> {
             MyGame item = ListUtil.getItem(apiRefresh.getList(), position);
-            if(item != null)
+            if (item != null)
                 Jump2View.getInstance().goFindGame(getActivity(), item.getApplication());
         });
         return baseQuickAdapter;
@@ -123,10 +123,11 @@ public class FgtMyGameList extends BaseListFragment6<MyGame> {
             findApp.getFindAppHelper().updateReservationView(activity, findApp, textView);
         }
     }
+
     private AbsGetDownloadListener absGetDownloadListener = new AbsGetDownloadListener(true) {
         @Override
         public String getDownloadUrl(String packageName) {
-            Applications item =  applicationMap.get(packageName);
+            Applications item = applicationMap.get(packageName);
             return item != null ? item.getDownload_url() : null;
         }
 
@@ -142,7 +143,7 @@ public class FgtMyGameList extends BaseListFragment6<MyGame> {
 
         @Override
         public DownloadHelper getDownloadHelper(String downloadUrl) {
-            Applications item =  applicationMap.get(downloadUrl);
+            Applications item = applicationMap.get(downloadUrl);
             return item != null ? item.getDownloadHelper() : null;
         }
     };
@@ -160,12 +161,12 @@ public class FgtMyGameList extends BaseListFragment6<MyGame> {
     @Override
     public void initView() {
         super.initView();
-        EventBus.getDefault().register(this);
+        ViewUtil.register(this);
     }
 
     @Override
     public void onDestroy() {
         super.onDestroy();
-        EventBus.getDefault().unregister(this);
+        ViewUtil.unregister(this);
     }
 }

+ 19 - 0
app/src/main/java/com/sheep/gamegroup/util/ViewUtil.java

@@ -84,6 +84,7 @@ import com.sheep.gamegroup.model.entity.RobTask;
 import com.sheep.gamegroup.model.entity.TaskEty;
 import com.sheep.gamegroup.model.entity.WebParams;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.module.game.fragment.FgtMyGameList;
 import com.sheep.gamegroup.module.yf_shop.model.ReceiveCouponsCheckResq;
 import com.sheep.gamegroup.module.yf_shop.model.ReceiveCouponsResp;
 import com.sheep.gamegroup.util.glide.RoundedCornersTransformation;
@@ -118,6 +119,7 @@ import com.umeng.socialize.media.UMImage;
 import com.umeng.socialize.media.UMWeb;
 
 import org.afinal.simplecache.ACache;
+import org.greenrobot.eventbus.EventBus;
 
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -2408,4 +2410,21 @@ public class ViewUtil {
         //如果不添加setFillEnabled和setFillAfter则动画执行结束后会自动回到远点
         view.startAnimation(translateAnimation);
     }
+
+    //注册eventBus
+    public static void register(Object object) {
+        try {
+            EventBus.getDefault().register(object);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+    //取消注册eventBus
+    public static void unregister(Object object) {
+        try {
+            EventBus.getDefault().unregister(object);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
 }