version:1.7
fix:优化接口请求 update:增加锁屏密码
This commit is contained in:
@@ -17,7 +17,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.blankj.utilcode.util.NetworkUtils;
|
||||
@@ -31,13 +31,14 @@ import com.fuying.sn.receiver.APKinstallReceiver;
|
||||
import com.fuying.sn.receiver.BootReceiver;
|
||||
import com.fuying.sn.utils.SPUtils;
|
||||
import com.fuying.sn.utils.TimeUtils;
|
||||
import com.fuying.sn.utils.ToastUtil;
|
||||
import com.fuying.sn.utils.Utils;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.tuo.customview.VerificationCodeView;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.core.ObservableEmitter;
|
||||
import io.reactivex.rxjava3.core.ObservableOnSubscribe;
|
||||
@@ -224,43 +225,14 @@ public class ManagerService extends Service implements NetworkUtils.OnNetworkSta
|
||||
});
|
||||
if (null == topView) {
|
||||
topView = LayoutInflater.from(getApplicationContext()).inflate(R.layout.activity_screen_lock, null);
|
||||
TextView textView = topView.findViewById(R.id.textView);
|
||||
textView.setText(name);
|
||||
// EditText et_password = topView.findViewById(R.id.et_password);
|
||||
// TextView tv_confirm = topView.findViewById(R.id.tv_confirm);
|
||||
// tv_confirm.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View view) {
|
||||
// String password = (String) SPUtils.get(ManagerService.this, UrlAddress.LOCK_SCREEN_PWD, "");
|
||||
// String pwd = et_password.getText().toString();
|
||||
// if (!TextUtils.isEmpty(pwd) && !TextUtils.isEmpty(password) && password.equals(pwd)) {
|
||||
// hideFloatingWindow();
|
||||
// }else {
|
||||
// ToastUtil.show("密码错误");
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
initTopView(topView, name);
|
||||
} else {
|
||||
if ("added".equals(topView.getTag())) {
|
||||
TextView textView = topView.findViewById(R.id.textView);
|
||||
textView.setText(name);
|
||||
// EditText et_password = topView.findViewById(R.id.et_password);
|
||||
// TextView tv_confirm = topView.findViewById(R.id.tv_confirm);
|
||||
// tv_confirm.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View view) {
|
||||
// String password = (String) SPUtils.get(ManagerService.this, UrlAddress.LOCK_SCREEN_PWD, "");
|
||||
// String pwd = et_password.getText().toString();
|
||||
// if (!TextUtils.isEmpty(pwd) && !TextUtils.isEmpty(password) && password.equals(pwd)) {
|
||||
// hideFloatingWindow();
|
||||
// }else {
|
||||
// ToastUtil.show("密码错误");
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
initTopView(topView, name);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
// topView.setAlpha(0.8f);
|
||||
// 设置LayoutParam
|
||||
@@ -291,6 +263,108 @@ public class ManagerService extends Service implements NetworkUtils.OnNetworkSta
|
||||
}
|
||||
}
|
||||
|
||||
private void initTopView(View view, String name) {
|
||||
TextView textView = view.findViewById(R.id.textView);
|
||||
TextView tv_hint = view.findViewById(R.id.tv_hint);
|
||||
textView.setText(name);
|
||||
LinearLayout ll_keyboard = view.findViewById(R.id.ll_keyboard);
|
||||
VerificationCodeView codeView = view.findViewById(R.id.icv);
|
||||
codeView.getEditText().setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
ll_keyboard.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
codeView.setInputCompleteListener(new VerificationCodeView.InputCompleteListener() {
|
||||
@Override
|
||||
public void inputComplete() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteContent() {
|
||||
|
||||
}
|
||||
});
|
||||
Button bt0 = view.findViewById(R.id.bt_0);
|
||||
Button bt1 = view.findViewById(R.id.bt_1);
|
||||
Button bt2 = view.findViewById(R.id.bt_2);
|
||||
Button bt3 = view.findViewById(R.id.bt_3);
|
||||
Button bt4 = view.findViewById(R.id.bt_4);
|
||||
Button bt5 = view.findViewById(R.id.bt_5);
|
||||
Button bt6 = view.findViewById(R.id.bt_6);
|
||||
Button bt7 = view.findViewById(R.id.bt_7);
|
||||
Button bt8 = view.findViewById(R.id.bt_8);
|
||||
Button bt9 = view.findViewById(R.id.bt_9);
|
||||
Button bt_del = view.findViewById(R.id.bt_del);
|
||||
Button bt_confirm = view.findViewById(R.id.bt_confirm);
|
||||
bt0.setOnClickListener(view1 -> add(codeView, "0"));
|
||||
bt1.setOnClickListener(view1 -> add(codeView, "1"));
|
||||
bt2.setOnClickListener(view1 -> add(codeView, "2"));
|
||||
bt3.setOnClickListener(view1 -> add(codeView, "3"));
|
||||
bt4.setOnClickListener(view1 -> add(codeView, "4"));
|
||||
bt5.setOnClickListener(view1 -> add(codeView, "5"));
|
||||
bt6.setOnClickListener(view1 -> add(codeView, "6"));
|
||||
bt7.setOnClickListener(view1 -> add(codeView, "7"));
|
||||
bt8.setOnClickListener(view1 -> add(codeView, "8"));
|
||||
bt9.setOnClickListener(view1 -> add(codeView, "9"));
|
||||
bt_del.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
tv_hint.setText("");
|
||||
codeView.clearInputContent();
|
||||
}
|
||||
});
|
||||
bt_confirm.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
String content = codeView.getInputContent();
|
||||
if (TextUtils.isEmpty(content)) {
|
||||
return;
|
||||
}
|
||||
Log.e(TAG, "inputComplete: " + content);
|
||||
String password = (String) SPUtils.get(ManagerService.this, UrlAddress.LOCK_SCREEN_PWD, "");
|
||||
if (!TextUtils.isEmpty(content) && !TextUtils.isEmpty(password) && password.equals(content)) {
|
||||
hideFloatingWindow();
|
||||
SPUtils.put(ManagerService.this, ManagerService.LOCK_STATE, 0);
|
||||
NetInterfaceManager.getInstance().getUpdateLockScreenObservable()
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse baseResponse) {
|
||||
Log.e("getUpdateLockScreenObservable", "onNext: " + baseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// ToastUtil.show("密码错误");
|
||||
tv_hint.setText("密码错误");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void add(VerificationCodeView codeView, String text) {
|
||||
Log.e(TAG, "add: text = " + text);
|
||||
String oldText = codeView.getEditText().getText().toString();
|
||||
Log.e(TAG, "add: " + oldText);
|
||||
codeView.getEditText().setText(text);
|
||||
}
|
||||
|
||||
private void hideFloatingWindow() {
|
||||
if (null == windowManager) {
|
||||
return;
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.fuying.sn.bean.SnInfo;
|
||||
|
||||
public class MainSContact {
|
||||
public interface MainView extends BaseView {
|
||||
|
||||
void setSnInfo(BaseResponse<SnInfo> response);
|
||||
void setLocked(int lockedStatus);
|
||||
void updateInfoFinish();
|
||||
@@ -30,6 +31,7 @@ public class MainSContact {
|
||||
|
||||
interface Presenter extends BasePresenter<MainView> {
|
||||
|
||||
/*更新的*/
|
||||
//获取所有app包名
|
||||
void getAllApp();
|
||||
//检查更新
|
||||
@@ -39,16 +41,20 @@ public class MainSContact {
|
||||
/*获取所有全局更新*/
|
||||
void getOverallApp();
|
||||
|
||||
|
||||
/*获取上传或下载的*/
|
||||
//获取设备信息
|
||||
void getSnInfo();
|
||||
//获取锁定状态
|
||||
void getLocked();
|
||||
|
||||
//上传设备信息
|
||||
void updateDeviceInfo();
|
||||
//获取id管控
|
||||
void getAppInside();
|
||||
|
||||
//获取强制下载
|
||||
void getForceInstall();
|
||||
//获取id管控
|
||||
void getAppInside();
|
||||
//获取系统设置
|
||||
void getSystemSettings();
|
||||
//获取浏览器书签
|
||||
|
||||
@@ -79,6 +79,49 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
this.mView = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressLint("NewApi")
|
||||
public void getAllApp() {
|
||||
NetInterfaceManager.getInstance().getAppWhiteList(new NetInterfaceManager.WhiteListCallback() {
|
||||
@Override
|
||||
public void onComplet() {
|
||||
mView.getAllAppFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkUpdate() {
|
||||
NetInterfaceManager.getInstance().checkAllAppUpdate(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.checkUpdateFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkFXYUpdate() {
|
||||
NetInterfaceManager.getInstance().checkFXYAppUpdate(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.checkFXYUpdateFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getOverallApp() {
|
||||
NetInterfaceManager.getInstance().getOverallApp(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.setOverallApp();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getSnInfo() {
|
||||
NetInterfaceManager.getInstance()
|
||||
@@ -108,7 +151,7 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void getLocked() {
|
||||
int statu = (int) SPUtils.get(mContext, CommonConfig.isLogined, 0);
|
||||
int statu = (int) SPUtils.get(mContext, CommonConfig.isLogined, 2);
|
||||
mView.setLocked(statu);
|
||||
}
|
||||
|
||||
@@ -118,97 +161,6 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
mView.updateInfoFinish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkUpdate() {
|
||||
NetInterfaceManager.getInstance().checkAllAppUpdate(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.checkUpdateFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkFXYUpdate() {
|
||||
NetInterfaceManager.getInstance().checkFXYAppUpdate(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.checkFXYUpdateFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressLint("NewApi")
|
||||
public void getAllApp() {
|
||||
// NetInterfaceManager.getInstance()
|
||||
// .getQueryAllAppControl()
|
||||
// .compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
// .subscribe(new Observer<BaseResponse<List<AppInfo>>>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// Log.e("getAllApp", "onSubscribe: ");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(BaseResponse<List<AppInfo>> listBaseResponse) {
|
||||
// Log.e("getAllApp", "onNext: " + listBaseResponse);
|
||||
// int code = listBaseResponse.code;
|
||||
// if (code == 200) {
|
||||
// List<AppInfo> appInfoList = listBaseResponse.data;
|
||||
// if (appInfoList == null || appInfoList.size() == 0) {
|
||||
// mMMKV.encode(UrlAddress.GET_ALL_PACKAGE, "");
|
||||
// ApkUtils.writeAppPackageList(mContext, "");
|
||||
// } else {
|
||||
// mMMKV.encode(UrlAddress.GET_ALL_PACKAGE, GsonUtils.toJSONString(appInfoList));
|
||||
// HashSet allPkgSet = new HashSet<String>();
|
||||
// for (AppInfo pkg : appInfoList) {
|
||||
// allPkgSet.add(pkg.getApp_package());
|
||||
// }
|
||||
// String allPkgString = String.join(",", allPkgSet);
|
||||
// Settings.System.putString(mContext.getContentResolver(), CommonConfig.ONLY_SHORTCUT_LIST, allPkgString);
|
||||
// Log.e("getAllApp", "onNext: " + allPkgString);
|
||||
// ApkUtils.writeAppPackageList(mContext, allPkgString);
|
||||
// NetInterfaceManager.getInstance().getAppStart(appInfoList);
|
||||
// }
|
||||
// JGYUtils.getInstance().deleteOtherApp();
|
||||
// } else {
|
||||
// mMMKV.encode(UrlAddress.GET_ALL_PACKAGE, "");
|
||||
// ApkUtils.writeAppPackageList(mContext, "");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Throwable e) {
|
||||
// Log.e("getAllApp", "onError: " + e.getMessage());
|
||||
// onComplete();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
// Log.e("getAllApp", "onComplete: ");
|
||||
// mView.getAllAppFinish();
|
||||
// }
|
||||
// });
|
||||
|
||||
NetInterfaceManager.getInstance().getAppWhiteList(new NetInterfaceManager.WhiteListCallback() {
|
||||
@Override
|
||||
public void onComplet() {
|
||||
mView.getAllAppFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getOverallApp() {
|
||||
NetInterfaceManager.getInstance().getOverallApp(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.setOverallApp();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppInside() {
|
||||
NetInterfaceManager.getInstance()
|
||||
@@ -305,76 +257,82 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void getBrowserLabel() {
|
||||
NetInterfaceManager.getInstance().getLabelControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<Label>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getBrowserLabel", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<Label> labelBaseResponse) {
|
||||
Log.e("getBrowserLabel", "onNext: " + labelBaseResponse);
|
||||
if (labelBaseResponse.code == 200) {
|
||||
String home_page = labelBaseResponse.data.getHome_page();
|
||||
Settings.System.putString(mContext.getContentResolver(), "homepagURL", home_page);
|
||||
//主页
|
||||
Intent homepag = new Intent("qch_app_brower_homepage");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
homepag.setPackage("com.android.settings")
|
||||
.setPackage("com.android.browser");
|
||||
}
|
||||
if (!TextUtils.isEmpty(home_page)) {
|
||||
homepag.putExtra("homepage", home_page);
|
||||
} else {
|
||||
homepag.putExtra("homepage", "");
|
||||
}
|
||||
mContext.sendBroadcast(homepag);
|
||||
|
||||
//书签
|
||||
String label_page = labelBaseResponse.data.getLabel_page();
|
||||
Intent websiteBookMark = new Intent("qch_app_brower_website");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
websiteBookMark.setPackage("com.android.settings")
|
||||
.setPackage("com.android.browser");
|
||||
}
|
||||
if (!TextUtils.isEmpty(label_page)) {
|
||||
websiteBookMark.putExtra("websiteBookMark", label_page);
|
||||
} else {
|
||||
websiteBookMark.putExtra("websiteBookMark", "");
|
||||
}
|
||||
mContext.sendBroadcast(websiteBookMark);
|
||||
} else {
|
||||
Intent intent1 = new Intent("qch_app_brower_homepage");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
intent1.setPackage("com.android.settings")
|
||||
.setPackage("com.android.browser");
|
||||
}
|
||||
intent1.putExtra("homepage", "");
|
||||
mContext.sendBroadcast(intent1);
|
||||
Intent intent2 = new Intent("qch_app_brower_website");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
intent2.setPackage("com.android.settings")
|
||||
.setPackage("com.android.browser");
|
||||
}
|
||||
intent2.putExtra("websiteBookMark", "");
|
||||
mContext.sendBroadcast(intent2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getBrowserLabel", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getBrowserLabel", "onComplete: ");
|
||||
mView.setBrowserLabel();
|
||||
}
|
||||
});
|
||||
NetInterfaceManager.getInstance().getBrowserLabel(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.setBrowserLabel();
|
||||
}
|
||||
});
|
||||
// NetInterfaceManager.getInstance().getLabelControl()
|
||||
// .compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
// .subscribe(new Observer<BaseResponse<Label>>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// Log.e("getBrowserLabel", "onSubscribe: ");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(BaseResponse<Label> labelBaseResponse) {
|
||||
// Log.e("getBrowserLabel", "onNext: " + labelBaseResponse);
|
||||
// if (labelBaseResponse.code == 200) {
|
||||
// String home_page = labelBaseResponse.data.getHome_page();
|
||||
// Settings.System.putString(mContext.getContentResolver(), "homepagURL", home_page);
|
||||
// //主页
|
||||
// Intent homepag = new Intent("qch_app_brower_homepage");
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// homepag.setPackage("com.android.settings")
|
||||
// .setPackage("com.android.browser");
|
||||
// }
|
||||
// if (!TextUtils.isEmpty(home_page)) {
|
||||
// homepag.putExtra("homepage", home_page);
|
||||
// } else {
|
||||
// homepag.putExtra("homepage", "");
|
||||
// }
|
||||
// mContext.sendBroadcast(homepag);
|
||||
//
|
||||
// //书签
|
||||
// String label_page = labelBaseResponse.data.getLabel_page();
|
||||
// Intent websiteBookMark = new Intent("qch_app_brower_website");
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// websiteBookMark.setPackage("com.android.settings")
|
||||
// .setPackage("com.android.browser");
|
||||
// }
|
||||
// if (!TextUtils.isEmpty(label_page)) {
|
||||
// websiteBookMark.putExtra("websiteBookMark", label_page);
|
||||
// } else {
|
||||
// websiteBookMark.putExtra("websiteBookMark", "");
|
||||
// }
|
||||
// mContext.sendBroadcast(websiteBookMark);
|
||||
// } else {
|
||||
// Intent intent1 = new Intent("qch_app_brower_homepage");
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// intent1.setPackage("com.android.settings")
|
||||
// .setPackage("com.android.browser");
|
||||
// }
|
||||
// intent1.putExtra("homepage", "");
|
||||
// mContext.sendBroadcast(intent1);
|
||||
// Intent intent2 = new Intent("qch_app_brower_website");
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// intent2.setPackage("com.android.settings")
|
||||
// .setPackage("com.android.browser");
|
||||
// }
|
||||
// intent2.putExtra("websiteBookMark", "");
|
||||
// mContext.sendBroadcast(intent2);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Throwable e) {
|
||||
// Log.e("getBrowserLabel", "onError: " + e.getMessage());
|
||||
// onComplete();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
// Log.e("getBrowserLabel", "onComplete: ");
|
||||
// mView.setBrowserLabel();
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -382,55 +340,61 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
*/
|
||||
@Override
|
||||
public void getBrowserWhiteList() {
|
||||
NetInterfaceManager.getInstance().getBrowserControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<BrowserApiData>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getBrowserWhiteList", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<BrowserApiData> response) {
|
||||
Log.e("getBrowserWhiteList", "onNext: " + response);
|
||||
if (response.code == 200) {
|
||||
//白名单
|
||||
List<BrowserBean> white = response.data.getWhiteList();
|
||||
if (null != white && white.size() != 0) {
|
||||
boolean whiteList = Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray",
|
||||
white.stream().map(BrowserBean::getAddress).collect(Collectors.joining(",")));
|
||||
Log.e("getBrowserWhiteList", "setBrowserList_white:" + white + ":" + whiteList);
|
||||
} else {
|
||||
Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", " ");
|
||||
}
|
||||
//黑名单
|
||||
List<BrowserBean> black = response.data.getBlackList();
|
||||
if (null != black && black.size() != 0) {
|
||||
boolean blackList = Settings.System.putString(mContext.getContentResolver(), "qch_webblack_url",
|
||||
black.stream().map(BrowserBean::getAddress).collect(Collectors.joining(",")));
|
||||
Log.e("getBrowserWhiteList", "setBrowserList_black:" + black + ":" + blackList);
|
||||
} else {
|
||||
Settings.System.putString(mContext.getContentResolver(), "qch_webblack_url", " ");
|
||||
}
|
||||
} else {
|
||||
Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", " ");
|
||||
Settings.System.putString(mContext.getContentResolver(), "qch_webblack_url", " ");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getBrowserWhiteList", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
new URLUtils(mContext).setBrowserList();
|
||||
mView.setBrowserWhiteList();
|
||||
Log.e("getBrowserWhiteList", "onComplete: ");
|
||||
}
|
||||
});
|
||||
NetInterfaceManager.getInstance().getBrowserWhiteList(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.setBrowserWhiteList();
|
||||
}
|
||||
});
|
||||
// NetInterfaceManager.getInstance().getBrowserControl()
|
||||
// .compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
// .subscribe(new Observer<BaseResponse<BrowserApiData>>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// Log.e("getBrowserWhiteList", "onSubscribe: ");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(BaseResponse<BrowserApiData> response) {
|
||||
// Log.e("getBrowserWhiteList", "onNext: " + response);
|
||||
// if (response.code == 200) {
|
||||
// //白名单
|
||||
// List<BrowserBean> white = response.data.getWhiteList();
|
||||
// if (null != white && white.size() != 0) {
|
||||
// boolean whiteList = Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray",
|
||||
// white.stream().map(BrowserBean::getAddress).collect(Collectors.joining(",")));
|
||||
// Log.e("getBrowserWhiteList", "setBrowserList_white:" + white + ":" + whiteList);
|
||||
// } else {
|
||||
// Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", " ");
|
||||
// }
|
||||
// //黑名单
|
||||
// List<BrowserBean> black = response.data.getBlackList();
|
||||
// if (null != black && black.size() != 0) {
|
||||
// boolean blackList = Settings.System.putString(mContext.getContentResolver(), "qch_webblack_url",
|
||||
// black.stream().map(BrowserBean::getAddress).collect(Collectors.joining(",")));
|
||||
// Log.e("getBrowserWhiteList", "setBrowserList_black:" + black + ":" + blackList);
|
||||
// } else {
|
||||
// Settings.System.putString(mContext.getContentResolver(), "qch_webblack_url", " ");
|
||||
// }
|
||||
// } else {
|
||||
// Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", " ");
|
||||
// Settings.System.putString(mContext.getContentResolver(), "qch_webblack_url", " ");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Throwable e) {
|
||||
// Log.e("getBrowserWhiteList", "onError: " + e.getMessage());
|
||||
// onComplete();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
// new URLUtils(mContext).setBrowserList();
|
||||
// mView.setBrowserWhiteList();
|
||||
// Log.e("getBrowserWhiteList", "onComplete: ");
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -456,7 +420,7 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<List<AppStart>> listBaseResponse) {
|
||||
Log.e("getAppStart", "onNext: ");
|
||||
Log.e("getAppStart", "onNext: " + listBaseResponse);
|
||||
int code = listBaseResponse.code;
|
||||
if (code == 200) {
|
||||
List<AppStart> list = listBaseResponse.data;
|
||||
|
||||
@@ -120,7 +120,6 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
mPresenter.getSnInfo();
|
||||
SPUtils.put(this, CommonConfig.JGY_FIRST_BOOT, 1);
|
||||
}
|
||||
mPresenter.checkUpdate();
|
||||
mPresenter.getAllApp();
|
||||
NTPTimeTask task = new NTPTimeTask();
|
||||
task.execute("ntp.aliyun.com");
|
||||
@@ -161,6 +160,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
if (TextUtils.isEmpty(aole_app_forbid)) {
|
||||
ApkUtils.writeAppPackageList(MainService.this, "");
|
||||
}
|
||||
mPresenter.getAllApp();
|
||||
|
||||
ApkUtils.UninstallAPP(this, "com.joytv.live");
|
||||
ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
|
||||
@@ -435,10 +435,8 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
public void onNext(String string) {
|
||||
Log.e("TimeObserver", "onNext: " + string);
|
||||
startCommandTime = runningTime = SystemClock.elapsedRealtime();
|
||||
// mPresenter.getAllApp();
|
||||
mPresenter.getSnInfo();
|
||||
NetInterfaceManager.getInstance().getAppWhiteList(() -> {
|
||||
Log.e(TAG, "onNext: getAppWhiteList");
|
||||
});
|
||||
startService();
|
||||
}
|
||||
|
||||
@@ -453,6 +451,27 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void getAllAppFinish() {
|
||||
mPresenter.checkUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkUpdateFinish() {
|
||||
mPresenter.checkFXYUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkFXYUpdateFinish() {
|
||||
mPresenter.getOverallApp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOverallApp() {
|
||||
Log.e(TAG, "setOverallApp: finish");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setSnInfo(BaseResponse<SnInfo> response) {
|
||||
if (response != null) {
|
||||
@@ -468,7 +487,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
ControlManager.getInstance().setDisableSetting();
|
||||
}
|
||||
//没有授权的设备
|
||||
else if (code == 400) {
|
||||
else if (code == 401) {
|
||||
ControlManager.getInstance().setDisableSetting();
|
||||
}
|
||||
}
|
||||
@@ -476,14 +495,15 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
|
||||
@Override
|
||||
public void setLocked(int lockedStatus) {
|
||||
Log.e(TAG, "setLocked: ");
|
||||
Log.e(TAG, "setLocked: " + lockedStatus);
|
||||
switch (lockedStatus) {
|
||||
case 0:
|
||||
case 0://没有绑定的
|
||||
ControlManager.getInstance().setDisableSetting();
|
||||
break;
|
||||
case 1:
|
||||
case 1://绑定了的
|
||||
mPresenter.getForceInstall();
|
||||
break;
|
||||
case 2:
|
||||
case 2://sn没有导入后台的
|
||||
ControlManager.getInstance().setDisableSetting();
|
||||
break;
|
||||
default:
|
||||
@@ -493,36 +513,27 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
|
||||
@Override
|
||||
public void updateInfoFinish() {
|
||||
mPresenter.checkUpdate();
|
||||
mPresenter.getScreenLock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkUpdateFinish() {
|
||||
mPresenter.checkFXYUpdate();
|
||||
public void setScreenLock() {
|
||||
mPresenter.getLockScreenPwd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkFXYUpdateFinish() {
|
||||
mPresenter.getAllApp();
|
||||
public void setLockScreenPwd() {
|
||||
Log.e(TAG, "setLockScreenPwd: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAllAppFinish() {
|
||||
mPresenter.getOverallApp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOverallApp() {
|
||||
public void setForceInstall() {
|
||||
mPresenter.getAppInside();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAppInside() {
|
||||
mPresenter.getForceInstall();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setForceInstall() {
|
||||
mPresenter.getSystemSettings();
|
||||
}
|
||||
|
||||
@@ -563,18 +574,6 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
|
||||
@Override
|
||||
public void setMyAppList() {
|
||||
mPresenter.getScreenLock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScreenLock() {
|
||||
mPresenter.getLockScreenPwd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLockScreenPwd() {
|
||||
Log.e(TAG, "SettingFinish: " + (SystemClock.elapsedRealtime() - runningTime) + " ms");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user