update:2020.01.10 20:21

fix:修改安装逻辑,优化状态栏逻辑
add:
This commit is contained in:
2020-01-10 20:22:04 +08:00
parent 0f23821d20
commit 7164c94e18
32 changed files with 645 additions and 521 deletions

View File

@@ -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);
}
}
}