Procházet zdrojové kódy

game detail tune up

billyyoyo před 5 roky
rodič
revize
8cf01b95a8

+ 20 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/Applications.java

@@ -102,6 +102,26 @@ public class Applications implements IDownload, IGameGroup, Serializable {
     //1下载  2预约
     private int mobile_appointment=0;
 
+    private int activity_id;
+
+    private String activity_url;
+
+    public int getActivity_id() {
+        return activity_id;
+    }
+
+    public void setActivity_id(int activity_id) {
+        this.activity_id = activity_id;
+    }
+
+    public String getActivity_url() {
+        return activity_url;
+    }
+
+    public void setActivity_url(String activity_url) {
+        this.activity_url = activity_url;
+    }
+
     public int getMobile_appointment() {
         return mobile_appointment;
     }

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

@@ -142,6 +142,8 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
     TextView gc_game_app_detail_bt2;
     @BindView(R.id.gc_game_app_detail_bt3)
     TextView gc_game_app_detail_bt3;
+    @BindView(R.id.gc_game_app_detail_bt4)
+    TextView gc_game_app_detail_bt4;
     @BindView(R.id.gc_game_app_hot_iv)
     View gc_game_app_hot_iv;
     @BindView(R.id.gc_game_app_detail_tag_list)
@@ -308,7 +310,7 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
         //加载游戏图标
         ViewUtil.setGameImage(gc_game_app_detail_icon, gameEntity.getApp().getIcon());
         //加载游戏名字
-        ViewUtil.setText(gc_game_app_detail_name, gameGroup == null ? gameEntity.getApp().getName(): gameGroup.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() : gameGroup.getInfo(null));
         //加载游戏标签
@@ -320,22 +322,35 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
                 recyclerView.getAdapter().notifyDataSetChanged();
         }
         //下载按钮
-        if(gameEntity.getApp().getMobile_appointment()==1) {
+        if (gameEntity.getApp().getMobile_appointment() == 1) {
             CommonUtil.getInstance().palyGameDetailBtnValue(false, gameEntity, gc_game_app_detail_bt2, 0);
-        }else{
+        } else if (gameEntity.getApp().getMobile_appointment() == 2) {
             ViewUtil.setText(gc_game_app_detail_bt2, "立即预约");
-            ViewUtil.setOnClickListener(gc_game_app_detail_bt2, v->new GameAppointHelper(this, gameEntity).showAppointDialog());
+            ViewUtil.setOnClickListener(gc_game_app_detail_bt2, v -> new GameAppointHelper(this, gameEntity, t -> {
+                ViewUtil.setText(gc_game_app_detail_bt2, "已预约");
+                ViewUtil.setOnClickListener(gc_game_app_detail_bt2, null);
+            }).showAppointDialog());
+        } else if (gameEntity.getApp().getMobile_appointment() == 3) {
+            ViewUtil.setText(gc_game_app_detail_bt2, "已预约");
+        } else {
+            ViewUtil.setVisibility(gc_game_app_detail_bt2, false);
         }
         fgtGameDetail.loadData(gameEntity);
         ViewUtil.setVisibility(gc_game_app_detail_bt3, gameEntity.getApp().hasGameDiscountId());
         ViewUtil.setVisibility(gc_game_app_hot_iv, gameEntity.getApp().getIsHot() == 1);
         ViewUtil.setVisibility(gc_game_app_discount_desc_btn, gameEntity.getApp().hasGameDiscountId());
 
-        if (isAutoDownload && gameEntity.getApp().getMobile_appointment()==1) {//可以进行自动下载
+        if (isAutoDownload && gameEntity.getApp().getMobile_appointment() == 1) {//可以进行自动下载
             if (!PackageUtil.isAppInstalled(SheepApp.getInstance(), gameEntity.getApp().getPackage_name())) {//未安装的情况才进行下载
                 gc_game_app_detail_bt2.performLongClick();
             }
         }
+        if (gameGroup == null) {
+            ViewUtil.setVisibility(gc_game_app_detail_bt4, gameEntity.getApp().getActivity_id() > 0);
+            ViewUtil.setOnClickListener(gc_game_app_detail_bt4, v->{
+                Jump2View.getInstance().goWeb(this, gameEntity.getApp().getActivity_url(), "活动");
+            });
+        }
     }
 
     //更新评分

+ 6 - 4
app/src/main/java/com/sheep/gamegroup/module/game/adapter/AdpGameGroupGameCompare.java

@@ -37,11 +37,12 @@ public class AdpGameGroupGameCompare extends BaseQuickAdapter<Applications, Base
         TextView item_gggc_score_tv = helper.itemView.findViewById(R.id.item_gggc_score_tv);
         TextView item_gggc_game = helper.itemView.findViewById(R.id.item_gggc_game);
         TextView item_gggc_version = helper.itemView.findViewById(R.id.item_gggc_version);
+        TextView item_gggc_activity = helper.itemView.findViewById(R.id.item_gggc_activity_flag);
 
         item_gggc_vip_tv.setOnClickListener(view -> {
-            CommonUtil.getInstance().getUserInfo(false, user->{
-                if(user==null) return;
-                if(user.isVIP()){
+            CommonUtil.getInstance().getUserInfo(false, user -> {
+                if (user == null) return;
+                if (user.isVIP()) {
                     Jump2View.getInstance().gotoGameVipRecharge(item);
                 } else {
                     Jump2View.getInstance().gotoVip(this.mContext);
@@ -55,9 +56,10 @@ public class AdpGameGroupGameCompare extends BaseQuickAdapter<Applications, Base
         boolean showVipTv = item.hasGameDiscountId();
         ViewUtil.setVisibility(item_gggc_vip_tv, showVipTv);
         ViewUtil.setText(item_gggc_game, item.getName());
-        ViewUtil.setText(item_gggc_version, "当前版本: "+item.getVersions());
+        ViewUtil.setText(item_gggc_version, "当前版本: " + item.getVersions());
         ViewUtil.setText(item_gggc_name_tv, item.getGameFrom());
         ViewUtil.setText(item_gggc_info_tv, item.getSimpleInfo());
         ViewUtil.setText(item_gggc_score_tv, NumberFormatUtils.retain1(item.getScore()));
+        ViewUtil.setVisibility(item_gggc_activity, item.getActivity_id() > 0);
     }
 }

+ 11 - 2
app/src/main/java/com/sheep/gamegroup/module/game/util/GameAppointHelper.java

@@ -15,6 +15,7 @@ import com.sheep.gamegroup.model.entity.UserEntity;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.util.RxjavaCountDownTimer;
+import com.sheep.gamegroup.util.TestUtil;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.groups.creditcard.RegexUtils;
 import com.sheep.jiuyan.samllsheep.R;
@@ -26,6 +27,7 @@ import butterknife.ButterKnife;
 import butterknife.OnClick;
 import io.reactivex.android.schedulers.AndroidSchedulers;
 import io.reactivex.schedulers.Schedulers;
+import rx.functions.Action1;
 
 public class GameAppointHelper {
 
@@ -42,10 +44,13 @@ public class GameAppointHelper {
 
     boolean hasMobile = false;
 
-    public GameAppointHelper(Context context, GameEntity game) {
+    private Action1<String> callback;
+
+    public GameAppointHelper(Context context, GameEntity game, Action1<String> callback) {
         this.context = context;
         this.game = game;
-        hasMobile = DataUtil.getInstance().getUserEntity().isBindMobile();
+        this.callback = callback;
+        hasMobile = !TextUtils.isEmpty(DataUtil.getInstance().getUserMobile());
     }
 
     public void showAppointDialog() {
@@ -87,6 +92,9 @@ public class GameAppointHelper {
                     @Override
                     public void onNext(BaseMessage baseMessage) {
                         G.showToast("预约成功");
+                        if(callback!=null){
+                            callback.call("");
+                        }
                         dialog.dismiss();
                     }
                 });
@@ -98,6 +106,7 @@ public class GameAppointHelper {
         if (hasMobile) {
             ViewUtil.setVisibility(code_view, !hasMobile);
             ViewUtil.setVisibility(get_code_btn, !hasMobile);
+            ViewUtil.setText(mobile_view, DataUtil.getInstance().getUserMobile());
         }
         return view;
     }

+ 8 - 0
app/src/main/res/drawable/shape_activity_gradient_rectangle_15.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <gradient
+        android:endColor="#4bbefd"
+        android:startColor="#5f98ff" />
+    <corners android:radius="15dp" />
+</shape>

+ 28 - 11
app/src/main/res/layout/act_game_group_or_game_detail.xml

@@ -59,6 +59,7 @@
                         android:id="@+id/gc_game_app_detail_iv"
                         android:layout_width="match_parent"
                         android:layout_height="216dp"
+                        android:maxHeight="300dp"
                         android:scaleType="centerCrop"
                         android:src="@drawable/loading_01"
                         app:layout_constraintTop_toTopOf="parent"/>
@@ -68,6 +69,7 @@
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:minHeight="100dp"
+                        android:maxHeight="300dp"
                         android:adjustViewBounds="true"
                         android:scaleType="fitXY"
                         android:src="@drawable/loading_01"
@@ -78,6 +80,7 @@
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:minHeight="100dp"
+                        android:maxHeight="300dp"
                         android:visibility="gone"
                         app:layout_constraintTop_toTopOf="parent"/>
                     <ImageView
@@ -125,6 +128,7 @@
 
                 <android.support.constraint.ConstraintLayout
                     android:layout_width="match_parent"
+                    android:paddingBottom="16dp"
                     android:layout_height="wrap_content">
 
                     <LinearLayout
@@ -204,7 +208,7 @@
                         android:id="@+id/gc_game_app_detail_tag_list"
                         android:layout_width="0dp"
                         android:layout_height="wrap_content"
-                        android:layout_marginTop="6dp"
+                        android:layout_marginTop="8dp"
                         app:layout_constraintEnd_toEndOf="parent"
                         app:layout_constraintTop_toBottomOf="@id/gc_game_app_detail_name"
                         app:layout_constraintStart_toStartOf="@id/gc_game_app_detail_name" />
@@ -217,13 +221,27 @@
                         android:text="1.8万人在玩   |   1.2G"
                         android:textColor="#ff999999"
                         android:textSize="12sp"
-                        android:layout_marginTop="4dp"
-                        android:layout_marginBottom="16dp"
+                        android:layout_marginTop="8dp"
                         app:layout_constraintEnd_toStartOf="@id/gc_game_app_detail_score_tv"
                         app:layout_constraintStart_toStartOf="@id/gc_game_app_detail_name"
                         app:layout_constraintBottom_toBottomOf="parent"
                         app:layout_constraintTop_toBottomOf="@id/gc_game_app_detail_tag_list" />
 
+                    <TextView
+                        android:id="@+id/gc_game_app_detail_bt1"
+                        android:layout_width="44dp"
+                        android:layout_height="17dp"
+                        android:background="@drawable/selector_button_stroke_main"
+                        android:gravity="center"
+                        android:onClick="onClickFollowTv"
+                        android:text="关注"
+                        android:textColor="@color/selector_color_stoke_main_btn"
+                        android:textSize="10sp"
+                        android:layout_marginTop="6dp"
+                        app:layout_constraintTop_toBottomOf="@+id/gc_game_app_detail_icon"
+                        app:layout_constraintRight_toRightOf="@+id/gc_game_app_detail_icon"
+                        app:layout_constraintLeft_toLeftOf="@+id/gc_game_app_detail_icon"/>
+
                     <LinearLayout
                         android:orientation="horizontal"
                         android:layout_width="wrap_content"
@@ -231,16 +249,15 @@
                         android:layout_marginEnd="12dp"
                         app:layout_constraintBottom_toBottomOf="@id/gc_game_app_detail_icon"
                         app:layout_constraintEnd_toEndOf="parent">
+
                         <TextView
-                            android:id="@+id/gc_game_app_detail_bt1"
-                            android:layout_width="56dp"
+                            android:id="@+id/gc_game_app_detail_bt4"
+                            style="@style/style_activity_td_tv"
+                            android:textSize="13sp"
+                            android:layout_width="66dp"
                             android:layout_height="24dp"
-                            android:background="@drawable/selector_button_stroke_main"
-                            android:gravity="center"
-                            android:onClick="onClickFollowTv"
-                            android:text="关注"
-                            android:textColor="@color/selector_color_stoke_main_btn"
-                            android:textSize="13sp" />
+                            android:visibility="gone"
+                            android:layout_marginStart="12dp" />
 
                         <TextView
                             android:id="@+id/gc_game_app_detail_bt3"

+ 18 - 0
app/src/main/res/layout/item_game_group_game_compare.xml

@@ -24,6 +24,24 @@
         android:layout_height="wrap_content" />
 
     <TextView
+        android:id="@+id/item_gggc_activity_flag"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:background="@drawable/shape_blue_stroke_rectangle_no_lb"
+        android:paddingStart="8dp"
+        android:paddingTop="2dp"
+        android:paddingEnd="8dp"
+        android:paddingBottom="2dp"
+        android:layout_marginEnd="10dp"
+        app:layout_constraintLeft_toRightOf="@+id/item_gggc_game"
+        app:layout_constraintTop_toTopOf="@+id/item_gggc_game"
+        app:layout_constraintBottom_toBottomOf="@+id/item_gggc_game"
+        android:layout_marginLeft="12dp"
+        android:text="活动"
+        android:textColor="#ff4889ff"
+        android:textSize="9sp" />
+
+    <TextView
         android:id="@+id/item_gggc_version"
         android:text="当前版本: v1.4.5.4"
         android:textSize="10sp"

+ 10 - 1
app/src/main/res/values/dd_styles.xml

@@ -543,6 +543,15 @@
         <item name="android:adjustViewBounds">true</item>
     </style>
     <!-- 会员通道textView 样式-->
+    <style name="style_activity_td_tv">
+        <item name="android:layout_width">80dp</item>
+        <item name="android:layout_height">30dp</item>
+        <item name="android:background">@drawable/shape_activity_gradient_rectangle_15</item>
+        <item name="android:gravity">center</item>
+        <item name="android:text">活动</item>
+        <item name="android:textColor">@android:color/white</item>
+        <item name="android:textSize">13sp</item>
+    </style>
     <style name="style_vip_td_tv">
         <item name="android:layout_width">80dp</item>
         <item name="android:layout_height">30dp</item>
@@ -550,7 +559,7 @@
         <item name="android:gravity">center</item>
         <item name="android:text">会员通道</item>
         <item name="android:textColor">#714E36</item>
-        <item name="android:textSize">14sp</item>
+        <item name="android:textSize">13sp</item>
     </style>
     <style name="style_vip_td_tv3">
         <item name="android:layout_width">70dp</item>