From 9f4ee8ad3054f2548e61e44b623f912b66d74564 Mon Sep 17 00:00:00 2001 From: fanhuitong <981964879@qq.com> Date: Fri, 17 Sep 2021 10:03:59 +0800 Subject: [PATCH] =?UTF-8?q?update:2021.01.27=20fix:=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=E6=9B=B4=E6=96=B0=20add:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 4 +- app/src/main/AndroidManifest.xml | 30 +- .../appstore/uiui/activity/HintActivity.java | 71 +++ .../appstore/uiui/activity/MainActivity.java | 94 +--- .../uiui/adapter/DownloadManagerAdapter.java | 6 + .../com/appstore/uiui/base/BaseActivity.java | 2 +- .../uiui/fragment/FeaturedFragment.java | 11 +- .../appstore/uiui/network/HTTPInterface.java | 476 ------------------ .../uiui/network/URLs/UrlAddress.java | 26 +- app/src/main/res/drawable/bg_hint.xml | 17 + app/src/main/res/drawable/bt_confirm.xml | 13 + app/src/main/res/layout/activity_hint.xml | 59 +++ app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 4400 -> 4240 bytes app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 4400 -> 4240 bytes app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 4400 -> 4240 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 4400 -> 4240 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 4400 -> 4240 bytes app/src/main/res/values/strings.xml | 3 +- app/src/main/res/values/styles.xml | 20 +- 19 files changed, 250 insertions(+), 582 deletions(-) create mode 100644 app/src/main/java/com/appstore/uiui/activity/HintActivity.java create mode 100644 app/src/main/res/drawable/bg_hint.xml create mode 100644 app/src/main/res/drawable/bt_confirm.xml create mode 100644 app/src/main/res/layout/activity_hint.xml diff --git a/app/build.gradle b/app/build.gradle index 5b712b5..80023d1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,8 +16,8 @@ android { applicationId "com.appstore.uiui" minSdkVersion 26 targetSdkVersion 29 - versionCode 61 - versionName "1.6.1" + versionCode 69 + versionName "1.6.9" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" //极光 ndk { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index bf7d8f1..0d236dc 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -35,6 +35,15 @@ android:supportsRtl="true" android:theme="@style/AppTheme" tools:ignore="GoogleAppIndexingWarning"> + + + + + + + @@ -44,12 +53,15 @@ - + - @@ -62,17 +74,6 @@ - - - - - - - - @@ -195,7 +196,8 @@ - + + userInfoBaseResponse) { int code = userInfoBaseResponse.code; + //已经绑定 if (code == 200) { UserInfo info = userInfoBaseResponse.data; SPUtils.put(MainActivity.this, "isLogined", 1); @@ -421,10 +428,19 @@ public class MainActivity extends BaseActivity { if (!TextUtils.isEmpty(info.getGrade())) { SPUtils.put(MainActivity.this, "sn_grade", info.getGrade()); } - } else if (code == -200) { + } + //没有绑定 + else if (code == 300) { SPUtils.put(MainActivity.this, "isLogined", 0); - } else if (code == -250) { + Intent intent = new Intent(); + intent.putExtra("text", getResources().getString(R.string.no_bind)); + intent.setClass(MainActivity.this, HintActivity.class); + startActivity(intent); + } + //没有设备 + else if (code == 400) { SPUtils.put(MainActivity.this, "isLogined", 2); + } } @@ -481,68 +497,4 @@ public class MainActivity extends BaseActivity { } }); } - - private Handler handler = new Handler() { - @Override - public void handleMessage(@NonNull Message msg) { - super.handleMessage(msg); - switch (msg.what) { -// case 0: -// SPUtils.put(MainActivity.this, "isLogined", 0); -// break; -// case 1: -// SPUtils.put(MainActivity.this, "isLogined", 1); -// UserInfo userInfo = (UserInfo) msg.obj; -// SPUtils.put(MainActivity.this, "member_id", userInfo.getMember_id()); -// SPUtils.put(MainActivity.this, "sn_id", userInfo.getId()); -// SPUtils.put(MainActivity.this, "sn_grade", userInfo.getGrade()); -// break; -// case 2: -// SPUtils.put(MainActivity.this, "isLogined", 2); -// break; - case 200: - String url = (String) msg.obj; -// getFile(url); - break; - case 201: - String apppackage = (String) msg.obj; - Log.e("fht", Settings.System.getString(getContentResolver(), "qch_app_forbid") + "?"); - if (Settings.System.putString(getContentResolver(), "qch_app_forbid", apppackage)) { - Log.e("fht", "app package write successful"); - } - break; - case 202: - break; - } - } - }; - -// private void getFile(String url) { -// OkGo.get(url) -// .execute(new FileCallback() { -// @Override -// public void onSuccess(final Response response) { -//// Settings.System.putString(getApplicationContext().getContentResolver(), "qch_app_forbid", "com.baidu.video"); -// new Thread(new Runnable() { -// @Override -// public void run() { -// ApkUtils.installApp(MainActivity.this, response.body().getAbsolutePath()); -// } -// }).start(); -// LogUtils.e("getFile", "download file successful,now installing"); -// } -// -// @Override -// public void onError(Response response) { -// super.onError(response); -// LogUtils.e("getFile", "File download Failure"); -// } -// -// @Override -// public void downloadProgress(Progress progress) { -// super.downloadProgress(progress); -// LogUtils.e("getFile", "已下载:" + progress.currentSize + ",总大小:" + progress.totalSize + ",进度:" + progress.fraction + ",当前网速:" + progress.speed); -// } -// }); -// } } diff --git a/app/src/main/java/com/appstore/uiui/adapter/DownloadManagerAdapter.java b/app/src/main/java/com/appstore/uiui/adapter/DownloadManagerAdapter.java index e376d27..26c8087 100644 --- a/app/src/main/java/com/appstore/uiui/adapter/DownloadManagerAdapter.java +++ b/app/src/main/java/com/appstore/uiui/adapter/DownloadManagerAdapter.java @@ -129,6 +129,12 @@ public class DownloadManagerAdapter extends RecyclerView.Adapterpost(UrlAddress.GET_ALL_APPINFO) -// .params("sn", Utils.getSerial()) -// .execute(new StringCallback() { -// @Override -// public void onSuccess(Response response) { -// try { -// JSONObject body = JSON.parseObject(response.body()); -//// LogUtils.e("onSuccess", body.toString()); -// LogUtils.e("fht", "getAllAppInfo onSuccess"); -// int code = body.getInteger("code"); -// String msg = body.getString("msg"); -// String data = body.getString("data"); -// List applist = JSON.parseArray(data, AppInfo.class); -// if (code == MessageWhat.CODE_SUCCESSFUL) { -// Message message = new Message(); -// message.what = 1; -// message.obj = applist; -// handler.sendMessage(message); -// } else { -// ToastUtil.show(msg); -// handler.sendEmptyMessage(0); -// } -// } catch (Exception e) { -// LogUtils.e("Exception", e.getMessage()); -// ToastUtil.show("服务器错误,请稍后重试"); -// handler.sendEmptyMessage(0); -// } -// } -// -// @Override -// public void onError(Response response) { -// super.onError(response); -// LogUtils.e("getAllAppInfo", response.getException().toString()); -// ToastUtil.show("网络连接失败,检查网络连接"); -// handler.sendEmptyMessage(0); -// } -// }); -// } -// -// public static synchronized void checkDevicesInfo(final Context context) { -// OkGo.get(UrlAddress.GET_INFO_FROMESN) -// .params("sn", Utils.getSerial()) -// .execute(new StringCallback() { -// @Override -// public void onSuccess(Response response) { -// Log.e("onSuccess", "checkDevicesInfo"); -// try { -// JSONObject bodyObject = JSON.parseObject(response.body()); -// Integer code = (bodyObject.getInteger("code")); -// String msg = bodyObject.getString("msg"); -// String data = bodyObject.getString("data"); -// SNInfo userInfo = JSON.parseObject(data, SNInfo.class); -// if (code == 200) { -// SPUtils.put(context, "isLogined", 1); -// SPUtils.put(context, "member_id", userInfo.getMember_id()); -// SPUtils.put(context, "sn_id", userInfo.getId()); -// } else if (code == -200) { -// SPUtils.put(context, "isLogined", 0); -// -// } else if (code == -250) { -// SPUtils.put(context, "isLogined", 2); -// //设备验证 -// } -// } catch (Exception ex) { -// Log.e("checkDevicesInfo", ex.getMessage()); -// } -// } -// -// @Override -// public void onError(Response response) { -// super.onError(response); -// Log.e("onError", response.getException().toString()); -// -// } -// }); -// } -// -// synchronized public static void getAllAppPackageName(final Handler handler) { -// OkGo.post(UrlAddress.GET_ALL_PACKAGENAME) -// .params("sn", Utils.getSerial()) -// .execute(new StringCallback() { -// @Override -// public void onSuccess(Response response) { -// String s = response.body(); -// try { -// JSONObject body = JSON.parseObject(s); -// int code = body.getInteger("code"); -// String msg = body.getString("msg"); -// String data = body.getString("data"); -// if (code == 200) { -// List jsonArray = JSON.parseArray(data, JSONObject.class); -// String packageList = ""; -// for (JSONObject jsonObject : jsonArray) { -// packageList += jsonObject.getString("app_package") + ","; -// } -// if (!packageList.isEmpty()) { -// Log.e("fht", packageList); -// Message message = new Message(); -// message.what = 201; -// message.obj = packageList; -// handler.sendMessage(message); -// } else { -// handler.sendEmptyMessage(202); -// } -// } -// } catch (Exception e) { -// -// } -// } -// -// @Override -// public void onError(Response response) { -// super.onError(response); -// } -// }); -// } -// -// synchronized public static void getRankApp(final Handler handler) { -// OkGo.get(UrlAddress.GET_ALL_RANK).execute(new StringCallback() { -// @Override -// public void onSuccess(Response response) { -// try { -// JSONObject body = JSON.parseObject(response.body()); -//// LogUtils.e("onSuccess", body.toString()); -// LogUtils.e("fht", "getAllAppInfo onSuccess"); -// int code = body.getInteger("code"); -// String msg = body.getString("msg"); -// String data = body.getString("data"); -// List applist = JSON.parseArray(data, AppInfo.class); -// if (code == MessageWhat.CODE_SUCCESSFUL) { -// Message message = new Message(); -// message.what = 1; -// message.obj = applist; -// handler.sendMessage(message); -// } else { -// ToastUtil.show(msg); -// handler.sendEmptyMessage(0); -// } -// } catch (Exception e) { -// LogUtils.e("Exception", e.getMessage()); -// ToastUtil.show("服务器错误,请稍后重试"); -// handler.sendEmptyMessage(0); -// } -// } -// -// @Override -// public void onError(Response response) { -// super.onError(response); -// LogUtils.e("getRankApp", response.getException().toString()); -// ToastUtil.show("网络连接失败,检查网络连接"); -// handler.sendEmptyMessage(0); -// } -// }); -// } -// -// synchronized public static void searchAppbyName(final Handler handler, String app_name) { -// OkGo.post(UrlAddress.GET_APPSEARCHE) -// .params("sn", Utils.getSerial()) -// .params("app_name", app_name) -// .execute(new StringCallback() { -// @Override -// public void onSuccess(Response response) { -// try { -// JSONObject body = JSON.parseObject(response.body()); -// LogUtils.e("onSuccess", body.toString()); -// LogUtils.e("fht", "searchAppbyName onSuccess"); -// int code = body.getInteger("code"); -// String msg = body.getString("msg"); -// String data = body.getString("data"); -// List applist = JSON.parseArray(data, AppInfo.class); -// if (code == MessageWhat.CODE_SUCCESSFUL) { -// Message message = new Message(); -// message.what = 1; -// message.obj = applist; -// handler.sendMessage(message); -// } else { -// ToastUtil.show(msg); -// handler.sendEmptyMessage(0); -// } -// } catch (Exception e) { -// LogUtils.e("Exception", e.getMessage()); -// ToastUtil.show("服务器错误,请稍后重试"); -// handler.sendEmptyMessage(0); -// } -// } -// -// @Override -// public void onError(Response response) { -// super.onError(response); -// LogUtils.e("searchAppbyName", response.getException().toString()); -// ToastUtil.show("网络连接失败,检查网络连接"); -// handler.sendEmptyMessage(0); -// -// } -// }); -// } -// -// synchronized public static void getUserInfo(final Handler handler) { -// String sn = Utils.getSerial(); -// OkGo.get(UrlAddress.GET_INFO_FROMESN) -// .params("sn", sn) -// .execute(new StringCallback() { -// @Override -// public void onSuccess(Response response) { -// LogUtils.e("fht", "getUserInfo onSuccess"); -// JSONObject jsonObject = JSON.parseObject(response.body()); -// int code = jsonObject.getInteger("code"); -// String msg = jsonObject.getString("msg"); -// if (code == MessageWhat.CODE_SUCCESSFUL) { -// String data = jsonObject.getString("data"); -// SNInfo userInfo = JSON.parseObject(data, SNInfo.class); -// Message message = new Message(); -// message.what = 1; -// message.obj = userInfo; -// handler.sendMessage(message); -// } else { -// ToastUtil.show(msg); -// } -// } -// -// @Override -// public void onError(Response response) { -// super.onError(response); -// LogUtils.e("getUserInfo", response.getException().toString()); -// ToastUtil.show("网络连接失败,检查网络连接"); -// } -// }); -// } -// -// synchronized public static void getUserInfo(final Context context) { -// OkGo.get(UrlAddress.GET_INFO_FROMESN) -// .params("sn", Utils.getSerial()) -// .execute(new StringCallback() { -// @Override -// public void onSuccess(Response response) { -// LogUtils.e("fht", "getUserInfo onSuccess"); -// JSONObject jsonObject = JSON.parseObject(response.body()); -// int code = jsonObject.getInteger("code"); -// String msg = jsonObject.getString("msg"); -// if (code == MessageWhat.CODE_SUCCESSFUL) { -// String data = jsonObject.getString("data"); -// SNInfo userInfo = JSON.parseObject(data, SNInfo.class); -// SPUtils.put(context, "member_id", userInfo.getMember_id()); -// SPUtils.put(context, "sn_id", userInfo.getId()); -// SPUtils.put(context, "sn_grade", userInfo.getSn_grade()); -// } else { -// ToastUtil.show(msg); -// } -// } -// -// @Override -// public void onError(Response response) { -// super.onError(response); -// LogUtils.e("getUserInfo", response.getException().toString()); -// ToastUtil.show("网络连接失败,检查网络连接"); -// } -// }); -// } -// -// synchronized public static void getSortApp(final Handler handler, int type, int grade, int subject) { -// OkGo.post(UrlAddress.GET_SORT_APP) -// .params("sn", Utils.getSerial()) -// .params("app_type", type)//应用分类 0学习 1娱乐 -// .params("grade", grade)//年级 以数字代表 -// .params("subject", subject) //科目 以数字代表 -// .execute(new StringCallback() { -// @Override -// public void onSuccess(Response response) { -// LogUtils.e("fht", "getSortApp onSuccess"); -// JSONObject jsonObject = JSON.parseObject(response.body()); -// LogUtils.e("fht", jsonObject.toString()); -// int code = jsonObject.getInteger("code"); -// String msg = jsonObject.getString("msg"); -// if (code == MessageWhat.CODE_SUCCESSFUL) { -// String data = jsonObject.getString("data"); -// List list = JSON.parseArray(data, AppInfo.class); -// Message message = new Message(); -// message.what = 1; -// message.obj = list; -// handler.sendMessage(message); -// } else { -// ToastUtil.show(msg); -// handler.sendEmptyMessage(0); -// } -// } -// -// @Override -// public void onError(Response response) { -// super.onError(response); -// LogUtils.e("getSortApp", response.getException().toString()); -// ToastUtil.show("网络连接失败,检查网络连接"); -// handler.sendEmptyMessage(0); -// } -// }); -// } -// -// synchronized public static void setAppinstallInfo(int member_id, String sn_id, String app_name, String packageName) { -// OkGo.post(UrlAddress.SET_APP_INSTALL_INFO) -// .params("member_id", member_id) -// .params("sn_id", sn_id) -// .params("app_name", app_name) -// .params("package", packageName) -// .execute(new StringCallback() { -// @Override -// public void onSuccess(Response response) { -// JSONObject object = JSON.parseObject(response.body()); -// int code = object.getInteger("code"); -// String msg = object.getString("msg"); -// LogUtils.e("setAppinstallInfo", msg); -// } -// -// @Override -// public void onError(Response response) { -// super.onError(response); -// LogUtils.e("setAppinstallInfo", "onError:" + response.getException()); -// -// } -// }); -// -// } -// -// synchronized public static void setAppuninstallInfo(String sn_id, String packageName) { -// OkGo.post(UrlAddress.SET_APP_UNINSTALL_INFO) -// .params("sn_id", sn_id) -// .params("package", packageName) -// .execute(new StringCallback() { -// @Override -// public void onSuccess(Response response) { -// JSONObject object = JSON.parseObject(response.body()); -// int code = object.getInteger("code"); -// String msg = object.getString("msg"); -// LogUtils.e("setAppinstallInfo", msg); -// if (code == MessageWhat.CODE_SUCCESSFUL) { -// -// } else { -// -// } -// } -// -// @Override -// public void onError(Response response) { -// super.onError(response); -// LogUtils.e("setAppinstallInfo", "onError:" + response.getException()); -// -// } -// }); -// -// } -// -// synchronized public static void checkUpdateByPackage(final Handler handler, final String packageName, String versionCode) { -// OkGo.post(UrlAddress.GET_APP_UPDATE) -// .params("code", versionCode) -// .params("package", packageName) -// .execute(new StringCallback() { -// @Override -// public void onSuccess(Response response) { -// try { -// JSONObject body = JSON.parseObject(response.body()); -// int code = body.getInteger("code"); -// String msg = body.getString("msg"); -// if (code == 200) { -// Message message = new Message(); -// JSONObject data = JSON.parseObject(body.getString("data")); -// if (data != null) { -// String url = data.getString("downloadurl"); -// message.what = 200; -// message.obj = url; -// } else { -// message.what = -200; -// } -// handler.sendMessage(message); -// } else { -// Log.e("checkUpdateByPackage", packageName + msg); -// } -// } catch (Exception e) { -// Log.e("checkUpdateByPackage", e.getMessage()); -// } -// } -// -// @Override -// public void onError(Response response) { -// super.onError(response); -// Log.e("checkUpdateByPackage", response.getException().toString()); -// } -// }); -// } -// -// public static void getBannerImg(final Handler handler) { -// OkGo.get(UrlAddress.GET_BANNER_IMG).execute(new StringCallback() { -// @Override -// public void onSuccess(Response response) { -// try { -// JSONObject body = JSON.parseObject(response.body()); -// int code = body.getInteger("code"); -// String msg = body.getString("msg"); -// if (code == 200) { -// Message message = new Message(); -// List data = JSON.parseArray(body.getString("data"), bannerImage.class); -// if (data != null) { -// List urlList = new ArrayList<>(); -// for (int i = 0; i < data.size(); i++) { -// urlList.add(data.get(0).getImg()); -// } -// message.what = 200; -// message.obj = urlList; -// } else { -// message.what = -200; -// } -// handler.sendMessage(message); -// } else { -// Log.e("checkUpdateByPackage", msg); -// } -// } catch (Exception e) { -// Log.e("checkUpdateByPackage", e.getMessage()); -// } -// } -// -// @Override -// public void onError(Response response) { -// super.onError(response); -// } -// }); -// -// } -// -// public static void getSubClassfy(final Handler handler) { -// OkGo.post(UrlAddress.GET_SUBClASSFY) -// .params("sn", Utils.getSerial()) -// .execute(new StringCallback() { -// @Override -// public void onSuccess(Response response) { -// JSONObject jsonObject = JSONObject.parseObject(response.body()); -// int code = jsonObject.getInteger("code"); -// String msg = jsonObject.getString("msg"); -// if (code == 200) { -// String data = jsonObject.getString("data"); -// if (!data.equals("")) { -// List list = Arrays.asList(data.split(",")); -// Message message = new Message(); -// message.what = 200; -// message.obj = list; -// handler.sendMessage(message); -// } -// } else { -// ToastUtil.debugShow(msg); -// handler.sendEmptyMessage(-200); -// } -// -// } -// -// @Override -// public void onError(Response response) { -// super.onError(response); -// } -// }); -// } - } diff --git a/app/src/main/java/com/appstore/uiui/network/URLs/UrlAddress.java b/app/src/main/java/com/appstore/uiui/network/URLs/UrlAddress.java index 18f1f7d..61a1476 100644 --- a/app/src/main/java/com/appstore/uiui/network/URLs/UrlAddress.java +++ b/app/src/main/java/com/appstore/uiui/network/URLs/UrlAddress.java @@ -6,32 +6,30 @@ public class UrlAddress { public final static String GET_ALL_APPINFO = "app/queryAllApp"; //获取所有应用 public final static String GET_PACKAGE_APP = "app/queryPackageApp"; - - public final static String GET_ALL_RANK = "App/rankings"; //获取所有应用排行 - public final static String GET_APPSEARCHE = "App/appSearch"; + public final static String GET_ALL_RANK = "App/rankings"; //搜索应用 - public final static String GET_INFO_FROMESN = "sn/getSnInfo"; + public final static String GET_APPSEARCHE = "App/appSearch"; //通过SN获取绑定信息 - public final static String GET_SORT_APP = "App/sortApp"; + public final static String GET_INFO_FROMESN = "sn/getSnInfo"; //app分类查询 - public final static String SET_APP_INSTALL_INFO = "App/appInstall"; + public final static String GET_SORT_APP = "App/sortApp"; //发送app安装信息 - public final static String SET_APP_UNINSTALL_INFO = "App/appUnload"; + public final static String SET_APP_INSTALL_INFO = "App/appInstall"; //发送app卸载信息 - public final static String GET_APP_UPDATE = "Update/update"; + public final static String SET_APP_UNINSTALL_INFO = "App/appUnload"; //根据包名获取更新 - public final static String GET_BANNER_IMG = "app/getBrand"; + public final static String GET_APP_UPDATE = "Update/update"; //获取banner图 + public final static String GET_BANNER_IMG = "app/getBrand"; public final static String GET_BANNER = "sn/getBanner"; - - public final static String GET_ALL_PACKAGENAME = "App/allPackageSn"; //获取所有应用包名 - public final static String GET_SUBClASSFY = "Application/getSubClassfy"; + public final static String GET_ALL_PACKAGENAME = "App/allPackageSn"; //获取应用分类 - public final static String SEND_DOWNLOADAPP = "app/downloadApp"; + public final static String GET_SUBClASSFY = "Application/getSubClassfy"; - public final static String GET_NEWESTAPPUPDATE = "app/newestAppUpdate"; + public final static String SEND_DOWNLOADAPP = "app/downloadApp"; //根据包名获取更新 + public final static String GET_NEWESTAPPUPDATE = "app/newestAppUpdate"; } diff --git a/app/src/main/res/drawable/bg_hint.xml b/app/src/main/res/drawable/bg_hint.xml new file mode 100644 index 0000000..925c62a --- /dev/null +++ b/app/src/main/res/drawable/bg_hint.xml @@ -0,0 +1,17 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bt_confirm.xml b/app/src/main/res/drawable/bt_confirm.xml new file mode 100644 index 0000000..8dd5b11 --- /dev/null +++ b/app/src/main/res/drawable/bt_confirm.xml @@ -0,0 +1,13 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_hint.xml b/app/src/main/res/layout/activity_hint.xml new file mode 100644 index 0000000..7e4c166 --- /dev/null +++ b/app/src/main/res/layout/activity_hint.xml @@ -0,0 +1,59 @@ + + + + + + + + + +