Procházet zdrojové kódy

比一比只显示下载按钮

zengjiebin před 7 roky
rodič
revize
47926d9aff

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

@@ -191,9 +191,11 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
             item_gc_game_app_list_rv.setNestedScrollingEnabled(false);
             item_gc_game_app_list_rv.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
             if(!ListUtil.isEmpty(gameGroup.getApplications())) {
-                for (Applications item : gameGroup.getApplications()) {
-                    applicationsMap.put(item.getDownload_link(), item);
-                    applicationsMap.put(item.getPackage_name(), item);
+                if(AdpGameGroupGameCompare.canDownload) {
+                    for (Applications item : gameGroup.getApplications()) {
+                        applicationsMap.put(item.getDownload_link(), item);
+                        applicationsMap.put(item.getPackage_name(), item);
+                    }
                 }
                 BaseQuickAdapter baseQuickAdapter = new AdpGameGroupGameCompare(gameGroup.getApplications());
                 baseQuickAdapter.bindToRecyclerView(item_gc_game_app_list_rv);
@@ -461,12 +463,12 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
 
         @Override
         public TextView getTextView2(String packageName) {
-            return recyclerView.findViewWithTag(PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + getDownloadUrl(packageName));
+            return item_gc_game_app_list_rv.findViewWithTag(PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + getDownloadUrl(packageName));
         }
 
         @Override
         public TextView getTextView(String downloadUrl) {
-            return recyclerView.findViewWithTag(PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + downloadUrl);
+            return item_gc_game_app_list_rv.findViewWithTag(PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + downloadUrl);
         }
 
         @Override
@@ -478,13 +480,15 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
     @Subscribe
     public void onEventMainThread(Intent intent) {
         absGetDownloadListener.onEventMainThread(intent);
-        absGetDownloadListener2.onEventMainThread(intent);
+        if(AdpGameGroupGameCompare.canDownload)
+            absGetDownloadListener2.onEventMainThread(intent);
     }
 
     @Subscribe
     public void onEventMainThread(BigEvent event) {
         absGetDownloadListener.onEventMainThread(event);
-        absGetDownloadListener2.onEventMainThread(event);
+        if(AdpGameGroupGameCompare.canDownload)
+            absGetDownloadListener2.onEventMainThread(event);
     }
 
     @Override

+ 5 - 2
app/src/main/java/com/sheep/gamegroup/module/game/adapter/AdpGameGroupGameCompare.java

@@ -25,6 +25,7 @@ public class AdpGameGroupGameCompare extends BaseQuickAdapter<Applications, Base
         super(R.layout.item_game_group_game_compare, data);
     }
 
+    public static final boolean canDownload = false;
     @Override
     protected void convert(BaseViewHolder helper, Applications item) {
         TextView item_gggc_download_tv = helper.itemView.findViewById(R.id.item_gggc_download_tv);
@@ -37,8 +38,10 @@ public class AdpGameGroupGameCompare extends BaseQuickAdapter<Applications, Base
         View item_gggc_line = helper.itemView.findViewById(R.id.item_gggc_line);
 
         item_gggc_vip_tv.setOnClickListener(view -> Jump2View.getInstance().gotoGameVipRecharge(item));
-        item.getFindAppHelper().updateDownloadTaskView(false, item, item_gggc_download_tv);
-        item_gggc_download_tv.setTag("PUBLIC_TAG_PREFIX_TEXTVIEW_LIST" + item.getDownload_link());
+        if(canDownload) {
+            item.getFindAppHelper().updateDownloadTaskView(true, item, item_gggc_download_tv);
+            item_gggc_download_tv.setTag("PUBLIC_TAG_PREFIX_TEXTVIEW_LIST" + item.getDownload_link());
+        }
         ViewUtil.setVisibility(item_gggc_vip_tv, item.hasGameDiscountId());
         ViewUtil.setVisibility(item_gggc_v_line, item.hasGameDiscountId());
         ViewUtil.setText(item_gggc_name_tv, item.getGameFrom());

+ 1 - 1
app/src/main/res/layout/item_game_group_game_compare.xml

@@ -11,7 +11,7 @@
         android:id="@+id/item_gggc_download_tv"
         style="@style/style_vip_td_tv"
         android:background="@drawable/selector_button_full_main"
-        android:text="下载游戏"
+        android:text="下载"
         android:layout_marginEnd="@dimen/end_igggc_line"
         android:textColor="@color/btn_color_main"
         app:layout_constraintBottom_toTopOf="@id/item_gggc_v_line"