version:1.1
fix: add:应用使用数据统计
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.info.sn"
|
||||
package="com.uiui.sn"
|
||||
android:sharedUserId="android.uid.system">
|
||||
|
||||
<!-- 系统权限,有系统签名可以使用 -->
|
||||
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
|
||||
@@ -22,7 +23,7 @@
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!-- Required -->
|
||||
<permission
|
||||
android:name="com.info.sn.permission.JPUSH_MESSAGE"
|
||||
android:name="com.uiui.sn.permission.JPUSH_MESSAGE"
|
||||
android:protectionLevel="signature" /> <!-- Required 一些系统要求的权限,如访问网络等 -->
|
||||
<uses-permission android:name="${JPUSH_PKGNAME}.permission.JPUSH_MESSAGE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
|
||||
@@ -51,7 +52,7 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
||||
|
||||
<application
|
||||
android:name=".base.BaseApplication"
|
||||
android:name="com.uiui.sn.base.BaseApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
@@ -61,36 +62,36 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/ImmerseTheme">
|
||||
<activity
|
||||
android:name=".activity.PrivacyPolicyActivity"
|
||||
android:name="com.uiui.sn.activity.PrivacyPolicyActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.UserAgreementActivity"
|
||||
android:name="com.uiui.sn.activity.UserAgreementActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.SNUidActivity"
|
||||
android:name="com.uiui.sn.activity.SNUidActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/activity_styles" />
|
||||
<activity
|
||||
android:name=".activity.selectegrade.SelecteGradeActivity"
|
||||
android:name="com.uiui.sn.activity.selectegrade.SelecteGradeActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/activity_styles" />
|
||||
<activity
|
||||
android:name=".activity.GuideActivity"
|
||||
android:name="com.uiui.sn.activity.GuideActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/activity_styles" />
|
||||
|
||||
<service
|
||||
android:name=".service.RemoteService"
|
||||
android:name="com.uiui.sn.service.RemoteService"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:process=":remote" />
|
||||
|
||||
<activity
|
||||
android:name=".activity.main.MainActivity"
|
||||
android:name="com.uiui.sn.activity.main.MainActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="sensorLandscape">
|
||||
android:screenOrientation="portrait">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@@ -99,13 +100,13 @@
|
||||
</activity>
|
||||
|
||||
<service
|
||||
android:name=".service.MainService"
|
||||
android:name="com.uiui.sn.service.MainService"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
<service android:name=".service.GuardService" />
|
||||
<service android:name=".service.DownloadService" />
|
||||
<service android:name="com.uiui.sn.service.GuardService" />
|
||||
<service android:name="com.uiui.sn.service.DownloadService" />
|
||||
<service
|
||||
android:name=".service.StepService"
|
||||
android:name="com.uiui.sn.service.StepService"
|
||||
android:exported="true">
|
||||
<intent-filter android:priority="1000">
|
||||
<action android:name="android.intent.action.SCREEN_OFF" />
|
||||
@@ -119,7 +120,7 @@
|
||||
<data android:scheme="package" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
<service android:name=".service.ManagerService">
|
||||
<service android:name="com.uiui.sn.service.ManagerService">
|
||||
<intent-filter android:priority="1000">
|
||||
<action android:name="android.intent.action.USER_PRESENT" />
|
||||
<action android:name="android.intent.action.SCREEN_ON" />
|
||||
@@ -132,11 +133,11 @@
|
||||
</service>
|
||||
|
||||
<activity
|
||||
android:name=".activity.ScreenLockActivity"
|
||||
android:name="com.uiui.sn.activity.ScreenLockActivity"
|
||||
android:taskAffinity=".activity.ScreenLockActivity" />
|
||||
|
||||
<receiver
|
||||
android:name=".receiver.BootReceiver"
|
||||
android:name="com.uiui.sn.receiver.BootReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter android:priority="1000">
|
||||
@@ -155,7 +156,7 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".receiver.APKinstallReceiver"
|
||||
android:name="com.uiui.sn.receiver.APKinstallReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:permission="com.example.broadcast.permission">
|
||||
@@ -168,13 +169,13 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".receiver.InstallResultReceiver"
|
||||
android:name="com.uiui.sn.receiver.InstallResultReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="com.info.sn.fileprovider"
|
||||
android:authorities="com.uiui.sn.fileprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
@@ -196,7 +197,7 @@
|
||||
<action android:name="cn.jpush.android.ui.PushActivity" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="com.info.sn" />
|
||||
<category android:name="com.uiui.sn" />
|
||||
</intent-filter>
|
||||
</activity> <!-- Required SDK 核心功能 -->
|
||||
<!-- 可配置android:process参数将PushService放在其他进程中 -->
|
||||
@@ -213,7 +214,7 @@
|
||||
</service> <!-- since 3.0.9 Required SDK 核心功能 -->
|
||||
<provider
|
||||
android:name="cn.jpush.android.service.DataProvider"
|
||||
android:authorities="com.info.sn.DataProvider"
|
||||
android:authorities="com.uiui.sn.DataProvider"
|
||||
android:exported="false"
|
||||
android:process=":pushcore"
|
||||
tools:replace="android:authorities" /> <!-- since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 -->
|
||||
@@ -225,12 +226,12 @@
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.intent.DaemonService" />
|
||||
|
||||
<category android:name="com.info.sn" />
|
||||
<category android:name="com.uiui.sn" />
|
||||
</intent-filter>
|
||||
</service> <!-- since 3.1.0 Required SDK 核心功能 -->
|
||||
<provider
|
||||
android:name="cn.jpush.android.service.DownloadProvider"
|
||||
android:authorities="com.info.sn.DownloadProvider"
|
||||
android:authorities="com.uiui.sn.DownloadProvider"
|
||||
android:exported="true"
|
||||
tools:replace="android:authorities" /> <!-- Required SDK核心功能 -->
|
||||
<receiver
|
||||
@@ -239,7 +240,7 @@
|
||||
android:exported="false">
|
||||
<intent-filter android:priority="1000">
|
||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" /> <!-- Required 显示通知栏 -->
|
||||
<category android:name="com.info.sn" />
|
||||
<category android:name="com.uiui.sn" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.USER_PRESENT" />
|
||||
@@ -264,19 +265,19 @@
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.intent.JNotifyActivity" />
|
||||
|
||||
<category android:name="com.info.sn" />
|
||||
<category android:name="com.uiui.sn" />
|
||||
</intent-filter>
|
||||
</activity> <!-- Since JCore2.0.0 Required SDK核心功能 -->
|
||||
<!-- 这个Service要继承JCommonService -->
|
||||
<service
|
||||
android:name=".jpush.PushService"
|
||||
android:name="com.uiui.sn.jpush.PushService"
|
||||
android:process=":pushcore">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jiguang.user.service.action" />
|
||||
</intent-filter>
|
||||
</service> <!-- User defined. For test only 用户自定义的广播接收器 -->
|
||||
<receiver
|
||||
android:name=".receiver.MyJPushReceiver"
|
||||
android:name="com.uiui.sn.receiver.MyJPushReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
@@ -285,10 +286,10 @@
|
||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" /> <!-- Required 用户接收SDK通知栏信息的intent -->
|
||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" /> <!-- Required 用户打开自定义通知栏的intent -->
|
||||
<action android:name="cn.jpush.android.intent.CONNECTION" /> <!-- 接收网络变化 连接/断开 since 1.6.3 -->
|
||||
<category android:name="com.info.sn" />
|
||||
<category android:name="com.uiui.sn" />
|
||||
</intent-filter>
|
||||
</receiver> <!-- User defined. For test only 用户自定义接收消息器,3.0.7开始支持,目前新tag/alias接口设置结果会在该广播接收器对应的方法中回调 -->
|
||||
<receiver android:name=".jpush.MyJPushMessageReceiver">
|
||||
<receiver android:name="com.uiui.sn.jpush.MyJPushMessageReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// IGetInfoInterface.aidl
|
||||
package com.info.sn;
|
||||
package com.uiui.sn;
|
||||
|
||||
// Declare any non-default types here with import statements
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// KeepAliveConnection.aidl
|
||||
package com.info.sn;
|
||||
package com.uiui.sn;
|
||||
|
||||
// Declare any non-default types here with import statements
|
||||
|
||||
@@ -1,357 +0,0 @@
|
||||
package com.info.sn.activity.selectegrade;
|
||||
|
||||
import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.info.sn.activity.main.MainActivity;
|
||||
import com.info.sn.activity.main.MainPresenter;
|
||||
import com.info.sn.bean.gankao.AvailableProduct;
|
||||
import com.info.sn.bean.gankao.CreateUserBean;
|
||||
import com.info.sn.bean.gankao.GankaoBaseResponse;
|
||||
import com.info.sn.bean.gankao.PowerUser;
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.bean.zuoye.Response;
|
||||
import com.info.sn.bean.zuoye.UserInfo;
|
||||
import com.info.sn.config.Scheme;
|
||||
import com.info.sn.manager.NetInterfaceManager;
|
||||
import com.info.sn.utils.LaunchTools;
|
||||
import com.info.sn.utils.SPUtils;
|
||||
import com.info.sn.utils.ToastUtil;
|
||||
import com.info.sn.utils.Utils;
|
||||
import com.trello.rxlifecycle2.LifecycleProvider;
|
||||
import com.trello.rxlifecycle2.android.ActivityEvent;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class SelecteGradePresenter implements SelecteGradeContact.Presenter {
|
||||
private String TAG;
|
||||
|
||||
private SelecteGradeContact.MainView mView;
|
||||
private Context mContext;
|
||||
|
||||
SelecteGradePresenter(Context context) {
|
||||
this.mContext = context;
|
||||
TAG = context.getClass().getSimpleName() + "." + MainPresenter.class.getSimpleName() + ":";
|
||||
}
|
||||
|
||||
private LifecycleProvider<ActivityEvent> provider;
|
||||
|
||||
public void setProvider(LifecycleProvider<ActivityEvent> provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
public LifecycleProvider<ActivityEvent> getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachView(SelecteGradeContact.MainView view) {
|
||||
this.mView = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachView() {
|
||||
this.mView = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkSN() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getsnInfoControl()
|
||||
.compose(getProvider().bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<UserInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e(TAG + "checkSN", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<UserInfo> userInfoBaseResponse) {
|
||||
Log.e(TAG + "checkSN", "onNext: ");
|
||||
int code = userInfoBaseResponse.code;
|
||||
mView.checkSNResult(code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e(TAG + "checkSN", "onError: " + e.getMessage());
|
||||
mView.checkSNResult(404);
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e(TAG + TAG + "checkSN", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGankaoUID() {
|
||||
String appid = Scheme.partner_id;
|
||||
String timestamp = String.valueOf(System.currentTimeMillis());
|
||||
String uid = Utils.getSerial();
|
||||
Log.e(TAG + TAG, "getGankaoUID: uid: " + uid);
|
||||
if (TextUtils.isEmpty(uid) || "0".equals(uid)) {
|
||||
ToastUtil.show("设备未绑定账号,请绑定后重试");
|
||||
return;
|
||||
}
|
||||
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
params.put("appid", appid);
|
||||
params.put("timestamp", timestamp);
|
||||
params.put("uid", uid);
|
||||
String token = LaunchTools.getToken(params);
|
||||
NetInterfaceManager.getInstance()
|
||||
.getCreateUserControl()
|
||||
.createUser(appid, timestamp, uid, token)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.compose(getProvider().bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<GankaoBaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e(TAG + "getGankaoUID", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(GankaoBaseResponse gankaoBaseResponse) {
|
||||
Log.e(TAG + "getGankaoUID", "onNext: " + JSONObject.toJSONString(gankaoBaseResponse));
|
||||
if (gankaoBaseResponse.code == 10002) {
|
||||
Type type = new TypeToken<CreateUserBean>() {
|
||||
}.getType();
|
||||
Gson gson = new Gson();
|
||||
CreateUserBean userBean = gson.fromJson(gson.toJson(gankaoBaseResponse.data), type);
|
||||
String gankaoPartnerUID = userBean.getGankaoPartnerUID();
|
||||
int gankaoUIDint = userBean.getGankaoUID();
|
||||
String gankaoUID = String.valueOf(gankaoUIDint);
|
||||
Log.e(TAG + "getGankaoUID", "onNext: gankaoUID: " + gankaoUID);
|
||||
SPUtils.put(mContext, "gankaoUID", gankaoUID);
|
||||
Settings.System.putString(mContext.getContentResolver(), "gankaoUID", gankaoUID);
|
||||
int isNew = userBean.getIsNew();
|
||||
mView.setGankaoUID(gankaoUID);
|
||||
} else {
|
||||
mView.setGankaoUID("");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
mView.setGankaoUID("");
|
||||
Log.e(TAG + "getGankaoUID", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e(TAG + "getGankaoUID", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queryAvailableProduct() {
|
||||
String appid = Scheme.partner_id;
|
||||
String timestamp = String.valueOf(System.currentTimeMillis());
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
params.put("appid", appid);
|
||||
params.put("timestamp", timestamp);
|
||||
NetInterfaceManager.getInstance()
|
||||
.getQueryProductControl()
|
||||
.activeUser(appid, timestamp, LaunchTools.getToken(params))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.compose(getProvider().bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<GankaoBaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e(TAG + "queryAvailableProduct", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(GankaoBaseResponse gankaoBaseResponse) {
|
||||
Log.e(TAG + "queryAvailableProduct", "onNext: " + JSONObject.toJSONString(gankaoBaseResponse));
|
||||
if (gankaoBaseResponse.code == 10000) {
|
||||
Type type = new TypeToken<List<AvailableProduct>>() {
|
||||
}.getType();
|
||||
Gson gson = new Gson();
|
||||
List<AvailableProduct> availableProductList = gson.fromJson(gson.toJson(gankaoBaseResponse.data), type);
|
||||
mView.setAvailableProduct(availableProductList);
|
||||
} else {
|
||||
ToastUtil.show("获取激活套餐失败");
|
||||
mView.setAvailableProduct(new ArrayList());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e(TAG + "queryAvailableProduct", "onError: " + e.getMessage());
|
||||
mView.setAvailableProduct(new ArrayList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e(TAG + "queryAvailableProduct", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activeUser(AvailableProduct product, int grade) {
|
||||
String specification_id = product.getSpecification_id();
|
||||
Log.e(TAG, "activeUser: specification_id: " + specification_id);
|
||||
String appid = Scheme.partner_id;
|
||||
String timestamp = String.valueOf(System.currentTimeMillis());
|
||||
String uid = Utils.getSerial();
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
params.put("appid", appid);
|
||||
params.put("timestamp", timestamp);
|
||||
params.put("uid", uid);
|
||||
params.put("specification_id", String.valueOf(specification_id));
|
||||
|
||||
NetInterfaceManager.getInstance()
|
||||
.getActiveUserControl()
|
||||
.activeUser(appid, timestamp, LaunchTools.getToken(params), uid, specification_id)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.compose(getProvider().bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<GankaoBaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e(TAG + "activeUser", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(GankaoBaseResponse gankaoBaseResponse) {
|
||||
String jsonString = JSONObject.toJSONString(gankaoBaseResponse);
|
||||
Log.e(TAG + "activeUser", "onNext: " + jsonString);
|
||||
switch (gankaoBaseResponse.code) {
|
||||
//第一次激活
|
||||
case 10000:
|
||||
//已经授权过的
|
||||
case 50000:
|
||||
Settings.System.putInt(mContext.getContentResolver(), MainActivity.activation, 1);
|
||||
break;
|
||||
default:
|
||||
Settings.System.putInt(mContext.getContentResolver(), MainActivity.activation, 0);
|
||||
break;
|
||||
}
|
||||
mView.activeUserFinish(gankaoBaseResponse.code, grade);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e(TAG + "activeUser", "onError: ");
|
||||
mView.activeUserFinish(0, grade);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e(TAG + "activeUser", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queryPowerUserList(int grade) {
|
||||
String appid = Scheme.partner_id;
|
||||
String timestamp = String.valueOf(System.currentTimeMillis());
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
params.put("appid", appid);
|
||||
params.put("timestamp", timestamp);
|
||||
|
||||
NetInterfaceManager.getInstance()
|
||||
.getQueryPowerUserListControl()
|
||||
.queryPowerUserList(appid, timestamp, LaunchTools.getToken(params))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.compose(getProvider().bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<GankaoBaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("queryPowerUserList", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(GankaoBaseResponse gankaoBaseResponse) {
|
||||
Log.e("queryPowerUserList", "onNext: ");
|
||||
// Log.e("queryPowerUserList", "onNext: " + JSONObject.toJSONString(gankaoBaseResponse));
|
||||
int code = gankaoBaseResponse.code;
|
||||
if (code == 10000) {
|
||||
Gson gson = new Gson();
|
||||
Type type = new TypeToken<List<PowerUser>>() {
|
||||
}.getType();
|
||||
JsonObject jsonObject = JsonParser.parseString(gson.toJson(gankaoBaseResponse.data)).getAsJsonObject();
|
||||
JsonArray jsonArray = jsonObject.getAsJsonArray("powerlist");
|
||||
List<PowerUser> powerUserList = gson.fromJson(gson.toJson(jsonArray), type);
|
||||
mView.queryPowerUserListFinish(powerUserList, grade);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("queryPowerUserList", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("queryPowerUserList", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUid(String jsonString, int grade) {
|
||||
String gankaoUID = Settings.System.getString(mContext.getContentResolver(), "gankaoUID");
|
||||
if (TextUtils.isEmpty(gankaoUID)) {
|
||||
ToastUtil.show("获取设备UID失败,请重新激活");
|
||||
}
|
||||
Log.e(TAG, "sendUid: " + jsonString);
|
||||
NetInterfaceManager.getInstance()
|
||||
.getSaveSnUidApiControl()
|
||||
.saveSnUid(Utils.getSerial(), gankaoUID, grade, jsonString)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.compose(getProvider().bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<Response>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e(TAG + "sendUid", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Response response) {
|
||||
Log.e(TAG + "sendUid", "onNext: " + JSONObject.toJSONString(response));
|
||||
mView.sendUidFinish(response.code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e(TAG + "sendUid", "onError: " + e.getMessage());
|
||||
mView.sendUidFinish(404);
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e(TAG + "sendUid", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
package com.info.sn.network;
|
||||
|
||||
public class UrlAddress {
|
||||
//主页接口
|
||||
public static final String ROOT_URL = "http://homework.uiuios.com/android/";
|
||||
//获取班级ID
|
||||
public static final String GET_BATCH = ROOT_URL + "sn/getBatch";
|
||||
//设备信息接口
|
||||
public static final String SNINFO = ROOT_URL + "sn/getSnInfo";
|
||||
//发送app信息
|
||||
public static final String APPLOG = ROOT_URL + "App/getApplog";
|
||||
//获取正在运行的app
|
||||
public static final String RUN_NEW_APP = "app/runNewApp";
|
||||
//根据包名获取更新
|
||||
public final static String GET_APP_UPDATE = ROOT_URL + "Update/update";
|
||||
//获取当前最顶层应用和电量
|
||||
public final static String SEND_RUNINGAPPINFO = ROOT_URL + "Monitoring/getAppNow";
|
||||
//在线状态
|
||||
public final static String SEND_DRIVE_STATE = ROOT_URL + "Online/online";
|
||||
//获取所有应用
|
||||
public final static String GET_ALL_PACKAGE = ROOT_URL + "app/queryAllApp";
|
||||
//绑定设备消息
|
||||
public final static String BIND_DEVICES = ROOT_URL + "sn/bindSn";
|
||||
//获取系统设置
|
||||
public final static String GET_SETTINGS = ROOT_URL + "control/getSetting";
|
||||
//浏览器网址管控
|
||||
public final static String SET_BROWSER_URL = ROOT_URL + "control/getBrowser";
|
||||
//浏览器书签管控
|
||||
public final static String SET_BROWSER_LABEL = ROOT_URL + "control/getLabel";
|
||||
//获取强制下载
|
||||
public final static String GET_FORCE_INSTALL = ROOT_URL + "app/getForceDownload";
|
||||
//获取app管控
|
||||
public final static String GET_APP_START = ROOT_URL + "sn/querySnAppStart";
|
||||
//发app跳转管控
|
||||
public final static String GET_APP_JUMP = ROOT_URL + "sn/querySnJump";
|
||||
//发app跳转管控
|
||||
public final static String QUERY_APP_INSIDE = ROOT_URL + "control/queryAppInside";
|
||||
//发送卸载或者安装信息
|
||||
public final static String SEND_INSTALLEDORREMOVED = ROOT_URL + "app/addAppInstall";
|
||||
//发送卸载或者安装信息
|
||||
public final static String UPDATE_SNINFO = ROOT_URL + "sn/updateAdminSn";
|
||||
//根据包名获取更新
|
||||
public final static String GET_NEWESTAPPUPDATE = ROOT_URL + "app/newestAppUpdate";
|
||||
//上传屏幕截图
|
||||
public final static String UPLOAD_SCREEN_SNAPSHOT = ROOT_URL + "sn/uploadScreenshot";
|
||||
//获取屏幕管控
|
||||
public final static String GET_SCREEN_LOCK = ROOT_URL + "sn/getScreenshot";
|
||||
//获取时间管控
|
||||
public final static String GET_TIME_CONTROL = ROOT_URL + "sn/getTimeControl";
|
||||
//获取用户头像和信息
|
||||
public static final String GET_USER_AVATAR_INFO = "sn/getUserAvatarInfo";
|
||||
//上传设备赶考的UID
|
||||
public static final String POST_USER_SAVESNUID = "sn/saveSnUid";
|
||||
//获取激活时间和赶考UID
|
||||
public static final String GET_SN_UID = "sn/getSnUid";
|
||||
//获取app使用信息
|
||||
public static final String UPLOAD_APP_USE_INFO = "sn/uploadAppUseInfo";
|
||||
//获取小程序二维码
|
||||
public static final String GET_APPLET_QRCODE = "file/getAppletQrCode";
|
||||
//获取操作指南
|
||||
public static final String GET_OPERATION_GUIDE = "file/getFiles";
|
||||
|
||||
|
||||
//赶考
|
||||
public static final String GANKAN_ROOT_URL = "https://www.gankao.com/api/service/";
|
||||
//创建/查询用户
|
||||
public static final String CREATE_USER = "createUser";
|
||||
//用户授权/激活权限
|
||||
public static final String ACTIVE_USER = "activeUser";
|
||||
//获得可用的权限产品规格
|
||||
public static final String QUERY_AVAILABLE_PRODUCT_SPECIFICATIONS = "queryAvailableProductSpecifications";
|
||||
//获取机构的接口授权记录
|
||||
public static final String QUERY_POWER_USER_LIST = "queryPowerUserList";
|
||||
//获取用户已获得的产品列表(权限、单体课程、套餐等)
|
||||
public static final String GET_USER_PRODUCTS = "getUserProducts";
|
||||
//升级用户会员权限的学段
|
||||
public static final String UPGRADE_USER_POWER = "upgradeUserPower";
|
||||
//撤销指定的用户授权记录
|
||||
public static final String CANCEL_USER_POWER = "cancelUserPower";
|
||||
|
||||
|
||||
/*
|
||||
* 极光
|
||||
* */
|
||||
//删除alias
|
||||
public static final String DELETE_JPUSH_ALIAS = "https://device.jpush.cn/v3/aliases/";
|
||||
//删除tags
|
||||
public static final String DELETE_JPUSH_TAG = "https://device.jpush.cn/v3/tags/";
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.info.sn.network.api.gankao;
|
||||
|
||||
import com.info.sn.bean.gankao.GankaoBaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface ActiveUserApi {
|
||||
@GET(UrlAddress
|
||||
.ACTIVE_USER)
|
||||
Observable<GankaoBaseResponse> activeUser(
|
||||
@Query("app_id") String app_id,
|
||||
@Query("timestamp") String timestamp,
|
||||
@Query("token") String token,
|
||||
@Query("uid") String uid,
|
||||
@Query("specification_id") String specification_id
|
||||
);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.info.sn.network.api.gankao;
|
||||
|
||||
import com.info.sn.bean.gankao.GankaoBaseResponse;
|
||||
import com.info.sn.bean.gankao.CancelUserPower;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface CancelUserPowerApi {
|
||||
@GET(UrlAddress.CANCEL_USER_POWER)
|
||||
Observable<GankaoBaseResponse<CancelUserPower>> cancelUserPower(
|
||||
@Query("app_id") String app_id,
|
||||
@Query("timestamp") String timestamp,
|
||||
@Query("token") String token,
|
||||
@Query("user_power_id") String user_power_id,
|
||||
@Query("specification_id") String specification_id
|
||||
);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.info.sn.network.api.gankao;
|
||||
|
||||
import com.info.sn.bean.gankao.GankaoBaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface CreateUserApi {
|
||||
@GET(UrlAddress.CREATE_USER)
|
||||
Observable<GankaoBaseResponse> createUser(
|
||||
@Query("app_id") String app_id,
|
||||
@Query("timestamp") String timestamp,
|
||||
@Query("uid") String uid,
|
||||
@Query("token") String token
|
||||
);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.info.sn.network.api.gankao;
|
||||
|
||||
import com.info.sn.bean.gankao.GankaoBaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface QueryPowerUserListApi {
|
||||
@GET(UrlAddress.QUERY_POWER_USER_LIST)
|
||||
Observable<GankaoBaseResponse> queryPowerUserList(
|
||||
@Query("app_id") String app_id,
|
||||
@Query("timestamp") String timestamp,
|
||||
@Query("token") String token
|
||||
);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.info.sn.network.api.gankao;
|
||||
|
||||
import com.info.sn.bean.gankao.GankaoBaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface QueryProductApi {
|
||||
@GET(UrlAddress.QUERY_AVAILABLE_PRODUCT_SPECIFICATIONS)
|
||||
Observable<GankaoBaseResponse> activeUser(
|
||||
@Query("app_id") String app_id,
|
||||
@Query("timestamp") String timestamp,
|
||||
@Query("token") String token
|
||||
);
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.info.sn.network.api.gankao;
|
||||
|
||||
import com.info.sn.bean.gankao.GankaoBaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface UpgradeUserPowerApi {
|
||||
@GET(UrlAddress.UPGRADE_USER_POWER)
|
||||
Observable<GankaoBaseResponse> upgradeUserPower(
|
||||
@Query("app_id") String app_id,
|
||||
@Query("timestamp") String timestamp,
|
||||
@Query("token") String token,
|
||||
@Query("uid") String uid,
|
||||
@Query("user_power_id") String user_power_id
|
||||
);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.info.sn.network.api.gankao;
|
||||
|
||||
import com.info.sn.bean.gankao.GankaoBaseResponse;
|
||||
import com.info.sn.bean.gankao.UserProduct;
|
||||
import com.info.sn.bean.gankao.UserProductCards;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface UserProductsApi {
|
||||
@GET(UrlAddress.GET_USER_PRODUCTS)
|
||||
Observable<GankaoBaseResponse<UserProductCards<List<UserProduct>>>> getUserProducts(
|
||||
@Query("app_id") String app_id,
|
||||
@Query("timestamp") String timestamp,
|
||||
@Query("token") String token,
|
||||
@Query("uid") String uid
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.Statistics;
|
||||
package com.uiui.sn.Statistics;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.usage.UsageStats;
|
||||
@@ -9,8 +9,6 @@ import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.SystemClock;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
public class AppInformation {
|
||||
private UsageStats usageStats;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.Statistics;
|
||||
package com.uiui.sn.Statistics;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.usage.UsageEvents;
|
||||
@@ -8,7 +8,7 @@ import android.content.Context;
|
||||
import android.os.Build;
|
||||
|
||||
|
||||
import com.info.sn.utils.ApkUtils;
|
||||
import com.uiui.sn.utils.ApkUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
@@ -44,7 +44,7 @@ public class StatisticsInfo {
|
||||
}
|
||||
|
||||
List<String> packageList = new ArrayList<String>() {{
|
||||
this.add("com.info.sn");
|
||||
this.add("com.uiui.sn");
|
||||
this.add("com.android.launcher3");
|
||||
this.add("com.android.settings");
|
||||
this.add("com.appstore.uiui");
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.activity;
|
||||
package com.uiui.sn.activity;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@@ -10,10 +10,10 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.github.chrisbanes.photoview.PhotoView;
|
||||
import com.info.sn.R;
|
||||
import com.info.sn.base.BaseActivity;
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.manager.NetInterfaceManager;
|
||||
import com.uiui.sn.R;
|
||||
import com.uiui.sn.base.BaseActivity;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.manager.NetInterfaceManager;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
@@ -1,13 +1,12 @@
|
||||
package com.info.sn.activity;
|
||||
package com.uiui.sn.activity;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import com.info.sn.R;
|
||||
import com.info.sn.base.BaseActivity;
|
||||
import com.uiui.sn.R;
|
||||
import com.uiui.sn.base.BaseActivity;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.info.sn.activity;
|
||||
package com.uiui.sn.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
@@ -12,11 +11,11 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.info.sn.R;
|
||||
import com.info.sn.adapter.SNUidAdapter;
|
||||
import com.info.sn.base.BaseActivity;
|
||||
import com.info.sn.bean.zuoye.SNUidBean;
|
||||
import com.info.sn.utils.ToastUtil;
|
||||
import com.uiui.sn.R;
|
||||
import com.uiui.sn.adapter.SNUidAdapter;
|
||||
import com.uiui.sn.base.BaseActivity;
|
||||
import com.uiui.sn.bean.zuoye.SNUidBean;
|
||||
import com.uiui.sn.utils.ToastUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package com.info.sn.activity;
|
||||
package com.uiui.sn.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.info.sn.R;
|
||||
import com.uiui.sn.R;
|
||||
|
||||
|
||||
public class ScreenLockActivity extends AppCompatActivity {
|
||||
@@ -1,13 +1,12 @@
|
||||
package com.info.sn.activity;
|
||||
package com.uiui.sn.activity;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import com.info.sn.R;
|
||||
import com.info.sn.base.BaseActivity;
|
||||
import com.uiui.sn.R;
|
||||
import com.uiui.sn.base.BaseActivity;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.activity.main;
|
||||
package com.uiui.sn.activity.main;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
@@ -24,45 +24,48 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.blankj.utilcode.util.NetworkUtils;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.flyco.tablayout.SlidingTabLayout;
|
||||
import com.info.sn.BuildConfig;
|
||||
import com.info.sn.R;
|
||||
import com.info.sn.activity.GuideActivity;
|
||||
import com.info.sn.activity.PrivacyPolicyActivity;
|
||||
import com.info.sn.activity.SNUidActivity;
|
||||
import com.info.sn.activity.UserAgreementActivity;
|
||||
import com.info.sn.activity.selectegrade.SelecteGradeActivity;
|
||||
import com.info.sn.base.BaseActivity;
|
||||
import com.info.sn.bean.gankao.AvailableProduct;
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.bean.zuoye.UserInfo;
|
||||
import com.info.sn.config.Configs;
|
||||
import com.info.sn.config.Scheme;
|
||||
import com.info.sn.dialog.ActivationDialog;
|
||||
import com.info.sn.dialog.UserDebugDialog;
|
||||
import com.info.sn.fragment.AppletQRCodeFragment;
|
||||
import com.info.sn.fragment.BaseFragmentPagerAdapter;
|
||||
import com.info.sn.fragment.QRCodeFragment;
|
||||
import com.info.sn.jpush.ExampleUtil;
|
||||
import com.info.sn.jpush.LocalBroadcastManager;
|
||||
import com.info.sn.jpush.TagAliasOperatorHelper;
|
||||
import com.info.sn.network.HTTPInterface;
|
||||
import com.info.sn.receiver.BootReceiver;
|
||||
import com.info.sn.service.DownloadService;
|
||||
import com.info.sn.service.GuardService;
|
||||
import com.info.sn.service.MainService;
|
||||
import com.info.sn.service.ManagerService;
|
||||
import com.info.sn.service.StepService;
|
||||
import com.info.sn.manager.ControlManager;
|
||||
import com.info.sn.manager.DeviceManager;
|
||||
import com.info.sn.utils.JGYUtils;
|
||||
import com.info.sn.utils.LaunchTools;
|
||||
import com.info.sn.utils.SPUtils;
|
||||
import com.info.sn.utils.TimeUtils;
|
||||
import com.info.sn.utils.ToastUtil;
|
||||
import com.info.sn.utils.Utils;
|
||||
import com.uiui.sn.BuildConfig;
|
||||
import com.uiui.sn.R;
|
||||
import com.uiui.sn.activity.GuideActivity;
|
||||
import com.uiui.sn.activity.PrivacyPolicyActivity;
|
||||
import com.uiui.sn.activity.SNUidActivity;
|
||||
import com.uiui.sn.activity.UserAgreementActivity;
|
||||
import com.uiui.sn.activity.selectegrade.SelecteGradeActivity;
|
||||
import com.uiui.sn.base.BaseActivity;
|
||||
import com.uiui.sn.bean.gankao.AvailableProduct;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.bean.zuoye.UserInfo;
|
||||
import com.uiui.sn.config.Configs;
|
||||
import com.uiui.sn.config.Scheme;
|
||||
import com.uiui.sn.dialog.ActivationDialog;
|
||||
import com.uiui.sn.dialog.UserDebugDialog;
|
||||
import com.uiui.sn.fragment.AppletQRCodeFragment;
|
||||
import com.uiui.sn.fragment.BaseFragmentPagerAdapter;
|
||||
import com.uiui.sn.fragment.QRCodeFragment;
|
||||
import com.uiui.sn.jpush.ExampleUtil;
|
||||
import com.uiui.sn.jpush.LocalBroadcastManager;
|
||||
import com.uiui.sn.jpush.TagAliasOperatorHelper;
|
||||
import com.uiui.sn.manager.NetInterfaceManager;
|
||||
import com.uiui.sn.network.HTTPInterface;
|
||||
import com.uiui.sn.receiver.BootReceiver;
|
||||
import com.uiui.sn.service.DownloadService;
|
||||
import com.uiui.sn.service.GuardService;
|
||||
import com.uiui.sn.service.MainService;
|
||||
import com.uiui.sn.service.ManagerService;
|
||||
import com.uiui.sn.service.StepService;
|
||||
import com.uiui.sn.manager.ControlManager;
|
||||
import com.uiui.sn.manager.DeviceManager;
|
||||
import com.uiui.sn.utils.JGYUtils;
|
||||
import com.uiui.sn.utils.LaunchTools;
|
||||
import com.uiui.sn.utils.SPUtils;
|
||||
import com.uiui.sn.utils.TimeUtils;
|
||||
import com.uiui.sn.utils.ToastUtil;
|
||||
import com.uiui.sn.utils.Utils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -75,8 +78,10 @@ import java.util.Set;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
import static com.info.sn.jpush.TagAliasOperatorHelper.ACTION_SET;
|
||||
import static com.uiui.sn.jpush.TagAliasOperatorHelper.ACTION_SET;
|
||||
|
||||
public class MainActivity extends BaseActivity implements MainContact.MainView, NetworkUtils.OnNetworkStatusChangedListener {
|
||||
private final String TAG = MainActivity.class.getSimpleName();
|
||||
@@ -88,72 +93,22 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
private long timeMillis;
|
||||
public static boolean isForeground = false;
|
||||
|
||||
@BindView(R.id.cl_update)
|
||||
ConstraintLayout cl_update;
|
||||
|
||||
@BindView(R.id.cl_vip)
|
||||
ConstraintLayout cl_vip;
|
||||
|
||||
@BindView(R.id.tv_exit)
|
||||
TextView tv_exit;
|
||||
|
||||
@BindView(R.id.tv_title)
|
||||
TextView tv_title;
|
||||
|
||||
@BindView(R.id.qr_code)
|
||||
ImageView qr_code;
|
||||
|
||||
@BindView(R.id.iv_logo)
|
||||
ImageView iv_logo;
|
||||
|
||||
@BindView(R.id.tv_note)
|
||||
TextView tv_note;
|
||||
|
||||
@BindView(R.id.tv_devsn)
|
||||
TextView tv_devsn;
|
||||
|
||||
@BindView(R.id.tv_username)
|
||||
TextView tv_username;
|
||||
|
||||
@BindView(R.id.tv_school)
|
||||
TextView tv_school;
|
||||
|
||||
@BindView(R.id.tv_grade)
|
||||
TextView tv_grade;
|
||||
|
||||
@BindView(R.id.tv_vip)
|
||||
TextView tv_vip;
|
||||
|
||||
@BindView(R.id.tv_version)
|
||||
TextView tv_version;
|
||||
|
||||
@BindView(R.id.tv_customversion)
|
||||
TextView tv_customversion;
|
||||
|
||||
@BindView(R.id.bt_activation)
|
||||
TextView bt_activation;
|
||||
|
||||
@BindView(R.id.bt_repurchase)
|
||||
TextView bt_repurchase;
|
||||
|
||||
@BindView(R.id.tv_guide)
|
||||
TextView tv_guide;
|
||||
|
||||
@BindView(R.id.tv_pripolicy)
|
||||
TextView tv_pripolicy;
|
||||
|
||||
@BindView(R.id.tv_useragreement)
|
||||
TextView tv_useragreement;
|
||||
|
||||
@BindView(R.id.tv_activate)
|
||||
TextView tv_activate;
|
||||
|
||||
@BindView(R.id.viewPager)
|
||||
ViewPager viewPager;
|
||||
|
||||
@BindView(R.id.slidingtablayout)
|
||||
SlidingTabLayout slidingtablayout;
|
||||
|
||||
@BindView(R.id.tv_sn)
|
||||
TextView tv_sn;
|
||||
@BindView(R.id.tv_bind)
|
||||
TextView tv_bind;
|
||||
@BindView(R.id.tv_version)
|
||||
TextView tv_version;
|
||||
@BindView(R.id.qr_code)
|
||||
ImageView qr_code;
|
||||
@BindView(R.id.iv_appqrcode)
|
||||
ImageView iv_appqrcode;
|
||||
@BindView(R.id.iv_exit)
|
||||
ImageView iv_exit;
|
||||
|
||||
@@ -182,26 +137,25 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
|
||||
setOnClickListener();
|
||||
tv_devsn.setText(Utils.getSerial());
|
||||
tv_version.setText(BuildConfig.VERSION_NAME);
|
||||
String rom = JGYUtils.getCustomVersion();
|
||||
tv_customversion.setText(rom);
|
||||
|
||||
tv_sn.setText("SN:" + Utils.getSerial());
|
||||
tv_version.setText(BuildConfig.VERSION_NAME);
|
||||
initTabLayout();
|
||||
readOldData();
|
||||
TimeTask task = new TimeTask();
|
||||
task.execute("ntp.aliyun.com");
|
||||
|
||||
getQRCodeURL();
|
||||
//更新设备信息之后停止停止这两个应用以免获取不到信息
|
||||
int versionCode = (int) SPUtils.get(this, "versionCode", 0);
|
||||
if (versionCode < BuildConfig.VERSION_CODE) {
|
||||
JGYUtils.getInstance().killBackgroundProcesses(this, "com.jiaoguanyi.os");
|
||||
JGYUtils.getInstance().killBackgroundProcesses(this, "com.gankao.gkwxhd");
|
||||
// JGYUtils.getInstance().killBackgroundProcesses(this, "com.jiaoguanyi.os");
|
||||
// JGYUtils.getInstance().killBackgroundProcesses(this, "com.gankao.gkwxhd");
|
||||
SPUtils.put(this, "versionCode", BuildConfig.VERSION_CODE);
|
||||
}
|
||||
//启动应用市场
|
||||
Intent bootIntent = new Intent(BootReceiver.BOOT_COMPLETED);
|
||||
bootIntent.setComponent(new ComponentName("com.jgyapp.market", "com.jgyapp.market.receiver.BootReceiver"));
|
||||
bootIntent.setComponent(new ComponentName("com.uiui.appstore", "com.uiui.appstore.receiver.BootReceiver"));
|
||||
sendBroadcast(bootIntent);
|
||||
}
|
||||
|
||||
@@ -239,7 +193,7 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
registerReceiver();
|
||||
setJpush();
|
||||
HTTPInterface.sendAppUsed(this);
|
||||
HTTPInterface.sendRunningApp(this);
|
||||
// HTTPInterface.sendRunningApp(this);
|
||||
HTTPInterface.getAPPinfo(this);
|
||||
time0 = System.currentTimeMillis();
|
||||
timeMillis = System.currentTimeMillis();
|
||||
@@ -260,7 +214,6 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
setClickable();
|
||||
mPresenter.getUserInfo();
|
||||
mPresenter.getSnInfo();
|
||||
isForeground = true;
|
||||
@@ -289,6 +242,48 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
}
|
||||
}
|
||||
|
||||
private void getQRCodeURL() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getQRCodeApiControl()
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getQRCodeURL", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
Log.e("getQRCodeURL", "onNext: ");
|
||||
if (baseResponse.code == 200) {
|
||||
JSONObject jsonObject = (JSONObject) JSON.toJSON(baseResponse.data);
|
||||
String url = jsonObject.getString("file");
|
||||
if (!TextUtils.isEmpty(url)) {
|
||||
Glide.with(iv_appqrcode)
|
||||
.load(url)
|
||||
.dontAnimate()
|
||||
.placeholder(getDrawable(R.drawable.applet_qrcode))
|
||||
.into(iv_appqrcode);
|
||||
} else {
|
||||
iv_appqrcode.setImageDrawable(getDrawable(R.drawable.applet_qrcode));
|
||||
}
|
||||
} else {
|
||||
iv_appqrcode.setImageDrawable(getDrawable(R.drawable.applet_qrcode));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getQRCodeURL", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getQRCodeURL", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private boolean isDebugMode() {
|
||||
if (DeviceManager.isDebugMode()) {
|
||||
return true;
|
||||
@@ -341,17 +336,12 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
||||
}
|
||||
|
||||
|
||||
private void initTabLayout() {
|
||||
List<Fragment> fragmentList = new ArrayList<>();
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
fragmentList.add(new AppletQRCodeFragment());
|
||||
fragmentList.add(new QRCodeFragment());
|
||||
BaseFragmentPagerAdapter adapter = new BaseFragmentPagerAdapter(fragmentManager, fragmentList);
|
||||
viewPager.setAdapter(adapter);
|
||||
viewPager.setOffscreenPageLimit(3);
|
||||
String[] titles = new String[]{"第一步 ", " 第二步"};
|
||||
slidingtablayout.setViewPager(viewPager, titles);
|
||||
}
|
||||
|
||||
private void setJpush() {
|
||||
@@ -374,12 +364,6 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
}
|
||||
|
||||
private void readOldData() {
|
||||
String sn_name = (String) SPUtils.get(this, Configs.UserName, defaultText);
|
||||
tv_username.setText(sn_name);
|
||||
String school = (String) SPUtils.get(this, Configs.UserSchool, defaultText);
|
||||
tv_school.setText(school);
|
||||
String grade = (String) SPUtils.get(this, Configs.UserGrade, defaultText);
|
||||
tv_grade.setText(grade);
|
||||
int statu = (int) SPUtils.get(this, Configs.isLogined, 0);
|
||||
switch (statu) {
|
||||
default:
|
||||
@@ -397,19 +381,7 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
}
|
||||
|
||||
private void setOnClickListener() {
|
||||
setClickable();
|
||||
cl_update.setOnClickListener(view -> continuousClick(COUNTS, DURATION));
|
||||
cl_vip.setOnClickListener(view -> {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("json", SnUidJSON);
|
||||
intent.setClass(MainActivity.this, SNUidActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
bt_activation.setOnClickListener(view -> {
|
||||
startActivity(new Intent(MainActivity.this, SelecteGradeActivity.class));
|
||||
// showActivationDialog();
|
||||
});
|
||||
iv_exit.setOnClickListener(view -> finish());
|
||||
iv_exit.setOnClickListener(view -> lazyExit());
|
||||
tv_title.setOnClickListener(view -> {
|
||||
if (isDebugMode()) {
|
||||
enterUserDebug();
|
||||
@@ -417,15 +389,18 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
|
||||
}
|
||||
});
|
||||
tv_guide.setOnClickListener(view -> startActivity(new Intent(MainActivity.this, GuideActivity.class)));
|
||||
tv_pripolicy.setOnClickListener(v -> {
|
||||
startActivity(new Intent(MainActivity.this, PrivacyPolicyActivity.class));
|
||||
});
|
||||
tv_useragreement.setOnClickListener(v -> {
|
||||
startActivity(new Intent(MainActivity.this, UserAgreementActivity.class));
|
||||
});
|
||||
}
|
||||
|
||||
private long mPreClickTime;
|
||||
|
||||
private void lazyExit() {
|
||||
if (System.currentTimeMillis() - mPreClickTime > 3000) {
|
||||
ToastUtil.show("再按一次,退出");
|
||||
mPreClickTime = System.currentTimeMillis();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
private void showActivationDialog() {
|
||||
ActivationDialog dialog = new ActivationDialog(this);
|
||||
@@ -660,31 +635,6 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
|
||||
public static String activation = "gankao_activation";
|
||||
|
||||
private void setClickable() {
|
||||
int isEnabled = Settings.System.getInt(getContentResolver(), activation, 0);
|
||||
if (isEnabled == 0) {
|
||||
bt_activation.setVisibility(View.VISIBLE);
|
||||
bt_repurchase.setVisibility(View.GONE);
|
||||
tv_vip.setVisibility(View.GONE);
|
||||
bt_activation.setEnabled(true);
|
||||
bt_activation.setText("激活学习系统");
|
||||
} else {
|
||||
bt_activation.setVisibility(View.GONE);
|
||||
bt_repurchase.setVisibility(View.VISIBLE);
|
||||
tv_vip.setVisibility(View.VISIBLE);
|
||||
bt_activation.setEnabled(false);
|
||||
bt_activation.setText("已激活学习系统");
|
||||
}
|
||||
if (BuildConfig.DEBUG) {
|
||||
bt_activation.setVisibility(View.VISIBLE);
|
||||
bt_repurchase.setVisibility(View.GONE);
|
||||
tv_vip.setVisibility(View.VISIBLE);
|
||||
bt_activation.setEnabled(true);
|
||||
bt_activation.setText("激活学习系统");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void startService() {
|
||||
startService(new Intent(this, MainService.class));
|
||||
startService(new Intent(this, GuardService.class));
|
||||
@@ -721,7 +671,7 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
//for receive customer msg from jpush server
|
||||
private MessageReceiver mMessageReceiver = new MessageReceiver();
|
||||
|
||||
private String MESSAGE_RECEIVED_ACTION = "com.info.sn.MESSAGE_RECEIVED_ACTION";
|
||||
private String MESSAGE_RECEIVED_ACTION = "com.uiui.sn.MESSAGE_RECEIVED_ACTION";
|
||||
private String KEY_TITLE = "title";
|
||||
private String KEY_MESSAGE = "message";
|
||||
private String KEY_EXTRAS = "extras";
|
||||
@@ -760,6 +710,7 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
int code = response.code;
|
||||
//设备已经绑定
|
||||
if (code == 200) {
|
||||
tv_bind.setText(getString(R.string.bind_succeed));
|
||||
UserInfo userInfo = response.data;
|
||||
boolean username = Settings.System.putString(getContentResolver(), "UserInfo_username", userInfo.getSn_name());
|
||||
boolean gread = Settings.System.putString(getContentResolver(), "UserInfo_grade", userInfo.getGrade());
|
||||
@@ -768,27 +719,23 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
SPUtils.put(this, "sn_id", userInfo.getId());
|
||||
if (!TextUtils.isEmpty(userInfo.getSn_name())) {
|
||||
SPUtils.put(this, "USERINFO_NAME", userInfo.getSn_name());
|
||||
tv_username.setText(userInfo.getSn_name());
|
||||
}
|
||||
if (!TextUtils.isEmpty(userInfo.getSchool())) {
|
||||
SPUtils.put(this, "USERINFO_SCHOOL", userInfo.getSchool());
|
||||
tv_school.setText(userInfo.getSchool());
|
||||
}
|
||||
if (!TextUtils.isEmpty(userInfo.getGrade())) {
|
||||
SPUtils.put(this, "USERINFO_GRADE", userInfo.getGrade());
|
||||
tv_grade.setText(userInfo.getGrade());
|
||||
}
|
||||
mPresenter.getLocked();
|
||||
}
|
||||
//设备没有绑定
|
||||
else if (code == 300) {
|
||||
tv_username.setText(defaultText);
|
||||
tv_school.setText(defaultText);
|
||||
tv_grade.setText(defaultText);
|
||||
tv_bind.setText(getString(R.string.scan_tips));
|
||||
ControlManager.getInstance().setDisableSetting();
|
||||
}
|
||||
//没有授权的设备
|
||||
else if (code == 400) {
|
||||
tv_bind.setText("设备未经授权");
|
||||
ToastUtil.show("设备未经授权");
|
||||
Log.e(TAG, "setInfo: " + "设备未经授权");
|
||||
ControlManager.getInstance().setDisableSetting();
|
||||
@@ -820,7 +767,6 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
} else {
|
||||
mPresenter.registerGankao();
|
||||
}
|
||||
setClickable();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -907,6 +853,4 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
public void setScreenLock() {
|
||||
Log.e(TAG, "SettingFinished: " + (System.currentTimeMillis() - timeMillis) + " ms");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.info.sn.activity.main;
|
||||
package com.uiui.sn.activity.main;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.bean.zuoye.UserInfo;
|
||||
import com.info.sn.bean.gankao.AvailableProduct;
|
||||
import com.info.sn.mvp.BasePresenter;
|
||||
import com.info.sn.mvp.BaseView;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.bean.zuoye.UserInfo;
|
||||
import com.uiui.sn.bean.gankao.AvailableProduct;
|
||||
import com.uiui.sn.mvp.BasePresenter;
|
||||
import com.uiui.sn.mvp.BaseView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.activity.main;
|
||||
package com.uiui.sn.activity.main;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
@@ -19,36 +19,35 @@ import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.info.sn.bean.gankao.AvailableProduct;
|
||||
import com.info.sn.bean.gankao.CreateUserBean;
|
||||
import com.info.sn.bean.gankao.GankaoBaseResponse;
|
||||
import com.info.sn.bean.gankao.PowerUser;
|
||||
import com.info.sn.bean.zuoye.AppInfo;
|
||||
import com.info.sn.bean.zuoye.AppStart;
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.bean.zuoye.Label;
|
||||
import com.info.sn.bean.zuoye.browser.BrowserApiData;
|
||||
import com.info.sn.bean.zuoye.browser.BrowserBean;
|
||||
import com.info.sn.bean.zuoye.UserAvatarInfo;
|
||||
import com.info.sn.bean.zuoye.UserInfo;
|
||||
import com.info.sn.config.Configs;
|
||||
import com.info.sn.config.Scheme;
|
||||
import com.info.sn.manager.AmapManager;
|
||||
import com.info.sn.manager.ControlManager;
|
||||
import com.info.sn.manager.NetInterfaceManager;
|
||||
import com.info.sn.network.HTTPInterface;
|
||||
import com.info.sn.network.api.BrowserLabel;
|
||||
import com.info.sn.service.ManagerService;
|
||||
import com.info.sn.utils.ApkUtils;
|
||||
import com.info.sn.utils.CXAESUtil;
|
||||
import com.info.sn.utils.JGYUtils;
|
||||
import com.info.sn.utils.LaunchTools;
|
||||
import com.info.sn.utils.SPUtils;
|
||||
import com.info.sn.utils.ServiceAliveUtils;
|
||||
import com.info.sn.utils.TimeUtils;
|
||||
import com.info.sn.utils.ToastUtil;
|
||||
import com.info.sn.utils.URLUtils;
|
||||
import com.info.sn.utils.Utils;
|
||||
import com.uiui.sn.bean.gankao.AvailableProduct;
|
||||
import com.uiui.sn.bean.gankao.CreateUserBean;
|
||||
import com.uiui.sn.bean.gankao.GankaoBaseResponse;
|
||||
import com.uiui.sn.bean.gankao.PowerUser;
|
||||
import com.uiui.sn.bean.zuoye.AppInfo;
|
||||
import com.uiui.sn.bean.zuoye.AppStart;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.bean.zuoye.Label;
|
||||
import com.uiui.sn.bean.zuoye.browser.BrowserApiData;
|
||||
import com.uiui.sn.bean.zuoye.browser.BrowserBean;
|
||||
import com.uiui.sn.bean.zuoye.UserAvatarInfo;
|
||||
import com.uiui.sn.bean.zuoye.UserInfo;
|
||||
import com.uiui.sn.config.Configs;
|
||||
import com.uiui.sn.config.Scheme;
|
||||
import com.uiui.sn.manager.AmapManager;
|
||||
import com.uiui.sn.manager.ControlManager;
|
||||
import com.uiui.sn.manager.NetInterfaceManager;
|
||||
import com.uiui.sn.network.HTTPInterface;
|
||||
import com.uiui.sn.service.ManagerService;
|
||||
import com.uiui.sn.utils.ApkUtils;
|
||||
import com.uiui.sn.utils.CXAESUtil;
|
||||
import com.uiui.sn.utils.JGYUtils;
|
||||
import com.uiui.sn.utils.LaunchTools;
|
||||
import com.uiui.sn.utils.SPUtils;
|
||||
import com.uiui.sn.utils.ServiceAliveUtils;
|
||||
import com.uiui.sn.utils.TimeUtils;
|
||||
import com.uiui.sn.utils.ToastUtil;
|
||||
import com.uiui.sn.utils.URLUtils;
|
||||
import com.uiui.sn.utils.Utils;
|
||||
import com.trello.rxlifecycle2.LifecycleProvider;
|
||||
import com.trello.rxlifecycle2.android.ActivityEvent;
|
||||
|
||||
@@ -66,6 +65,8 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import static com.uiui.sn.service.ManagerService.LOCK_STATE;
|
||||
|
||||
/**
|
||||
* @author jgy02
|
||||
*/
|
||||
@@ -103,60 +104,6 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void queryPowerUserList() {
|
||||
String appid = Scheme.partner_id;
|
||||
String timestamp = String.valueOf(System.currentTimeMillis());
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
params.put("appid", appid);
|
||||
params.put("timestamp", timestamp);
|
||||
|
||||
NetInterfaceManager.getInstance()
|
||||
.getQueryPowerUserListControl()
|
||||
.queryPowerUserList(appid, timestamp, LaunchTools.getToken(params))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.compose(getProvider().bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<GankaoBaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("queryPowerUserList", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(GankaoBaseResponse gankaoBaseResponse) {
|
||||
Log.e("queryPowerUserList", "onNext: " + JSONObject.toJSONString(gankaoBaseResponse));
|
||||
int code = gankaoBaseResponse.code;
|
||||
if (code == 10000) {
|
||||
Gson gson = new Gson();
|
||||
Type type = new TypeToken<List<PowerUser>>() {
|
||||
}.getType();
|
||||
JsonObject jsonObject = JsonParser.parseString(gson.toJson(gankaoBaseResponse.data)).getAsJsonObject();
|
||||
JsonArray jsonArray = jsonObject.getAsJsonArray("powerlist");
|
||||
List<PowerUser> powerUserList = gson.fromJson(gson.toJson(jsonArray), type);
|
||||
HashMap<String, PowerUser> hashMap = new HashMap<>();
|
||||
for (PowerUser powerUser : powerUserList) {
|
||||
hashMap.put(powerUser.getUserID(), powerUser);
|
||||
}
|
||||
PowerUser powerUser = hashMap.get(Utils.getSerial());
|
||||
if (powerUser != null) {
|
||||
String date = powerUser.getAuthorizationDate();
|
||||
mView.setPowerUserList(date);
|
||||
} else {
|
||||
mView.setPowerUserList("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("queryPowerUserList", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("queryPowerUserList", "onComplete: ");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -198,167 +145,18 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
*/
|
||||
@Override
|
||||
public void getGankaoUID() {
|
||||
String appid = Scheme.partner_id;
|
||||
String timestamp = String.valueOf(System.currentTimeMillis());
|
||||
String uid = Utils.getSerial();
|
||||
Log.e(TAG + TAG, "getGankaoUID: uid: " + uid);
|
||||
if (TextUtils.isEmpty(uid) || "0".equals(uid)) {
|
||||
ToastUtil.show("设备未绑定账号,请绑定后重试");
|
||||
return;
|
||||
}
|
||||
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
params.put("appid", appid);
|
||||
params.put("timestamp", timestamp);
|
||||
params.put("uid", uid);
|
||||
String token = LaunchTools.getToken(params);
|
||||
NetInterfaceManager.getInstance()
|
||||
.getCreateUserControl()
|
||||
.createUser(appid, timestamp, uid, token)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.compose(getProvider().bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<GankaoBaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e(TAG + "getGankaoUID", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(GankaoBaseResponse gankaoBaseResponse) {
|
||||
Log.e(TAG + "getGankaoUID", "onNext: " + JSONObject.toJSONString(gankaoBaseResponse));
|
||||
if (gankaoBaseResponse.code == 10002) {
|
||||
Type type = new TypeToken<CreateUserBean>() {
|
||||
}.getType();
|
||||
Gson gson = new Gson();
|
||||
CreateUserBean userBean = gson.fromJson(gson.toJson(gankaoBaseResponse.data), type);
|
||||
String gankaoPartnerUID = userBean.getGankaoPartnerUID();
|
||||
int gankaoUIDint = userBean.getGankaoUID();
|
||||
String gankaoUID = String.valueOf(gankaoUIDint);
|
||||
Log.e(TAG + "getGankaoUID", "onNext: gankaoUID: " + gankaoUID);
|
||||
SPUtils.put(mContext, "gankaoUID", gankaoUID);
|
||||
Settings.System.putString(mContext.getContentResolver(), "gankaoUID", gankaoUID);
|
||||
int isNew = userBean.getIsNew();
|
||||
mView.setGankaoUID(gankaoUID);
|
||||
} else {
|
||||
mView.setGankaoUID("");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
mView.setGankaoUID("");
|
||||
Log.e(TAG + "getGankaoUID", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e(TAG + "getGankaoUID", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void queryAvailableProduct(String gankaoUID) {
|
||||
String appid = Scheme.partner_id;
|
||||
String timestamp = String.valueOf(System.currentTimeMillis());
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
params.put("appid", appid);
|
||||
params.put("timestamp", timestamp);
|
||||
NetInterfaceManager.getInstance()
|
||||
.getQueryProductControl()
|
||||
.activeUser(appid, timestamp, LaunchTools.getToken(params))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.compose(getProvider().bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<GankaoBaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e(TAG + "queryAvailableProduct", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(GankaoBaseResponse gankaoBaseResponse) {
|
||||
Log.e(TAG + "queryAvailableProduct", "onNext: " + JSONObject.toJSONString(gankaoBaseResponse));
|
||||
if (gankaoBaseResponse.code == 10000) {
|
||||
Type type = new TypeToken<List<AvailableProduct>>() {
|
||||
}.getType();
|
||||
Gson gson = new Gson();
|
||||
List<AvailableProduct> availableProductList = gson.fromJson(gson.toJson(gankaoBaseResponse.data), type);
|
||||
mView.setAvailableProduct(availableProductList, gankaoUID);
|
||||
} else {
|
||||
ToastUtil.show("获取激活套餐失败");
|
||||
mView.setAvailableProduct(new ArrayList(), gankaoUID);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e(TAG + "queryAvailableProduct", "onError: " + e.getMessage());
|
||||
mView.setAvailableProduct(new ArrayList(), gankaoUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e(TAG + "queryAvailableProduct", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activeUser(@NotNull AvailableProduct product, String gankaoUID) {
|
||||
String specification_id = product.getSpecification_id();
|
||||
Log.e(TAG, "activeUser: specification_id: " + specification_id);
|
||||
String appid = Scheme.partner_id;
|
||||
String timestamp = String.valueOf(System.currentTimeMillis());
|
||||
String uid = Utils.getSerial();
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
params.put("appid", appid);
|
||||
params.put("timestamp", timestamp);
|
||||
params.put("uid", uid);
|
||||
params.put("specification_id", String.valueOf(specification_id));
|
||||
|
||||
NetInterfaceManager.getInstance()
|
||||
.getActiveUserControl()
|
||||
.activeUser(appid, timestamp, LaunchTools.getToken(params), uid, specification_id)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.compose(getProvider().bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<GankaoBaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e(TAG + "activeUser", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(GankaoBaseResponse gankaoBaseResponse) {
|
||||
Log.e(TAG + "activeUser", "onNext: " + JSONObject.toJSONString(gankaoBaseResponse));
|
||||
switch (gankaoBaseResponse.code) {
|
||||
case 10000:
|
||||
case 50000:
|
||||
Settings.System.putInt(mContext.getContentResolver(), MainActivity.activation, 1);
|
||||
// sendUid(product, gankaoUID);
|
||||
break;
|
||||
default:
|
||||
Settings.System.putInt(mContext.getContentResolver(), MainActivity.activation, 0);
|
||||
break;
|
||||
|
||||
}
|
||||
mView.activeUserFinish(gankaoBaseResponse.code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e(TAG + "activeUser", "onError: ");
|
||||
mView.activeUserFinish(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e(TAG + "activeUser", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -519,59 +317,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void registerGankao() {
|
||||
String appid = Scheme.partner_id;
|
||||
String timestamp = String.valueOf(System.currentTimeMillis());
|
||||
String uid = Utils.getSerial();
|
||||
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
params.put("appid", appid);
|
||||
params.put("timestamp", timestamp);
|
||||
params.put("uid", uid);
|
||||
|
||||
NetInterfaceManager.getInstance()
|
||||
.getCreateUserControl()
|
||||
.createUser(appid, timestamp, uid, LaunchTools.getToken(params))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.compose(getProvider().bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<GankaoBaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e(TAG + "getGankaoUID", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(GankaoBaseResponse gankaoBaseResponse) {
|
||||
Log.e(TAG + "getGankaoUID", "onNext: " + JSONObject.toJSONString(gankaoBaseResponse));
|
||||
if (gankaoBaseResponse.code == 10002) {
|
||||
Type type = new TypeToken<CreateUserBean>() {
|
||||
}.getType();
|
||||
Gson gson = new Gson();
|
||||
CreateUserBean userBean = gson.fromJson(gson.toJson(gankaoBaseResponse.data), type);
|
||||
String gankaoPartnerUID = userBean.getGankaoPartnerUID();
|
||||
int gankaoUIDint = userBean.getGankaoUID();
|
||||
String gankaoUID = String.valueOf(gankaoUIDint);
|
||||
Log.e(TAG + "getGankaoUID", "onNext: gankaoUID: " + gankaoUID);
|
||||
SPUtils.put(mContext, "gankaoUID", gankaoUID);
|
||||
Settings.System.putString(mContext.getContentResolver(), "gankaoUID", gankaoUID);
|
||||
int isNew = userBean.getIsNew();
|
||||
mView.setGankao(gankaoUID);
|
||||
} else {
|
||||
mView.setGankao("");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
mView.setGankao("");
|
||||
Log.e(TAG + "getGankaoUID", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e(TAG + "getGankaoUID", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -745,7 +491,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<List<AppInfo>> listBaseResponse) {
|
||||
Log.e(TAG + "getForceInstall", "onNext: ");
|
||||
Log.e(TAG + "getForceInstall", "onNext: " + listBaseResponse);
|
||||
int code = listBaseResponse.code;
|
||||
if (code == 200) {
|
||||
List<AppInfo> appInfos = listBaseResponse.data;
|
||||
@@ -1065,6 +811,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
if (!ServiceAliveUtils.isServiceAlice(mContext, ManagerService.class.getName())) {
|
||||
mContext.startService(new Intent(mContext, ManagerService.class));
|
||||
}
|
||||
SPUtils.put(mContext, LOCK_STATE, is_screen_lock);
|
||||
Intent intent = new Intent();
|
||||
// intent.putExtra("name", name);
|
||||
if (1 == is_screen_lock) {
|
||||
@@ -1,10 +1,6 @@
|
||||
package com.info.sn.activity.selectegrade;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
package com.uiui.sn.activity.selectegrade;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
@@ -13,18 +9,15 @@ import android.widget.RadioGroup;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.info.sn.R;
|
||||
import com.info.sn.activity.main.MainActivity;
|
||||
import com.info.sn.base.BaseActivity;
|
||||
import com.info.sn.bean.gankao.AvailableProduct;
|
||||
import com.info.sn.bean.gankao.PowerUser;
|
||||
import com.info.sn.config.Scheme;
|
||||
import com.info.sn.utils.LaunchTools;
|
||||
import com.info.sn.utils.SPUtils;
|
||||
import com.info.sn.utils.ToastUtil;
|
||||
import com.info.sn.utils.Utils;
|
||||
import com.uiui.sn.R;
|
||||
import com.uiui.sn.base.BaseActivity;
|
||||
import com.uiui.sn.bean.gankao.AvailableProduct;
|
||||
import com.uiui.sn.bean.gankao.PowerUser;
|
||||
import com.uiui.sn.config.Scheme;
|
||||
import com.uiui.sn.utils.LaunchTools;
|
||||
import com.uiui.sn.utils.SPUtils;
|
||||
import com.uiui.sn.utils.ToastUtil;
|
||||
import com.uiui.sn.utils.Utils;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.info.sn.activity.selectegrade;
|
||||
package com.uiui.sn.activity.selectegrade;
|
||||
|
||||
import com.info.sn.activity.main.MainContact;
|
||||
import com.info.sn.bean.gankao.AvailableProduct;
|
||||
import com.info.sn.bean.gankao.PowerUser;
|
||||
import com.info.sn.mvp.BasePresenter;
|
||||
import com.info.sn.mvp.BaseView;
|
||||
import com.uiui.sn.bean.gankao.AvailableProduct;
|
||||
import com.uiui.sn.bean.gankao.PowerUser;
|
||||
import com.uiui.sn.mvp.BasePresenter;
|
||||
import com.uiui.sn.mvp.BaseView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.uiui.sn.activity.selectegrade;
|
||||
|
||||
import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.uiui.sn.activity.main.MainActivity;
|
||||
import com.uiui.sn.activity.main.MainPresenter;
|
||||
import com.uiui.sn.bean.gankao.AvailableProduct;
|
||||
import com.uiui.sn.bean.gankao.CreateUserBean;
|
||||
import com.uiui.sn.bean.gankao.GankaoBaseResponse;
|
||||
import com.uiui.sn.bean.gankao.PowerUser;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.bean.zuoye.Response;
|
||||
import com.uiui.sn.bean.zuoye.UserInfo;
|
||||
import com.uiui.sn.config.Scheme;
|
||||
import com.uiui.sn.manager.NetInterfaceManager;
|
||||
import com.uiui.sn.utils.LaunchTools;
|
||||
import com.uiui.sn.utils.SPUtils;
|
||||
import com.uiui.sn.utils.ToastUtil;
|
||||
import com.uiui.sn.utils.Utils;
|
||||
import com.trello.rxlifecycle2.LifecycleProvider;
|
||||
import com.trello.rxlifecycle2.android.ActivityEvent;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class SelecteGradePresenter implements SelecteGradeContact.Presenter {
|
||||
private String TAG;
|
||||
|
||||
private SelecteGradeContact.MainView mView;
|
||||
private Context mContext;
|
||||
|
||||
SelecteGradePresenter(Context context) {
|
||||
this.mContext = context;
|
||||
TAG = context.getClass().getSimpleName() + "." + MainPresenter.class.getSimpleName() + ":";
|
||||
}
|
||||
|
||||
private LifecycleProvider<ActivityEvent> provider;
|
||||
|
||||
public void setProvider(LifecycleProvider<ActivityEvent> provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
public LifecycleProvider<ActivityEvent> getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachView(SelecteGradeContact.MainView view) {
|
||||
this.mView = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachView() {
|
||||
this.mView = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkSN() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getsnInfoControl()
|
||||
.compose(getProvider().bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<UserInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e(TAG + "checkSN", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<UserInfo> userInfoBaseResponse) {
|
||||
Log.e(TAG + "checkSN", "onNext: ");
|
||||
int code = userInfoBaseResponse.code;
|
||||
mView.checkSNResult(code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e(TAG + "checkSN", "onError: " + e.getMessage());
|
||||
mView.checkSNResult(404);
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e(TAG + TAG + "checkSN", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGankaoUID() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queryAvailableProduct() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activeUser(AvailableProduct product, int grade) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queryPowerUserList(int grade) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUid(String jsonString, int grade) {
|
||||
String gankaoUID = Settings.System.getString(mContext.getContentResolver(), "gankaoUID");
|
||||
if (TextUtils.isEmpty(gankaoUID)) {
|
||||
ToastUtil.show("获取设备UID失败,请重新激活");
|
||||
}
|
||||
Log.e(TAG, "sendUid: " + jsonString);
|
||||
NetInterfaceManager.getInstance()
|
||||
.getSaveSnUidApiControl()
|
||||
.saveSnUid(Utils.getSerial(), gankaoUID, grade, jsonString)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.compose(getProvider().bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<Response>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e(TAG + "sendUid", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Response response) {
|
||||
Log.e(TAG + "sendUid", "onNext: " + JSONObject.toJSONString(response));
|
||||
mView.sendUidFinish(response.code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e(TAG + "sendUid", "onError: " + e.getMessage());
|
||||
mView.sendUidFinish(404);
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e(TAG + "sendUid", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.adapter;
|
||||
package com.uiui.sn.adapter;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -8,8 +8,8 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.info.sn.R;
|
||||
import com.info.sn.bean.zuoye.SNUidBean;
|
||||
import com.uiui.sn.R;
|
||||
import com.uiui.sn.bean.zuoye.SNUidBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package com.info.sn.base;
|
||||
package com.uiui.sn.base;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.info.sn.BuildConfig;
|
||||
import com.info.sn.R;
|
||||
import com.info.sn.utils.StatusBarUtil;
|
||||
import com.uiui.sn.BuildConfig;
|
||||
import com.uiui.sn.R;
|
||||
import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;
|
||||
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;
|
||||
|
||||
@@ -1,27 +1,24 @@
|
||||
package com.info.sn.base;
|
||||
package com.uiui.sn.base;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Process;
|
||||
import android.util.Log;
|
||||
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.blankj.utilcode.util.ProcessUtils;
|
||||
import com.info.sn.BuildConfig;
|
||||
import com.info.sn.jpush.TagAliasOperatorHelper;
|
||||
import com.info.sn.manager.AmapManager;
|
||||
import com.info.sn.manager.NetInterfaceManager;
|
||||
import com.info.sn.manager.ControlManager;
|
||||
import com.info.sn.manager.DeviceManager;
|
||||
import com.info.sn.network.HTTPInterface;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.info.sn.utils.JGYUtils;
|
||||
import com.info.sn.utils.SystemUtils;
|
||||
import com.info.sn.utils.ToastUtil;
|
||||
import com.info.sn.utils.Utils;
|
||||
import com.uiui.sn.BuildConfig;
|
||||
import com.uiui.sn.jpush.TagAliasOperatorHelper;
|
||||
import com.uiui.sn.manager.AmapManager;
|
||||
import com.uiui.sn.manager.NetInterfaceManager;
|
||||
import com.uiui.sn.manager.ControlManager;
|
||||
import com.uiui.sn.manager.DeviceManager;
|
||||
import com.uiui.sn.network.HTTPInterface;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
import com.uiui.sn.utils.JGYUtils;
|
||||
import com.uiui.sn.utils.ToastUtil;
|
||||
import com.uiui.sn.utils.Utils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.info.sn.base;
|
||||
package com.uiui.sn.base;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.TargetApi;
|
||||
@@ -17,7 +17,7 @@ import android.provider.Settings;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
|
||||
import com.info.sn.R;
|
||||
import com.uiui.sn.R;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.gankao;
|
||||
package com.uiui.sn.bean.gankao;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.gankao;
|
||||
package com.uiui.sn.bean.gankao;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.gankao;
|
||||
package com.uiui.sn.bean.gankao;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.gankao;
|
||||
package com.uiui.sn.bean.gankao;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.gankao;
|
||||
package com.uiui.sn.bean.gankao;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.gankao;
|
||||
package com.uiui.sn.bean.gankao;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.gankao;
|
||||
package com.uiui.sn.bean.gankao;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.gankao;
|
||||
package com.uiui.sn.bean.gankao;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.zuoye;
|
||||
package com.uiui.sn.bean.zuoye;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.zuoye;
|
||||
package com.uiui.sn.bean.zuoye;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.zuoye;
|
||||
package com.uiui.sn.bean.zuoye;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.zuoye;
|
||||
package com.uiui.sn.bean.zuoye;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.zuoye;
|
||||
package com.uiui.sn.bean.zuoye;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.info.sn.bean.zuoye;
|
||||
package com.uiui.sn.bean.zuoye;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.zuoye;
|
||||
package com.uiui.sn.bean.zuoye;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.zuoye;
|
||||
package com.uiui.sn.bean.zuoye;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.zuoye;
|
||||
package com.uiui.sn.bean.zuoye;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.zuoye;
|
||||
package com.uiui.sn.bean.zuoye;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.zuoye;
|
||||
package com.uiui.sn.bean.zuoye;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.zuoye;
|
||||
package com.uiui.sn.bean.zuoye;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.zuoye;
|
||||
package com.uiui.sn.bean.zuoye;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.zuoye.browser;
|
||||
package com.uiui.sn.bean.zuoye.browser;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.bean.zuoye.browser;
|
||||
package com.uiui.sn.bean.zuoye.browser;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.config;
|
||||
package com.uiui.sn.config;
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.config;
|
||||
package com.uiui.sn.config;
|
||||
|
||||
public class Configs {
|
||||
public static String isLogined = "isLogined";
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.config;
|
||||
package com.uiui.sn.config;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
@@ -8,9 +8,9 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
import com.info.sn.utils.CXAESUtil;
|
||||
import com.info.sn.utils.Hash;
|
||||
import com.info.sn.utils.Utils;
|
||||
import com.uiui.sn.utils.CXAESUtil;
|
||||
import com.uiui.sn.utils.Hash;
|
||||
import com.uiui.sn.utils.Utils;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.info.sn.dialog;
|
||||
package com.uiui.sn.dialog;
|
||||
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
@@ -12,7 +11,7 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import com.info.sn.R;
|
||||
import com.uiui.sn.R;
|
||||
|
||||
|
||||
/**
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.dialog;
|
||||
package com.uiui.sn.dialog;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
@@ -12,8 +12,8 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import com.info.sn.R;
|
||||
import com.info.sn.activity.main.MainActivity;
|
||||
import com.uiui.sn.R;
|
||||
import com.uiui.sn.activity.main.MainActivity;
|
||||
|
||||
|
||||
/**
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.dialog;
|
||||
package com.uiui.sn.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
@@ -12,7 +12,7 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.info.sn.R;
|
||||
import com.uiui.sn.R;
|
||||
|
||||
|
||||
public class InfoDialog extends Dialog {
|
||||
@@ -1,21 +1,17 @@
|
||||
package com.info.sn.dialog;
|
||||
package com.uiui.sn.dialog;
|
||||
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.info.sn.R;
|
||||
import com.info.sn.activity.main.MainActivity;
|
||||
import com.uiui.sn.R;
|
||||
|
||||
|
||||
/**
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.info.sn.fragment;
|
||||
package com.uiui.sn.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import android.text.TextUtils;
|
||||
@@ -15,20 +14,12 @@ import android.widget.ImageView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.info.sn.R;
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.manager.NetInterfaceManager;
|
||||
import com.trello.rxlifecycle2.LifecycleProvider;
|
||||
import com.trello.rxlifecycle2.LifecycleTransformer;
|
||||
import com.trello.rxlifecycle2.RxLifecycle;
|
||||
import com.trello.rxlifecycle2.android.ActivityEvent;
|
||||
import com.trello.rxlifecycle2.android.FragmentEvent;
|
||||
import com.trello.rxlifecycle2.android.RxLifecycleAndroid;
|
||||
import com.uiui.sn.R;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.manager.NetInterfaceManager;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.subjects.BehaviorSubject;
|
||||
|
||||
|
||||
/**
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.fragment;
|
||||
package com.uiui.sn.fragment;
|
||||
|
||||
import android.util.SparseArray;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.fragment;
|
||||
package com.uiui.sn.fragment;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
@@ -11,12 +11,10 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.info.sn.R;
|
||||
import com.info.sn.config.Configs;
|
||||
import com.info.sn.utils.CXAESUtil;
|
||||
import com.info.sn.utils.Utils;
|
||||
|
||||
import butterknife.BindView;
|
||||
import com.uiui.sn.R;
|
||||
import com.uiui.sn.config.Configs;
|
||||
import com.uiui.sn.utils.CXAESUtil;
|
||||
import com.uiui.sn.utils.Utils;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.info.sn.jpush;
|
||||
package com.uiui.sn.jpush;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import com.info.sn.BuildConfig;
|
||||
import com.info.sn.utils.Utils;
|
||||
import com.uiui.sn.BuildConfig;
|
||||
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.jpush;
|
||||
package com.uiui.sn.jpush;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
@@ -8,10 +8,8 @@ import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.os.Bundle;
|
||||
import android.os.Looper;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.jpush;
|
||||
package com.uiui.sn.jpush;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.jpush;
|
||||
package com.uiui.sn.jpush;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.info.sn.jpush;
|
||||
package com.uiui.sn.jpush;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.info.sn.base.BaseApplication;
|
||||
import com.uiui.sn.base.BaseApplication;
|
||||
|
||||
import cn.jpush.android.api.CustomMessage;
|
||||
import cn.jpush.android.api.JPushMessage;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.jpush;
|
||||
package com.uiui.sn.jpush;
|
||||
|
||||
import cn.jpush.android.service.JCommonService;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.jpush;
|
||||
package com.uiui.sn.jpush;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
@@ -6,7 +6,7 @@ import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
|
||||
import com.info.sn.utils.ToastUtil;
|
||||
import com.uiui.sn.utils.ToastUtil;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.jpush;
|
||||
package com.uiui.sn.jpush;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.manager;
|
||||
package com.uiui.sn.manager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
@@ -7,7 +7,7 @@ import com.amap.api.location.AMapLocation;
|
||||
import com.amap.api.location.AMapLocationClient;
|
||||
import com.amap.api.location.AMapLocationClientOption;
|
||||
import com.amap.api.location.AMapLocationListener;
|
||||
import com.info.sn.utils.SPUtils;
|
||||
import com.uiui.sn.utils.SPUtils;
|
||||
|
||||
public class AmapManager {
|
||||
private static AmapManager sInstance;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.manager;
|
||||
package com.uiui.sn.manager;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
@@ -11,11 +11,11 @@ import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.info.sn.bean.zuoye.SystemSettings;
|
||||
import com.info.sn.utils.ApkUtils;
|
||||
import com.info.sn.utils.JGYUtils;
|
||||
import com.info.sn.utils.SPUtils;
|
||||
import com.info.sn.utils.ToastUtil;
|
||||
import com.uiui.sn.bean.zuoye.SystemSettings;
|
||||
import com.uiui.sn.utils.ApkUtils;
|
||||
import com.uiui.sn.utils.JGYUtils;
|
||||
import com.uiui.sn.utils.SPUtils;
|
||||
import com.uiui.sn.utils.ToastUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
@@ -402,16 +402,20 @@ public class ControlManager {
|
||||
mContext.sendBroadcast(tfmediaIntent);
|
||||
if (setting_tfmedia == 1) {
|
||||
String qch_tfmedia_filetypes = settings.getSetting_tfmedia_format();
|
||||
HashSet<String> types = new HashSet<>(Arrays.asList(qch_tfmedia_filetypes.split(",")));
|
||||
types.removeIf(new Predicate<String>() {
|
||||
@Override
|
||||
public boolean test(String s) {
|
||||
return TextUtils.isEmpty(s);
|
||||
}
|
||||
});
|
||||
String typesString = String.join(",", types);
|
||||
JGYUtils.putString(mContext.getContentResolver(), "qch_tfmedia_filetypes", typesString);//影音管控
|
||||
Log.e("SystemSetting", "qch_tfmedia_filetypes :" + typesString);
|
||||
if (TextUtils.isEmpty(qch_tfmedia_filetypes)) {
|
||||
JGYUtils.putString(mContext.getContentResolver(), "qch_tfmedia_filetypes", "");//影音管控
|
||||
} else {
|
||||
HashSet<String> types = new HashSet<>(Arrays.asList(qch_tfmedia_filetypes.split(",")));
|
||||
types.removeIf(new Predicate<String>() {
|
||||
@Override
|
||||
public boolean test(String s) {
|
||||
return TextUtils.isEmpty(s);
|
||||
}
|
||||
});
|
||||
String typesString = String.join(",", types);
|
||||
JGYUtils.putString(mContext.getContentResolver(), "qch_tfmedia_filetypes", typesString);//影音管控
|
||||
Log.e("SystemSetting", "qch_tfmedia_filetypes :" + typesString);
|
||||
}
|
||||
} else {
|
||||
JGYUtils.putInt(mContext.getContentResolver(), "qch_tfmedia_forbid", 0);
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.info.sn.manager;
|
||||
package com.uiui.sn.manager;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
|
||||
import com.info.sn.BuildConfig;
|
||||
import com.info.sn.utils.SPUtils;
|
||||
import com.info.sn.utils.ToastUtil;
|
||||
import com.uiui.sn.BuildConfig;
|
||||
import com.uiui.sn.utils.SPUtils;
|
||||
import com.uiui.sn.utils.ToastUtil;
|
||||
|
||||
public class DeviceManager {
|
||||
private static final String TAG = DeviceManager.class.getSimpleName();
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.info.sn.manager;
|
||||
package com.uiui.sn.manager;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.bumptech.glide.GlideBuilder;
|
||||
import com.bumptech.glide.load.engine.cache.DiskLruCacheFactory;
|
||||
import com.bumptech.glide.module.AppGlideModule;
|
||||
import com.info.sn.utils.StorageUtils;
|
||||
import com.uiui.sn.utils.StorageUtils;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2017/2/9.
|
||||
@@ -1,51 +1,45 @@
|
||||
package com.info.sn.manager;
|
||||
package com.uiui.sn.manager;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.info.sn.bean.zuoye.AppInfo;
|
||||
import com.info.sn.bean.zuoye.AppStart;
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.bean.zuoye.Label;
|
||||
import com.info.sn.bean.zuoye.UserAvatarInfo;
|
||||
import com.info.sn.bean.zuoye.UserInfo;
|
||||
import com.info.sn.bean.zuoye.browser.BrowserApiData;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.info.sn.network.api.APPJump;
|
||||
import com.info.sn.network.api.AddAppInstall;
|
||||
import com.info.sn.network.api.AppUsedApi;
|
||||
import com.info.sn.network.api.BindDevices;
|
||||
import com.info.sn.network.api.Browser;
|
||||
import com.info.sn.network.api.BrowserLabel;
|
||||
import com.info.sn.network.api.ForceInstall;
|
||||
import com.info.sn.network.api.GetBatchApi;
|
||||
import com.info.sn.network.api.GetGuideApi;
|
||||
import com.info.sn.network.api.GetSnUidApi;
|
||||
import com.info.sn.network.api.NewestAppUpdate;
|
||||
import com.info.sn.network.api.QRCodeApi;
|
||||
import com.info.sn.network.api.QueryAllApp;
|
||||
import com.info.sn.network.api.QueryAppInside;
|
||||
import com.info.sn.network.api.QuerySnAppStart;
|
||||
import com.info.sn.network.api.RunningApp;
|
||||
import com.info.sn.network.api.SNInfoApi;
|
||||
import com.info.sn.network.api.SaveSnUidApi;
|
||||
import com.info.sn.network.api.ScreenLock;
|
||||
import com.info.sn.network.api.ScreenState;
|
||||
import com.info.sn.network.api.Setting;
|
||||
import com.info.sn.network.api.TimeControl;
|
||||
import com.info.sn.network.api.UpdateAdminSn;
|
||||
import com.info.sn.network.api.UploadScreenshot;
|
||||
import com.info.sn.network.api.UserInfoControl;
|
||||
import com.info.sn.network.api.gankao.ActiveUserApi;
|
||||
import com.info.sn.network.api.gankao.CancelUserPowerApi;
|
||||
import com.info.sn.network.api.gankao.CreateUserApi;
|
||||
import com.info.sn.network.api.gankao.QueryPowerUserListApi;
|
||||
import com.info.sn.network.api.gankao.QueryProductApi;
|
||||
import com.info.sn.network.api.gankao.UpgradeUserPowerApi;
|
||||
import com.info.sn.network.api.gankao.UserProductsApi;
|
||||
import com.info.sn.utils.MD5Util;
|
||||
import com.info.sn.utils.Utils;
|
||||
import com.uiui.sn.bean.zuoye.AppInfo;
|
||||
import com.uiui.sn.bean.zuoye.AppStart;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.bean.zuoye.Label;
|
||||
import com.uiui.sn.bean.zuoye.UserAvatarInfo;
|
||||
import com.uiui.sn.bean.zuoye.UserInfo;
|
||||
import com.uiui.sn.bean.zuoye.browser.BrowserApiData;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
import com.uiui.sn.network.api.APPJump;
|
||||
import com.uiui.sn.network.api.AddAppInstall;
|
||||
import com.uiui.sn.network.api.AppUsedApi;
|
||||
import com.uiui.sn.network.api.BindDevices;
|
||||
import com.uiui.sn.network.api.Browser;
|
||||
import com.uiui.sn.network.api.BrowserLabel;
|
||||
import com.uiui.sn.network.api.ForceInstall;
|
||||
import com.uiui.sn.network.api.GetBatchApi;
|
||||
import com.uiui.sn.network.api.GetControlScreenshotApi;
|
||||
import com.uiui.sn.network.api.GetGuideApi;
|
||||
import com.uiui.sn.network.api.GetSnUidApi;
|
||||
import com.uiui.sn.network.api.NewestAppUpdate;
|
||||
import com.uiui.sn.network.api.QRCodeApi;
|
||||
import com.uiui.sn.network.api.QueryAllApp;
|
||||
import com.uiui.sn.network.api.QueryAppInside;
|
||||
import com.uiui.sn.network.api.QuerySnAppStart;
|
||||
import com.uiui.sn.network.api.RunningApp;
|
||||
import com.uiui.sn.network.api.SNInfoApi;
|
||||
import com.uiui.sn.network.api.SaveSnUidApi;
|
||||
import com.uiui.sn.network.api.ScreenLock;
|
||||
import com.uiui.sn.network.api.ScreenState;
|
||||
import com.uiui.sn.network.api.Setting;
|
||||
import com.uiui.sn.network.api.TimeControl;
|
||||
import com.uiui.sn.network.api.UpdateAdminSn;
|
||||
import com.uiui.sn.network.api.UploadScreenshot;
|
||||
import com.uiui.sn.network.api.UserInfoControl;
|
||||
import com.uiui.sn.utils.MD5Util;
|
||||
import com.uiui.sn.utils.Utils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -74,7 +68,7 @@ public class NetInterfaceManager {
|
||||
private Context mContext;
|
||||
private Retrofit mRetrofit;
|
||||
private OkHttpClient okHttpClient;
|
||||
private Retrofit mGankaoRetrofit;
|
||||
// private Retrofit mGankaoRetrofit;
|
||||
private final ConcurrentHashMap<String, Long> requestIdsMap = new ConcurrentHashMap<>();
|
||||
|
||||
//超时时间
|
||||
@@ -184,14 +178,14 @@ public class NetInterfaceManager {
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
.build();
|
||||
}
|
||||
if (null == mGankaoRetrofit) {
|
||||
mGankaoRetrofit = new Retrofit.Builder()
|
||||
.client(okHttpClient)
|
||||
.baseUrl(UrlAddress.GANKAN_ROOT_URL)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
.build();
|
||||
}
|
||||
// if (null == mGankaoRetrofit) {
|
||||
// mGankaoRetrofit = new Retrofit.Builder()
|
||||
// .client(okHttpClient)
|
||||
// .baseUrl(UrlAddress.GANKAN_ROOT_URL)
|
||||
// .addConverterFactory(GsonConverterFactory.create())
|
||||
// .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
// .build();
|
||||
// }
|
||||
}
|
||||
|
||||
public static void init(Context context) {
|
||||
@@ -356,33 +350,37 @@ public class NetInterfaceManager {
|
||||
return mRetrofit.create(AppUsedApi.class);
|
||||
}
|
||||
|
||||
//赶考
|
||||
|
||||
public CreateUserApi getCreateUserControl() {
|
||||
return mGankaoRetrofit.create(CreateUserApi.class);
|
||||
public GetControlScreenshotApi getControlScreenshotApi() {
|
||||
return mRetrofit.create(GetControlScreenshotApi.class);
|
||||
}
|
||||
|
||||
public ActiveUserApi getActiveUserControl() {
|
||||
return mGankaoRetrofit.create(ActiveUserApi.class);
|
||||
}
|
||||
|
||||
public QueryProductApi getQueryProductControl() {
|
||||
return mGankaoRetrofit.create(QueryProductApi.class);
|
||||
}
|
||||
|
||||
public QueryPowerUserListApi getQueryPowerUserListControl() {
|
||||
return mGankaoRetrofit.create(QueryPowerUserListApi.class);
|
||||
}
|
||||
|
||||
public UserProductsApi getUserProductsControl() {
|
||||
return mGankaoRetrofit.create(UserProductsApi.class);
|
||||
}
|
||||
|
||||
public CancelUserPowerApi getCancelUserPowerControl() {
|
||||
return mGankaoRetrofit.create(CancelUserPowerApi.class);
|
||||
}
|
||||
|
||||
public UpgradeUserPowerApi getUpgradeUserPowerControl() {
|
||||
return mGankaoRetrofit.create(UpgradeUserPowerApi.class);
|
||||
}
|
||||
// //赶考
|
||||
//
|
||||
// public CreateUserApi getCreateUserControl() {
|
||||
// return mGankaoRetrofit.create(CreateUserApi.class);
|
||||
// }
|
||||
//
|
||||
// public ActiveUserApi getActiveUserControl() {
|
||||
// return mGankaoRetrofit.create(ActiveUserApi.class);
|
||||
// }
|
||||
//
|
||||
// public QueryProductApi getQueryProductControl() {
|
||||
// return mGankaoRetrofit.create(QueryProductApi.class);
|
||||
// }
|
||||
//
|
||||
// public QueryPowerUserListApi getQueryPowerUserListControl() {
|
||||
// return mGankaoRetrofit.create(QueryPowerUserListApi.class);
|
||||
// }
|
||||
//
|
||||
// public UserProductsApi getUserProductsControl() {
|
||||
// return mGankaoRetrofit.create(UserProductsApi.class);
|
||||
// }
|
||||
//
|
||||
// public CancelUserPowerApi getCancelUserPowerControl() {
|
||||
// return mGankaoRetrofit.create(CancelUserPowerApi.class);
|
||||
// }
|
||||
//
|
||||
// public UpgradeUserPowerApi getUpgradeUserPowerControl() {
|
||||
// return mGankaoRetrofit.create(UpgradeUserPowerApi.class);
|
||||
// }
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.mvp;
|
||||
package com.uiui.sn.mvp;
|
||||
|
||||
public interface BasePresenter<V extends BaseView> {
|
||||
void attachView(V view);
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.mvp;
|
||||
package com.uiui.sn.mvp;
|
||||
|
||||
public interface BaseView {
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.info.sn.network;
|
||||
package com.uiui.sn.network;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
@@ -6,6 +6,8 @@ import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
@@ -14,43 +16,53 @@ import android.util.Log;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.blankj.utilcode.util.ImageUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.info.sn.BuildConfig;
|
||||
import com.info.sn.Statistics.AppInformation;
|
||||
import com.info.sn.Statistics.StatisticsInfo;
|
||||
import com.info.sn.bean.zuoye.AppInfo;
|
||||
import com.info.sn.bean.zuoye.AppStart;
|
||||
import com.info.sn.bean.zuoye.AppUploadInfo;
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.bean.zuoye.Label;
|
||||
import com.info.sn.bean.zuoye.browser.BrowserApiData;
|
||||
import com.info.sn.bean.zuoye.browser.BrowserBean;
|
||||
import com.info.sn.jpush.TagAliasOperatorHelper;
|
||||
import com.info.sn.manager.ControlManager;
|
||||
import com.info.sn.manager.NetInterfaceManager;
|
||||
import com.info.sn.network.api.NewestAppUpdate;
|
||||
import com.info.sn.network.api.UpdateAdminSn;
|
||||
import com.info.sn.service.ManagerService;
|
||||
import com.info.sn.utils.ApkUtils;
|
||||
import com.info.sn.utils.FileUtils;
|
||||
import com.info.sn.utils.JGYUtils;
|
||||
import com.info.sn.utils.SPUtils;
|
||||
import com.info.sn.utils.TimeUtils;
|
||||
import com.info.sn.utils.URLUtils;
|
||||
import com.info.sn.utils.Utils;
|
||||
import com.uiui.sn.BuildConfig;
|
||||
import com.uiui.sn.Statistics.AppInformation;
|
||||
import com.uiui.sn.Statistics.StatisticsInfo;
|
||||
import com.uiui.sn.bean.zuoye.AppInfo;
|
||||
import com.uiui.sn.bean.zuoye.AppStart;
|
||||
import com.uiui.sn.bean.zuoye.AppUploadInfo;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.bean.zuoye.Label;
|
||||
import com.uiui.sn.bean.zuoye.browser.BrowserApiData;
|
||||
import com.uiui.sn.bean.zuoye.browser.BrowserBean;
|
||||
import com.uiui.sn.jpush.TagAliasOperatorHelper;
|
||||
import com.uiui.sn.manager.ControlManager;
|
||||
import com.uiui.sn.manager.NetInterfaceManager;
|
||||
import com.uiui.sn.network.api.GetControlScreenshotApi;
|
||||
import com.uiui.sn.network.api.NewestAppUpdate;
|
||||
import com.uiui.sn.network.api.UpdateAdminSn;
|
||||
import com.uiui.sn.network.api.UploadScreenshot;
|
||||
import com.uiui.sn.service.ManagerService;
|
||||
import com.uiui.sn.utils.ApkUtils;
|
||||
import com.uiui.sn.utils.CmdUtil;
|
||||
import com.uiui.sn.utils.FileUtils;
|
||||
import com.uiui.sn.utils.JGYUtils;
|
||||
import com.uiui.sn.utils.SPUtils;
|
||||
import com.uiui.sn.utils.TimeUtils;
|
||||
import com.uiui.sn.utils.URLUtils;
|
||||
import com.uiui.sn.utils.Utils;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.ObservableSource;
|
||||
import io.reactivex.Observer;
|
||||
@@ -58,10 +70,14 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.BiFunction;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import kotlin.io.OnErrorAction;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.MultipartBody;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
import static com.info.sn.jpush.TagAliasOperatorHelper.ACTION_SET;
|
||||
import static com.uiui.sn.jpush.TagAliasOperatorHelper.ACTION_SET;
|
||||
|
||||
public class HTTPInterface {
|
||||
private static String TAG = HTTPInterface.class.getSimpleName();
|
||||
@@ -325,7 +341,8 @@ public class HTTPInterface {
|
||||
|
||||
|
||||
public static void getAppStart(final Context context, List<AppInfo> appInfoList) {
|
||||
NetInterfaceManager.getInstance().getAppStartControl()
|
||||
NetInterfaceManager.getInstance()
|
||||
.getAppStartControl()
|
||||
.subscribe(new Observer<BaseResponse<List<AppStart>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
@@ -532,6 +549,8 @@ public class HTTPInterface {
|
||||
}
|
||||
}
|
||||
|
||||
private static int hide = 1;
|
||||
|
||||
//隐藏显示app
|
||||
@SuppressLint("NewApi")
|
||||
private static void setAppHide(Context context, List<AppStart> list) {
|
||||
@@ -542,7 +561,7 @@ public class HTTPInterface {
|
||||
String app_package = app.getApp_package();
|
||||
int is_lock = app.getIs_lock();
|
||||
try {
|
||||
if (is_lock == 1) {
|
||||
if (is_lock == hide) {
|
||||
pm.setApplicationEnabledSetting(app_package, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
||||
hideAPPList.add(app_package);
|
||||
} else {
|
||||
@@ -649,25 +668,26 @@ public class HTTPInterface {
|
||||
jsonObject.put("address", address);
|
||||
jsonObject.put("longitude", longitude);
|
||||
jsonObject.put("latitude", latitude);
|
||||
String a = jsonObject.toString();
|
||||
String machine = Utils.getMachine(context);
|
||||
String hardware = Utils.getHardware(context);
|
||||
Log.e(TAG, "updateAdminInfo: getHardware = " + hardware);
|
||||
JSONObject softwareJson = new JSONObject();
|
||||
softwareJson.put("appstore_version", ApkUtils.getAPPVersionName(context, "com.jgyapp.market"));
|
||||
softwareJson.put("appstore_version", ApkUtils.getAPPVersionName(context, "com.uiui.appstore"));
|
||||
softwareJson.put("updatetools_version", ApkUtils.getAPPVersionName(context, "com.uiuios.updatetools"));
|
||||
softwareJson.put("info_version", ApkUtils.getAPPVersionName(context, "com.info.sn"));
|
||||
softwareJson.put("info_version", ApkUtils.getAPPVersionName(context, "com.uiui.sn"));
|
||||
softwareJson.put("jiaoguanyi_version", ApkUtils.getAPPVersionName(context, "com.jiaoguanyi.os"));
|
||||
softwareJson.put("gankao_version", ApkUtils.getAPPVersionName(context, "com.gankao.gkwxhd"));
|
||||
softwareJson.put("learning_version", ApkUtils.getAPPVersionName(context, "com.info.learning"));
|
||||
softwareJson.put("chat_version", ApkUtils.getAPPVersionName(context, "com.info.chat"));
|
||||
softwareJson.put("jpush_id", JPushInterface.getRegistrationID(context));
|
||||
String addr = jsonObject.toString();
|
||||
String machine = Utils.getMachine(context);
|
||||
String hardware = Utils.getHardware(context);
|
||||
Log.e(TAG, "updateAdminInfo: getHardware = " + hardware);
|
||||
String software = softwareJson.toJSONString();
|
||||
UpdateAdminSn updateAdminSn = NetInterfaceManager.getInstance().getUpdateAdminSnControl();
|
||||
updateAdminSn.sendAdminSn(Utils.getSerial(),
|
||||
jsonObject.toJSONString(),
|
||||
addr,
|
||||
machine,
|
||||
hardware,
|
||||
softwareJson.toJSONString()
|
||||
software
|
||||
).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@@ -986,7 +1006,6 @@ public class HTTPInterface {
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse response) {
|
||||
Log.e("sendAppUsed", "onNext: ");
|
||||
Log.e("sendAppUsed", "onNext: " + JSONObject.toJSONString(response));
|
||||
}
|
||||
|
||||
@@ -1078,6 +1097,189 @@ public class HTTPInterface {
|
||||
});
|
||||
}
|
||||
|
||||
private static Observable<Integer> getScreenshot(Context context, String filePath) {
|
||||
Observable<Integer> screenshotObservable = Observable.create(new ObservableOnSubscribe<Integer>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<Integer> e) {
|
||||
int code = CmdUtil.execute("screencap -p " + filePath).code;
|
||||
e.onNext(code);
|
||||
e.onComplete();
|
||||
}
|
||||
}).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
return screenshotObservable;
|
||||
}
|
||||
|
||||
private static Observable<BaseResponse> getSendFile(String path, MultipartBody.Part body) {
|
||||
return NetInterfaceManager.getInstance()
|
||||
.getControlScreenshotApi()
|
||||
.getControlScreenshot(Utils.getSerial(), body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public static void screenshot(Context context) {
|
||||
String path = context.getExternalFilesDir("db").getAbsolutePath();
|
||||
String filePath = path + File.separator + Utils.getSerial() + ".png";
|
||||
getScreenshot(context, filePath).concatMap(new Function<Integer, ObservableSource<BaseResponse>>() {
|
||||
@Override
|
||||
public ObservableSource<BaseResponse> apply(Integer integer) throws Exception {
|
||||
if (integer != 0) {
|
||||
throw new FileNotFoundException();
|
||||
}
|
||||
File file = new File(filePath);
|
||||
if (!file.exists()) {
|
||||
throw new FileNotFoundException(filePath);
|
||||
}
|
||||
Bitmap bitmap = BitmapFactory.decodeFile(filePath);
|
||||
if (bitmap.getWidth() < bitmap.getHeight()) {
|
||||
bitmap = ImageUtils.rotate(bitmap, -90, bitmap.getWidth(), bitmap.getHeight());
|
||||
}
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
|
||||
file.createNewFile();
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
InputStream is = new ByteArrayInputStream(baos.toByteArray());
|
||||
int x;
|
||||
byte[] b = new byte[1024 * 100];
|
||||
while ((x = is.read(b)) != -1) {
|
||||
fos.write(b, 0, x);
|
||||
}
|
||||
fos.close();
|
||||
RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file);
|
||||
MultipartBody.Part body = MultipartBody.Part.createFormData("file", file.getName(), requestFile);
|
||||
return getSendFile(filePath, body);
|
||||
}
|
||||
}).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("screenshot", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
Log.e("screenshot", "onNext: " + baseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("screenshot", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("screenshot", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public static void doscreenshot(final Context context) {
|
||||
String path = context.getExternalFilesDir("db").getAbsolutePath();
|
||||
String filePath = path + File.separator + Utils.getSerial() + ".png";
|
||||
Observable.create(new ObservableOnSubscribe<Integer>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<Integer> e) throws Exception {
|
||||
int n = CmdUtil.execute("screencap -p " + filePath).code;
|
||||
e.onNext(n);
|
||||
}
|
||||
}).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<Integer>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Integer integer) {
|
||||
if (integer == 0) {
|
||||
uplaodImage(context, filePath);
|
||||
} else {
|
||||
Log.e("doss", "失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("doss", "Throwable=" + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void uplaodImage(final Context context, String filePath) {
|
||||
File file = new File(filePath);
|
||||
if (!file.exists()) {
|
||||
Log.e("uplaodImage", "File does not exists");
|
||||
return;
|
||||
}
|
||||
|
||||
Bitmap bitmap = BitmapFactory.decodeFile(filePath);
|
||||
if (bitmap.getWidth() < bitmap.getHeight()) {
|
||||
bitmap = ImageUtils.rotate(bitmap, -90, bitmap.getWidth(), bitmap.getHeight());
|
||||
}
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
|
||||
|
||||
try {
|
||||
file.createNewFile();
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
InputStream is = new ByteArrayInputStream(baos.toByteArray());
|
||||
int x = 0;
|
||||
byte[] b = new byte[1024 * 100];
|
||||
while ((x = is.read(b)) != -1) {
|
||||
fos.write(b, 0, x);
|
||||
}
|
||||
fos.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file);
|
||||
MultipartBody.Part body = MultipartBody.Part.createFormData("file", file.getName(), requestFile);
|
||||
NetInterfaceManager.getInstance()
|
||||
.getControlScreenshotApi()
|
||||
.getControlScreenshot(Utils.getSerial(), body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("uplaod", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
int code = baseResponse.code;
|
||||
if (code == 200) {
|
||||
Log.e("uplaod", "onNext: " + baseResponse.msg);
|
||||
} else {
|
||||
Log.e("uplaod", code + ": " + baseResponse.msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("uplaod", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("uplaod", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static List<String> factoryApp = new ArrayList<String>() {{
|
||||
this.add("com.gankao.gkwxhd");
|
||||
this.add("com.jiaoguanyi.os");
|
||||
93
app/src/main/java/com/uiui/sn/network/UrlAddress.java
Normal file
93
app/src/main/java/com/uiui/sn/network/UrlAddress.java
Normal file
@@ -0,0 +1,93 @@
|
||||
package com.uiui.sn.network;
|
||||
|
||||
public class UrlAddress {
|
||||
//主页接口
|
||||
public static final String ROOT_URL = "https://led.aolelearn.cn/android/";
|
||||
//获取班级ID
|
||||
public static final String GET_BATCH = "sn/getBatch";
|
||||
//设备信息接口
|
||||
public static final String SNINFO = "sn/getSnInfo";
|
||||
//发送app信息
|
||||
public static final String APPLOG = "App/getApplog";
|
||||
//获取正在运行的app
|
||||
public static final String RUN_NEW_APP = "app/runNewApp";
|
||||
//根据包名获取更新
|
||||
public final static String GET_APP_UPDATE = "Update/update";
|
||||
//获取当前最顶层应用和电量
|
||||
public final static String SEND_RUNINGAPPINFO = "Monitoring/getAppNow";
|
||||
//在线状态
|
||||
public final static String SEND_DRIVE_STATE = "Online/online";
|
||||
//获取所有应用
|
||||
public final static String GET_ALL_PACKAGE = "app/queryAllApp";
|
||||
//绑定设备消息
|
||||
public final static String BIND_DEVICES = "sn/bindSn";
|
||||
//获取系统设置
|
||||
public final static String GET_SETTINGS = "control/getSetting";
|
||||
//浏览器网址管控
|
||||
public final static String SET_BROWSER_URL = "control/getBrowser";
|
||||
//浏览器书签管控
|
||||
public final static String SET_BROWSER_LABEL = "control/getLabel";
|
||||
//获取强制下载
|
||||
public final static String GET_FORCE_INSTALL = "app/getForceDownload";
|
||||
//获取app管控
|
||||
public final static String GET_APP_START = "sn/querySnAppStart";
|
||||
//发app跳转管控
|
||||
public final static String GET_APP_JUMP = "sn/querySnJump";
|
||||
//发app跳转管控
|
||||
public final static String QUERY_APP_INSIDE = "control/queryAppInside";
|
||||
//发送卸载或者安装信息
|
||||
public final static String SEND_INSTALLEDORREMOVED = "app/addAppInstall";
|
||||
//发送卸载或者安装信息
|
||||
public final static String UPDATE_SNINFO = "sn/updateAdminSn";
|
||||
//根据包名获取更新
|
||||
public final static String GET_NEWESTAPPUPDATE = "app/newestAppUpdate";
|
||||
//上传屏幕截图
|
||||
public final static String UPLOAD_SCREEN_SNAPSHOT = "sn/uploadScreenshot";
|
||||
//获取屏幕管控
|
||||
public final static String GET_SCREEN_LOCK = "sn/getScreenshot";
|
||||
//获取时间管控
|
||||
public final static String GET_TIME_CONTROL = "sn/getTimeControl";
|
||||
//获取用户头像和信息
|
||||
public static final String GET_USER_AVATAR_INFO = "sn/getUserAvatarInfo";
|
||||
//上传设备赶考的UID
|
||||
public static final String POST_USER_SAVESNUID = "sn/saveSnUid";
|
||||
//获取激活时间和赶考UID
|
||||
public static final String GET_SN_UID = "sn/getSnUid";
|
||||
//获取app使用信息
|
||||
public static final String UPLOAD_APP_USE_INFO = "sn/uploadAppUseInfo";
|
||||
//获取小程序二维码
|
||||
public static final String GET_APPLET_QRCODE = "file/getAppletQrCode";
|
||||
//获取操作指南
|
||||
public static final String GET_OPERATION_GUIDE = "file/getFiles";
|
||||
//上传控制面版截图
|
||||
public static final String UPLOAD_CONTROL_SCREENSHOT = "sn/uploadControlScreenshot";
|
||||
//获取应用白名单
|
||||
public static final String GET_APP_AND_WHITE = "getAppAndWhite";
|
||||
|
||||
|
||||
// //赶考
|
||||
// public static final String GANKAN_ROOT_URL = "https://www.gankao.com/api/service/";
|
||||
// //创建/查询用户
|
||||
// public static final String CREATE_USER = "createUser";
|
||||
// //用户授权/激活权限
|
||||
// public static final String ACTIVE_USER = "activeUser";
|
||||
// //获得可用的权限产品规格
|
||||
// public static final String QUERY_AVAILABLE_PRODUCT_SPECIFICATIONS = "queryAvailableProductSpecifications";
|
||||
// //获取机构的接口授权记录
|
||||
// public static final String QUERY_POWER_USER_LIST = "queryPowerUserList";
|
||||
// //获取用户已获得的产品列表(权限、单体课程、套餐等)
|
||||
// public static final String GET_USER_PRODUCTS = "getUserProducts";
|
||||
// //升级用户会员权限的学段
|
||||
// public static final String UPGRADE_USER_POWER = "upgradeUserPower";
|
||||
// //撤销指定的用户授权记录
|
||||
// public static final String CANCEL_USER_POWER = "cancelUserPower";
|
||||
|
||||
|
||||
/*
|
||||
* 极光
|
||||
* */
|
||||
//删除alias
|
||||
public static final String DELETE_JPUSH_ALIAS = "https://device.jpush.cn/v3/aliases/";
|
||||
//删除tags
|
||||
public static final String DELETE_JPUSH_TAG = "https://device.jpush.cn/v3/tags/";
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.info.sn.network.api;
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.info.sn.bean.zuoye.AppJump;
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.uiui.sn.bean.zuoye.AppJump;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.info.sn.network.api;
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Field;
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.info.sn.network.api;
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Field;
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.info.sn.network.api;
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.info.sn.network.api;
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.info.sn.network.api;
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.bean.zuoye.browser.BrowserApiData;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.bean.zuoye.browser.BrowserApiData;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.info.sn.network.api;
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.bean.zuoye.Label;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.bean.zuoye.Label;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.info.sn.network.api;
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.info.sn.bean.zuoye.AppInfo;
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.uiui.sn.bean.zuoye.AppInfo;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.info.sn.network.api;
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.MultipartBody;
|
||||
import retrofit2.http.Multipart;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Part;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface GetControlScreenshotApi {
|
||||
@Multipart
|
||||
@POST(UrlAddress.UPLOAD_CONTROL_SCREENSHOT)
|
||||
Observable<BaseResponse> getControlScreenshot(
|
||||
@Query("sn") String sn,
|
||||
@Part MultipartBody.Part body
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.info.sn.network.api;
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.info.sn.network.api;
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.info.sn.network.api;
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.info.sn.network.api;
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.info.sn.bean.zuoye.AppInfo;
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.uiui.sn.bean.zuoye.AppInfo;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.info.sn.network.api;
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.info.sn.network.api;
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.info.sn.bean.zuoye.AppInfo;
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.uiui.sn.bean.zuoye.AppInfo;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.info.sn.network.api;
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.info.sn.network.api;
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.info.sn.bean.zuoye.AppStart;
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.uiui.sn.bean.zuoye.AppStart;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -12,8 +12,7 @@ import retrofit2.http.Query;
|
||||
|
||||
public interface QuerySnAppStart {
|
||||
@GET(UrlAddress.GET_APP_START)
|
||||
Observable<BaseResponse<List<AppStart>>>
|
||||
getAppStatu(
|
||||
Observable<BaseResponse<List<AppStart>>> getAppStatu(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.info.sn.network.api;
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Field;
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.info.sn.network.api;
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.info.sn.bean.zuoye.BaseResponse;
|
||||
import com.info.sn.bean.zuoye.UserInfo;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.uiui.sn.bean.zuoye.BaseResponse;
|
||||
import com.uiui.sn.bean.zuoye.UserInfo;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.info.sn.network.api;
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.info.sn.bean.zuoye.Response;
|
||||
import com.info.sn.network.UrlAddress;
|
||||
import com.uiui.sn.bean.zuoye.Response;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Field;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user