update
This commit is contained in:
@@ -306,66 +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);
|
||||
|
||||
}
|
||||
}
|
||||
// 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