增加远程获取app设置
This commit is contained in:
@@ -19,4 +19,11 @@ interface IGetInfoInterface {
|
||||
List<String> getHideAPP();
|
||||
//获取禁止打开的APP
|
||||
List<String> getForbidAPP();
|
||||
|
||||
//获取app设置
|
||||
String getAppTimeControl();
|
||||
//获取整机设置
|
||||
String getSnTimeControl();
|
||||
//获取系统设置
|
||||
String getSetting();
|
||||
}
|
||||
|
||||
128
app/src/main/java/com/uiui/sn/bean/AppTimeControl.java
Normal file
128
app/src/main/java/com/uiui/sn/bean/AppTimeControl.java
Normal file
@@ -0,0 +1,128 @@
|
||||
package com.uiui.sn.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class AppTimeControl implements Serializable {
|
||||
private static final long serialVersionUID = -240088037272271214L;
|
||||
|
||||
String app_package;
|
||||
//使用控制方式 0始终可用 1分类 2整机 3自由
|
||||
int tc_use_type;
|
||||
//分类使用控制方式 0始终可用 1整机 2自由
|
||||
int class_use_type;
|
||||
//控制方式开关 0关1开
|
||||
int is_control;
|
||||
//使用额度开关 0关1开
|
||||
int is_quota;
|
||||
//使用时间段开关 0关1开
|
||||
int is_part;
|
||||
//上学日可使用时间 单位秒
|
||||
long work_time;
|
||||
//休息日可使用时间 单位秒
|
||||
long rest_time;
|
||||
//使用时间段类型 0禁用 1开放
|
||||
int part_type;
|
||||
//使用时间段
|
||||
List<PartTime> time_part;
|
||||
//今日可用时间
|
||||
long today_time;
|
||||
//分类ID
|
||||
int tc_class_id;
|
||||
|
||||
public String getApp_package() {
|
||||
return app_package;
|
||||
}
|
||||
|
||||
public void setApp_package(String app_package) {
|
||||
this.app_package = app_package;
|
||||
}
|
||||
|
||||
public int getTc_use_type() {
|
||||
return tc_use_type;
|
||||
}
|
||||
|
||||
public void setTc_use_type(int tc_use_type) {
|
||||
this.tc_use_type = tc_use_type;
|
||||
}
|
||||
|
||||
public int getClass_use_type() {
|
||||
return class_use_type;
|
||||
}
|
||||
|
||||
public void setClass_use_type(int class_use_type) {
|
||||
this.class_use_type = class_use_type;
|
||||
}
|
||||
|
||||
public int getIs_control() {
|
||||
return is_control;
|
||||
}
|
||||
|
||||
public void setIs_control(int is_control) {
|
||||
this.is_control = is_control;
|
||||
}
|
||||
|
||||
public int getIs_quota() {
|
||||
return is_quota;
|
||||
}
|
||||
|
||||
public void setIs_quota(int is_quota) {
|
||||
this.is_quota = is_quota;
|
||||
}
|
||||
|
||||
public int getIs_part() {
|
||||
return is_part;
|
||||
}
|
||||
|
||||
public void setIs_part(int is_part) {
|
||||
this.is_part = is_part;
|
||||
}
|
||||
|
||||
public long getWork_time() {
|
||||
return work_time;
|
||||
}
|
||||
|
||||
public void setWork_time(long work_time) {
|
||||
this.work_time = work_time;
|
||||
}
|
||||
|
||||
public long getRest_time() {
|
||||
return rest_time;
|
||||
}
|
||||
|
||||
public void setRest_time(long rest_time) {
|
||||
this.rest_time = rest_time;
|
||||
}
|
||||
|
||||
public int getPart_type() {
|
||||
return part_type;
|
||||
}
|
||||
|
||||
public void setPart_type(int part_type) {
|
||||
this.part_type = part_type;
|
||||
}
|
||||
|
||||
public List<PartTime> getTime_part() {
|
||||
return time_part;
|
||||
}
|
||||
|
||||
public void setTime_part(List<PartTime> time_part) {
|
||||
this.time_part = time_part;
|
||||
}
|
||||
|
||||
public long getToday_time() {
|
||||
return today_time;
|
||||
}
|
||||
|
||||
public void setToday_time(long today_time) {
|
||||
this.today_time = today_time;
|
||||
}
|
||||
|
||||
public int getTc_class_id() {
|
||||
return tc_class_id;
|
||||
}
|
||||
|
||||
public void setTc_class_id(int tc_class_id) {
|
||||
this.tc_class_id = tc_class_id;
|
||||
}
|
||||
}
|
||||
89
app/src/main/java/com/uiui/sn/bean/MachineControl.java
Normal file
89
app/src/main/java/com/uiui/sn/bean/MachineControl.java
Normal file
@@ -0,0 +1,89 @@
|
||||
package com.uiui.sn.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class MachineControl implements Serializable {
|
||||
private static final long serialVersionUID = 8554412088242960068L;
|
||||
|
||||
int id;
|
||||
/*是否开启整机额度*/
|
||||
int is_quota;
|
||||
/*上学日额度*/
|
||||
long work_time;
|
||||
/*休息日额度*/
|
||||
long rest_time;
|
||||
|
||||
/*整机使用时间段控制*/
|
||||
int is_part;
|
||||
/*开放或者禁用类型*/
|
||||
int part_type;
|
||||
/*今日剩余时长*/
|
||||
long today_time;
|
||||
/*上学日时间段*/
|
||||
List<PartTime> time_part;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getIs_quota() {
|
||||
return is_quota;
|
||||
}
|
||||
|
||||
public void setIs_quota(int is_quota) {
|
||||
this.is_quota = is_quota;
|
||||
}
|
||||
|
||||
public long getWork_time() {
|
||||
return work_time;
|
||||
}
|
||||
|
||||
public void setWork_time(long work_time) {
|
||||
this.work_time = work_time;
|
||||
}
|
||||
|
||||
public long getRest_time() {
|
||||
return rest_time;
|
||||
}
|
||||
|
||||
public void setRest_time(long rest_time) {
|
||||
this.rest_time = rest_time;
|
||||
}
|
||||
|
||||
public int getIs_part() {
|
||||
return is_part;
|
||||
}
|
||||
|
||||
public void setIs_part(int is_part) {
|
||||
this.is_part = is_part;
|
||||
}
|
||||
|
||||
public int getPart_type() {
|
||||
return part_type;
|
||||
}
|
||||
|
||||
public void setPart_type(int part_type) {
|
||||
this.part_type = part_type;
|
||||
}
|
||||
|
||||
public long getToday_time() {
|
||||
return today_time;
|
||||
}
|
||||
|
||||
public void setToday_time(long today_time) {
|
||||
this.today_time = today_time;
|
||||
}
|
||||
|
||||
public List<PartTime> getTime_part() {
|
||||
return time_part;
|
||||
}
|
||||
|
||||
public void setTime_part(List<PartTime> time_part) {
|
||||
this.time_part = time_part;
|
||||
}
|
||||
}
|
||||
71
app/src/main/java/com/uiui/sn/bean/PartTime.java
Normal file
71
app/src/main/java/com/uiui/sn/bean/PartTime.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package com.uiui.sn.bean;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class PartTime implements Serializable {
|
||||
private static final long serialVersionUID = 1077218795525291465L;
|
||||
|
||||
//开始时间
|
||||
String start_time;
|
||||
//结束时间
|
||||
String end_time;
|
||||
//类型 0上学日 1休息日
|
||||
int day_type;
|
||||
|
||||
public String getStart_time() {
|
||||
return start_time;
|
||||
}
|
||||
|
||||
public void setStart_time(String start_time) {
|
||||
this.start_time = start_time;
|
||||
}
|
||||
|
||||
public String getEnd_time() {
|
||||
return end_time;
|
||||
}
|
||||
|
||||
public void setEnd_time(String end_time) {
|
||||
this.end_time = end_time;
|
||||
}
|
||||
|
||||
public int getDay_type() {
|
||||
return day_type;
|
||||
}
|
||||
|
||||
public void setDay_type(int day_type) {
|
||||
this.day_type = day_type;
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
Gson gson = new Gson();
|
||||
JsonObject jsonObject = JsonParser.parseString(gson.toJson(this)).getAsJsonObject();
|
||||
return jsonObject.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj instanceof PartTime) {
|
||||
PartTime partTime = (PartTime) obj;
|
||||
return start_time.equals(partTime.start_time)
|
||||
&& end_time.equals(partTime.end_time)
|
||||
&& day_type == partTime.day_type;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,14 +27,15 @@ import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.uiui.sn.BuildConfig;
|
||||
import com.uiui.sn.bean.AppInfo;
|
||||
import com.uiui.sn.bean.AppStart;
|
||||
import com.uiui.sn.bean.AppTimeControl;
|
||||
import com.uiui.sn.bean.AppUploadInfo;
|
||||
import com.uiui.sn.bean.AppletQRCode;
|
||||
import com.uiui.sn.bean.BaseResponse;
|
||||
import com.uiui.sn.bean.BatchID;
|
||||
import com.uiui.sn.bean.CloudLessonSetting;
|
||||
import com.uiui.sn.bean.Label;
|
||||
import com.uiui.sn.bean.MachineControl;
|
||||
import com.uiui.sn.bean.SnInfo;
|
||||
import com.uiui.sn.bean.SystemSettings;
|
||||
import com.uiui.sn.bean.SystemSettingsSet;
|
||||
import com.uiui.sn.bean.UserAvatarInfo;
|
||||
import com.uiui.sn.bean.browser.BrowserApiData;
|
||||
@@ -47,6 +48,7 @@ import com.uiui.sn.manager.ConnectMode;
|
||||
import com.uiui.sn.manager.ControlManager;
|
||||
import com.uiui.sn.network.api.APPJump;
|
||||
import com.uiui.sn.network.api.AddAppInstall;
|
||||
import com.uiui.sn.network.api.AppTimeControlApi;
|
||||
import com.uiui.sn.network.api.BindDevices;
|
||||
import com.uiui.sn.network.api.Browser;
|
||||
import com.uiui.sn.network.api.BrowserLabel;
|
||||
@@ -56,6 +58,7 @@ 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.GetPublicIPApi;
|
||||
import com.uiui.sn.network.api.MachineTimeControlApi;
|
||||
import com.uiui.sn.network.api.NewestAppUpdate;
|
||||
import com.uiui.sn.network.api.QRCodeApi;
|
||||
import com.uiui.sn.network.api.QueryAllApp;
|
||||
@@ -71,7 +74,6 @@ 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.network.interceptor.RepeatRequestInterceptor;
|
||||
import com.uiui.sn.service.ManagerService;
|
||||
import com.uiui.sn.utils.ApkUtils;
|
||||
import com.uiui.sn.utils.AppUsedTimeUtils;
|
||||
import com.uiui.sn.utils.CmdUtil;
|
||||
@@ -79,7 +81,6 @@ import com.uiui.sn.utils.FileUtils;
|
||||
import com.uiui.sn.utils.JGYUtils;
|
||||
import com.uiui.sn.utils.MD5Util;
|
||||
import com.uiui.sn.utils.SPUtils;
|
||||
import com.uiui.sn.utils.TimeUtils;
|
||||
import com.uiui.sn.utils.URLUtils;
|
||||
import com.uiui.sn.utils.Utils;
|
||||
|
||||
@@ -109,7 +110,6 @@ import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.functions.BiFunction;
|
||||
import io.reactivex.rxjava3.functions.Function;
|
||||
import io.reactivex.rxjava3.functions.Function3;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
import okhttp3.Cache;
|
||||
@@ -428,6 +428,20 @@ public class NetInterfaceManager {
|
||||
return mRetrofit.create(GetControlScreenshotApi.class);
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<List<AppTimeControl>>> getAppTimeControlObservable() {
|
||||
return mRetrofit.create(AppTimeControlApi.class)
|
||||
.getAppTimeControl(Utils.getSerial())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<MachineControl>> getMachineTimeControlObservable() {
|
||||
return mRetrofit.create(MachineTimeControlApi.class)
|
||||
.getSnTimeControl(Utils.getSerial())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
@@ -1968,8 +1982,10 @@ public class NetInterfaceManager {
|
||||
String data = new Gson().toJson(BaseResponse.data.getAdmin());
|
||||
Log.e("getSystemSettings", "onNext: " + data);
|
||||
ControlManager.getInstance().setSystemSetting(data);
|
||||
cacheHelper.put(UrlAddress.GET_SETTINGS, GsonUtils.toJSONString(BaseResponse.data.getAdmin()));
|
||||
} else {
|
||||
ControlManager.getInstance().setDisableSetting();
|
||||
cacheHelper.put(UrlAddress.GET_SETTINGS, "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1986,6 +2002,10 @@ public class NetInterfaceManager {
|
||||
});
|
||||
}
|
||||
|
||||
public String getSystemSettingsJson() {
|
||||
return cacheHelper.getAsString(UrlAddress.GET_SETTINGS);
|
||||
}
|
||||
|
||||
public void getTimeControl() {
|
||||
// getTimeControlObservable()
|
||||
// .subscribe(new Observer<BaseResponse>() {
|
||||
@@ -2189,4 +2209,158 @@ public class NetInterfaceManager {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getAppTimeControl(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
||||
ConnectMode connectMode = ConnectMode.ONE_MINUTE;
|
||||
if (refresh) {
|
||||
connectMode = ConnectMode.DEFAULT;
|
||||
}
|
||||
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_APP_TIME_CONTROL, connectMode)) {
|
||||
getAppTimeControl(lifecycle, callback);
|
||||
} else {
|
||||
String jsonString = cacheHelper.getAsString(UrlAddress.GET_APP_TIME_CONTROL);
|
||||
//为 "" 是已经请求成功的
|
||||
if (jsonString == null) {
|
||||
getAppTimeControl(lifecycle, callback);
|
||||
} else {
|
||||
Gson gson = new Gson();
|
||||
Type type = new TypeToken<List<AppTimeControl>>() {
|
||||
}.getType();
|
||||
List<AppTimeControl> appInfos = gson.fromJson(jsonString, type);
|
||||
callback.onComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getAppTimeControlJson() {
|
||||
return cacheHelper.getAsString(UrlAddress.GET_APP_TIME_CONTROL);
|
||||
}
|
||||
|
||||
public void getAppTimeControl(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
||||
getAppTimeControlObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(getAppTimeControlObserver(callback));
|
||||
}
|
||||
|
||||
public void getAppTimeControl(onCompleteCallback callback) {
|
||||
getAppTimeControlObservable()
|
||||
.subscribe(getAppTimeControlObserver(callback));
|
||||
}
|
||||
|
||||
public void getAppTimeControl() {
|
||||
getAppTimeControlObservable()
|
||||
.subscribe(getAppTimeControlObserver(null));
|
||||
}
|
||||
|
||||
private Observer<BaseResponse<List<AppTimeControl>>> getAppTimeControlObserver(onCompleteCallback callback) {
|
||||
return new Observer<BaseResponse<List<AppTimeControl>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getAppTimeControlObserver", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<AppTimeControl>> listBaseResponse) {
|
||||
Log.e("getAppTimeControlObserver", "onNext: ");
|
||||
if (listBaseResponse.code == 200) {
|
||||
List<AppTimeControl> appTimeControls = listBaseResponse.data;
|
||||
cacheHelper.put(UrlAddress.GET_SN_TIME_CONTROL, GsonUtils.toJSONString(appTimeControls));
|
||||
} else {
|
||||
cacheHelper.put(UrlAddress.GET_SN_TIME_CONTROL, "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getAppTimeControlObserver", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAppTimeControlObserver", "onComplete: ");
|
||||
if (callback != null) {
|
||||
callback.onComplete();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public void getSnTimeControl(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
||||
ConnectMode connectMode = ConnectMode.ONE_MINUTE;
|
||||
if (refresh) {
|
||||
connectMode = ConnectMode.DEFAULT;
|
||||
}
|
||||
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_SN_TIME_CONTROL, connectMode)) {
|
||||
getSnTimeControl(lifecycle, callback);
|
||||
} else {
|
||||
String jsonString = cacheHelper.getAsString(UrlAddress.GET_SN_TIME_CONTROL);
|
||||
//为 "" 是已经请求成功的
|
||||
if (jsonString == null) {
|
||||
getSnTimeControl(lifecycle, callback);
|
||||
} else {
|
||||
Gson gson = new Gson();
|
||||
Type type = new TypeToken<MachineControl>() {
|
||||
}.getType();
|
||||
MachineControl machineControl = gson.fromJson(jsonString, type);
|
||||
callback.onComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getSnTimeControllJson() {
|
||||
return cacheHelper.getAsString(UrlAddress.GET_SN_TIME_CONTROL);
|
||||
}
|
||||
|
||||
public void getSnTimeControl(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
||||
getMachineTimeControlObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(getSnTimeControlObserver(callback));
|
||||
}
|
||||
|
||||
public void getSnTimeControl(onCompleteCallback callback) {
|
||||
getMachineTimeControlObservable()
|
||||
.subscribe(getSnTimeControlObserver(callback));
|
||||
}
|
||||
|
||||
public void getSnTimeControl() {
|
||||
getMachineTimeControlObservable()
|
||||
.subscribe(getSnTimeControlObserver(null));
|
||||
}
|
||||
|
||||
public Observer<BaseResponse<MachineControl>> getSnTimeControlObserver(onCompleteCallback callback) {
|
||||
return new Observer<BaseResponse<MachineControl>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getSnTimeControlObserver", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<MachineControl> machineControlBaseResponse) {
|
||||
Log.e("getSnTimeControlObserver", "onNext: ");
|
||||
if (machineControlBaseResponse.code == 200) {
|
||||
MachineControl machineControl = machineControlBaseResponse.data;
|
||||
cacheHelper.put(UrlAddress.GET_SN_TIME_CONTROL, GsonUtils.toJSONString(machineControl));
|
||||
} else {
|
||||
cacheHelper.put(UrlAddress.GET_SN_TIME_CONTROL, "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getSnTimeControlObserver", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getSnTimeControlObserver", "onComplete: ");
|
||||
if (callback != null) {
|
||||
callback.onComplete();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,10 @@ public class UrlAddress {
|
||||
public final static String BIND_DEVICES = "sn/bindSn";
|
||||
/*获取系统设置*/
|
||||
public final static String GET_SETTINGS = "control/getSetting";
|
||||
/*获取app桌面管控配置*/
|
||||
public final static String GET_APP_TIME_CONTROL = "Control/getAppTimeControl";
|
||||
/*获取整机管控配置*/
|
||||
public final static String GET_SN_TIME_CONTROL = "Control/getSnTimeControl";
|
||||
/*浏览器网址管控*/
|
||||
public final static String SET_BROWSER_URL = "control/getBrowser";
|
||||
/*浏览器书签管控*/
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
|
||||
import com.uiui.sn.bean.AppTimeControl;
|
||||
import com.uiui.sn.bean.BaseResponse;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface AppTimeControlApi {
|
||||
@GET(UrlAddress.GET_APP_TIME_CONTROL)
|
||||
Observable<BaseResponse<List<AppTimeControl>>> getAppTimeControl(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.uiui.sn.bean.BaseResponse;
|
||||
import com.uiui.sn.bean.MachineControl;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface MachineTimeControlApi {
|
||||
@GET(UrlAddress.GET_SN_TIME_CONTROL)
|
||||
Observable<BaseResponse<MachineControl>> getSnTimeControl(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import android.util.Log;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.uiui.sn.IGetInfoInterface;
|
||||
import com.uiui.sn.network.NetInterfaceManager;
|
||||
import com.uiui.sn.service.main.MainService;
|
||||
import com.uiui.sn.utils.JGYUtils;
|
||||
import com.uiui.sn.utils.SPUtils;
|
||||
@@ -79,5 +80,20 @@ public class RemoteService extends Service {
|
||||
public List<String> getForbidAPP() throws RemoteException {
|
||||
return JGYUtils.getInstance().getForbidList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppTimeControl() throws RemoteException {
|
||||
return NetInterfaceManager.getInstance().getAppTimeControlJson();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSnTimeControl() throws RemoteException {
|
||||
return NetInterfaceManager.getInstance().getSnTimeControllJson();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSetting() throws RemoteException {
|
||||
return NetInterfaceManager.getInstance().getSystemSettingsJson();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -19,7 +19,8 @@ public class MainSContact {
|
||||
void setBrowserLabel();
|
||||
void setBrowserWhiteList();
|
||||
void setAppStart();
|
||||
void setTimeControl();
|
||||
void setAppTimeControl();
|
||||
void setSnTimeControl();
|
||||
void setScreenLock();
|
||||
}
|
||||
|
||||
@@ -49,7 +50,9 @@ public class MainSContact {
|
||||
//应用自启
|
||||
void getAppStart();
|
||||
//获取时间管控
|
||||
void getTimeControl();
|
||||
void getAppTimeControl();
|
||||
//获取整机管控
|
||||
void getSnTimeControl();
|
||||
//获取锁屏管控
|
||||
void getScreenLock();
|
||||
|
||||
|
||||
@@ -450,64 +450,13 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTimeControl() {
|
||||
// NetInterfaceManager.getInstance()
|
||||
// .getTimeControlObservable()
|
||||
// .compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
// .subscribe(new Observer<BaseResponse>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// Log.e("getTimeControlControl", "onSubscribe: ");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(BaseResponse baseResponse) {
|
||||
// Log.e("getTimeControlControl", "onNext: ");
|
||||
// int code = baseResponse.code;
|
||||
// if (code == 200) {
|
||||
// JsonObject jsonObject = GsonUtils.getJsonObject(GsonUtils.toJSONString(baseResponse.data));
|
||||
// JsonObject work = jsonObject.getAsJsonObject("work");
|
||||
// String work_start_time = work.get("start_time").getAsString();
|
||||
// String work_end_time = work.get("end_time").getAsString();
|
||||
// JsonObject rest = jsonObject.getAsJsonObject("rest");
|
||||
// String rest_start_time = rest.get("start_time").getAsString();
|
||||
// String rest_end_time = rest.get("end_time").getAsString();
|
||||
// TimeUtils.ContralTime workingTime = TimeUtils.String2WorkingTime(mContext, work_start_time + "-" + work_end_time);
|
||||
// TimeUtils.ContralTime weekTime = TimeUtils.String2WeekTime(mContext, rest_start_time + "-" + rest_end_time);
|
||||
// if (null != workingTime) {
|
||||
// Log.e("getTimeControlControl", "200:" + workingTime.toString());
|
||||
// }
|
||||
// if (null != weekTime) {
|
||||
// Log.e("getTimeControlControl", "200:" + weekTime.toString());
|
||||
// }
|
||||
// } else {
|
||||
// TimeUtils.setEmpty(mContext);
|
||||
// TimeUtils.ContralTime workingTime = TimeUtils.getWorkingDayContralTime(mContext);
|
||||
// if (null != workingTime) {
|
||||
// Log.e("getTimeControlControl", workingTime.toString());
|
||||
// }
|
||||
// TimeUtils.ContralTime weekTime = TimeUtils.getWeekDayContralTime(mContext);
|
||||
// if (null != weekTime) {
|
||||
// Log.e("getTimeControlControl", weekTime.toString());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Throwable e) {
|
||||
// Log.e("getTimeControlControl", "onError: " + e.getMessage());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
// Log.e("getTimeControlControl", "onComplete: ");
|
||||
// Intent intent = new Intent();
|
||||
// intent.setAction(ManagerService.ACTION_UPDATE);
|
||||
// mContext.sendBroadcast(intent);
|
||||
//
|
||||
// }
|
||||
// });
|
||||
mView.setTimeControl();
|
||||
public void getAppTimeControl() {
|
||||
mView.setAppTimeControl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSnTimeControl() {
|
||||
mView.setSnTimeControl();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -462,11 +462,16 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
|
||||
@Override
|
||||
public void setAppStart() {
|
||||
mPresenter.getTimeControl();
|
||||
mPresenter.getAppTimeControl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTimeControl() {
|
||||
public void setAppTimeControl() {
|
||||
mPresenter.getSnTimeControl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSnTimeControl() {
|
||||
mPresenter.getScreenLock();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user