update:2020.01.10 20:21
fix:修改安装逻辑,优化状态栏逻辑 add:
This commit is contained in:
@@ -19,7 +19,9 @@ import com.lzy.okserver.download.DownloadService;
|
||||
import com.mjsheng.myappstore.Statistics.AppInformation;
|
||||
import com.mjsheng.myappstore.Statistics.StatisticsInfo;
|
||||
import com.mjsheng.myappstore.activity.MainActivity;
|
||||
import com.mjsheng.myappstore.bean.FileData;
|
||||
import com.mjsheng.myappstore.comm.CommonDatas;
|
||||
import com.mjsheng.myappstore.utils.ApkUtils;
|
||||
import com.mjsheng.myappstore.utils.Configure;
|
||||
import com.mjsheng.myappstore.utils.MySQLData;
|
||||
import com.mjsheng.myappstore.utils.ToastUtil;
|
||||
@@ -304,6 +306,66 @@ public class MyApplication extends MultiDexApplication implements Thread.Uncaugh
|
||||
NetStateChangeReceiver.unregisterReceiver(this);
|
||||
}
|
||||
|
||||
static List<FileData> fileList = new ArrayList<>();
|
||||
|
||||
|
||||
static String packageName = "";
|
||||
|
||||
public void setInstallIngPackageName(String packageNames) {
|
||||
packageName = packageNames;
|
||||
Log.e("fht", "正在安装:" + packageNames);
|
||||
}
|
||||
|
||||
public String getInstallIngPackageName() {
|
||||
return packageName;
|
||||
}
|
||||
|
||||
public void addFileData(FileData data) {
|
||||
fileList.add(data);
|
||||
updateList();
|
||||
}
|
||||
|
||||
public void removeDate(String packageName) {
|
||||
if (fileList != null && fileList.size() > 0) {
|
||||
for (FileData data : fileList) {
|
||||
if (data.getPackageName().equals(packageName)) {
|
||||
fileList.remove(data);
|
||||
break;
|
||||
} else {
|
||||
Log.e("fht", "not found object");
|
||||
}
|
||||
}
|
||||
}
|
||||
setInstallIngPackageName("");
|
||||
if (fileList.size() > 0) {
|
||||
updateList();
|
||||
} else {
|
||||
Log.e("fht", "fileList为空");
|
||||
setInstallIngPackageName("");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void updateList() {
|
||||
if (getInstallIngPackageName().equals("") || ApkUtils.isAvailable(getAppContext(), packageName)) {
|
||||
if (fileList != null && fileList.size() > 0) {
|
||||
if (!fileList.get(0).getPackageName().equals("") || ApkUtils.isAvailable(getAppContext(), fileList.get(0).getPackageName())) {
|
||||
String s = packageName;
|
||||
ApkUtils.installApp(this, fileList.get(0).getFilePath());
|
||||
setInstallIngPackageName(fileList.get(0).getPackageName());
|
||||
} else {
|
||||
removeDate(fileList.get(0).getPackageName());
|
||||
Log.e("fht", "已安装");
|
||||
setInstallIngPackageName("");
|
||||
}
|
||||
} else {
|
||||
Log.e("fht", "任务为空");
|
||||
}
|
||||
} else {
|
||||
Log.e("fht", "安装中:" + packageName);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user