修复插件化问题
This commit is contained in:
@ -25,6 +25,7 @@ import com.gh.gamecenter.MainActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.eventbus.EBPutUrl;
|
||||
import com.gh.gamecenter.manager.DataCollectionManager;
|
||||
import com.gh.gamecenter.manager.PackageManager;
|
||||
|
||||
@ -33,6 +34,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
import de.greenrobot.event.EventBus;
|
||||
|
||||
public class DownloadItemUtils {
|
||||
|
||||
// 初始化gameMap
|
||||
@ -142,8 +145,15 @@ public class DownloadItemUtils {
|
||||
downloadBtn.setText("更新");
|
||||
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style);
|
||||
} else {
|
||||
downloadBtn.setText("启动");
|
||||
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_launch_style);
|
||||
PackageManager mPackageManager = new PackageManager(context);
|
||||
if (entity.getTag() != null && entity.getTag().size() != 0
|
||||
&& !mPackageManager.isSignature(entity.getApk().get(0).getPackageName())) {
|
||||
downloadBtn.setText("插件化");
|
||||
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_plugin_style);
|
||||
} else {
|
||||
downloadBtn.setText("启动");
|
||||
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_launch_style);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
downloadBtn.setText("下载");
|
||||
@ -632,7 +642,8 @@ public class DownloadItemUtils {
|
||||
int position,
|
||||
RecyclerView.Adapter<RecyclerView.ViewHolder> adapter) {
|
||||
|
||||
final String path = entity.getEntryMap().get(entity.getEntryMap().keyAt(0)).getPath();
|
||||
DownloadEntity downloadEntity = entity.getEntryMap().get(entity.getEntryMap().keyAt(0));
|
||||
final String path = downloadEntity.getPath();
|
||||
if (FileUtils.isEmptyFile(path)) {
|
||||
Toast.makeText(context, "解析包错误", Toast.LENGTH_SHORT).show();
|
||||
DownloadManager.getInstance(context).cancel(
|
||||
@ -642,6 +653,7 @@ public class DownloadItemUtils {
|
||||
} else {
|
||||
PackageManager manager = new PackageManager(context);
|
||||
if (manager.launchSetup(path)) {
|
||||
EventBus.getDefault().post(new EBPutUrl(downloadEntity.getPackageName(), downloadEntity.getUrl()));
|
||||
context.startActivity(PackageUtils.getInstallIntent(path));
|
||||
} else {
|
||||
DialogUtils.showPluginDialog(context, new DialogUtils.ConfiremListener() {
|
||||
|
||||
Reference in New Issue
Block a user