根据issues整理项目
This commit is contained in:
@ -54,7 +54,6 @@ import com.gh.gamecenter.entity.GameCollectionEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.entity.GameUpdateEntity;
|
||||
import com.gh.gamecenter.eventbus.EBDownloadDelete;
|
||||
import com.gh.gamecenter.eventbus.EBPWDismiss;
|
||||
import com.gh.gamecenter.eventbus.EBPackage;
|
||||
import com.gh.gamecenter.eventbus.EBPlatformChanged;
|
||||
import com.gh.gamecenter.eventbus.EBPutUrl;
|
||||
@ -82,17 +81,20 @@ import de.greenrobot.event.EventBus;
|
||||
public class DownloadDialog {
|
||||
|
||||
private static DownloadDialog instance;
|
||||
|
||||
private Context context;
|
||||
|
||||
private DownloadDialog() {
|
||||
private boolean isShow;
|
||||
|
||||
private DownloadDialog(Context context) {
|
||||
this.context = context;
|
||||
isShow = false;
|
||||
}
|
||||
|
||||
public static DownloadDialog getInstance(Context context) {
|
||||
if (instance == null) {
|
||||
instance = new DownloadDialog();
|
||||
instance = new DownloadDialog(context);
|
||||
}
|
||||
instance.context = context;
|
||||
return instance;
|
||||
}
|
||||
|
||||
@ -162,6 +164,11 @@ public class DownloadDialog {
|
||||
TextView dPercentage,
|
||||
String lstr) {
|
||||
|
||||
if (isShow) {
|
||||
return;
|
||||
}
|
||||
isShow = true;
|
||||
|
||||
SharedPreferences sp = context.getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);
|
||||
row = sp.getInt("download_box_row", 3);
|
||||
column = sp.getInt("download_box_column", 3);
|
||||
@ -283,7 +290,7 @@ public class DownloadDialog {
|
||||
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss() {
|
||||
EventBus.getDefault().post(new EBPWDismiss());
|
||||
isShow = false;
|
||||
EventBus.getDefault().unregister(DownloadDialog.this);
|
||||
DownloadManager.getInstance(context).removeObserver(dataWatcher);
|
||||
}
|
||||
@ -633,7 +640,7 @@ public class DownloadDialog {
|
||||
context.startActivity(PackageUtils.getUninstallIntent(context, path));
|
||||
}
|
||||
}
|
||||
}, null);
|
||||
});
|
||||
}
|
||||
|
||||
private class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewHolder> {
|
||||
@ -943,7 +950,7 @@ public class DownloadDialog {
|
||||
PackageUtils.getPackageNameByPath(context, path), path);
|
||||
context.startActivity(PackageUtils.getUninstallIntent(context, path));
|
||||
}
|
||||
}, null);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user