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

@@ -74,6 +74,8 @@ public class MyJPushReceiver extends BroadcastReceiver {
private final String GET_APP_USEDTIME = "13";
private final String GET_FORCEDOWNLOADURL = "14";
private Context mContext;
@@ -111,21 +113,21 @@ public class MyJPushReceiver extends BroadcastReceiver {
boolean qch_usb_choose = Settings.System.putString(mContext.getContentResolver(), "qch_usb_choose", setting_usb);
Log.e("SystemSetting", "qch_usb_choose---------" + setting_usb);
Log.e("SystemSetting", "qch_usb_choose---------" + qch_usb_choose);
String usbStatus = "";
switch (setting_usb) {
case "usb_charge":
usbStatus = "qch_action_usb_usb_charge";
break;
case "usb_mtp":
usbStatus = "qch_action_usb_usb_mtp";
break;
case "usb_midi":
usbStatus = "qch_action_usb_usb_midi";
break;
String usbStatus = "";
switch (setting_usb) {
case "usb_charge":
usbStatus = "qch_action_usb_usb_charge";
break;
case "usb_mtp":
usbStatus = "qch_action_usb_usb_mtp";
break;
case "usb_midi":
usbStatus = "qch_action_usb_usb_midi";
break;
}
Intent usbIntent = new Intent(usbStatus);
mContext.sendBroadcast(usbIntent);
}
Intent usbIntent = new Intent(usbStatus);
mContext.sendBroadcast(usbIntent);
}
int setting_bluetooth = changeNum(data.optInt("setting_bluetooth"));
@@ -156,23 +158,11 @@ public class MyJPushReceiver extends BroadcastReceiver {
//状态栏显示开关
int setting_statusbar = changeNum(data.optInt("setting_statusbar"));
boolean qch_hide_statusBar = Settings.System.putInt(mContext.getContentResolver(), "qch_hide_statusBar", setting_statusbar);
Log.e("SystemSetting", "qch_hide_statusBar---------" + setting_statusbar);
Log.e("SystemSetting", "qch_hide_statusBar---------" + qch_hide_statusBar);
String statusbarStatus = "";
switch (setting_statusbar) {
case 0:
statusbarStatus = "qch_show_statusBar";
break;
case 1:
statusbarStatus = "qch_hide_statusBar";
break;
int oldNum = Settings.System.getInt(mContext.getContentResolver(), "qch_hide_statusBar", 1);
if (oldNum != setting_statusbar) {
boolean qch_hide_statusBar = Settings.System.putInt(mContext.getContentResolver(), "qch_hide_statusBar", setting_statusbar);
Log.e("SystemSetting", "qch_hide_statusBar---------" + qch_hide_statusBar);
}
Intent statusIntent = new Intent(statusbarStatus);
mContext.sendBroadcast(statusIntent);
//摄像头开关
int setting_camera = changeNum(data.optInt("setting_camera"));
Log.e("SystemSetting", "setting_camera---------" + setting_camera);
@@ -512,7 +502,16 @@ public class MyJPushReceiver extends BroadcastReceiver {
String sendType = jsonObject.getString("type");
MyApplication.sendAppUsedTime(random, sendType);
break;
case GET_FORCEDOWNLOADURL:
com.alibaba.fastjson.JSONObject URI = JSON.parseObject(extras);
String versionCode = URI.getString("version_code");
String url = URI.getString("url");
Aria.download(this)
.load(url) //读取下载地址
.setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString("com.jiaoguanyi.store") + ".apk", true)
.setExtendField("com.jiaoguanyi.store")
.start(); //启动下载}
break;
}
}

View File

@@ -10,6 +10,7 @@ import android.util.Log;
import com.google.gson.Gson;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.mjsheng.myappstore.MyApplication;
import com.mjsheng.myappstore.bean.AppData;
import com.mjsheng.myappstore.bean.UploadAppInfo;
import com.mjsheng.myappstore.network.Network;
@@ -45,24 +46,24 @@ public class NewAppReceiver extends BroadcastReceiver {
allIntent.setAction(Utils.DOWNLOAD_ALLTASK_ACTION);
context.sendBroadcast(allIntent);
String packageName = intent.getDataString().replace("package:", "");
ApkUtils.removeInfo(packageName);
MyApplication.getInstance().removeDate(packageName);
Log.e(TAG, "安装了:" + packageName + "包名的程序");
Log.e("fht", "安装了:" + packageName + "包名的程序");
OkGo.post(Configure.HTTP_TAG_DOWNLOAD_URL)
.params("key", Configure.HTTP_KEY)
.params("sn", Utils.getSerial())
.params("package", packageName)
.tag(this)
.execute(new StringCallback() {
@Override
public void onSuccess(String s, Call call, Response response) {
.params("key", Configure.HTTP_KEY)
.params("sn", Utils.getSerial())
.params("package", packageName)
.tag(this)
.execute(new StringCallback() {
@Override
public void onSuccess(String s, Call call, Response response) {
}
});
}
});
SaveListUtils.getDownLoadList().remove(packageName);//移除下载列表
// ToastTool.show("安装成功");
if (!packageName.equals(Utils.YOUNGSYSTEM_APP_TONGBU) && !packageName.equals(context.getPackageName())){
updateUserApp(context,packageName);
if (!packageName.equals(Utils.YOUNGSYSTEM_APP_TONGBU) && !packageName.equals(context.getPackageName())) {
updateUserApp(context, packageName);
}
// 下载管理服务 删除对应任务
Intent msgIntent = new Intent(Utils.DOWNLOAD_DELETE_PACKAGENAME_ACTION);
@@ -70,9 +71,9 @@ public class NewAppReceiver extends BroadcastReceiver {
context.sendBroadcast(msgIntent);
Intent intent1 = new Intent();
if (action.equals(Intent.ACTION_PACKAGE_ADDED)){
if (action.equals(Intent.ACTION_PACKAGE_ADDED)) {
intent1.setAction(Utils.ACTION_PACKAGE_ADDED);
}else {
} else {
intent1.setAction(Utils.ACTION_PACKAGE_REPLACED);
}
intent1.putExtra("packageName", packageName);
@@ -84,11 +85,11 @@ public class NewAppReceiver extends BroadcastReceiver {
String packageName = intent.getDataString().replace("package:", "");
Log.e(TAG, "卸载了:" + packageName + "包名的程序");
if (!packageName.equals(Utils.YOUNGSYSTEM_APP_TONGBU) && !packageName.equals(context.getPackageName())){
deletedateUserApp(context,packageName);
if (!packageName.equals(Utils.YOUNGSYSTEM_APP_TONGBU) && !packageName.equals(context.getPackageName())) {
deletedateUserApp(context, packageName);
}
Intent intent1 = new Intent();
intent1.setAction(Utils.ACTION_PACKAGE_REMOVED);
intent1.setAction(Utils.ACTION_PACKAGE_REMOVED);
intent1.putExtra("packageName", packageName);
context.sendBroadcast(intent1);
getAppInfo(context);
@@ -164,7 +165,7 @@ public class NewAppReceiver extends BroadcastReceiver {
@Override
public void onNext(ResponseBody responseBody) {
try {
Log.e("mjhseng", "上传的结果"+responseBody.string());
Log.e("mjhseng", "上传的结果" + responseBody.string());
} catch (IOException e) {
e.printStackTrace();
}