|
|
@@ -55,8 +55,10 @@ import org.afinal.simplecache.ApiKey;
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
import org.greenrobot.eventbus.Subscribe;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Locale;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
import butterknife.BindView;
|
|
|
import butterknife.OnClick;
|
|
|
@@ -64,6 +66,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
import io.reactivex.schedulers.Schedulers;
|
|
|
|
|
|
import static com.sheep.gamegroup.util.UMConfigUtils.Event.FIND_SHARE;
|
|
|
+import static com.sheep.gamegroup.view.adapter.TryMakeMoneyAdp.PUBLIC_TAG_PREFIX_TEXTVIEW_LIST;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -187,14 +190,20 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
item_gc_game_app_list_rv.setHasFixedSize(true);
|
|
|
item_gc_game_app_list_rv.setNestedScrollingEnabled(false);
|
|
|
item_gc_game_app_list_rv.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
|
|
|
- BaseQuickAdapter baseQuickAdapter = new AdpGameGroupGameCompare(gameGroup.getApplications());
|
|
|
- baseQuickAdapter.bindToRecyclerView(item_gc_game_app_list_rv);
|
|
|
- baseQuickAdapter.setOnItemClickListener((adapter, view, position) -> {
|
|
|
- Applications item = ListUtil.getItem(gameGroup.getApplications(), position);
|
|
|
- if(item != null){
|
|
|
- Jump2View.getInstance().goEntity(item);
|
|
|
+ if(!ListUtil.isEmpty(gameGroup.getApplications())) {
|
|
|
+ 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);
|
|
|
+ baseQuickAdapter.setOnItemClickListener((adapter, view, position) -> {
|
|
|
+ Applications item = ListUtil.getItem(gameGroup.getApplications(), position);
|
|
|
+ if (item != null) {
|
|
|
+ Jump2View.getInstance().goEntity(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -440,14 +449,42 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ //更新下载进度
|
|
|
+ private Map<String, Applications> applicationsMap = new HashMap<>();
|
|
|
+
|
|
|
+ private AbsGetDownloadListener absGetDownloadListener2 = new AbsGetDownloadListener(true) {
|
|
|
+ @Override
|
|
|
+ public String getDownloadUrl(String packageName) {
|
|
|
+ Applications item = applicationsMap.get(packageName);
|
|
|
+ return item != null ? item.getDownload_link() : null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public TextView getTextView2(String packageName) {
|
|
|
+ return recyclerView.findViewWithTag(PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + getDownloadUrl(packageName));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public TextView getTextView(String downloadUrl) {
|
|
|
+ return recyclerView.findViewWithTag(PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + downloadUrl);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public DownloadHelper getDownloadHelper(String downloadUrl) {
|
|
|
+ Applications item = applicationsMap.get(downloadUrl);
|
|
|
+ return item != null ? item.getDownloadHelper() : null;
|
|
|
+ }
|
|
|
+ };
|
|
|
@Subscribe
|
|
|
public void onEventMainThread(Intent intent) {
|
|
|
absGetDownloadListener.onEventMainThread(intent);
|
|
|
+ absGetDownloadListener2.onEventMainThread(intent);
|
|
|
}
|
|
|
|
|
|
@Subscribe
|
|
|
public void onEventMainThread(BigEvent event) {
|
|
|
absGetDownloadListener.onEventMainThread(event);
|
|
|
+ absGetDownloadListener2.onEventMainThread(event);
|
|
|
}
|
|
|
|
|
|
@Override
|