1.0.7 主页优化,加入心跳
This commit is contained in:
44
app/CMakeLists.txt
Normal file
44
app/CMakeLists.txt
Normal file
@@ -0,0 +1,44 @@
|
||||
# For more information about using CMake with Android Studio, read the
|
||||
# documentation: https://d.android.com/studio/projects/add-native-code.html
|
||||
|
||||
# Sets the minimum version of CMake required to build the native library.
|
||||
|
||||
cmake_minimum_required(VERSION 3.4.1)
|
||||
|
||||
# Creates and names a library, sets it as either STATIC
|
||||
# or SHARED, and provides the relative paths to its source code.
|
||||
# You can define multiple libraries, and CMake builds them for you.
|
||||
# Gradle automatically packages shared libraries with your APK.
|
||||
|
||||
add_library( # Sets the name of the library.
|
||||
aoleyun
|
||||
|
||||
# Sets the library as a shared library.
|
||||
SHARED
|
||||
|
||||
# Provides a relative path to your source file(s).
|
||||
src/main/jni/aoleyun.cpp)
|
||||
|
||||
# Searches for a specified prebuilt library and stores the path as a
|
||||
# variable. Because CMake includes system libraries in the search path by
|
||||
# default, you only need to specify the name of the public NDK library
|
||||
# you want to add. CMake verifies that the library exists before
|
||||
# completing its build.
|
||||
|
||||
find_library( # Sets the name of the path variable.
|
||||
log-lib
|
||||
|
||||
# Specifies the name of the NDK library that
|
||||
# you want CMake to locate.
|
||||
log )
|
||||
|
||||
# Specifies libraries CMake should link to your target library. You
|
||||
# can link multiple libraries, such as libraries you define in this
|
||||
# build script, prebuilt third-party libraries, or system libraries.
|
||||
|
||||
target_link_libraries( # Specifies the target library.
|
||||
aoleyun
|
||||
|
||||
# Links the target library to the log library
|
||||
# included in the NDK.
|
||||
${log-lib} )
|
||||
@@ -16,8 +16,8 @@ android {
|
||||
applicationId "com.uiuipad.find"
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 29
|
||||
versionCode 3
|
||||
versionName "1.0.2"
|
||||
versionCode 8
|
||||
versionName "1.0.7"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
@@ -25,8 +25,8 @@ android {
|
||||
|
||||
ndk {
|
||||
//选择要添加的对应 cpu 类型的 .so 库。
|
||||
abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', "x86"
|
||||
// 还可以添加 'x86', 'x86_64', 'mips', 'mips64'
|
||||
abiFilters 'armeabi-v7a', 'arm64-v8a', "x86"
|
||||
// 还可以添加 'armeabi', 'x86', 'x86_64', 'mips', 'mips64'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,15 @@ android {
|
||||
v2SigningEnabled false
|
||||
}
|
||||
|
||||
iPlay50SE {
|
||||
storeFile file("keystore/iPlay50SE.keystore")
|
||||
storePassword "123456"
|
||||
keyAlias "iplay50se"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
U807 {
|
||||
storeFile file("keystore/AllwinnerU807.jks")
|
||||
storePassword "123456"
|
||||
@@ -64,8 +73,6 @@ android {
|
||||
keyPassword "123456"
|
||||
v2SigningEnabled false
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
@@ -83,6 +90,20 @@ android {
|
||||
signingConfig signingConfigs.U807
|
||||
}
|
||||
|
||||
iPlay50SEDebug.initWith(debug)
|
||||
iPlay50SEDebug {
|
||||
buildConfigField "String", "platform", '"iPaly50SE"'
|
||||
versionNameSuffix "-debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.iPlay50SE
|
||||
}
|
||||
|
||||
iPlay50SERelease.initWith(release)
|
||||
iPlay50SERelease {
|
||||
buildConfigField "String", "platform", '"iPaly50SE"'
|
||||
signingConfig signingConfigs.iPlay50SE
|
||||
}
|
||||
|
||||
debug {
|
||||
versionNameSuffix "-debug"
|
||||
debuggable true
|
||||
@@ -121,6 +142,11 @@ android {
|
||||
}
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path file('CMakeLists.txt')
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -147,8 +173,11 @@ dependencies {
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
|
||||
//Retrofit
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:adapter-rxjava3:2.9.0'
|
||||
// gson converter
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||
// 标准转换器,去掉 Retrofit以Mutipart上传参数时,String参数会多一对双引号
|
||||
implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
|
||||
//RxJava
|
||||
implementation 'io.reactivex.rxjava3:rxjava:3.0.0'
|
||||
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
|
||||
@@ -180,6 +209,10 @@ dependencies {
|
||||
//Aria
|
||||
implementation 'com.arialyy.aria:core:3.8.15'
|
||||
annotationProcessor 'com.arialyy.aria:compiler:3.8.15'
|
||||
//Java WebSocket
|
||||
implementation "org.java-websocket:Java-WebSocket:1.5.3"
|
||||
implementation 'com.tencent.bugly:crashreport:4.1.9.2'
|
||||
implementation 'com.iqiyi.xcrash:xcrash-android-lib:3.0.0'
|
||||
}
|
||||
|
||||
preBuild {
|
||||
|
||||
BIN
app/keystore/iPlay50SE.keystore
Normal file
BIN
app/keystore/iPlay50SE.keystore
Normal file
Binary file not shown.
@@ -71,7 +71,9 @@
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".activity.main.MainActivity">
|
||||
<activity
|
||||
android:name=".activity.main.MainActivity"
|
||||
android:screenOrientation="userPortrait">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@@ -99,7 +101,24 @@
|
||||
<action android:name="android.intent.action.TIME_TICK" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
<service android:name=".service.RemoteService"
|
||||
<service
|
||||
android:name=".service.SocketService"
|
||||
android:exported="true">
|
||||
<intent-filter android:priority="1000">
|
||||
<action android:name="android.intent.action.SCREEN_OFF" />
|
||||
<action android:name="android.intent.action.SCREEN_ON" />
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
<action android:name="android.intent.action.USER_PRESENT" />
|
||||
<action android:name="android.intent.action.ACTION_SHUTDOWN" />
|
||||
<action android:name="android.intent.action.FACTORY_RESET" />
|
||||
<action android:name="android.intent.action.MASTER_CLEAR" />
|
||||
|
||||
<data android:scheme="package" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name=".service.RemoteService"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:process=":snremote" />
|
||||
@@ -123,6 +142,19 @@
|
||||
<action android:name="android.intent.action.SCREEN_OFF" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".receiver.APKinstallReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:permission="com.example.broadcast.permission">
|
||||
<intent-filter android:priority="1000">
|
||||
<action android:name="android.intent.action.PACKAGE_ADDED" />
|
||||
<action android:name="android.intent.action.PACKAGE_REPLACED" />
|
||||
<action android:name="android.intent.action.PACKAGE_REMOVED" />
|
||||
|
||||
<data android:scheme="package" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver
|
||||
android:name=".receiver.InstallResultReceiver"
|
||||
@@ -176,7 +208,7 @@
|
||||
<!-- AK鉴权 -->
|
||||
<meta-data
|
||||
android:name="com.baidu.lbsapi.API_KEY"
|
||||
android:value="rAN40nR4GDgBBbm5C5xbjasptzyMKTSS" />
|
||||
android:value="yhlCxeBmZ1I7ZO50Emw4ptPtcYGOFg59" />
|
||||
<!-- http://lbsyun.baidu.com/apiconsole/key -->
|
||||
</application>
|
||||
|
||||
|
||||
13
app/src/main/aidl/com/uiuipad/sn/KeepAliveConnection.aidl
Normal file
13
app/src/main/aidl/com/uiuipad/sn/KeepAliveConnection.aidl
Normal file
@@ -0,0 +1,13 @@
|
||||
// KeepAliveConnection.aidl
|
||||
package com.uiuipad.sn;
|
||||
|
||||
// Declare any non-default types here with import statements
|
||||
|
||||
interface KeepAliveConnection {
|
||||
/**
|
||||
* Demonstrates some basic types that you can use as parameters
|
||||
* and return values in AIDL.
|
||||
*/
|
||||
// void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat,
|
||||
// double aDouble, String aString);
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import android.graphics.Bitmap;
|
||||
|
||||
import com.uiuipad.find.base.BasePresenter;
|
||||
import com.uiuipad.find.base.BaseView;
|
||||
import com.uiuipad.find.bean.SnInfo;
|
||||
import com.uiuipad.find.bean.kuxin.SnInfo;
|
||||
|
||||
public class MainAContact {
|
||||
interface Presenter extends BasePresenter<MainView> {
|
||||
|
||||
@@ -6,8 +6,8 @@ import android.util.Log;
|
||||
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.SnInfo;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.SnInfo;
|
||||
import com.uiuipad.find.comm.CommonConfig;
|
||||
import com.uiuipad.find.network.NetInterfaceManager;
|
||||
import com.uiuipad.find.util.BitmapUtils;
|
||||
|
||||
@@ -12,21 +12,29 @@ import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.blankj.utilcode.util.NetworkUtils;
|
||||
import com.blankj.utilcode.util.StringUtils;
|
||||
import com.jakewharton.rxbinding2.view.RxView;
|
||||
import com.shehuan.niv.NiceImageView;
|
||||
import com.uiuipad.find.BuildConfig;
|
||||
import com.uiuipad.find.R;
|
||||
import com.uiuipad.find.base.BaseActivity;
|
||||
import com.uiuipad.find.bean.SnInfo;
|
||||
import com.uiuipad.find.bean.kuxin.SnInfo;
|
||||
import com.uiuipad.find.service.ManagerService;
|
||||
import com.uiuipad.find.service.SocketService;
|
||||
import com.uiuipad.find.service.main.MainService;
|
||||
import com.uiuipad.find.util.ApkUtils;
|
||||
import com.uiuipad.find.util.TimeUtils;
|
||||
import com.uiuipad.find.util.ToastUtil;
|
||||
import com.uiuipad.find.util.Utils;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.reactivex.functions.Consumer;
|
||||
|
||||
public class MainActivity extends BaseActivity implements MainAContact.MainView, NetworkUtils.OnNetworkStatusChangedListener {
|
||||
private static final String TAG = MainActivity.class.getSimpleName();
|
||||
@@ -48,9 +56,12 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
TextView tv_bind_time;
|
||||
@BindView(R.id.iv_qrcode)
|
||||
ImageView iv_qrcode;
|
||||
@BindView(R.id.bt_update)
|
||||
Button bt_update;
|
||||
|
||||
@BindView(R.id.tv_system_version)
|
||||
TextView tv_system_version;
|
||||
@BindView(R.id.cl_ota)
|
||||
ConstraintLayout cl_ota;
|
||||
@BindView(R.id.cl_app)
|
||||
ConstraintLayout cl_app;
|
||||
|
||||
private MainAPresenter mPresenter;
|
||||
|
||||
@@ -90,6 +101,7 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
|
||||
startService(new Intent(this, ManagerService.class));
|
||||
startService(new Intent(this, SocketService.class));
|
||||
Intent intent = new Intent(MainActivity.this, MainService.class);
|
||||
bindService(intent, serviceConnect, BIND_AUTO_CREATE);
|
||||
startService(intent);
|
||||
@@ -98,17 +110,43 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
|
||||
tv_version.setText(BuildConfig.VERSION_NAME);
|
||||
tv_serial.setText(Utils.getSerial());
|
||||
tv_system_version.setText(Utils.getCustomVersion());
|
||||
|
||||
bt_update.setOnClickListener(new View.OnClickListener() {
|
||||
RxView.clicks(cl_app)
|
||||
.throttleFirst(60, TimeUnit.SECONDS) //两秒钟之内只取一个点击事件,防抖操作
|
||||
.subscribe(new Consumer<Object>() {
|
||||
/**
|
||||
* Consume the given value.
|
||||
*
|
||||
* @param o the value
|
||||
* @throws Exception on error
|
||||
*/
|
||||
@Override
|
||||
public void accept(Object o) throws Exception {
|
||||
ToastUtil.show("正在检查更新");
|
||||
if (mMainBinder != null) {
|
||||
mMainBinder.getService().mPresenter.getSelfApp();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// bt_update.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View view) {
|
||||
// if (mMainBinder != null) {
|
||||
// mMainBinder.getService().mPresenter.getSelfApp();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
cl_ota.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (mMainBinder != null) {
|
||||
mMainBinder.getService().mPresenter.getSelfApp();
|
||||
}
|
||||
ApkUtils.openPackage(MainActivity.this, "com.yhk.qeota", "com.yhk.qeota.activity.ScrollingActivity");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
MainService.MainBinder mMainBinder;
|
||||
private ServiceConnect serviceConnect = new ServiceConnect();
|
||||
|
||||
@@ -147,14 +185,14 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
|
||||
@Override
|
||||
public void setSnInfo(SnInfo snInfo) {
|
||||
if (snInfo==null){
|
||||
if (snInfo == null) {
|
||||
tv_phone.setText("未绑定");
|
||||
}else {
|
||||
String phone =snInfo.getMobile();
|
||||
if (StringUtils.isEmpty(phone)){
|
||||
} else {
|
||||
String phone = snInfo.getMobile();
|
||||
if (StringUtils.isEmpty(phone)) {
|
||||
tv_phone.setText("未绑定");
|
||||
tv_bind_time.setText("未绑定");
|
||||
}else {
|
||||
tv_bind_time.setText(getString(R.string.login_bind));
|
||||
} else {
|
||||
tv_phone.setText(phone);
|
||||
long bindTime = snInfo.getBind_time();
|
||||
tv_bind_time.setText(String.format(getString(R.string.binding_time), TimeUtils.transferSecondToDate(bindTime)));
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.alibaba.sdk.android.push.CloudPushService;
|
||||
import com.alibaba.sdk.android.push.CommonCallback;
|
||||
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.tencent.bugly.crashreport.CrashReport;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.uiuipad.find.BuildConfig;
|
||||
import com.uiuipad.find.manager.MapManager;
|
||||
@@ -38,6 +39,11 @@ public class BaseApplication extends Application {
|
||||
PushManager.init(this);
|
||||
MapManager.init(this);
|
||||
aliyunPushInit();
|
||||
|
||||
CrashReport.initCrashReport(getApplicationContext(), "f217a2d1c7", false);
|
||||
CrashReport.setDeviceId(this, Utils.getSerial());
|
||||
xcrash.XCrash.init(this);
|
||||
|
||||
}
|
||||
|
||||
private void catchException() {
|
||||
@@ -105,6 +111,19 @@ public class BaseApplication extends Application {
|
||||
"errorCode: " + errorCode + ", errorMsg:" + errorMsg + "\n");
|
||||
}
|
||||
});
|
||||
String[] tag = new String[]{BuildConfig.platform};
|
||||
pushService.bindTag(CloudPushService.DEVICE_TARGET, tag, null, new CommonCallback() {
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
Log.e("AliyunPush", "bind tag " + tag + " success");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(String errorCode, String errorMsg) {
|
||||
Log.e("AliyunPush", "bind tag " + tag + " failed." +
|
||||
"errorCode: " + errorCode + ", errorMsg:" + errorMsg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.uiuipad.find.bean.aolelearn;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class ActivationBean implements Serializable {
|
||||
private static final long serialVersionUID = 930211633376920464L;
|
||||
|
||||
//是否激活 0否1是
|
||||
int is_activation;
|
||||
//
|
||||
String code;
|
||||
//激活码类型 0体验卡 1正式
|
||||
int code_type;
|
||||
//体验到期时间戳 单位秒 0代表没有时间限制
|
||||
long expire_time;
|
||||
//激活时间
|
||||
long activation_time;
|
||||
|
||||
public int getIs_activation() {
|
||||
return is_activation;
|
||||
}
|
||||
|
||||
public void setIs_activation(int is_activation) {
|
||||
this.is_activation = is_activation;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public int getCode_type() {
|
||||
return code_type;
|
||||
}
|
||||
|
||||
public void setCode_type(int code_type) {
|
||||
this.code_type = code_type;
|
||||
}
|
||||
|
||||
public long getExpire_time() {
|
||||
return expire_time;
|
||||
}
|
||||
|
||||
public void setExpire_time(long expire_time) {
|
||||
this.expire_time = expire_time;
|
||||
}
|
||||
|
||||
public long getActivation_time() {
|
||||
return activation_time;
|
||||
}
|
||||
|
||||
public void setActivation_time(long activation_time) {
|
||||
this.activation_time = activation_time;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,284 @@
|
||||
package com.uiuipad.find.bean.aolelearn;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class AoleAppInfo implements Serializable {
|
||||
private static final long serialVersionUID = 8831166142886512597L;
|
||||
|
||||
@SerializedName(value = "app_id", alternate = {"id"})
|
||||
int app_id;
|
||||
|
||||
String app_name;
|
||||
String app_img;
|
||||
String app_developer;
|
||||
long app_size;
|
||||
String app_package;
|
||||
String app_version_name;
|
||||
String app_md5;
|
||||
double app_score;
|
||||
String app_preview1;
|
||||
String app_preview2;
|
||||
String app_preview3;
|
||||
String app_url;
|
||||
String app_remarks;
|
||||
String app_desc;
|
||||
int is_promote;
|
||||
int weight;
|
||||
String discount;
|
||||
String use_type;
|
||||
|
||||
long app_version_code;
|
||||
String app_downloads;
|
||||
int app_category;
|
||||
int app_subject;
|
||||
int app_type;
|
||||
int app_status;
|
||||
int is_delete;
|
||||
int is_update;
|
||||
int is_silent;
|
||||
String createtime;
|
||||
|
||||
public int getApp_id() {
|
||||
return app_id;
|
||||
}
|
||||
|
||||
public void setApp_id(int app_id) {
|
||||
this.app_id = app_id;
|
||||
}
|
||||
|
||||
public String getApp_name() {
|
||||
return app_name;
|
||||
}
|
||||
|
||||
public void setApp_name(String app_name) {
|
||||
this.app_name = app_name;
|
||||
}
|
||||
|
||||
public String getApp_img() {
|
||||
return app_img;
|
||||
}
|
||||
|
||||
public void setApp_img(String app_img) {
|
||||
this.app_img = app_img;
|
||||
}
|
||||
|
||||
public String getApp_developer() {
|
||||
return app_developer;
|
||||
}
|
||||
|
||||
public void setApp_developer(String app_developer) {
|
||||
this.app_developer = app_developer;
|
||||
}
|
||||
|
||||
public long getApp_size() {
|
||||
return app_size;
|
||||
}
|
||||
|
||||
public void setApp_size(long app_size) {
|
||||
this.app_size = app_size;
|
||||
}
|
||||
|
||||
public String getApp_package() {
|
||||
return app_package;
|
||||
}
|
||||
|
||||
public void setApp_package(String app_package) {
|
||||
this.app_package = app_package;
|
||||
}
|
||||
|
||||
public String getApp_version_name() {
|
||||
return app_version_name;
|
||||
}
|
||||
|
||||
public void setApp_version_name(String app_version_name) {
|
||||
this.app_version_name = app_version_name;
|
||||
}
|
||||
|
||||
public String getApp_md5() {
|
||||
return app_md5;
|
||||
}
|
||||
|
||||
public void setApp_md5(String app_md5) {
|
||||
this.app_md5 = app_md5;
|
||||
}
|
||||
|
||||
public double getApp_score() {
|
||||
return app_score;
|
||||
}
|
||||
|
||||
public void setApp_score(double app_score) {
|
||||
this.app_score = app_score;
|
||||
}
|
||||
|
||||
public String getApp_preview1() {
|
||||
return app_preview1;
|
||||
}
|
||||
|
||||
public void setApp_preview1(String app_preview1) {
|
||||
this.app_preview1 = app_preview1;
|
||||
}
|
||||
|
||||
public String getApp_preview2() {
|
||||
return app_preview2;
|
||||
}
|
||||
|
||||
public void setApp_preview2(String app_preview2) {
|
||||
this.app_preview2 = app_preview2;
|
||||
}
|
||||
|
||||
public String getApp_preview3() {
|
||||
return app_preview3;
|
||||
}
|
||||
|
||||
public void setApp_preview3(String app_preview3) {
|
||||
this.app_preview3 = app_preview3;
|
||||
}
|
||||
|
||||
public String getApp_url() {
|
||||
return app_url;
|
||||
}
|
||||
|
||||
public void setApp_url(String app_url) {
|
||||
this.app_url = app_url;
|
||||
}
|
||||
|
||||
public String getApp_remarks() {
|
||||
return app_remarks;
|
||||
}
|
||||
|
||||
public void setApp_remarks(String app_remarks) {
|
||||
this.app_remarks = app_remarks;
|
||||
}
|
||||
|
||||
public String getApp_desc() {
|
||||
return app_desc;
|
||||
}
|
||||
|
||||
public void setApp_desc(String app_desc) {
|
||||
this.app_desc = app_desc;
|
||||
}
|
||||
|
||||
public int getIs_promote() {
|
||||
return is_promote;
|
||||
}
|
||||
|
||||
public void setIs_promote(int is_promote) {
|
||||
this.is_promote = is_promote;
|
||||
}
|
||||
|
||||
public int getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(int weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public String getDiscount() {
|
||||
return discount;
|
||||
}
|
||||
|
||||
public void setDiscount(String discount) {
|
||||
this.discount = discount;
|
||||
}
|
||||
|
||||
public String getUse_type() {
|
||||
return use_type;
|
||||
}
|
||||
|
||||
public void setUse_type(String use_type) {
|
||||
this.use_type = use_type;
|
||||
}
|
||||
|
||||
public long getApp_version_code() {
|
||||
return app_version_code;
|
||||
}
|
||||
|
||||
public void setApp_version_code(long app_version_code) {
|
||||
this.app_version_code = app_version_code;
|
||||
}
|
||||
|
||||
public String getApp_downloads() {
|
||||
return app_downloads;
|
||||
}
|
||||
|
||||
public void setApp_downloads(String app_downloads) {
|
||||
this.app_downloads = app_downloads;
|
||||
}
|
||||
|
||||
public int getApp_category() {
|
||||
return app_category;
|
||||
}
|
||||
|
||||
public void setApp_category(int app_category) {
|
||||
this.app_category = app_category;
|
||||
}
|
||||
|
||||
public int getApp_subject() {
|
||||
return app_subject;
|
||||
}
|
||||
|
||||
public void setApp_subject(int app_subject) {
|
||||
this.app_subject = app_subject;
|
||||
}
|
||||
|
||||
public int getApp_type() {
|
||||
return app_type;
|
||||
}
|
||||
|
||||
public void setApp_type(int app_type) {
|
||||
this.app_type = app_type;
|
||||
}
|
||||
|
||||
public int getApp_status() {
|
||||
return app_status;
|
||||
}
|
||||
|
||||
public void setApp_status(int app_status) {
|
||||
this.app_status = app_status;
|
||||
}
|
||||
|
||||
public int getIs_delete() {
|
||||
return is_delete;
|
||||
}
|
||||
|
||||
public void setIs_delete(int is_delete) {
|
||||
this.is_delete = is_delete;
|
||||
}
|
||||
|
||||
public int getIs_update() {
|
||||
return is_update;
|
||||
}
|
||||
|
||||
public void setIs_update(int is_update) {
|
||||
this.is_update = is_update;
|
||||
}
|
||||
|
||||
public int getIs_silent() {
|
||||
return is_silent;
|
||||
}
|
||||
|
||||
public void setIs_silent(int is_silent) {
|
||||
this.is_silent = is_silent;
|
||||
}
|
||||
|
||||
public String getCreatetime() {
|
||||
return createtime;
|
||||
}
|
||||
|
||||
public void setCreatetime(String createtime) {
|
||||
this.createtime = createtime;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
|
||||
}
|
||||
}
|
||||
109
app/src/main/java/com/uiuipad/find/bean/jxw/JxwResponse.java
Normal file
109
app/src/main/java/com/uiuipad/find/bean/jxw/JxwResponse.java
Normal file
@@ -0,0 +1,109 @@
|
||||
package com.uiuipad.find.bean.jxw;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class JxwResponse implements Serializable {
|
||||
private static final long serialVersionUID = -3527835972252533705L;
|
||||
|
||||
/*返回文字描述*/
|
||||
public String msg;
|
||||
/*状态码*/
|
||||
public int code;
|
||||
public Data data;
|
||||
|
||||
/**
|
||||
* 返回数据
|
||||
*/
|
||||
public class Data implements Serializable {
|
||||
private static final long serialVersionUID = 3049954023686065635L;
|
||||
|
||||
/*授权成功sn号列表*/
|
||||
List<String> successSnList;
|
||||
/*已经存在的sn号列表*/
|
||||
List<String> existingSnList;
|
||||
/*开通失败的数量*/
|
||||
int failedNum;
|
||||
/*开通成功的数量*/
|
||||
int successNum;
|
||||
/*剩余可开通次数*/
|
||||
int restNum;
|
||||
/*已经开通sn号数量*/
|
||||
int usedTotalNum;
|
||||
/*未授权列表(超过可授权次数)*/
|
||||
List<String> unauthorised;
|
||||
|
||||
public List<String> getSuccessSnList() {
|
||||
return successSnList;
|
||||
}
|
||||
|
||||
public void setSuccessSnList(List<String> successSnList) {
|
||||
this.successSnList = successSnList;
|
||||
}
|
||||
|
||||
public List<String> getExistingSnList() {
|
||||
return existingSnList;
|
||||
}
|
||||
|
||||
public void setExistingSnList(List<String> existingSnList) {
|
||||
this.existingSnList = existingSnList;
|
||||
}
|
||||
|
||||
public int getFailedNum() {
|
||||
return failedNum;
|
||||
}
|
||||
|
||||
public void setFailedNum(int failedNum) {
|
||||
this.failedNum = failedNum;
|
||||
}
|
||||
|
||||
public int getSuccessNum() {
|
||||
return successNum;
|
||||
}
|
||||
|
||||
public void setSuccessNum(int successNum) {
|
||||
this.successNum = successNum;
|
||||
}
|
||||
|
||||
public int getRestNum() {
|
||||
return restNum;
|
||||
}
|
||||
|
||||
public void setRestNum(int restNum) {
|
||||
this.restNum = restNum;
|
||||
}
|
||||
|
||||
public int getUsedTotalNum() {
|
||||
return usedTotalNum;
|
||||
}
|
||||
|
||||
public void setUsedTotalNum(int usedTotalNum) {
|
||||
this.usedTotalNum = usedTotalNum;
|
||||
}
|
||||
|
||||
public List<String> getUnauthorised() {
|
||||
return unauthorised;
|
||||
}
|
||||
|
||||
public void setUnauthorised(List<String> unauthorised) {
|
||||
this.unauthorised = unauthorised;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.uiuipad.find.bean;
|
||||
package com.uiuipad.find.bean.kuxin;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.uiuipad.find.bean;
|
||||
package com.uiuipad.find.bean.kuxin;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.uiuipad.find.bean;
|
||||
package com.uiuipad.find.bean.kuxin;
|
||||
|
||||
import android.content.pm.PackageInfo;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.uiuipad.find.bean;
|
||||
package com.uiuipad.find.bean.kuxin;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.uiuipad.find.bean;
|
||||
package com.uiuipad.find.bean.kuxin;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.uiuipad.find.bean;
|
||||
package com.uiuipad.find.bean.kuxin;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
11
app/src/main/java/com/uiuipad/find/comm/ApkInfo.java
Normal file
11
app/src/main/java/com/uiuipad/find/comm/ApkInfo.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.uiuipad.find.comm;
|
||||
|
||||
public class ApkInfo {
|
||||
|
||||
/*九学王*/
|
||||
public static final String JXW_LAUNCHER_PACKAGE_NAME = "com.jxw.launcher";
|
||||
/*注册服务*/
|
||||
public static final String JXW_LAUNCHER_CLASS_NAME = "com.jht.engine.platsign.PlatformService";
|
||||
/*学习资源*/
|
||||
public static final String JXW_LAUNCHER_UPDATE_CLASS_NAME = "com.jxw.engine.platsign.UpdateActivity";
|
||||
}
|
||||
@@ -13,9 +13,26 @@ public class CommonConfig {
|
||||
|
||||
public static final String IS_LOGINED = "isLogined";
|
||||
|
||||
public static final String INSTALL_SD_APKS = "install_sd_apks";
|
||||
|
||||
|
||||
public static final String LOST_STATUS_KEY = "is_lost_mod";
|
||||
public static final String FIND_STRING_KEY = "find_string";
|
||||
|
||||
public static final String JXW_ACTIVATION_CODE_ACTION = "JXW_ACTIVATION_CODE_ACTION";
|
||||
public static final String JXW_ACTIVATION_CODE_KEY = "JXW_ACTIVATION_CODE_KEY";
|
||||
/*是否激活接口请求缓存*/
|
||||
public static final String ACTIVATION_BEAN_KEY = "IFLYTEK_UIUI_ACTIVATION_BEAN_KEY";
|
||||
/*保存激活码*/
|
||||
public static final String ACTIVATIONBEAN_CODE_KEY = "UIUI_ACTIVATIONBEAN_CODE";
|
||||
/*是否激活*/
|
||||
public static final String UIUI_ACTIVATION_KEY = "iflytek_uiui_activation";
|
||||
/*激活码类型*/
|
||||
public static final String UIUI_CODE_TYPE_KEY = "iflytek_uiui_code_type";
|
||||
/*体验到期时间戳*/
|
||||
public static final String UIUI_EXPIRE_TIME_KEY = "iflytek_uiui_expire_time";
|
||||
|
||||
|
||||
/*USB模式-充电*/
|
||||
public final static String AOLE_ACTION_USB_USB_CHARGE = "aole_action_usb_usb_charge";
|
||||
/*USB模式-MTP*/
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.baidu.location.BDLocation;
|
||||
import com.baidu.location.LocationClient;
|
||||
import com.baidu.location.LocationClientOption;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.uiuipad.find.bean.MapBean;
|
||||
import com.uiuipad.find.bean.kuxin.MapBean;
|
||||
import com.uiuipad.find.comm.CommonConfig;
|
||||
import com.uiuipad.find.gson.GsonUtils;
|
||||
|
||||
|
||||
@@ -3,63 +3,85 @@ package com.uiuipad.find.network;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.provider.Settings;
|
||||
import android.text.format.Formatter;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.uiuipad.find.bean.AppInfo;
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.SnInfo;
|
||||
import com.uiuipad.find.bean.SnSetting;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.uiuipad.find.BuildConfig;
|
||||
import com.uiuipad.find.bean.aolelearn.ActivationBean;
|
||||
import com.uiuipad.find.bean.aolelearn.AoleAppInfo;
|
||||
import com.uiuipad.find.bean.jxw.JxwResponse;
|
||||
import com.uiuipad.find.bean.kuxin.AppInfo;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.SnInfo;
|
||||
import com.uiuipad.find.bean.kuxin.SnSetting;
|
||||
import com.uiuipad.find.comm.ApkInfo;
|
||||
import com.uiuipad.find.comm.CommonConfig;
|
||||
import com.uiuipad.find.network.api.app.GetAppApi;
|
||||
import com.uiuipad.find.network.api.app.GetSelfAppApi;
|
||||
import com.uiuipad.find.network.api.app.UpdateAppInstallApi;
|
||||
import com.uiuipad.find.network.api.manage.RemoveLockScreenApi;
|
||||
import com.uiuipad.find.network.api.manage.SnSettingApi;
|
||||
import com.uiuipad.find.network.api.manage.UpdateSnLocationApi;
|
||||
import com.uiuipad.find.network.api.manage.UploadSnScreenshotApi;
|
||||
import com.uiuipad.find.network.api.sn.SnConfirmBindApi;
|
||||
import com.uiuipad.find.network.api.sn.SnInfoApi;
|
||||
import com.uiuipad.find.network.api.sn.UpdateSnInfoApi;
|
||||
import com.uiuipad.find.network.interceptor.MD5Util;
|
||||
import com.uiuipad.find.gson.GsonUtils;
|
||||
import com.uiuipad.find.network.api.aolelearn.ClassAppApi;
|
||||
import com.uiuipad.find.network.api.aolelearn.ForceInstall;
|
||||
import com.uiuipad.find.network.api.aolelearn.NewestAppUpdateApi;
|
||||
import com.uiuipad.find.network.api.aolelearn.SnIsActivationApi;
|
||||
import com.uiuipad.find.network.api.aolelearn.TestAppApi;
|
||||
import com.uiuipad.find.network.api.jxw.AuthorizedApi;
|
||||
import com.uiuipad.find.network.api.jxw.JxwUtils;
|
||||
import com.uiuipad.find.network.api.kuxin.app.GetAppApi;
|
||||
import com.uiuipad.find.network.api.kuxin.app.GetSelfAppApi;
|
||||
import com.uiuipad.find.network.api.kuxin.app.UpdateAppInstallApi;
|
||||
import com.uiuipad.find.network.api.kuxin.manage.RemoveLockScreenApi;
|
||||
import com.uiuipad.find.network.api.kuxin.manage.SnSettingApi;
|
||||
import com.uiuipad.find.network.api.kuxin.manage.UpdateSnLocationApi;
|
||||
import com.uiuipad.find.network.api.kuxin.manage.UploadSnScreenshotApi;
|
||||
import com.uiuipad.find.network.api.kuxin.sn.SnConfirmBindApi;
|
||||
import com.uiuipad.find.network.api.kuxin.sn.SnInfoApi;
|
||||
import com.uiuipad.find.network.api.kuxin.sn.UpdateSnInfoApi;
|
||||
import com.uiuipad.find.network.interceptor.RepeatRequestInterceptor;
|
||||
import com.uiuipad.find.service.ManagerService;
|
||||
import com.uiuipad.find.util.ApkUtils;
|
||||
import com.uiuipad.find.util.CacheUtils;
|
||||
import com.uiuipad.find.util.ControlUtils;
|
||||
import com.uiuipad.find.util.FileUtils;
|
||||
import com.uiuipad.find.util.TimeUtils;
|
||||
import com.uiuipad.find.util.Utils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.core.ObservableEmitter;
|
||||
import io.reactivex.rxjava3.core.ObservableOnSubscribe;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Protocol;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
import retrofit2.converter.scalars.ScalarsConverterFactory;
|
||||
|
||||
public class NetInterfaceManager {
|
||||
private static final String TAG = NetInterfaceManager.class.getSimpleName();
|
||||
@@ -72,13 +94,16 @@ public class NetInterfaceManager {
|
||||
private Retrofit mRetrofit;
|
||||
private OkHttpClient mOkHttpClient;
|
||||
|
||||
private final ConcurrentHashMap<String, Long> requestIdsMap = new ConcurrentHashMap<>();
|
||||
private Retrofit mAolelearnRetrofit;
|
||||
private OkHttpClient mAolelearnOkHttpClient;
|
||||
|
||||
private Retrofit mJxwRetrofit;
|
||||
private OkHttpClient mJxwOkHttpClient;
|
||||
|
||||
//超时时间
|
||||
private static final int timeOut = 5;
|
||||
private static final int TIME_OUT = 5;
|
||||
// 缓存文件最大限制大小20M
|
||||
private static final long cacheSize = 1024 * 1024 * 64;
|
||||
public static final String CUSTOM_REPEAT_REQ_PROTOCOL = "MY_CUSTOM_REPEAT_REQ_PROTOCOL";
|
||||
private static final long CACHE_SIZE = 1024 * 1024 * 64;
|
||||
|
||||
private NetInterfaceManager(Context context) {
|
||||
if (context == null) {
|
||||
@@ -91,15 +116,15 @@ public class NetInterfaceManager {
|
||||
if (mOkHttpClient == null) {
|
||||
//如果无法生存缓存文件目录,检测权限使用已经加上,检测手机是否把文件读写权限禁止了
|
||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||
builder.connectTimeout(timeOut, TimeUnit.SECONDS); // 设置连接超时时间
|
||||
builder.writeTimeout(timeOut, TimeUnit.SECONDS);// 设置写入超时时间
|
||||
builder.readTimeout(timeOut, TimeUnit.SECONDS);// 设置读取数据超时时间
|
||||
builder.connectTimeout(TIME_OUT, TimeUnit.SECONDS); // 设置连接超时时间
|
||||
builder.writeTimeout(TIME_OUT, TimeUnit.SECONDS);// 设置写入超时时间
|
||||
builder.readTimeout(TIME_OUT, TimeUnit.SECONDS);// 设置读取数据超时时间
|
||||
builder.retryOnConnectionFailure(true);// 设置进行连接失败重试
|
||||
builder.addInterceptor(new RepeatRequestInterceptor());
|
||||
|
||||
// 设置缓存文件路径
|
||||
String cacheDirectory = getCacheDir() + "/OkHttpCache";
|
||||
Cache cache = new Cache(new File(cacheDirectory), cacheSize);
|
||||
Cache cache = new Cache(new File(cacheDirectory), CACHE_SIZE);
|
||||
builder.cache(cache);// 设置缓存
|
||||
mOkHttpClient = builder.build();
|
||||
}
|
||||
@@ -109,6 +134,56 @@ public class NetInterfaceManager {
|
||||
.baseUrl(UrlAddress.ROOT_URL)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
|
||||
.addConverterFactory(ScalarsConverterFactory.create())
|
||||
.build();
|
||||
}
|
||||
|
||||
if (mAolelearnRetrofit == null) {
|
||||
if (mAolelearnOkHttpClient == null) {
|
||||
//如果无法生存缓存文件目录,检测权限使用已经加上,检测手机是否把文件读写权限禁止了
|
||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||
builder.connectTimeout(TIME_OUT, TimeUnit.SECONDS); // 设置连接超时时间
|
||||
builder.writeTimeout(TIME_OUT, TimeUnit.SECONDS);// 设置写入超时时间
|
||||
builder.readTimeout(TIME_OUT, TimeUnit.SECONDS);// 设置读取数据超时时间
|
||||
builder.retryOnConnectionFailure(true);// 设置进行连接失败重试
|
||||
builder.addInterceptor(new RepeatRequestInterceptor());
|
||||
|
||||
// 设置缓存文件路径
|
||||
String cacheDirectory = getCacheDir() + "/OkHttpCache";
|
||||
Cache cache = new Cache(new File(cacheDirectory), CACHE_SIZE);
|
||||
builder.cache(cache);// 设置缓存
|
||||
mAolelearnOkHttpClient = builder.build();
|
||||
}
|
||||
|
||||
mAolelearnRetrofit = new Retrofit.Builder()
|
||||
.client(mAolelearnOkHttpClient)
|
||||
.baseUrl(UrlAddress.AOLELEARN_ROOT_URL)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
|
||||
.addConverterFactory(ScalarsConverterFactory.create())
|
||||
.build();
|
||||
}
|
||||
|
||||
if (mJxwRetrofit == null) {
|
||||
if (mJxwOkHttpClient == null) {
|
||||
//如果无法生存缓存文件目录,检测权限使用已经加上,检测手机是否把文件读写权限禁止了
|
||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||
builder.connectTimeout(TIME_OUT, TimeUnit.SECONDS); // 设置连接超时时间
|
||||
builder.writeTimeout(TIME_OUT, TimeUnit.SECONDS);// 设置写入超时时间
|
||||
builder.readTimeout(TIME_OUT, TimeUnit.SECONDS);// 设置读取数据超时时间
|
||||
builder.retryOnConnectionFailure(true);// 设置进行连接失败重试
|
||||
builder.addInterceptor(new RepeatRequestInterceptor());
|
||||
// 设置缓存文件路径
|
||||
String cacheDirectory = getCacheDir() + "/OkHttpCache";
|
||||
Cache cache = new Cache(new File(cacheDirectory), CACHE_SIZE);
|
||||
builder.cache(cache);// 设置缓存
|
||||
mJxwOkHttpClient = builder.build();
|
||||
}
|
||||
mJxwRetrofit = new Retrofit.Builder()
|
||||
.client(mJxwOkHttpClient)
|
||||
.baseUrl(UrlAddress.JXW_ROOT_URL)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -178,7 +253,7 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse> getUpdateSnLocationControl(String location, double longitude, double latitude) {
|
||||
public Observable<BaseResponse> getUpdateSnLocationControl(String location, String longitude, String latitude) {
|
||||
return mRetrofit.create(UpdateSnLocationApi.class)
|
||||
.updateSnLocation(Utils.getSerial(), location, longitude, latitude)
|
||||
.subscribeOn(Schedulers.io())
|
||||
@@ -211,14 +286,14 @@ public class NetInterfaceManager {
|
||||
|
||||
public Observable<BaseResponse<List<AppInfo>>> getAppControl() {
|
||||
return mRetrofit.create(GetAppApi.class)
|
||||
.getApp(Utils.getSerial(), Build.MODEL)
|
||||
.getApp(Utils.getSerial(), BuildConfig.platform)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<List<AppInfo>>> getSelfAppControl() {
|
||||
return mRetrofit.create(GetSelfAppApi.class)
|
||||
.getSelfApp(Utils.getSerial())
|
||||
.getSelfApp(Utils.getSerial(), BuildConfig.platform)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
@@ -237,6 +312,52 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
|
||||
public Observable<JxwResponse> getAuthorizedControl(RequestBody body) {
|
||||
return mJxwRetrofit.create(AuthorizedApi.class)
|
||||
.addByAuthorized(JxwUtils.getParams(), body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<ActivationBean>> getSnIsActivationObservable() {
|
||||
return mAolelearnRetrofit.create(SnIsActivationApi.class)
|
||||
.getSnIsActivation(Utils.getSerial())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<List<AoleAppInfo>>> getAdminAppByClassObservable(int id) {
|
||||
return mAolelearnRetrofit.create(ClassAppApi.class)
|
||||
.getAdminAppByClass(id)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<List<AoleAppInfo>>> getForceInstallControl() {
|
||||
return mAolelearnRetrofit.create(ForceInstall.class)
|
||||
.getForceInstall(Utils.getSerial())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<AoleAppInfo>> getUpdateObservable(String packageName) {
|
||||
return mAolelearnRetrofit.create(NewestAppUpdateApi.class)
|
||||
.getAppUpdate(packageName, "0", 1)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<List<AoleAppInfo>>> getTestAppObservable() {
|
||||
return mAolelearnRetrofit.create(TestAppApi.class)
|
||||
.getTestApp(Utils.getSerial())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* API
|
||||
@@ -272,7 +393,17 @@ public class NetInterfaceManager {
|
||||
if (snSettingBaseResponse.code == 200) {
|
||||
SnSetting snSetting = snSettingBaseResponse.data;
|
||||
int is_control = snSetting.getIs_control();
|
||||
Settings.Global.putInt(mCrv,"is_control", is_control);
|
||||
int old = Settings.Global.getInt(mCrv, "is_control", 0);
|
||||
if (is_control != old) {
|
||||
try {
|
||||
new CacheUtils().clearApplicationUserData(mContext, "com.uiuipad.os");
|
||||
new CacheUtils().clearApplicationUserData(mContext, "com.android.launcher3");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e(TAG, "clearCache: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
Settings.Global.putInt(mCrv, "is_control", is_control);
|
||||
int is_loss = snSetting.getIs_loss();
|
||||
String loss_str = snSetting.getLoss_str();
|
||||
mMMKV.encode(CommonConfig.LOST_STATUS_KEY, is_loss);
|
||||
@@ -373,4 +504,347 @@ public class NetInterfaceManager {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public interface SnIsActivationCallback {
|
||||
void isActivation(ActivationBean activationBean);
|
||||
}
|
||||
|
||||
public void getSnIsActivation(BehaviorSubject<ActivityEvent> lifecycle, SnIsActivationCallback callback) {
|
||||
getSnIsActivationObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<ActivationBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getSnIsActivation", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<ActivationBean> baseResponse) {
|
||||
Log.e("getSnIsActivation", "onNext: " + baseResponse);
|
||||
if (baseResponse.code == 200) {
|
||||
ActivationBean isActivationBean = baseResponse.data;
|
||||
if (isActivationBean != null) {
|
||||
mMMKV.encode(CommonConfig.ACTIVATION_BEAN_KEY, GsonUtils.toJSONString(isActivationBean));
|
||||
String code = isActivationBean.getCode();
|
||||
Settings.System.putString(mCrv, CommonConfig.ACTIVATIONBEAN_CODE_KEY, code);
|
||||
mMMKV.encode(CommonConfig.ACTIVATIONBEAN_CODE_KEY, code);
|
||||
Intent intent = new Intent(CommonConfig.JXW_ACTIVATION_CODE_ACTION);
|
||||
intent.putExtra(CommonConfig.JXW_ACTIVATION_CODE_KEY, code);
|
||||
intent.setPackage("com.uiui.zysn");
|
||||
mContext.sendBroadcast(intent);
|
||||
|
||||
int is_activation = isActivationBean.getIs_activation();
|
||||
if (is_activation == 1) {
|
||||
checkLocalExternalFiles();
|
||||
boolean start_jxw = mMMKV.decodeBool("start_jxw_key", false);
|
||||
if (!start_jxw) {
|
||||
if (ApkUtils.isAvailable(mContext, ApkInfo.JXW_LAUNCHER_PACKAGE_NAME)) {
|
||||
Intent intent2 = new Intent(Intent.ACTION_VIEW);
|
||||
intent2.setPackage(ApkInfo.JXW_LAUNCHER_PACKAGE_NAME);
|
||||
intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent2.setClassName(ApkInfo.JXW_LAUNCHER_PACKAGE_NAME, ApkInfo.JXW_LAUNCHER_UPDATE_CLASS_NAME);
|
||||
try {
|
||||
mContext.startActivity(intent2);
|
||||
mMMKV.encode("start_jxw_key", true);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "run: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Settings.Global.putInt(mContext.getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, is_activation);
|
||||
int code_type = isActivationBean.getCode_type();
|
||||
Settings.Global.putInt(mContext.getContentResolver(), CommonConfig.UIUI_CODE_TYPE_KEY, code_type);
|
||||
long expire_time = isActivationBean.getExpire_time();
|
||||
Settings.Global.putLong(mContext.getContentResolver(), CommonConfig.UIUI_EXPIRE_TIME_KEY, expire_time);
|
||||
callback.isActivation(isActivationBean);
|
||||
} else {
|
||||
callback.isActivation(null);
|
||||
}
|
||||
} else {
|
||||
callback.isActivation(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getSnIsActivation", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getSnIsActivation", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static final String AOLE_DIR = "learnapp";
|
||||
|
||||
public void checkLocalExternalFiles() {
|
||||
int install = mMMKV.decodeInt(CommonConfig.INSTALL_SD_APKS, 0);
|
||||
Log.e(TAG, "checkLocalExternalFiles: installed = " + install);
|
||||
if (install == 1) {
|
||||
Log.e(TAG, "checkLocalExternalFiles: install");
|
||||
// return;
|
||||
}
|
||||
File[] externalFiles = mContext.getExternalFilesDirs(null);
|
||||
Log.e(TAG, "checkLocalAppInstall: externalFiles = " + Arrays.toString(externalFiles));
|
||||
|
||||
String SdPath = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
Log.e(TAG, "checkLocalAppInstall: SdPath = " + SdPath);
|
||||
String aolePath = SdPath + File.separator + AOLE_DIR;
|
||||
File file = new File(aolePath);
|
||||
if (!file.exists()) {
|
||||
Log.e(TAG, "checkLocalExternalFiles: dir not exists");
|
||||
return;
|
||||
}
|
||||
String[] apkName = file.list();
|
||||
if (apkName == null || apkName.length == 0) {
|
||||
Log.e(TAG, "checkLocalAppInstall: apkName is empty");
|
||||
} else {
|
||||
Observable.create(new ObservableOnSubscribe<HashMap<String, String>>() {
|
||||
@Override
|
||||
public void subscribe(@NonNull ObservableEmitter<HashMap<String, String>> emitter) throws Throwable {
|
||||
HashMap<String, String> packageListMap = new HashMap<>();
|
||||
for (String fileName : apkName) {
|
||||
String apkPath = aolePath + File.separator + fileName;
|
||||
Log.e(TAG, "subscribe: " + apkPath);
|
||||
String pkg = ApkUtils.getPackageName(mContext, apkPath);
|
||||
if (mJxwApps.contains(pkg)) {
|
||||
packageListMap.put(pkg, apkPath);
|
||||
} else {
|
||||
Log.e(TAG, "checkLocalAppInstall: skip: " + pkg + " fileName: " + fileName);
|
||||
}
|
||||
}
|
||||
emitter.onNext(packageListMap);
|
||||
emitter.onComplete();
|
||||
}
|
||||
}).subscribe(new Observer<HashMap<String, String>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("checkLocalAppInstall", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull HashMap<String, String> stringStringHashMap) {
|
||||
Log.e("checkLocalAppInstall", "onNext: " + stringStringHashMap);
|
||||
stringStringHashMap.forEach(new BiConsumer<String, String>() {
|
||||
@Override
|
||||
public void accept(String key, String value) {
|
||||
if (ApkUtils.isAvailable(mContext, key)) {
|
||||
Log.e("checkLocalAppInstall", "accept: installed: " + key);
|
||||
} else {
|
||||
ApkUtils.installApp(mContext, value);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("checkLocalAppInstall", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("checkLocalAppInstall", "onComplete: ");
|
||||
mMMKV.encode(CommonConfig.INSTALL_SD_APKS, 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Set<String> mJxwApps = new HashSet<String>() {{
|
||||
this.add("air.com.zhihuiyoujiao.flashplayer");
|
||||
this.add("com.example.arithmeticformula");
|
||||
this.add("com.example.elementcycleapp");
|
||||
this.add("com.example.pianpangbushou");
|
||||
this.add("com.iflytek.cyber.iot.show.core");
|
||||
this.add("com.iflytek.speechcloud");
|
||||
this.add("com.jxw.bihuamingcheng");
|
||||
this.add("com.jxw.bishunguize");
|
||||
this.add("com.jxw.characterlearning");
|
||||
this.add("com.jxw.dmxcy");
|
||||
this.add("com.jxw.englishsoundmark");
|
||||
this.add("com.jxw.examsystem");
|
||||
this.add("com.jxw.game");
|
||||
this.add("com.jxw.gb.zwpg");
|
||||
this.add("com.jxw.handwrite");
|
||||
this.add("com.jxw.jinfangyici");
|
||||
this.add("com.jxw.jxwbook");
|
||||
this.add("com.jxw.jxwcalculator");
|
||||
this.add("com.jxw.laboratory");
|
||||
this.add("com.jxw.learnchinesepinyin");
|
||||
this.add("com.jxw.letterstudynew");
|
||||
this.add("com.jxw.liancichengju");
|
||||
this.add("com.jxw.mskt.video");
|
||||
this.add("com.jxw.newyouer.video");
|
||||
this.add("com.jxw.online_study");
|
||||
this.add("com.jxw.question");
|
||||
this.add("com.jxw.schultegrid");
|
||||
this.add("com.jxw.singsound");
|
||||
this.add("com.jxw.studydigital");
|
||||
this.add("com.jxw.teacher.video");
|
||||
this.add("com.jxw.wuweijidanci");
|
||||
this.add("com.jxw.youer.video");
|
||||
this.add("com.jxw.yuwenxiezuo");
|
||||
this.add("com.jxw.yyhb");
|
||||
this.add("com.jxw.zncd");
|
||||
this.add("com.jxw.souti");
|
||||
this.add("com.jxw.xdfzq");
|
||||
this.add("com.oirsdfg89.flg");
|
||||
this.add("com.study.flashplayer");
|
||||
this.add("com.tech.translate");
|
||||
this.add("com.uiui.zybrowser");
|
||||
this.add("com.uiui.zysn ");
|
||||
this.add("com.jxw.launcher");
|
||||
this.add("com.uiui.zyappstore");
|
||||
this.add("com.uiui.zy");
|
||||
this.add("com.uiui.zyos");
|
||||
this.add("com.teclast.zyos");
|
||||
this.add("com.teclast.zybrowser");
|
||||
this.add("com.teclast.zyappstore");
|
||||
this.add("com.teclast.zy");
|
||||
}};
|
||||
|
||||
public interface JxwAppCallback {
|
||||
void setJxwApp(List<AoleAppInfo> appInfos);
|
||||
}
|
||||
|
||||
public void getJxwApp(BehaviorSubject<ActivityEvent> lifecycle, JxwAppCallback callback) {
|
||||
getAdminAppByClassObservable(11)
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<List<AoleAppInfo>>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getJxwApp", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<List<AoleAppInfo>> listBaseResponse) {
|
||||
Log.e("getJxwApp", "onNext: " + listBaseResponse);
|
||||
if (listBaseResponse.code == 200) {
|
||||
List<AoleAppInfo> appInfos = listBaseResponse.data;
|
||||
if (appInfos != null && appInfos.size() != 0) {
|
||||
callback.setJxwApp(appInfos);
|
||||
getAllAppUpdate(appInfos);
|
||||
} else {
|
||||
callback.setJxwApp(null);
|
||||
}
|
||||
} else {
|
||||
callback.setJxwApp(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getJxwApp", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getJxwApp", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param appInfos 获取所有app直接更新
|
||||
*/
|
||||
public void getAllAppUpdate(List<AoleAppInfo> appInfos) {
|
||||
if (appInfos == null || appInfos.size() == 0) {
|
||||
return;
|
||||
}
|
||||
HashMap<String, AoleAppInfo> appInfoHashMap = new HashMap<>();
|
||||
for (AoleAppInfo appInfo : appInfos) {
|
||||
if (appInfo == null) {
|
||||
continue;
|
||||
}
|
||||
appInfoHashMap.put(appInfo.getApp_package(), appInfo);
|
||||
}
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
for (Map.Entry<String, AoleAppInfo> entry : appInfoHashMap.entrySet()) {
|
||||
PackageInfo packageInfo = null;
|
||||
try {
|
||||
packageInfo = pm.getPackageInfo(entry.getKey(), 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (entry.getValue() != null) {
|
||||
if (packageInfo == null) {
|
||||
//未安装
|
||||
String s = new Gson().toJson(entry.getValue());
|
||||
Log.e(TAG, "getAllAppUpdate: " + s);
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(s);
|
||||
FileUtils.ariaDownload(mContext, entry.getValue().getApp_url(), jsonObject);
|
||||
} else {
|
||||
long appVersionCode;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
appVersionCode = packageInfo.getLongVersionCode();
|
||||
} else {
|
||||
appVersionCode = packageInfo.versionCode;
|
||||
}
|
||||
long versionCode = entry.getValue().getApp_version_code();
|
||||
//版本升级
|
||||
if (appVersionCode < versionCode) {
|
||||
Log.e(TAG, "getAllAppUpdate: need update : " + entry.getValue().getApp_package());
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(new Gson().toJson(entry.getValue()));
|
||||
FileUtils.ariaDownload(mContext, entry.getValue().getApp_url(), jsonObject);
|
||||
} else {
|
||||
Log.e(TAG, "getAllAppUpdate: installed: " + entry.getValue().getApp_package());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface AuthenticationCallback {
|
||||
void setAuthenticationResponse(JxwResponse jxwResponse);
|
||||
|
||||
void onComplete();
|
||||
}
|
||||
|
||||
public void getJxwAuthentication(BehaviorSubject<ActivityEvent> lifecycle, AuthenticationCallback callback) {
|
||||
MediaType JSON = MediaType.parse("application/json; charset=utf-8");
|
||||
List<String> snList = new ArrayList<>();
|
||||
String code = mMMKV.decodeString(CommonConfig.ACTIVATIONBEAN_CODE_KEY, "");
|
||||
snList.add(code);
|
||||
String jsonString = GsonUtils.toJSONString(snList);
|
||||
RequestBody requestBody = RequestBody.Companion.create(JSON, jsonString);
|
||||
getAuthorizedControl(requestBody)
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<JxwResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getJxwAuthentication", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull JxwResponse jxwResponseBaseResponse) {
|
||||
Log.e("getJxwAuthentication", "onNext: " + jxwResponseBaseResponse);
|
||||
if (jxwResponseBaseResponse.code == 0) {
|
||||
// startJxwLauncher();
|
||||
}
|
||||
if (callback != null)
|
||||
callback.setAuthenticationResponse(jxwResponseBaseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getJxwAuthentication", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getJxwAuthentication", "onComplete: ");
|
||||
if (callback != null)
|
||||
callback.onComplete();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ public class UrlAddress {
|
||||
* 主页接口
|
||||
* */
|
||||
public static final String ROOT_URL = "https://kxapi.uiuios.com/android/";
|
||||
|
||||
public static final String WEBSOCKET_URL = "wss://kxapi.uiuios.com:3018";
|
||||
|
||||
/*
|
||||
* 设备
|
||||
@@ -84,8 +84,28 @@ public class UrlAddress {
|
||||
/*删除闹钟*/
|
||||
public static final String ALARM_CLOCK_DELETE = "equipment/alarmClock/alarmClockDelete";
|
||||
|
||||
/*
|
||||
* 学生
|
||||
* */
|
||||
/*主页接口*/
|
||||
public static final String AOLELEARN_ROOT_URL = "https://led.aolelearn.com/android/";
|
||||
/*获取设备是否激活*/
|
||||
public static final String GET_SN_IS_ACTIVATION = "sn/getSnIsActivation";
|
||||
/*获取管理员所有应用*/
|
||||
public final static String GET_ADMIN_APP = "getAdminApp";
|
||||
/*获取强制下载*/
|
||||
public final static String GET_FORCE_INSTALL = "app/getForceDownload";
|
||||
/*根据包名获取更新*/
|
||||
public final static String GET_NEWESTAPPUPDATE = "app/newestAppUpdate";
|
||||
/*获取灰度更新*/
|
||||
public static final String GET_TEST_APP_INFO = "app/getTestAppInfo";
|
||||
|
||||
|
||||
/*九学王测试服务器*/
|
||||
public static final String JXW_ROOT_URL = "http://api.jxwxxkj.com/";
|
||||
/*激活接口*/
|
||||
public static final String ADD_BY_AUTHORIZED = "api/thddevice/series/addByAuthorized";
|
||||
|
||||
/*通过ip获取信息*/
|
||||
public static final String PCONLINE_WHOIS = "http://whois.pconline.com.cn/";
|
||||
public static final String WHOIS = "ipJson.jsp";
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.uiuipad.find.network.api.aolelearn;
|
||||
|
||||
import com.uiuipad.find.bean.aolelearn.AoleAppInfo;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface ClassAppApi {
|
||||
@GET(UrlAddress.GET_ADMIN_APP)
|
||||
Observable<BaseResponse<List<AoleAppInfo>>> getAdminAppByClass(
|
||||
@Query("class_id") int class_id
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.uiuipad.find.network.api.aolelearn;
|
||||
|
||||
import com.uiuipad.find.bean.aolelearn.AoleAppInfo;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface ForceInstall {
|
||||
@GET(UrlAddress.GET_FORCE_INSTALL)
|
||||
Observable<BaseResponse<List<AoleAppInfo>>> getForceInstall(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.uiuipad.find.network.api.aolelearn;
|
||||
|
||||
import com.uiuipad.find.bean.aolelearn.AoleAppInfo;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface NewestAppUpdateApi {
|
||||
@GET(UrlAddress.GET_NEWESTAPPUPDATE)
|
||||
Observable<BaseResponse<AoleAppInfo>> getAppUpdate(
|
||||
@Query("packageName") String packageName,
|
||||
@Query("versionCode") String versionCode,
|
||||
@Query("type") int type
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.uiuipad.find.network.api.aolelearn;
|
||||
|
||||
import com.uiuipad.find.bean.aolelearn.ActivationBean;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface SnIsActivationApi {
|
||||
@GET(UrlAddress.GET_SN_IS_ACTIVATION)
|
||||
Observable<BaseResponse<ActivationBean>> getSnIsActivation(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.uiuipad.find.network.api.aolelearn;
|
||||
|
||||
import com.uiuipad.find.bean.aolelearn.AoleAppInfo;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface TestAppApi {
|
||||
@GET(UrlAddress.GET_TEST_APP_INFO)
|
||||
Observable<BaseResponse<List<AoleAppInfo>>> getTestApp(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.uiuipad.find.network.api.jxw;
|
||||
|
||||
import com.uiuipad.find.bean.jxw.JxwResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.QueryMap;
|
||||
|
||||
public interface AuthorizedApi {
|
||||
@POST(UrlAddress.ADD_BY_AUTHORIZED)
|
||||
Observable<JxwResponse> addByAuthorized(
|
||||
@QueryMap Map<String, String> params,
|
||||
@Body RequestBody json
|
||||
);
|
||||
}
|
||||
120
app/src/main/java/com/uiuipad/find/network/api/jxw/JxwUtils.java
Normal file
120
app/src/main/java/com/uiuipad/find/network/api/jxw/JxwUtils.java
Normal file
@@ -0,0 +1,120 @@
|
||||
package com.uiuipad.find.network.api.jxw;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.uiuipad.find.BuildConfig;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class JxwUtils {
|
||||
private static final String TAG = JxwUtils.class.getSimpleName();
|
||||
|
||||
static {
|
||||
System.loadLibrary("aoleyun");
|
||||
}
|
||||
|
||||
public static native String getAppId();
|
||||
|
||||
public static native String getAppSecret();
|
||||
|
||||
public static native String getAppIsbn();
|
||||
|
||||
public static native String getNonce();
|
||||
|
||||
public static String getSignature(long timestamp) {
|
||||
//用于获取signature
|
||||
SortedMap<String, String> items = new TreeMap<>();
|
||||
items.put("appId", getAppId());
|
||||
items.put("timestamp", getTimestamp(timestamp));
|
||||
items.put("nonce", getNonce());
|
||||
items.put("appsecret", getAppSecret());
|
||||
items.put("appIsbn", getAppIsbn());
|
||||
String signature = signature(items);
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.e(TAG, "getSignature: " + signature);
|
||||
}
|
||||
return signature;
|
||||
}
|
||||
|
||||
public static Map<String, String> getParams() {
|
||||
long timestamp = System.currentTimeMillis();
|
||||
String signature = getSignature(timestamp);
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("appId", getAppId());
|
||||
params.put("timestamp", getTimestamp(timestamp));
|
||||
params.put("nonce", getNonce());
|
||||
params.put("signature", signature);
|
||||
params.put("appIsbn", getAppIsbn());
|
||||
return params;
|
||||
}
|
||||
|
||||
public static String getTimestamp(long timestamp) {
|
||||
return String.valueOf(timestamp / 1000);
|
||||
}
|
||||
|
||||
|
||||
/*source*/
|
||||
// public void userScore() {
|
||||
// //用于获取signature
|
||||
// SortedMap<String, String> items = new TreeMap<>();
|
||||
// items.put("appId", "九学王提供的-appId");
|
||||
// items.put("timestamp", "1624282817");
|
||||
// items.put("其它参数","其它参数的值");
|
||||
// items.put("nonce", "X6SH3YeRTs");
|
||||
// items.put("appsecret", "appsecret的值");
|
||||
// String signature = signature(items);
|
||||
// System.out.println(signature);
|
||||
//
|
||||
// //请求参数设置
|
||||
// MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>();
|
||||
// paramMap.add("其它参数","其它参数的值");
|
||||
// paramMap.add("appId", "appId的值");
|
||||
// paramMap.add("timestamp", "1624282817");
|
||||
// paramMap.add("nonce", "X6SH3YeRTs");
|
||||
// paramMap.add("signature", signature);
|
||||
//
|
||||
// //这里调用我们的服务
|
||||
// }
|
||||
|
||||
public static String signature(SortedMap<String,String> items){
|
||||
StringBuilder forSign= new StringBuilder();
|
||||
|
||||
for(String key:items.keySet()){
|
||||
forSign.append(key).append("=").append(items.get(key)).append("&");
|
||||
}
|
||||
|
||||
forSign.setLength(forSign.length()-1);
|
||||
|
||||
return encryptSHA1(forSign.toString());
|
||||
}
|
||||
|
||||
public static String encryptSHA1(String content){
|
||||
try {
|
||||
MessageDigest digest = MessageDigest.getInstance("SHA-1");
|
||||
digest.update(content.getBytes(StandardCharsets.UTF_8));
|
||||
byte[] messageDigest = digest.digest();
|
||||
StringBuilder hexString = new StringBuilder();
|
||||
|
||||
for (byte b : messageDigest) {
|
||||
String shaHex = Integer.toHexString(b & 0xFF);
|
||||
|
||||
if (shaHex.length() < 2) {
|
||||
hexString.append(0);
|
||||
}
|
||||
|
||||
hexString.append(shaHex);
|
||||
}
|
||||
|
||||
return hexString.toString();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
package com.uiuipad.find.network.api.alarmClock;
|
||||
package com.uiuipad.find.network.api.kuxin.alarmClock;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import okhttp3.MultipartBody;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Part;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.uiuipad.find.network.api.alarmClock;
|
||||
package com.uiuipad.find.network.api.kuxin.alarmClock;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.uiuipad.find.network.api.alarmClock;
|
||||
package com.uiuipad.find.network.api.kuxin.alarmClock;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.uiuipad.find.network.api.alarmClock;
|
||||
package com.uiuipad.find.network.api.kuxin.alarmClock;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.uiuipad.find.network.api.alarmClock;
|
||||
package com.uiuipad.find.network.api.kuxin.alarmClock;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.uiuipad.find.network.api.alarmClock;
|
||||
package com.uiuipad.find.network.api.kuxin.alarmClock;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.uiuipad.find.network.api.app;
|
||||
package com.uiuipad.find.network.api.kuxin.app;
|
||||
|
||||
import com.uiuipad.find.bean.AppInfo;
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.AppInfo;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import java.util.List;
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.uiuipad.find.network.api.app;
|
||||
package com.uiuipad.find.network.api.kuxin.app;
|
||||
|
||||
import com.uiuipad.find.bean.AppInfo;
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.AppInfo;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import java.util.List;
|
||||
@@ -13,6 +13,7 @@ import retrofit2.http.Query;
|
||||
public interface GetSelfAppApi {
|
||||
@GET(UrlAddress.GET_SELF_APP)
|
||||
Observable<BaseResponse<List<AppInfo>>> getSelfApp(
|
||||
@Query("sn") String sn
|
||||
@Query("sn") String sn,
|
||||
@Query("platform") String platform
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.uiuipad.find.network.api.app;
|
||||
package com.uiuipad.find.network.api.kuxin.app;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.uiuipad.find.network.api.manage;
|
||||
package com.uiuipad.find.network.api.kuxin.manage;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.uiuipad.find.network.api.manage;
|
||||
package com.uiuipad.find.network.api.kuxin.manage;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.uiuipad.find.network.api.manage;
|
||||
package com.uiuipad.find.network.api.kuxin.manage;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.uiuipad.find.network.api.manage;
|
||||
package com.uiuipad.find.network.api.kuxin.manage;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.uiuipad.find.network.api.manage;
|
||||
package com.uiuipad.find.network.api.kuxin.manage;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.uiuipad.find.network.api.manage;
|
||||
package com.uiuipad.find.network.api.kuxin.manage;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.SnSetting;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.SnSetting;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.uiuipad.find.network.api.manage;
|
||||
package com.uiuipad.find.network.api.kuxin.manage;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@@ -14,7 +14,7 @@ public interface UpdateSnLocationApi {
|
||||
Observable<BaseResponse> updateSnLocation(
|
||||
@Field("sn") String sn,
|
||||
@Field("location") String location,
|
||||
@Field("location_longitude") double locationLongitude,
|
||||
@Field("location_latitude") double locationLatitude
|
||||
@Field("location_longitude") String locationLongitude,
|
||||
@Field("location_latitude") String locationLatitude
|
||||
);
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package com.uiuipad.find.network.api.manage;
|
||||
package com.uiuipad.find.network.api.kuxin.manage;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import okhttp3.MultipartBody;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Multipart;
|
||||
import retrofit2.http.POST;
|
||||
@@ -16,7 +17,7 @@ public interface UploadSnScreenshotApi {
|
||||
@Multipart
|
||||
@POST(UrlAddress.UPLOAD_SN_SCREENSHOT)
|
||||
Call<BaseResponse> uploadSnScreenshot(
|
||||
@PartMap Map<String, String> params,
|
||||
@PartMap Map<String, RequestBody> params,
|
||||
@Part MultipartBody.Part body
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.uiuipad.find.network.api.manage;
|
||||
package com.uiuipad.find.network.api.kuxin.manage;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.uiuipad.find.network.api.sn;
|
||||
package com.uiuipad.find.network.api.kuxin.sn;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.uiuipad.find.network.api.sn;
|
||||
package com.uiuipad.find.network.api.kuxin.sn;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.uiuipad.find.network.api.sn;
|
||||
package com.uiuipad.find.network.api.kuxin.sn;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.uiuipad.find.network.api.sn;
|
||||
package com.uiuipad.find.network.api.kuxin.sn;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.SnInfo;
|
||||
import com.uiuipad.find.bean.SnSetting;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.SnInfo;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@@ -1,14 +1,11 @@
|
||||
package com.uiuipad.find.network.api.sn;
|
||||
package com.uiuipad.find.network.api.kuxin.sn;
|
||||
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.Multipart;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.PartMap;
|
||||
@@ -18,9 +18,9 @@ import com.google.gson.JsonObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.uiuipad.find.activity.AudioActivity;
|
||||
import com.uiuipad.find.bean.AppInfo;
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.SnSetting;
|
||||
import com.uiuipad.find.bean.kuxin.AppInfo;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.SnSetting;
|
||||
import com.uiuipad.find.comm.CommonConfig;
|
||||
import com.uiuipad.find.dialog.CustomDialog;
|
||||
import com.uiuipad.find.gson.GsonUtils;
|
||||
@@ -120,6 +120,10 @@ public class PushManager {
|
||||
private static final String CLEAR_APP_CACHE = "27";
|
||||
/*应用管控开关*/
|
||||
private static final String SYSTEM_CONTROL = "29";
|
||||
/*摄像头拍照*/
|
||||
private static final String FRONT_CAMERA = "30";
|
||||
/*设备解绑*/
|
||||
private static final String UNBIND_DEVICES = "31";
|
||||
|
||||
private PushManager(Context context) {
|
||||
if (context == null) {
|
||||
@@ -213,6 +217,7 @@ public class PushManager {
|
||||
case APP_UNINSTALL:
|
||||
break;
|
||||
case CLEAR_APP_CACHE:
|
||||
|
||||
break;
|
||||
default:
|
||||
}
|
||||
@@ -235,7 +240,13 @@ public class PushManager {
|
||||
public void onReceiveLocation(BDLocation bdLocation) {
|
||||
Log.e(TAG, "onReceiveLocation: ");
|
||||
if (bdLocation != null) {
|
||||
NetInterfaceManager.getInstance().getUpdateSnLocationControl(mMMKV.decodeString(CommonConfig.MAP_ADDRESS_KEY, "-"), bdLocation.getLongitude(), bdLocation.getLatitude())
|
||||
double longitude = bdLocation.getLongitude();
|
||||
double latitude = bdLocation.getLatitude();
|
||||
Log.e(TAG, "onReceiveLocation: longitude = " + longitude);
|
||||
Log.e(TAG, "onReceiveLocation: latitude = " + latitude);
|
||||
NetInterfaceManager.getInstance().getUpdateSnLocationControl(mMMKV.decodeString(CommonConfig.MAP_ADDRESS_KEY, "-"),
|
||||
Double.toString(longitude),
|
||||
Double.toString(latitude))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
@@ -471,9 +482,9 @@ public class PushManager {
|
||||
RequestBody fileBody = RequestBody.Companion.create(file, mediaType);
|
||||
//设置一个file文件
|
||||
MultipartBody.Part body = MultipartBody.Part.createFormData("file", file.getName(), fileBody);
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("sn", Utils.getSerial());
|
||||
params.put("type", "1");
|
||||
Map<String, RequestBody> params = new HashMap<>();
|
||||
params.put("sn", NetInterfaceManager.convertToRequestBody(Utils.getSerial()));
|
||||
params.put("type", NetInterfaceManager.convertToRequestBody("1"));
|
||||
Call<BaseResponse> call = NetInterfaceManager.getInstance().getUploadSnScreenshotApi().uploadSnScreenshot(params, body);
|
||||
call.enqueue(new RetryCallback<BaseResponse>(call, 10, 30 * 1000) {
|
||||
@Override
|
||||
@@ -492,4 +503,4 @@ public class PushManager {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import com.uiuipad.find.service.ManagerService;
|
||||
import com.uiuipad.find.service.SocketService;
|
||||
import com.uiuipad.find.service.main.MainService;
|
||||
|
||||
public class BootReceiver extends BroadcastReceiver {
|
||||
@@ -29,6 +30,7 @@ public class BootReceiver extends BroadcastReceiver {
|
||||
|| Intent.ACTION_SCREEN_OFF.equals(action)
|
||||
) {
|
||||
context.startService(new Intent(context, MainService.class));
|
||||
context.startService(new Intent(context, SocketService.class));
|
||||
context.startService(new Intent(context, ManagerService.class));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.tencent.mmkv.MMKV;
|
||||
import com.tuo.customview.VerificationCodeView;
|
||||
import com.uiuipad.find.BuildConfig;
|
||||
import com.uiuipad.find.R;
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.comm.CommonConfig;
|
||||
import com.uiuipad.find.network.NetInterfaceManager;
|
||||
import com.uiuipad.find.receiver.APKinstallReceiver;
|
||||
|
||||
297
app/src/main/java/com/uiuipad/find/service/SocketService.java
Normal file
297
app/src/main/java/com/uiuipad/find/service/SocketService.java
Normal file
@@ -0,0 +1,297 @@
|
||||
package com.uiuipad.find.service;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Binder;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.PowerManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.blankj.utilcode.util.NetworkUtils;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.uiuipad.find.network.UrlAddress;
|
||||
import com.uiuipad.find.util.ControlUtils;
|
||||
import com.uiuipad.find.util.Utils;
|
||||
import com.uiuipad.find.websocket.JWebSocketClient;
|
||||
import com.uiuipad.sn.KeepAliveConnection;
|
||||
|
||||
import org.java_websocket.handshake.ServerHandshake;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
public class SocketService extends Service implements NetworkUtils.OnNetworkStatusChangedListener {
|
||||
private final static String TAG = SocketService.class.getSimpleName() + "ZY";
|
||||
|
||||
public JWebSocketClient client;
|
||||
private JWebSocketClientBinder mBinder = new JWebSocketClientBinder();
|
||||
|
||||
@Override
|
||||
public void onDisconnected() {
|
||||
Log.i("JWebSocketClientService", "网络断开连接");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected(NetworkUtils.NetworkType networkType) {
|
||||
Log.i("JWebSocketClientService", "网络已连接");
|
||||
}
|
||||
|
||||
//用于Activity和service通讯
|
||||
public class JWebSocketClientBinder extends Binder {
|
||||
public SocketService getService() {
|
||||
return SocketService.this;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return new KeepAliveConnection.Stub() {
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
registerScreenLockReceiver();
|
||||
//初始化websocket
|
||||
initSocketClient();
|
||||
mHandler.postDelayed(heartBeatRunnable, HEART_BEAT_RATE);//开启心跳检测
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
// 绑定建立链接
|
||||
Log.e("JWebSocketClientService", "onStartCommand: ");
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
private ScreenLockReceiver screenLockReceiver;
|
||||
|
||||
private void registerScreenLockReceiver() {
|
||||
if (null == screenLockReceiver) {
|
||||
screenLockReceiver = new ScreenLockReceiver();
|
||||
}
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||
filter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||
filter.addAction(Intent.ACTION_SCREEN_ON);
|
||||
filter.addAction(Intent.ACTION_BOOT_COMPLETED);
|
||||
filter.addAction(Intent.ACTION_USER_PRESENT);
|
||||
filter.addAction(Intent.ACTION_SHUTDOWN);
|
||||
filter.addAction(Intent.ACTION_FACTORY_RESET);
|
||||
filter.addAction(Intent.ACTION_MASTER_CLEAR);
|
||||
registerReceiver(screenLockReceiver, filter);
|
||||
}
|
||||
|
||||
private class ScreenLockReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
Log.e(TAG, "onReceive:" + action);
|
||||
if (TextUtils.isEmpty(action)) {
|
||||
Log.e(TAG, "onReceive: is NULL");
|
||||
return;
|
||||
}
|
||||
switch (action) {
|
||||
case Intent.ACTION_BOOT_COMPLETED:
|
||||
case Intent.ACTION_USER_PRESENT:
|
||||
case Intent.ACTION_SCREEN_ON:
|
||||
mHandler.post(heartBeatRunnable);//开启心跳检测
|
||||
sendMsg(1);
|
||||
break;
|
||||
case Intent.ACTION_SCREEN_OFF:
|
||||
case Intent.ACTION_SHUTDOWN:
|
||||
case Intent.ACTION_FACTORY_RESET:
|
||||
case Intent.ACTION_MASTER_CLEAR:
|
||||
sendMsg(0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
NetworkUtils.unregisterNetworkStatusChangedListener(this);
|
||||
closeConnect();
|
||||
if (screenLockReceiver != null) {
|
||||
unregisterReceiver(screenLockReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化websocket连接
|
||||
*/
|
||||
private void initSocketClient() {
|
||||
URI uri = URI.create(UrlAddress.WEBSOCKET_URL);
|
||||
client = new JWebSocketClient(uri) {
|
||||
@Override
|
||||
public void onMessage(String message) {
|
||||
Log.i("JWebSocketClientService", "收到服务器发来的消息:" + message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpen(ServerHandshake handshakedata) {
|
||||
super.onOpen(handshakedata);
|
||||
Log.i("JWebSocketClientService", "websocket连接成功");
|
||||
sendMsg(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose(int code, String reason, boolean remote) {
|
||||
super.onClose(code, reason, remote);
|
||||
Log.i("JWebSocketClientService", "websocket连接关闭:" + reason);
|
||||
// client.close();
|
||||
// initSocketClient();
|
||||
if (ControlUtils.getScreenStatus(SocketService.this)) {
|
||||
mHandler.postDelayed(heartBeatRunnable, HEART_BEAT_RATE);//开启心跳检测
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
super.onError(ex);
|
||||
Log.i("JWebSocketClientService", "websocket连接错误:" + ex.getMessage());
|
||||
// client.close();
|
||||
// initSocketClient();
|
||||
if (ControlUtils.getScreenStatus(SocketService.this)) {
|
||||
mHandler.postDelayed(heartBeatRunnable, HEART_BEAT_RATE);//开启心跳检测
|
||||
} else {
|
||||
Log.i("JWebSocketClientService", "postDelayed off");
|
||||
}
|
||||
}
|
||||
};
|
||||
connect();
|
||||
}
|
||||
|
||||
/**
|
||||
* 连接websocket
|
||||
*/
|
||||
private void connect() {
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
//connectBlocking多出一个等待操作,会先连接再发送,否则未连接发送会报错
|
||||
Log.i("JWebSocketClientService", "websocket链接中");
|
||||
client.connectBlocking();
|
||||
} catch (Exception e) {
|
||||
Log.i("JWebSocketClientService", e.getMessage());
|
||||
// e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
*/
|
||||
public void sendMsg() {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("sn", Utils.getSerial());
|
||||
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
||||
if (!pm.isScreenOn()) {
|
||||
jsonObject.addProperty("is_online", 0);
|
||||
//熄屏状态
|
||||
} else {
|
||||
jsonObject.addProperty("is_online", 1);
|
||||
}
|
||||
if (null != client) {
|
||||
Log.i("JWebSocketClientService", "发送的消息:" + jsonObject.toString());
|
||||
client.send(jsonObject.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public void sendMsg(int state) {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("sn", Utils.getSerial());
|
||||
jsonObject.addProperty("is_online", state);
|
||||
if (null != client) {
|
||||
Log.i("JWebSocketClientService", "发送的消息:" + jsonObject.toString());
|
||||
try {
|
||||
client.send(jsonObject.toString());
|
||||
} catch (Exception e) {
|
||||
Log.i(TAG, "sendMsg :" + e.getLocalizedMessage());
|
||||
}
|
||||
} else {
|
||||
Log.i("JWebSocketClientService", "未连接");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 断开连接
|
||||
*/
|
||||
private void closeConnect() {
|
||||
try {
|
||||
if (null != client) {
|
||||
client.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
client = null;
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------websocket心跳检测------------------------------------------------
|
||||
private static final long HEART_BEAT_RATE = 30 * 1000;//每隔50秒进行一次对长连接的心跳检测
|
||||
private Handler mHandler = new Handler();
|
||||
private Runnable heartBeatRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.i("JWebSocketClientService", "心跳包检测websocket连接状态");
|
||||
if (client != null) {
|
||||
if (client.isOpen()) {
|
||||
Log.i("JWebSocketClientService", "websocket已连接");
|
||||
sendMsg();
|
||||
} else if (client.isClosed()) {
|
||||
Log.i("JWebSocketClientService", "websocket重连中");
|
||||
if (ControlUtils.getScreenStatus(SocketService.this)) {
|
||||
reconnectWs();
|
||||
} else {
|
||||
Log.i("JWebSocketClientService", "reconnectWs off");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//如果client已为空,重新初始化连接
|
||||
client = null;
|
||||
initSocketClient();
|
||||
}
|
||||
//每隔一定的时间,对长连接进行一次心跳检测
|
||||
if (ControlUtils.getScreenStatus(SocketService.this)) {
|
||||
mHandler.postDelayed(this, HEART_BEAT_RATE);
|
||||
} else {
|
||||
Log.i("JWebSocketClientService", "websocket息屏不重连");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 开启重连
|
||||
*/
|
||||
private void reconnectWs() {
|
||||
mHandler.removeCallbacks(heartBeatRunnable);
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Log.i("JWebSocketClientService", "开启重连");
|
||||
client.reconnectBlocking();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,11 @@ package com.uiuipad.find.service.main;
|
||||
|
||||
import com.uiuipad.find.base.BasePresenter;
|
||||
import com.uiuipad.find.base.BaseView;
|
||||
import com.uiuipad.find.bean.aolelearn.ActivationBean;
|
||||
import com.uiuipad.find.bean.aolelearn.AoleAppInfo;
|
||||
import com.uiuipad.find.bean.jxw.JxwResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MainSContact {
|
||||
interface Presenter extends BasePresenter<MainView> {
|
||||
@@ -10,6 +15,16 @@ public class MainSContact {
|
||||
void getSnSetting();
|
||||
void getApp();
|
||||
void getSelfApp();
|
||||
|
||||
void getSnIsActivation();
|
||||
/*激活九学王*/
|
||||
void setJxwActivation();
|
||||
/*激活后获取九学王app*/
|
||||
void getJxwApp();
|
||||
void getAdminAppByClass();
|
||||
void getForceInstall();
|
||||
void getAppUpdate();
|
||||
void getTestApp();
|
||||
}
|
||||
|
||||
public interface MainView extends BaseView {
|
||||
@@ -17,5 +32,15 @@ public class MainSContact {
|
||||
void getSnSettingFinish();
|
||||
void getAppFinish();
|
||||
void getSelfAppFinish();
|
||||
|
||||
void setSnIsActivation(ActivationBean activationBean);
|
||||
void activationJxw(JxwResponse jxwResponse);
|
||||
void activationJxwComplete();
|
||||
void setJxwApp(List<AoleAppInfo> appInfos);
|
||||
void getAdminAppByClassFinish();
|
||||
void getForceInstallFinish();
|
||||
void getAppUpdateFinish();
|
||||
void getTestAppFinish();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,11 @@ import android.util.Log;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.uiuipad.find.bean.AppInfo;
|
||||
import com.uiuipad.find.bean.BaseResponse;
|
||||
import com.uiuipad.find.bean.aolelearn.ActivationBean;
|
||||
import com.uiuipad.find.bean.aolelearn.AoleAppInfo;
|
||||
import com.uiuipad.find.bean.jxw.JxwResponse;
|
||||
import com.uiuipad.find.bean.kuxin.AppInfo;
|
||||
import com.uiuipad.find.bean.kuxin.BaseResponse;
|
||||
import com.uiuipad.find.comm.CommonConfig;
|
||||
import com.uiuipad.find.network.NetInterfaceManager;
|
||||
import com.uiuipad.find.util.ApkUtils;
|
||||
@@ -93,17 +96,17 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
public void getApp() {
|
||||
// NetInterfaceManager.getInstance().getAppControl()
|
||||
//// .compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
//// .subscribe(new Observer<BaseResponse<List<AppInfo>>>() {
|
||||
//// .subscribe(new Observer<BaseResponse<List<AoleAppInfo>>>() {
|
||||
//// @Override
|
||||
//// public void onSubscribe(@NonNull Disposable d) {
|
||||
//// Log.e("getApp", "onSubscribe: ");
|
||||
//// }
|
||||
////
|
||||
//// @Override
|
||||
//// public void onNext(@NonNull BaseResponse<List<AppInfo>> baseResponse) {
|
||||
//// public void onNext(@NonNull BaseResponse<List<AoleAppInfo>> baseResponse) {
|
||||
//// Log.e("getApp", "onNext: " + baseResponse);
|
||||
//// if (baseResponse.code==200){
|
||||
//// List<AppInfo> appInfoList =baseResponse.data;
|
||||
//// List<AoleAppInfo> appInfoList =baseResponse.data;
|
||||
//// ApkUtils.checkAppInstall(mContext,appInfoList);
|
||||
//// }
|
||||
//// }
|
||||
@@ -155,4 +158,59 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSnIsActivation() {
|
||||
NetInterfaceManager.getInstance().getSnIsActivation(getLifecycle(), new NetInterfaceManager.SnIsActivationCallback() {
|
||||
@Override
|
||||
public void isActivation(ActivationBean activationBean) {
|
||||
mView.setSnIsActivation(activationBean);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJxwActivation() {
|
||||
NetInterfaceManager.getInstance().getJxwAuthentication(lifecycle, new NetInterfaceManager.AuthenticationCallback() {
|
||||
@Override
|
||||
public void setAuthenticationResponse(JxwResponse jxwResponse) {
|
||||
mView.activationJxw(jxwResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.activationJxwComplete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getJxwApp() {
|
||||
NetInterfaceManager.getInstance().getJxwApp(lifecycle, new NetInterfaceManager.JxwAppCallback() {
|
||||
@Override
|
||||
public void setJxwApp(List<AoleAppInfo> appInfos) {
|
||||
mView.setJxwApp(appInfos);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAdminAppByClass() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getForceInstall() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppUpdate() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTestApp() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,13 +30,19 @@ import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.trello.rxlifecycle4.android.RxLifecycleAndroid;
|
||||
import com.uiuipad.find.R;
|
||||
import com.uiuipad.find.activity.main.MainActivity;
|
||||
import com.uiuipad.find.bean.aolelearn.ActivationBean;
|
||||
import com.uiuipad.find.bean.aolelearn.AoleAppInfo;
|
||||
import com.uiuipad.find.bean.jxw.JxwResponse;
|
||||
import com.uiuipad.find.comm.CommonConfig;
|
||||
import com.uiuipad.find.gson.GsonUtils;
|
||||
import com.uiuipad.find.network.NetInterfaceManager;
|
||||
import com.uiuipad.find.push.PushManager;
|
||||
import com.uiuipad.find.util.ApkUtils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
@@ -218,5 +224,57 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
@Override
|
||||
public void getSelfAppFinish() {
|
||||
NetInterfaceManager.getInstance().updateAppInstall();
|
||||
mPresenter.getSnIsActivation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSnIsActivation(ActivationBean activationBean) {
|
||||
if (activationBean != null) {
|
||||
// Intent intent = new Intent(PushManager.ACTION_REFRESH_BINDING_STATUS);
|
||||
// intent.setPackage("com.uiui.zyos");
|
||||
// sendBroadcast(intent);
|
||||
int is_activation = activationBean.getIs_activation();
|
||||
Log.e(TAG, "IsActivationBean: " + is_activation);
|
||||
if (is_activation == 0) {
|
||||
|
||||
} else if (is_activation == 1) {
|
||||
mPresenter.setJxwActivation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activationJxw(JxwResponse jxwResponse) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activationJxwComplete() {
|
||||
mPresenter.getJxwApp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJxwApp(List<AoleAppInfo> appInfos) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAdminAppByClassFinish() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getForceInstallFinish() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppUpdateFinish() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTestAppFinish() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
package com.uiuipad.find.util;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageInstaller;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.os.Binder;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.uiuipad.find.BuildConfig;
|
||||
import com.uiuipad.find.bean.AppInfo;
|
||||
import com.uiuipad.find.bean.InstallAppInfo;
|
||||
import com.uiuipad.find.bean.kuxin.AppInfo;
|
||||
import com.uiuipad.find.bean.kuxin.InstallAppInfo;
|
||||
import com.uiuipad.find.gson.GsonUtils;
|
||||
import com.uiuipad.find.receiver.InstallResultReceiver;
|
||||
|
||||
@@ -29,7 +32,9 @@ import java.io.OutputStream;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -323,7 +328,7 @@ public class ApkUtils {
|
||||
|
||||
public static void checkAppInstall(Context context, AppInfo appInfo) {
|
||||
if (appInfo == null) {
|
||||
Log.e("checkAppInstall", "AppInfo is null");
|
||||
Log.e("checkAppInstall", "AoleAppInfo is null");
|
||||
return;
|
||||
}
|
||||
String packageName = appInfo.getApp_package();
|
||||
@@ -356,13 +361,106 @@ public class ApkUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static final Set<String> jxwApkNames = new HashSet<String>() {{
|
||||
this.add("com.study.flashplayer");
|
||||
this.add("com.oirsdfg89.flg");
|
||||
this.add("com.jxw.bihuamingcheng");
|
||||
this.add("com.jxw.bishunguize");
|
||||
this.add("com.jxw.englishsoundmark");
|
||||
this.add("com.jxw.characterlearning");
|
||||
this.add("com.jxw.jinfangyici");
|
||||
this.add("com.jxw.singsound");
|
||||
this.add("com.jxw.liancichengju");
|
||||
this.add("com.example.pianpangbushou");
|
||||
this.add("com.jxw.learnchinesepinyin");
|
||||
this.add("com.jxw.studydigital");
|
||||
this.add("com.jxw.laboratory");
|
||||
this.add("com.jxw.jxwcalculator");
|
||||
this.add("com.example.arithmeticformula");
|
||||
this.add("com.jxw.question");
|
||||
this.add("com.jxw.online_study");
|
||||
this.add("com.tech.translate");
|
||||
this.add("com.jxw.wuweijidanci");
|
||||
this.add("com.jxw.mskt.video");
|
||||
this.add("com.example.elementcycleapp");
|
||||
this.add("com.jxw.yuwenxiezuo");
|
||||
this.add("com.jxw.schultegrid");
|
||||
this.add("com.jxw.handwrite");
|
||||
this.add("com.jxw.gb.zwpg");
|
||||
this.add("com.jxw.lwxfy");
|
||||
this.add("com.jxw.examsystem");
|
||||
this.add("com.jxw.yyhb");
|
||||
this.add("com.jxw.zncd");
|
||||
this.add("com.jxw.usagedate");
|
||||
this.add("com.jxw.jxwbook");
|
||||
this.add("com.jxw.game");
|
||||
this.add("com.jxw.newyouer.video");
|
||||
this.add("com.jxw.teacher.video");
|
||||
this.add("com.jxw.xdfzq");
|
||||
this.add("com.jxw.huiben");
|
||||
this.add("com.jxw.youer.video");
|
||||
this.add("com.jxw.souti");
|
||||
this.add("com.jxw.pedu.clickread");
|
||||
|
||||
this.add("com.jxw.dmxcy");
|
||||
this.add("com.jxw.letterstudynew");
|
||||
this.add("com.jxw.launcher");
|
||||
|
||||
this.add("air.com.zhihuiyoujiao.flashplayer");
|
||||
|
||||
this.add("com.iflytek.cyber.iot.show.core");
|
||||
this.add("com.iflytek.speechcloud");
|
||||
}};
|
||||
|
||||
private static final Set<String> systemApps = new HashSet<String>() {{
|
||||
this.add("com.android.deskclock");
|
||||
this.add("com.android.music");
|
||||
this.add("com.android.documentsui");
|
||||
this.add("com.mediatek.camera");
|
||||
this.add("com.android.calendar");
|
||||
this.add("com.android.calculator2");
|
||||
this.add("com.android.gallery3d");
|
||||
this.add("com.android.soundrecorder");
|
||||
this.add("com.android.settings");
|
||||
this.add("org.chromium.chrome");
|
||||
this.add("com.softwinner.music");
|
||||
this.add("com.softwinner.miracastReceiver");
|
||||
this.add("com.softwinner.camera");
|
||||
this.add("org.chromium.webview_shell");
|
||||
// this.add("com.uiuipad.find");
|
||||
// this.add("com.uiuipad.os");
|
||||
this.add("com.softwinner.videoplayer");
|
||||
this.add("com.sohu.inputmethod.sogou");
|
||||
this.add("com.tencent.mtt");
|
||||
}};
|
||||
|
||||
public static String getInstallAppInfo(Context context) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
List<PackageInfo> packageInfos = pm.getInstalledPackages(0);
|
||||
List<PackageInfo> filter = packageInfos.stream().filter(packageInfo -> !isSystemApp(context, packageInfo.packageName)).collect(Collectors.toList());
|
||||
List<PackageInfo> filter = packageInfos.stream().filter(new Predicate<PackageInfo>() {
|
||||
@Override
|
||||
public boolean test(PackageInfo packageInfo) {
|
||||
if (isSystemApp(context, packageInfo.packageName)) {
|
||||
if (systemApps.contains(packageInfo.packageName)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
List<PackageInfo> filterJxwApp = filter.stream().filter(packageInfo -> !jxwApkNames.contains(packageInfo.packageName)).collect(Collectors.toList());
|
||||
List<InstallAppInfo> installAppInfos = new ArrayList<>();
|
||||
for (PackageInfo packageInfo : filter) {
|
||||
for (PackageInfo packageInfo : filterJxwApp) {
|
||||
if ("com.uiuipad.find".equals(packageInfo.packageName)
|
||||
|| "com.uiuipad.os".equals(packageInfo.packageName)
|
||||
|| "com.uiui.zybrowser".equals(packageInfo.packageName)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
InstallAppInfo installAppInfo = packageInfo2AppInfo(pm, packageInfo);
|
||||
installAppInfos.add(installAppInfo);
|
||||
}
|
||||
@@ -384,4 +482,94 @@ public class ApkUtils {
|
||||
return appInfo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据文件路径获取包名
|
||||
*/
|
||||
public static String getPackageName(Context context, String filePath) {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
PackageInfo info = packageManager.getPackageArchiveInfo(filePath, PackageManager.GET_ACTIVITIES);
|
||||
if (info != null) {
|
||||
ApplicationInfo appInfo = info.applicationInfo;
|
||||
return appInfo.packageName; //得到安装包名称
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Context getPackageContext(Context context, String packageName) {
|
||||
Context pkgContext = null;
|
||||
if (context.getPackageName().equals(packageName)) {
|
||||
pkgContext = context;
|
||||
} else {
|
||||
// 创建第三方应用的上下文环境
|
||||
try {
|
||||
pkgContext = context.createPackageContext(packageName,
|
||||
Context.CONTEXT_IGNORE_SECURITY
|
||||
| Context.CONTEXT_INCLUDE_CODE);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return pkgContext;
|
||||
}
|
||||
|
||||
public static Intent getAppOpenIntentByPackageName(Context context, String packageName) {
|
||||
//Activity完整名
|
||||
String mainAct = null;
|
||||
//根据包名寻找
|
||||
PackageManager pkgMag = context.getPackageManager();
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
List<ResolveInfo> list = pkgMag.queryIntentActivities(intent,
|
||||
PackageManager.GET_ACTIVITIES);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
ResolveInfo info = list.get(i);
|
||||
if (info.activityInfo.packageName.equals(packageName)) {
|
||||
mainAct = info.activityInfo.name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (TextUtils.isEmpty(mainAct)) {
|
||||
return null;
|
||||
}
|
||||
intent.setComponent(new ComponentName(packageName, mainAct));
|
||||
return intent;
|
||||
}
|
||||
|
||||
public static boolean openPackage(Context context, String packageName) {
|
||||
Context pkgContext = getPackageContext(context, packageName);
|
||||
Intent intent = getAppOpenIntentByPackageName(context, packageName);
|
||||
if (pkgContext != null && intent != null) {
|
||||
pkgContext.startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean openPackage(Context context, String packageName, String className) {
|
||||
if (TextUtils.isEmpty(className)) {
|
||||
return openPackage(context, packageName);
|
||||
}
|
||||
ComponentName cn = new ComponentName(packageName, className);
|
||||
Intent intent = new Intent();
|
||||
intent.setComponent(cn);
|
||||
//Fix for Android 13
|
||||
if (Build.VERSION.SDK_INT < 33) {
|
||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
}
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
if (context != null) {
|
||||
try {
|
||||
context.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "openPackage: " + e.getMessage());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
140
app/src/main/java/com/uiuipad/find/util/CacheUtils.java
Normal file
140
app/src/main/java/com/uiuipad/find/util/CacheUtils.java
Normal file
@@ -0,0 +1,140 @@
|
||||
package com.uiuipad.find.util;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.IPackageDataObserver;
|
||||
import android.content.pm.IPackageManager;
|
||||
import android.content.pm.IPackageStatsObserver;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageStats;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.util.Log;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class CacheUtils {
|
||||
|
||||
private static final String TAG = CacheUtils.class.getSimpleName();
|
||||
private final long MAX_WAIT_TIME = 60 * 1000;
|
||||
private final long WAIT_TIME_INCR = 10 * 1000;
|
||||
|
||||
/**
|
||||
* 获取应用数据大小 cache + data
|
||||
*
|
||||
* @param context
|
||||
* @param packageName
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
|
||||
public long getApplicationCache(Context context, String packageName) throws Exception {
|
||||
try {
|
||||
PackageStatsObserver observer = new PackageStatsObserver();
|
||||
// wait on observer
|
||||
synchronized (observer) {
|
||||
Method method = PackageManager.class.getMethod("getPackageSizeInfo", new Class[]{String.class, IPackageStatsObserver.class});
|
||||
method.invoke(context.getPackageManager(), packageName, observer);
|
||||
// getPm().getPackageSizeInfo(packageName, UserHandle.myUserId(), observer);
|
||||
long waitTime = 0;
|
||||
while ((!observer.isDone()) || (waitTime > MAX_WAIT_TIME)) {
|
||||
observer.wait(WAIT_TIME_INCR);
|
||||
waitTime += WAIT_TIME_INCR;
|
||||
}
|
||||
if (!observer.isDone()) {
|
||||
throw new Exception("Timed out waiting for PackageStatsObserver.onGetStatsCompleted");
|
||||
}
|
||||
}
|
||||
Log.d(TAG, "toString " + observer.stats.toString());
|
||||
return observer.stats.dataSize + observer.stats.cacheSize;
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed to get handle for PackageManger Exception: " + e);
|
||||
return -1;
|
||||
} catch (InterruptedException e) {
|
||||
Log.w(TAG, "InterruptedException :" + e);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除应用数据
|
||||
*
|
||||
* @param context
|
||||
* @param packageName
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean clearApplicationUserData(Context context, String packageName) throws Exception {
|
||||
Log.e(TAG, "clearApplicationUserData: " + packageName);
|
||||
try {
|
||||
PackageDataObserver observer = new PackageDataObserver();
|
||||
// wait on observer
|
||||
synchronized (observer) {
|
||||
Method method = PackageManager.class.getMethod("clearApplicationUserData", new Class[]{String.class, IPackageDataObserver.class});
|
||||
method.invoke(context.getPackageManager(), packageName, observer);
|
||||
// getPm().deleteApplicationCacheFiles(appid, observer);
|
||||
long waitTime = 0;
|
||||
while (!observer.isDone() || (waitTime > MAX_WAIT_TIME)) {
|
||||
observer.wait(WAIT_TIME_INCR);
|
||||
waitTime += WAIT_TIME_INCR;
|
||||
}
|
||||
if (!observer.isDone()) {
|
||||
throw new Exception("timed out waiting for PackageDataObserver.onRemoveCompleted");
|
||||
}
|
||||
}
|
||||
Log.d(TAG, "clearApplicationUserData " + observer.retValue);
|
||||
return observer.retValue;
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed to get handle for PackageManger Exception: " + e);
|
||||
return false;
|
||||
} catch (InterruptedException e) {
|
||||
Log.w(TAG, "InterruptedException :" + e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private IPackageManager getPm() {
|
||||
return IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
|
||||
}
|
||||
|
||||
class PackageDataObserver extends IPackageDataObserver.Stub {
|
||||
public boolean retValue = false;
|
||||
private boolean doneFlag = false;
|
||||
|
||||
@Override
|
||||
public void onRemoveCompleted(String packageName, boolean succeeded) throws RemoteException {
|
||||
synchronized (this) {
|
||||
retValue = succeeded;
|
||||
doneFlag = true;
|
||||
notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isDone() {
|
||||
return doneFlag;
|
||||
}
|
||||
}
|
||||
|
||||
class PackageStatsObserver extends IPackageStatsObserver.Stub {
|
||||
public boolean retValue = false;
|
||||
public PackageStats stats;
|
||||
private boolean doneFlag = false;
|
||||
|
||||
@Override
|
||||
public void onGetStatsCompleted(PackageStats pStats, boolean succeeded) throws RemoteException {
|
||||
synchronized (this) {
|
||||
retValue = succeeded;
|
||||
stats = pStats;
|
||||
doneFlag = true;
|
||||
notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isDone() {
|
||||
return doneFlag;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.uiuipad.find.util;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.PowerManager;
|
||||
@@ -12,7 +11,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.uiuipad.find.BuildConfig;
|
||||
import com.uiuipad.find.bean.SnSetting;
|
||||
import com.uiuipad.find.bean.kuxin.SnSetting;
|
||||
import com.uiuipad.find.comm.CommonConfig;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
@@ -80,6 +79,7 @@ public class ControlUtils {
|
||||
if (pkg.equalsIgnoreCase(BuildConfig.APPLICATION_ID)
|
||||
|| "com.tencent.mm".equals(pkg)
|
||||
|| "com.uiui.sn".equals(pkg)
|
||||
|| "com.uiuipad.os".equals(pkg)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public class ControlUtils {
|
||||
public static void setSystemControl(Context context, SnSetting snSetting) {
|
||||
int is_control = snSetting.getIs_control();
|
||||
if (is_control == 0) {
|
||||
setUSBstate(context, 0);
|
||||
setUsbState(context, 0);
|
||||
setBluetooth(context, 0);
|
||||
setDeveloperOptions(context, 0);
|
||||
setCanReset(context, 0);
|
||||
@@ -146,7 +146,7 @@ public class ControlUtils {
|
||||
} else {
|
||||
int is_storeinstall = snSetting.getIs_storeinstall();
|
||||
int is_usb = snSetting.getIs_usb();
|
||||
setUSBstate(context, is_usb);
|
||||
setUsbState(context, is_usb);
|
||||
int is_bluetooth_file = snSetting.getIs_bluetooth_file();
|
||||
setBluetooth(context, is_bluetooth_file);
|
||||
int is_developer = snSetting.getIs_developer();
|
||||
@@ -162,8 +162,8 @@ public class ControlUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void disableSystemControl(Context context){
|
||||
setUSBstate(context, 0);
|
||||
public static void disableSystemControl(Context context) {
|
||||
setUsbState(context, 0);
|
||||
setBluetooth(context, 0);
|
||||
setDeveloperOptions(context, 0);
|
||||
setCanReset(context, 0);
|
||||
@@ -171,39 +171,25 @@ public class ControlUtils {
|
||||
setNavigationBar(context, 0);
|
||||
setTF(context, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* usb连接模式管控
|
||||
*/
|
||||
private static void setUSBstate(Context context, int status) {
|
||||
//USB数据功能管控
|
||||
//仅充电:usb_charge
|
||||
//MTP模式:usb_mtp
|
||||
//Midi模式:usb_midi
|
||||
if (!BuildConfig.DEBUG) {
|
||||
try {
|
||||
// boolean qch_usb_choose = Settings.System.putString(context.getContentResolver(), "qch_usb_choose", status);
|
||||
// Log.e("SystemSetting", "qch_usb_choose:" + qch_usb_choose);
|
||||
String usbStatus = "";
|
||||
switch (status) {
|
||||
case 0:
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
|
||||
break;
|
||||
case 1:
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MTP;
|
||||
break;
|
||||
// case "usb_midi":
|
||||
// usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MIDI;
|
||||
// break;
|
||||
default:
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
|
||||
break;
|
||||
}
|
||||
Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
|
||||
context.sendBroadcast(usbIntent);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setUSBstate: " + e.getMessage());
|
||||
}
|
||||
private static void setUsbState(Context context, int status) {
|
||||
Log.e(TAG, "setUsbState: " + status);
|
||||
String usbStatus;
|
||||
switch (status) {
|
||||
case 0:
|
||||
default:
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
|
||||
break;
|
||||
case 1:
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MTP;
|
||||
break;
|
||||
}
|
||||
// Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
|
||||
Intent usbIntent = new Intent(usbStatus);
|
||||
context.sendBroadcast(usbIntent);
|
||||
}
|
||||
|
||||
private static void setBluetooth(Context context, int status) {
|
||||
@@ -217,10 +203,9 @@ public class ControlUtils {
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_Developeroptions", status);
|
||||
int old_dev_enabled = Settings.Global.getInt(context.getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0);
|
||||
Log.e(TAG, "setDeveloperOptions: " + old_dev_enabled);
|
||||
int new_state = (status == 1 ? 0 : 1);
|
||||
if (old_dev_enabled != new_state) {
|
||||
Settings.Global.putInt(context.getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, new_state);
|
||||
Settings.Global.putInt(context.getContentResolver(), Settings.Global.ADB_ENABLED, new_state);
|
||||
if (old_dev_enabled != status) {
|
||||
Settings.Global.putInt(context.getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, status);
|
||||
Settings.Global.putInt(context.getContentResolver(), Settings.Global.ADB_ENABLED, status);
|
||||
}
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, status);
|
||||
if (status == 1) {
|
||||
@@ -272,51 +257,29 @@ public class ControlUtils {
|
||||
* @param status 状态栏显示开关
|
||||
*/
|
||||
private static void setActionBar(Context context, int status) {
|
||||
int oldNum = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, 0);
|
||||
if (oldNum != status) {
|
||||
boolean aole_hide_statusBar = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, status);
|
||||
Log.e("SystemSetting", "aole_hide_statusBar:" + aole_hide_statusBar);
|
||||
String statusbarStatus = "";
|
||||
switch (status) {
|
||||
case 0:
|
||||
statusbarStatus = CommonConfig.AOLE_ACTION_SHOW_STATUS_BAR;
|
||||
break;
|
||||
case 1:
|
||||
statusbarStatus = CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
|
||||
context.sendBroadcast(statusIntent);
|
||||
}
|
||||
Log.e(TAG, "setActionBar: " + status);
|
||||
Settings.Global.putInt(context.getContentResolver(), "PULLDOWN_MENU_ENABLED", status);
|
||||
// int oldNum = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, 0);
|
||||
// if (oldNum != status) {
|
||||
// boolean aole_hide_statusBar = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, status);
|
||||
// Log.e("SystemSetting", "aole_hide_statusBar:" + aole_hide_statusBar);
|
||||
// String statusbarStatus = "";
|
||||
// switch (status) {
|
||||
// case 0:
|
||||
// statusbarStatus = CommonConfig.AOLE_ACTION_SHOW_STATUS_BAR;
|
||||
// break;
|
||||
// case 1:
|
||||
// statusbarStatus = CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR;
|
||||
// break;
|
||||
// default:
|
||||
// }
|
||||
// Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
|
||||
// context.sendBroadcast(statusIntent);
|
||||
// }
|
||||
}
|
||||
|
||||
private static void setTF(Context context, int state) {
|
||||
try {
|
||||
//tfmedia开关
|
||||
// int setting_tfmedia = 1;
|
||||
boolean qch_tfmedia_forbid = Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", state);
|
||||
Log.e(TAG, "setting_tfmedia---------" + qch_tfmedia_forbid);
|
||||
String tfmediaStatus = "";
|
||||
switch (state) {
|
||||
case 1:
|
||||
tfmediaStatus = "qch_tfmedia_open";
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
tfmediaStatus = "qch_tfmedia_forbid";
|
||||
break;
|
||||
}
|
||||
Intent tfmediaIntent = new Intent(tfmediaStatus).setPackage("com.android.settings");
|
||||
context.sendBroadcast(tfmediaIntent);
|
||||
if (state == 1) {
|
||||
boolean qch_tfmedia_filetypes = Settings.System.putString(context.getContentResolver(), "qch_tfmedia_filetypes", "Empty");//影音管控
|
||||
Log.e(TAG, "qch_tfmedia_filetypes:" + qch_tfmedia_filetypes);
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", 0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setTF: " + e.getMessage());
|
||||
}
|
||||
Log.e(TAG, "setTF: " + state);
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, state == 1 ? 0 : 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,4 +211,35 @@ public class Utils {
|
||||
long totalBlocks = sf.getBlockCount();
|
||||
return Formatter.formatFileSize(context, blockSize * totalBlocks);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取系统保存的字段
|
||||
*
|
||||
* @param key
|
||||
* @param defaultValue
|
||||
* @return
|
||||
*/
|
||||
public static String getProperty(String key, String defaultValue) {
|
||||
String value = defaultValue;
|
||||
try {
|
||||
Class<?> c = Class.forName("android.os.SystemProperties");
|
||||
Method get = c.getMethod("get", String.class, String.class);
|
||||
value = (String) (get.invoke(c, key, defaultValue));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取自定义版本号 或者版本号
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getCustomVersion() {
|
||||
return getProperty("ro.build.display.id", "获取失败");
|
||||
// return Utils.getProperty("ro.custom.build.version", "获取失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.uiuipad.find.websocket;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import org.java_websocket.client.WebSocketClient;
|
||||
import org.java_websocket.drafts.Draft_6455;
|
||||
import org.java_websocket.handshake.ServerHandshake;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
public class JWebSocketClient extends WebSocketClient {
|
||||
public JWebSocketClient(URI serverUri) {
|
||||
super(serverUri, new Draft_6455());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpen(ServerHandshake handshakedata) {
|
||||
Log.i("JWebSocketClient", "onOpen()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(String message) {
|
||||
Log.i("JWebSocketClient", "onMessage()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose(int code, String reason, boolean remote) {
|
||||
Log.i("JWebSocketClient", "onClose():" + reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
Log.i("JWebSocketClient", "onError():" + ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
78
app/src/main/jni/aoleyun.cpp
Normal file
78
app/src/main/jni/aoleyun.cpp
Normal file
@@ -0,0 +1,78 @@
|
||||
#include <jni.h>
|
||||
#include <string>
|
||||
#include <sys/system_properties.h>
|
||||
// 日志打印
|
||||
#include <android/log.h>
|
||||
|
||||
#define LOG_TAG "TAG_LOG"
|
||||
#define LOGI(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_aoleyun_sn_utils_JGYUtils_getAuthorization(JNIEnv *env, jclass clazz) {
|
||||
// TODO: implement getAuthorization()
|
||||
std::string hello;
|
||||
|
||||
// 1. 获取 SDK 版本号 , 存储于 C 字符串 sdk_verison_str 中
|
||||
char sdk[128] = "0";
|
||||
|
||||
// 获取版本号方法
|
||||
__system_property_get("ro.build.version.sdk", sdk);
|
||||
//将版本号转为 int 值
|
||||
int sdk_verison = atoi(sdk);
|
||||
jclass cls = env->FindClass("com/uiuipad/find/BuildConfig");
|
||||
jfieldID jfieldId_text = env->GetStaticFieldID(cls, "FLAVOR", "Ljava/lang/String;");
|
||||
jstring text = (jstring) env->GetStaticObjectField(cls, jfieldId_text);
|
||||
const char *char_name = env->GetStringUTFChars(text, JNI_FALSE);
|
||||
std::string s = char_name;
|
||||
if (s.compare("newly") == 0) {
|
||||
LOGI("newly");
|
||||
hello = "Basic NzljNjRlZjQxYjg3MjhhZDZhYTI5YWY6YWJjNjQ3NzRiYjc2YzMyZDVkZTg0Yzk3==";
|
||||
} else if (s.compare("MTKnewly") == 0) {
|
||||
LOGI("MTKnewly");
|
||||
hello = "Basic NzljNjRlZjQxYjg3MjhhZDZhYTI5YWY6YWJjNjQ3NzRiYjc2YzMyZDVkZTg0Yzk3==";
|
||||
} else if (s.compare("beta") == 0) {
|
||||
LOGI("beta");
|
||||
hello = "Basic NTJkODE2NDM2NjViYjJjYWRhY2YwZTllOmI5N2RkZTYwNjdhY2ZhMjY5MDlhZjQ1Nw==";
|
||||
}
|
||||
// LOGI("%s", char_name);
|
||||
// LOGI("dasdasd");
|
||||
// LOGI("%s", hello.c_str());
|
||||
return env->NewStringUTF(hello.c_str());
|
||||
}
|
||||
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_aoleyun_sn_activity_main_MainAPresenter_getAeskey(JNIEnv *env, jobject thiz) {
|
||||
std::string key = "0123456789ABCDEF";
|
||||
return env->NewStringUTF(key.c_str());
|
||||
}
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_uiuipad_find_network_api_jxw_JxwUtils_getAppId(JNIEnv *env, jclass clazz) {
|
||||
std::string key = "qchapi";
|
||||
return env->NewStringUTF(key.c_str());
|
||||
}
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_uiuipad_find_network_api_jxw_JxwUtils_getAppSecret(JNIEnv *env, jclass clazz) {
|
||||
std::string key = "WDkn3LpnxSgQy3qUaum";
|
||||
return env->NewStringUTF(key.c_str());
|
||||
}
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_uiuipad_find_network_api_jxw_JxwUtils_getAppIsbn(JNIEnv *env, jclass clazz) {
|
||||
std::string key = "qchzdxt";
|
||||
return env->NewStringUTF(key.c_str());
|
||||
}
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_uiuipad_find_network_api_jxw_JxwUtils_getNonce(JNIEnv *env, jclass clazz) {
|
||||
std::string key = "X6SH3YeRTs";
|
||||
return env->NewStringUTF(key.c_str());
|
||||
}
|
||||
BIN
app/src/main/res/drawable-hdpi/icon_ota.png
Normal file
BIN
app/src/main/res/drawable-hdpi/icon_ota.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 839 B |
@@ -4,6 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorPrimary"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".activity.main.MainActivity">
|
||||
|
||||
@@ -36,38 +37,12 @@
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_back"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:text="@string/unknown"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/bt_update"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_update"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:background="@drawable/bt_default_selector"
|
||||
android:stateListAnimator="@null"
|
||||
android:text="检查更新"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
@@ -86,9 +61,9 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:layout_weight="2"
|
||||
android:background="@drawable/card_background">
|
||||
|
||||
@@ -141,10 +116,10 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:layout_weight="2"
|
||||
android:background="@drawable/card_background"
|
||||
android:visibility="visible">
|
||||
|
||||
@@ -200,13 +175,151 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_system_version1"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:text="固件"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_10"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_system_version2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:text="版本号"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_system_version1"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_system_version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/unknown"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="@dimen/sp_9"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/cl_ota"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_system_version2"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_ota"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:background="@drawable/bt_default_normnl"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:text="检查更新"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_app_version1"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:text="软件"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_10"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_app_version2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:text="版本号"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_app_version1"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/unknown"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="@dimen/sp_9"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/cl_app"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_app_version2"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_app"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:background="@drawable/bt_default_normnl"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:text="检查更新"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="@dimen/dp_8"
|
||||
android:layout_margin="@dimen/dp_16"
|
||||
android:layout_weight="4"
|
||||
android:background="@drawable/card_background">
|
||||
|
||||
@@ -265,9 +378,10 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:text="小酷平板手机助手"
|
||||
android:gravity="center"
|
||||
android:text="扫码登录\n小酷平板守护助手"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="@dimen/sp_10"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_appletqrcode"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_appletqrcode"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_appletqrcode" />
|
||||
@@ -300,8 +414,10 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:gravity="center"
|
||||
android:text="@string/login_bind"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="@dimen/sp_10"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_qrcode"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_qrcode"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_qrcode" />
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorPrimary"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".activity.main.MainActivity">
|
||||
|
||||
@@ -36,38 +37,12 @@
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_back"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:text="@string/unknown"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/bt_update"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_update"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:background="@drawable/bt_default_selector"
|
||||
android:stateListAnimator="@null"
|
||||
android:text="检查更新"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
@@ -86,9 +61,9 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:layout_weight="2"
|
||||
android:background="@drawable/card_background">
|
||||
|
||||
@@ -141,10 +116,10 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:layout_weight="2"
|
||||
android:background="@drawable/card_background"
|
||||
android:visibility="visible">
|
||||
|
||||
@@ -200,13 +175,151 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_system_version1"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:text="固件"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_10"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_system_version2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:text="版本号"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_system_version1"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_system_version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/unknown"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="@dimen/sp_9"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/cl_ota"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_system_version2"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_ota"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:background="@drawable/bt_default_normnl"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:text="检查更新"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_app_version1"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:text="软件"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_10"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_app_version2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:text="版本号"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_app_version1"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/unknown"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="@dimen/sp_9"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/cl_app"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_app_version2"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_app"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:background="@drawable/bt_default_normnl"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:text="检查更新"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="@dimen/dp_8"
|
||||
android:layout_margin="@dimen/dp_16"
|
||||
android:layout_weight="4"
|
||||
android:background="@drawable/card_background">
|
||||
|
||||
@@ -265,7 +378,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:text="小酷平板手机助手"
|
||||
android:gravity="center"
|
||||
android:text="扫码登录\n小酷平板守护助手"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_appletqrcode"
|
||||
@@ -300,6 +414,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:gravity="center"
|
||||
android:text="@string/login_bind"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_qrcode"
|
||||
|
||||
@@ -5,5 +5,6 @@
|
||||
<string name="default_nickname">小酷</string>
|
||||
|
||||
<string name="binding_time">绑定时间:%s</string>
|
||||
<string name="login_bind">请登录后扫码绑定\n管控平板</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -13,6 +13,8 @@ android {
|
||||
buildTypes {
|
||||
U807Debug {}
|
||||
U807Release {}
|
||||
iPlay50SEDebug {}
|
||||
iPlay50SERelease {}
|
||||
debug {}
|
||||
release {}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ android {
|
||||
buildTypes {
|
||||
U807Debug {}
|
||||
U807Release {}
|
||||
iPlay50SEDebug {}
|
||||
iPlay50SERelease {}
|
||||
debug {}
|
||||
release {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user