From 2d1bb6435fbc0fdd60aa67ff1bef5b43eaf6d68f Mon Sep 17 00:00:00 2001 From: kehaoyuan Date: Tue, 23 Jan 2018 14:50:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=89=E8=A3=85/=E5=8D=B8?= =?UTF-8?q?=E8=BD=BD=E5=90=8E=E6=B8=B8=E6=88=8F=E6=8F=92=E4=BB=B6=E5=8C=96?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E6=97=A0=E6=B3=95=E6=9B=B4=E6=96=B0=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gh/gamecenter/fragment/GameFragment.java | 71 +++++++++---------- 1 file changed, 34 insertions(+), 37 deletions(-) diff --git a/app/src/main/java/com/gh/gamecenter/fragment/GameFragment.java b/app/src/main/java/com/gh/gamecenter/fragment/GameFragment.java index bff1a3950c..c55ed7ca0c 100644 --- a/app/src/main/java/com/gh/gamecenter/fragment/GameFragment.java +++ b/app/src/main/java/com/gh/gamecenter/fragment/GameFragment.java @@ -11,7 +11,6 @@ import com.facebook.drawee.backends.pipeline.Fresco; import com.gc.materialdesign.views.ProgressBarCircularIndeterminate; import com.gh.base.OnRequestCallBackListener; import com.gh.base.fragment.BaseFragment; -import com.gh.common.util.ApkActiveUtils; import com.gh.common.util.DownloadItemUtils; import com.gh.download.DownloadManager; import com.gh.gamecenter.MainActivity; @@ -80,7 +79,7 @@ public class GameFragment extends BaseFragment implements SwipeRefreshLayout.OnR for (Integer locationPlugin : locationPluginList) { gameEntity = adapter.getPluginList().get(locationPlugin); RecyclerView.Adapter pluginAdapter = adapter.getPluginAdapter(); - if (gameEntity != null && pluginAdapter != null ) { + if (gameEntity != null && pluginAdapter != null) { DownloadItemUtils.processDate(getActivity(), gameEntity, downloadEntity, pluginAdapter, locationPlugin); } @@ -224,48 +223,46 @@ public class GameFragment extends BaseFragment implements SwipeRefreshLayout.OnR if (locationList != null) { GameEntity gameEntity; for (int location : locationList) { - gameEntity = adapter.getGameEntityByLocation(location); - if (gameEntity != null) { - ApkActiveUtils.filterHideApk(gameEntity); - if (gameEntity.isPluggable()) { - // 插件化列表 - if ("安装".equals(busFour.getType()) || "卸载".equals(busFour.getType())) { - List list = adapter.getPluginList(); - for (int i = 0; i < list.size(); i++) { - final GameEntity entity = list.get(i); - final ArrayList apkEntities = entity.getApk(); - final ApkEntity normalApkEntity = apkEntities.get(0); + if (location == 1) { + List pluginList = adapter.getPluginList(); + for (int i = 0; i < pluginList.size(); i++) { + final GameEntity entity = pluginList.get(i); + final ArrayList apkEntities = entity.getApk(); + final ApkEntity pluginApkEntity = apkEntities.get(0); - if (normalApkEntity.getPackageName().equals(busFour.getPackageName())) { - // 安装完成 插件化区域消失 - list.remove(i); - if (list.isEmpty()) { - adapter.initItemCount(); - adapter.notifyItemRemoved(1); - } else { - adapter.initPlugin(); - adapter.initLocationMap(); - adapter.notifyItemChanged(1); - } -// } - break; + if (pluginApkEntity.getPackageName().equals(busFour.getPackageName())) { + if ("卸载".equals(busFour.getType()) && // 插件化过程中 卸载卸载原包后 更新下载按钮 + DownloadManager.getInstance(getContext()).getDownloadEntityByUrl(pluginApkEntity.getUrl()) != null) { + adapter.notifyItemChanged(1); + } else { + // 安装完成 插件化区域消失 + pluginList.remove(i); + if (pluginList.isEmpty()) { + adapter.initItemCount(); + adapter.notifyItemRemoved(1); + } else { + adapter.initPlugin(); + adapter.initLocationMap(); + adapter.notifyItemChanged(1); } } + break; } - } else { - if ("安装".equals(busFour.getType())) { - for (ApkEntity apkEntity : gameEntity.getApk()) { - if (apkEntity.getPackageName().equals(busFour.getPackageName())) { - if (gameEntity.getEntryMap() != null) { - gameEntity.getEntryMap().remove(apkEntity.getPlatform()); - } - adapter.notifyItemChanged(location); - break; + } + } else { + gameEntity = adapter.getGameEntityByLocation(location); + if ("安装".equals(busFour.getType())) { + for (ApkEntity apkEntity : gameEntity.getApk()) { + if (apkEntity.getPackageName().equals(busFour.getPackageName())) { + if (gameEntity.getEntryMap() != null) { + gameEntity.getEntryMap().remove(apkEntity.getPlatform()); } + adapter.notifyItemChanged(location); + break; } - } else if ("卸载".equals(busFour.getType())) { - adapter.notifyItemChanged(location); } + } else if ("卸载".equals(busFour.getType())) { + adapter.notifyItemChanged(location); } } }