ソースを参照

game group and game detail tune up

billyyoyo 5 年 前
コミット
f3daaf59eb

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/module/game/activity/ActGameGroupOrGameDetail.java

@@ -308,9 +308,9 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
         //加载游戏图标
         ViewUtil.setGameImage(gc_game_app_detail_icon, gameEntity.getApp().getIcon());
         //加载游戏名字
-        ViewUtil.setText(gc_game_app_detail_name, gameEntity.getApp().getName());
+        ViewUtil.setText(gc_game_app_detail_name, gameGroup == null ? gameEntity.getApp().getName(): gameGroup.getName());
         //加载游戏大小与多少人在玩信息
-        ViewUtil.setText(gc_game_app_detail_info_tv, gameGroup == null ? gameEntity.getApp().getInfoContainGameFrom() : gameEntity.getApp().getInfo());
+        ViewUtil.setText(gc_game_app_detail_info_tv, gameGroup == null ? gameEntity.getApp().getInfoContainGameFrom() : gameGroup.getInfo(null));
         //加载游戏标签
         if (gameEntity.getApp().getTags() != null) {
             tagList.clear();

+ 24 - 0
app/src/main/java/com/sheep/gamegroup/module/game/model/GameGroup.java

@@ -1,11 +1,16 @@
 package com.sheep.gamegroup.module.game.model;
 
+import com.kfzs.duanduan.utils.NumberFormatUtils;
 import com.sheep.gamegroup.model.entity.Applications;
 import com.sheep.gamegroup.module.game.api.IGameGroup;
 import com.sheep.gamegroup.util.ListUtil;
+import com.sheep.gamegroup.util.string.SpannableSb;
+import com.sheep.jiuyan.samllsheep.R;
 
 import java.util.List;
 
+import rx.functions.Action1;
+
 /**
  * Created by realicing on 2019/1/18.
  * realicing@sina.com
@@ -43,12 +48,22 @@ public class GameGroup implements IGameGroup {
 
     private int game_discount_id;
 
+    private int online_num;
+
     private String updated_at;
 
     public String getName() {
         return Name;
     }
 
+    public int getOnline_num() {
+        return online_num;
+    }
+
+    public void setOnline_num(int online_num) {
+        this.online_num = online_num;
+    }
+
     @Override
     public String getPackageSizeMsg() {
         return package_size + "M";
@@ -163,4 +178,13 @@ public class GameGroup implements IGameGroup {
             return app.getId();
         return 0;
     }
+
+    public CharSequence getInfo(Action1<SpannableSb> action1) {
+        return new SpannableSb("#999999", R.dimen.text_size_12)
+                .callAction(action1)
+                .append(package_size+"M").defaultTcTs()
+                .kgz().append(NumberFormatUtils.retainMost2W(online_num), "#2EBEF2").defaultTextSize()
+                .append("人在玩").defaultTcTs()
+                .getSsb();
+    }
 }

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/module/search/GameHolder.java

@@ -49,7 +49,7 @@ public class GameHolder extends SearchResultHolder<GameSimple> {
     public void configView() {
         LayoutParamsUtil.resetLayoutParams(item_name_tv, new Lp(G.DENSITY).setTopMargin(8));
         ViewUtil.setText(item_name_tv, item.getName());
-        ViewUtil.setText(item_date_tv, item.getPackage_size());
+        ViewUtil.setText(item_date_tv, item.getPackage_size()+"M");
         GlideImageLoader.setGameImage(item_icon_iv, item.getIcon());
         ViewUtil.setText(detail_task_tv_center, "查看详情");
 

+ 2 - 1
app/src/main/res/layout/act_game_group_or_game_detail.xml

@@ -52,7 +52,8 @@
 
                 <android.support.constraint.ConstraintLayout
                     android:layout_width="match_parent"
-                    android:layout_height="wrap_content">
+                    android:layout_height="wrap_content"
+                    android:maxHeight="300dp">
 
                     <ImageView
                         android:id="@+id/gc_game_app_detail_iv"