feat(exit): 添加验证码退出登录功能
新增ExitCodeActivity和ExitCodeViewModel,通过短信验证码实现安全退出登录,同时重构了多个ViewModel中的网络请求调用,并添加了桌面自定义信息实体类。
This commit is contained in:
1 parent
a46540de74
commit
93f22b2678
38 files changed
+4308
-3499
No files matched your search
+2
-2
@@ -20,8 +20,8 @@ android {
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 29
|
||||
|
||||
versionCode 45
|
||||
versionName "1.4.4"
|
||||
versionCode 46
|
||||
versionName "1.4.5"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
@@ -34,12 +34,14 @@
|
||||
<!--不确定是否要申请,没有找到-->
|
||||
<uses-permission android:name="com.hihonor.permission.sec.MDM" />
|
||||
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER" />
|
||||
|
||||
<!-- 清单文件中, 申明监听通话精确状态权限,该权限需要android:sharedUserId="android.uid.system" -->
|
||||
<uses-permission android:name="android.permission.READ_PRECISE_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
@@ -110,7 +112,6 @@
|
||||
<!--如果您的应用需要后台定位权限,且有可能运行在Android Q设备上,并且设置了target>28,必须增加这个权限声明-->
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
||||
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
||||
|
||||
|
||||
<application
|
||||
@@ -222,6 +223,12 @@
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="landscape"
|
||||
android:theme="@style/AppThemeWithoutFitsSystemWindows" />
|
||||
<activity
|
||||
android:name=".activity.exit.ExitCodeActivity"
|
||||
android:configChanges="keyboardHidden"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/DialogStyle"
|
||||
android:screenOrientation="landscape" />
|
||||
<activity
|
||||
android:name=".activity.ManualActivity"
|
||||
android:launchMode="singleTask"
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.xwad.os.activity.exit;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.lifecycle.Observer;
|
||||
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.xwad.os.R;
|
||||
import com.xwad.os.base.mvvm.BaseMvvmActivity;
|
||||
import com.xwad.os.databinding.ActivityExitCodeBinding;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.observers.DisposableObserver;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
|
||||
public class ExitCodeActivity extends BaseMvvmActivity<ExitCodeViewModel, ActivityExitCodeBinding> {
|
||||
|
||||
private Disposable mDisposable;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_exit_code;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDataBinding() {
|
||||
mViewModel.setCtx(this);
|
||||
mViewModel.setVDBinding(mViewDataBinding);
|
||||
mViewModel.setLifecycle(getLifecycleSubject());
|
||||
mViewDataBinding.setClick(new BtnClick());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
mViewModel.mSentSuccessfullyData.observe(this, new Observer<Boolean>() {
|
||||
@Override
|
||||
public void onChanged(Boolean aBoolean) {
|
||||
if (aBoolean) {
|
||||
Toaster.show("验证码发送成功");
|
||||
startCountdown();
|
||||
} else {
|
||||
setCodeTextEnable();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mViewModel.mExitSuccessData.observe(this, new Observer<Boolean>() {
|
||||
@Override
|
||||
public void onChanged(Boolean aBoolean) {
|
||||
if (aBoolean) {
|
||||
Intent intent = new Intent();
|
||||
setResult(Activity.RESULT_OK, intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mDisposable != null && !mDisposable.isDisposed()) {
|
||||
mDisposable.dispose();
|
||||
mDisposable = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void startCountdown() {
|
||||
int countdownTime = 60;
|
||||
|
||||
mDisposable = Observable.interval(0, 1, TimeUnit.SECONDS)
|
||||
.take(countdownTime + 1)
|
||||
.map(aLong -> countdownTime - aLong)
|
||||
.subscribeOn(Schedulers.computation())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycleSubject(), ActivityEvent.DESTROY))
|
||||
.subscribeWith(new DisposableObserver<Long>() {
|
||||
@Override
|
||||
public void onNext(Long remainingTime) {
|
||||
Log.e("ExitCodeActivity", "countdown: " + remainingTime);
|
||||
mViewDataBinding.tvGetCode.setText(remainingTime + "秒");
|
||||
mViewDataBinding.tvGetCode.setEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("ExitCodeActivity", "countdown Error: ", e);
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("ExitCodeActivity", "countdown complete");
|
||||
setCodeTextEnable();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setCodeTextEnable() {
|
||||
mViewDataBinding.tvGetCode.setText("获取");
|
||||
mViewDataBinding.tvGetCode.setEnabled(true);
|
||||
}
|
||||
|
||||
public class BtnClick {
|
||||
public void getCode(View view) {
|
||||
mViewDataBinding.tvGetCode.setText("发送中");
|
||||
mViewDataBinding.tvGetCode.setEnabled(false);
|
||||
// Editable editable = mViewDataBinding.etMobile.getText();
|
||||
// if (editable == null) {
|
||||
// Toaster.show("请输入手机号");
|
||||
// setCodeTextEnable();
|
||||
// return;
|
||||
// }
|
||||
// String mobile = editable.toString();
|
||||
// if (TextUtils.isEmpty(mobile)) {
|
||||
// Toaster.show("请输入手机号");
|
||||
// setCodeTextEnable();
|
||||
// return;
|
||||
// }
|
||||
mViewModel.getPhoneCode();
|
||||
}
|
||||
|
||||
public void codeExit(View view) {
|
||||
// Editable editable = mViewDataBinding.etMobile.getText();
|
||||
// if (editable == null) {
|
||||
// Toaster.show("请输入手机号");
|
||||
// return;
|
||||
// }
|
||||
// String mobile = editable.toString();
|
||||
// if (TextUtils.isEmpty(mobile)) {
|
||||
// Toaster.show("请输入手机号");
|
||||
// return;
|
||||
// }
|
||||
Editable codeEditable = mViewDataBinding.etCode.getText();
|
||||
if (codeEditable == null) {
|
||||
Toaster.show("请输入验证码");
|
||||
return;
|
||||
}
|
||||
String code = codeEditable.toString();
|
||||
if (TextUtils.isEmpty(code)) {
|
||||
Toaster.show("请输入验证码");
|
||||
return;
|
||||
}
|
||||
mViewModel.codeExit(code);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.xwad.os.activity.exit;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.xwad.os.base.mvvm.BaseViewModel;
|
||||
import com.xwad.os.bean.BaseResponse;
|
||||
import com.xwad.os.config.CommonConfig;
|
||||
import com.xwad.os.databinding.ActivityExitCodeBinding;
|
||||
import com.xwad.os.network.NetInterfaceManager;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class ExitCodeViewModel extends BaseViewModel<ActivityExitCodeBinding, ActivityEvent> {
|
||||
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
@Override
|
||||
public ActivityExitCodeBinding getVDBinding() {
|
||||
return binding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
|
||||
public MutableLiveData<Boolean> mSentSuccessfullyData = new MutableLiveData<>();
|
||||
|
||||
public void getPhoneCode() {
|
||||
NetInterfaceManager.getInstance().getLogoutCodeObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("ExitCodeVM", "getPhoneCode onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse baseResponse) {
|
||||
Log.e("ExitCodeVM", "getPhoneCode onNext: ");
|
||||
mSentSuccessfullyData.setValue(baseResponse.code == 200);
|
||||
Toaster.show(baseResponse.msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("ExitCodeVM", "getPhoneCode onError: " + e.getMessage());
|
||||
mSentSuccessfullyData.setValue(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("ExitCodeVM", "getPhoneCode onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public MutableLiveData<Boolean> mExitSuccessData = new MutableLiveData<>();
|
||||
|
||||
public void codeExit(String code) {
|
||||
NetInterfaceManager.getInstance().getLogoutObservable(code)
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("ExitCodeVM", "codeExit onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse baseResponse) {
|
||||
Log.e("ExitCodeVM", "codeExit onNext: " + baseResponse);
|
||||
if (baseResponse.code == 200) {
|
||||
// 验证成功,清除登录状态
|
||||
mMMKV.encode(CommonConfig.ACCOUNT_LOGIN_STATU, 0);
|
||||
mMMKV.encode(CommonConfig.ACCOUNT_LOGIN_TOKEN, "");
|
||||
mMMKV.encode(CommonConfig.ACCOUNT_LOGIN_MOBILE, "");
|
||||
mMMKV.encode(CommonConfig.ACCOUNT_LOGIN_ID, "");
|
||||
mMMKV.encode(CommonConfig.ACCOUNT_DEVICE_ID, "");
|
||||
mMMKV.encode(CommonConfig.ACCOUNT_DEVICE_SN, "");
|
||||
// Toaster.show("验证成功");
|
||||
mExitSuccessData.setValue(true);
|
||||
} else {
|
||||
Toaster.show(baseResponse.msg);
|
||||
mExitSuccessData.setValue(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("ExitCodeVM", "codeExit onError: " + e.getMessage());
|
||||
mExitSuccessData.setValue(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("ExitCodeVM", "codeExit onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -412,6 +412,12 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
|
||||
// mViewModel.getOauthToken();
|
||||
// mViewModel.getAnswerControlStatus();
|
||||
// mViewModel.getPublicIp();
|
||||
|
||||
// if (!mMMKV.decodeBool(CommonConfig.SET_WALLPAPER, false)) {
|
||||
// boolean successful = JgyUtils.getInstance().setSystemWallpaperBoth(R.drawable.mine_wallpaper);
|
||||
// Log.d(TAG, "initData: setSystemWallpaperBoth = " + successful);
|
||||
// mMMKV.encode(CommonConfig.SET_WALLPAPER, successful);
|
||||
// }
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
@@ -716,25 +722,25 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
|
||||
|
||||
private void setDisallowUninstall() {
|
||||
Observable.create((ObservableOnSubscribe<Integer>) emitter -> {
|
||||
Log.e("setDisallowUninstall", "subscribe: ");
|
||||
Log.e("setDisallowUninstall", "subscribe: ");
|
||||
// //强制激活设备管理器
|
||||
// AdminManager.getInstance().setForcedActiveDeviceAdmin();
|
||||
// 添加阻止某应用被卸载名单
|
||||
AdminManager.getInstance().addDisallowedUninstallPackages(forceAppList);
|
||||
Log.e(TAG, "setDisallowUninstall: getDisallowedUninstallPackageList: " + AdminManager.getInstance().getDisallowedUninstallPackageList());
|
||||
// 添加保持某应用始终运行名单
|
||||
AdminManager.getInstance().addPersistentApp(mPersistentApp);
|
||||
Log.e(TAG, "setDisallowUninstall: getPersistentApp: " + AdminManager.getInstance().getPersistentApp());
|
||||
//设置可信任应用列表
|
||||
AdminManager.getInstance().removeSuperTrustListForHwSystemManger(AdminManager.getInstance().getSuperTrustListForHwSystemManger());
|
||||
// TODO: 2026/1/13 有闪退但是没有报错信息
|
||||
// 添加阻止某应用被卸载名单
|
||||
AdminManager.getInstance().addDisallowedUninstallPackages(forceAppList);
|
||||
Log.e(TAG, "setDisallowUninstall: getDisallowedUninstallPackageList: " + AdminManager.getInstance().getDisallowedUninstallPackageList());
|
||||
// 添加保持某应用始终运行名单
|
||||
AdminManager.getInstance().addPersistentApp(mPersistentApp);
|
||||
Log.e(TAG, "setDisallowUninstall: getPersistentApp: " + AdminManager.getInstance().getPersistentApp());
|
||||
//设置可信任应用列表
|
||||
AdminManager.getInstance().removeSuperTrustListForHwSystemManger(AdminManager.getInstance().getSuperTrustListForHwSystemManger());
|
||||
// TODO: 2026/1/13 有闪退但是没有报错信息
|
||||
// AdminManager.getInstance().setSuperTrustListForHwSystemManger(forceAppList);
|
||||
Log.e(TAG, "setDisallowUninstall: getSuperTrustListForHwSystemManger = " + AdminManager.getInstance().getSuperTrustListForHwSystemManger());
|
||||
Log.e(TAG, "setDisallowUninstall: getSuperTrustListForHwSystemManger = " + AdminManager.getInstance().getSuperTrustListForHwSystemManger());
|
||||
// AdminManager.getInstance().addDisabledDeactivateMdmPackages(forceAppList);
|
||||
Log.e(TAG, "setDisallowUninstall: getSerial: " + Utils.getSerial(this));
|
||||
AdminManager.getInstance().addInstallPackageDefaultTrustList(ApkUtils.mJxwApps);
|
||||
emitter.onNext(1);
|
||||
}).subscribeOn(Schedulers.io())
|
||||
Log.e(TAG, "setDisallowUninstall: getSerial: " + Utils.getSerial(this));
|
||||
AdminManager.getInstance().addInstallPackageDefaultTrustList(ApkUtils.mJxwApps);
|
||||
emitter.onNext(1);
|
||||
}).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new io.reactivex.rxjava3.core.Observer<Integer>() {
|
||||
@Override
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.tencent.mmkv.MMKV;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.xwad.os.BuildConfig;
|
||||
import com.xwad.os.R;
|
||||
import com.xwad.os.base.mvvm.BaseViewModel;
|
||||
import com.xwad.os.bean.AppInfo;
|
||||
import com.xwad.os.bean.BaseResponse;
|
||||
@@ -54,77 +53,58 @@ public class HomeViewModel extends BaseViewModel<ActivityHomeBinding, ActivityEv
|
||||
public MutableLiveData<String> mGradleData = new MutableLiveData<>();
|
||||
|
||||
public void getSnInfo() {
|
||||
NetInterfaceManager.getInstance().getSnInfoControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<SnInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getSnInfo", "onSubscribe: ");
|
||||
}
|
||||
NetInterfaceManager.getInstance().getSnInfo(getLifecycle(), new NetInterfaceManager.ObserverCallback() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<SnInfo> snInfoBaseResponse) {
|
||||
Log.e("getSnInfo", "onNext: ");
|
||||
if (snInfoBaseResponse.code == 200) {
|
||||
SnInfo snInfo = snInfoBaseResponse.data;
|
||||
String old = mMMKV.decodeString(CommonConfig.UIUI_USER_GRADE_KEY, getCtx().getString(R.string.default_grade));
|
||||
String grade = snInfo.getGrade();
|
||||
SPUtils.setGrade(grade);
|
||||
// if (!old.equals(grade)) {
|
||||
// mMMKV.encode(CommonConfig.UIUI_USER_GRADE_KEY, grade);
|
||||
// Toaster.showLong("桌面调整,正在重启");
|
||||
// Utils.triggerRebirth(getCtx());
|
||||
// } else {
|
||||
// Log.e("getSnInfo", "onNext: not changed");
|
||||
// }
|
||||
mGradleData.setValue(grade);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onNext(BaseResponse response) {
|
||||
if (response.code == 200) {
|
||||
SnInfo snInfo = (SnInfo) response.data;
|
||||
String grade = snInfo.getGrade();
|
||||
SPUtils.setGrade(grade);
|
||||
mGradleData.setValue(grade);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getSnInfo", "onError: " + e.getMessage());
|
||||
}
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getSnInfo", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getSnInfo", "onComplete: ");
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public MutableLiveData<SystemSettings> mSystemSettingsMutableLiveData = new MutableLiveData<>();
|
||||
|
||||
public void getSystemSettings() {
|
||||
NetInterfaceManager.getInstance().getSettingControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<SystemSettings>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getSystemSettings", "onSubscribe: ");
|
||||
}
|
||||
NetInterfaceManager.getInstance().getSystemSettings(getLifecycle(), new NetInterfaceManager.ObserverCallback() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<SystemSettings> systemSettingsBaseResponse) {
|
||||
Log.e("getSystemSettings", "onNext: " + systemSettingsBaseResponse);
|
||||
if (systemSettingsBaseResponse.code == 200) {
|
||||
SystemSettings systemSettings = systemSettingsBaseResponse.data;
|
||||
mMMKV.encode(CommonConfig.APP_INSTALLATION, systemSettings.getSetting_other_appInstaller());
|
||||
mSystemSettingsMutableLiveData.setValue(systemSettings);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onNext(BaseResponse response) {
|
||||
if (response.code == 200) {
|
||||
SystemSettings systemSettings = (SystemSettings) response.data;
|
||||
mMMKV.encode(CommonConfig.APP_INSTALLATION, systemSettings.getSetting_other_appInstaller());
|
||||
mSystemSettingsMutableLiveData.setValue(systemSettings);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getSystemSettings", "onError: " + e.getMessage());
|
||||
}
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getSystemSettings", "onComplete: ");
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -51,73 +51,63 @@ public class MainViewModel extends BaseViewModel<ActivityMainBinding, ActivityEv
|
||||
public MutableLiveData<String> mGradleData = new MutableLiveData<>();
|
||||
|
||||
public void getSnInfo() {
|
||||
NetInterfaceManager.getInstance().getSnInfoControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<SnInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getSnInfo", "onSubscribe: ");
|
||||
}
|
||||
NetInterfaceManager.getInstance().getSnInfo(getLifecycle(), new NetInterfaceManager.ObserverCallback() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<SnInfo> snInfoBaseResponse) {
|
||||
Log.e("getSnInfo", "onNext: ");
|
||||
if (snInfoBaseResponse.code == 200) {
|
||||
SnInfo snInfo = snInfoBaseResponse.data;
|
||||
String old = mMMKV.decodeString(CommonConfig.UIUI_USER_GRADE_KEY, getCtx().getString(R.string.default_grade));
|
||||
if (!old.equals(snInfo.getGrade())) {
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_GRADE_KEY, snInfo.getGrade());
|
||||
Toaster.showLong("桌面调整,正在重启");
|
||||
Utils.triggerRebirth(getCtx());
|
||||
} else {
|
||||
Log.e("getSnInfo", "onNext: not changed");
|
||||
}
|
||||
mGradleData.setValue(snInfo.getGrade());
|
||||
}
|
||||
@Override
|
||||
public void onNext(BaseResponse response) {
|
||||
if (response.code == 200) {
|
||||
SnInfo snInfo = (SnInfo) response.data;
|
||||
String old = mMMKV.decodeString(CommonConfig.UIUI_USER_GRADE_KEY, getCtx().getString(R.string.default_grade));
|
||||
if (!old.equals(snInfo.getGrade())) {
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_GRADE_KEY, snInfo.getGrade());
|
||||
Toaster.showLong("桌面调整,正在重启");
|
||||
Utils.triggerRebirth(getCtx());
|
||||
} else {
|
||||
Log.e("getSnInfo", "onNext: not changed");
|
||||
}
|
||||
mGradleData.setValue(snInfo.getGrade());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getSnInfo", "onError: " + e.getMessage());
|
||||
}
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getSnInfo", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getSnInfo", "onComplete: ");
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public MutableLiveData<SystemSettings> mSystemSettingsMutableLiveData = new MutableLiveData<>();
|
||||
|
||||
public void getSystemSettings() {
|
||||
NetInterfaceManager.getInstance().getSettingControl()
|
||||
.subscribe(new Observer<BaseResponse<SystemSettings>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getSystemSettings", "onSubscribe: ");
|
||||
}
|
||||
NetInterfaceManager.getInstance().getSystemSettings(new NetInterfaceManager.ObserverCallback() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<SystemSettings> systemSettingsBaseResponse) {
|
||||
Log.e("getSystemSettings", "onNext: " + systemSettingsBaseResponse);
|
||||
if (systemSettingsBaseResponse.code == 200) {
|
||||
SystemSettings systemSettings = systemSettingsBaseResponse.data;
|
||||
mSystemSettingsMutableLiveData.setValue(systemSettings);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onNext(BaseResponse response) {
|
||||
if (response.code == 200) {
|
||||
SystemSettings systemSettings = (SystemSettings) response.data;
|
||||
mSystemSettingsMutableLiveData.setValue(systemSettings);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getSystemSettings", "onError: " + e.getMessage());
|
||||
}
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getSystemSettings", "onComplete: ");
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -41,31 +41,12 @@ public class UserViewModel extends BaseViewModel<ActivityUserBinding, ActivityEv
|
||||
public MutableLiveData<UserAvatarInfo> mUserAvatarInfoData = new MutableLiveData<>();
|
||||
|
||||
public void getUserAvatarInfo() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getUserAvatarInfoControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<UserAvatarInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getUserAvatarInfo", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<UserAvatarInfo> userAvatarInfoBaseResponse) {
|
||||
Log.e("getUserAvatarInfo", "onNext: " + userAvatarInfoBaseResponse);
|
||||
mUserAvatarInfoData.setValue(userAvatarInfoBaseResponse.data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getUserAvatarInfo", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getUserAvatarInfo", "onComplete: ");
|
||||
}
|
||||
});
|
||||
NetInterfaceManager.getInstance().getUserAvatarInfo(getLifecycle(), new NetInterfaceManager.UserAvatarInfoCallback() {
|
||||
@Override
|
||||
public void setUserAvatarInfo(UserAvatarInfo info) {
|
||||
mUserAvatarInfoData.setValue(info);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public MutableLiveData<AppInfo> mAppUpdateInfoData = new MutableLiveData<>();
|
||||
@@ -146,7 +127,7 @@ public class UserViewModel extends BaseViewModel<ActivityUserBinding, ActivityEv
|
||||
if (!ActivationUtil.getInstance().isLogin()) {
|
||||
return;
|
||||
}
|
||||
NetInterfaceManager.getInstance().getupdateAvatarObservable(params, multipartBody)
|
||||
NetInterfaceManager.getInstance().getUpdateAvatarObservable(params, multipartBody)
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.xwad.os.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class DesktopCustomInfo implements Serializable {
|
||||
private static final long serialVersionUID = -6331426739993694587L;
|
||||
|
||||
public String banner;
|
||||
public String top_tag_img;
|
||||
public String boot_animation;
|
||||
public String wallpaper;
|
||||
|
||||
public String getBanner() {
|
||||
return banner;
|
||||
}
|
||||
|
||||
public void setBanner(String banner) {
|
||||
this.banner = banner;
|
||||
}
|
||||
|
||||
public String getTop_tag_img() {
|
||||
return top_tag_img;
|
||||
}
|
||||
|
||||
public void setTop_tag_img(String top_tag_img) {
|
||||
this.top_tag_img = top_tag_img;
|
||||
}
|
||||
|
||||
public String getBoot_animation() {
|
||||
return boot_animation;
|
||||
}
|
||||
|
||||
public void setBoot_animation(String boot_animation) {
|
||||
this.boot_animation = boot_animation;
|
||||
}
|
||||
|
||||
public String getWallpaper() {
|
||||
return wallpaper;
|
||||
}
|
||||
|
||||
public void setWallpaper(String wallpaper) {
|
||||
this.wallpaper = wallpaper;
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class CommonConfig {
|
||||
public static final String AES_KEY = "xqdep8exnafpef3d";
|
||||
|
||||
public static final String LOCK_SCREEN_PASSWORD = "Iflytek_lockScreenPasswordKey";
|
||||
public static final String DEFAULT_PASSWORD = "666666";
|
||||
public static final String DEFAULT_PASSWORD = "260825";
|
||||
|
||||
public static final String SCREEN_LOCK_PWD = "screen_lock_passwd";
|
||||
public static final String SUPER_PASSWORD = "0728";
|
||||
@@ -167,4 +167,8 @@ public class CommonConfig {
|
||||
/*应用ID管控*/
|
||||
public final static String AOLE_ACTION_APP_FORBID_ARRAY = "DeselectViewArray";
|
||||
|
||||
/**
|
||||
* 是否已经设置了壁纸
|
||||
*/
|
||||
public static final String SET_WALLPAPER = "set_wallpaper_1";
|
||||
}
|
||||
+2
-5
@@ -126,17 +126,14 @@ public class LoginStatuDialogFragment extends BaseMvvmDialogFragment<LoginStatuV
|
||||
//
|
||||
// }
|
||||
// }).show(getChildFragmentManager(), "LogoutDialogFragment");
|
||||
|
||||
mMMKV.encode(CommonConfig.ACCOUNT_LOGIN_STATU, 0);
|
||||
mMMKV.remove(CommonConfig.ACCOUNT_LOGIN_TOKEN);
|
||||
mMMKV.remove(CommonConfig.ACCOUNT_LOGIN_MOBILE);
|
||||
mMMKV.remove(CommonConfig.ACCOUNT_LOGIN_ID);
|
||||
dismiss();
|
||||
if (mClickCallback != null) {
|
||||
mClickCallback.onLoginOut();
|
||||
}
|
||||
}
|
||||
|
||||
public void changePasswd(View view) {
|
||||
dismiss();
|
||||
new PasswdDialogFragment(new PasswdDialogFragment.ClickCallback() {
|
||||
@Override
|
||||
public void onCodeLoginClick() {
|
||||
|
||||
@@ -1,28 +1,19 @@
|
||||
package com.xwad.os.fragment.mine;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.FragmentEvent;
|
||||
import com.xwad.os.base.mvvm.BaseViewModel;
|
||||
import com.xwad.os.bean.BaseResponse;
|
||||
import com.xwad.os.bean.SnInfo;
|
||||
import com.xwad.os.bean.UserAvatarInfo;
|
||||
import com.xwad.os.config.CommonConfig;
|
||||
import com.xwad.os.databinding.FragmentMineBinding;
|
||||
import com.xwad.os.network.NetInterfaceManager;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class MineViewModel extends BaseViewModel<FragmentMineBinding, FragmentEvent> {
|
||||
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
@Override
|
||||
public FragmentMineBinding getVDBinding() {
|
||||
return binding;
|
||||
@@ -36,69 +27,36 @@ public class MineViewModel extends BaseViewModel<FragmentMineBinding, FragmentEv
|
||||
public MutableLiveData<UserAvatarInfo> mUserAvatarInfoData = new MutableLiveData<>();
|
||||
|
||||
public void getUserAvatarInfo() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getUserAvatarInfoControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<UserAvatarInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getUserAvatarInfo", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<UserAvatarInfo> userAvatarInfoBaseResponse) {
|
||||
Log.e("getUserAvatarInfo", "onNext: " + userAvatarInfoBaseResponse);
|
||||
mUserAvatarInfoData.setValue(userAvatarInfoBaseResponse.data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getUserAvatarInfo", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getUserAvatarInfo", "onComplete: ");
|
||||
}
|
||||
});
|
||||
NetInterfaceManager.getInstance().getUserAvatarInfoFragment(getLifecycle(), new NetInterfaceManager.UserAvatarInfoCallback() {
|
||||
@Override
|
||||
public void setUserAvatarInfo(UserAvatarInfo info) {
|
||||
mUserAvatarInfoData.setValue(info);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public MutableLiveData<SnInfo> mSnInfoData = new MutableLiveData<>();
|
||||
|
||||
public void getSnInfo() {
|
||||
NetInterfaceManager.getInstance().getSnInfoControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<SnInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getSnInfo", "onSubscribe: ");
|
||||
}
|
||||
NetInterfaceManager.getInstance().getSnInfoFragment(getLifecycle(), new NetInterfaceManager.ObserverCallback() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<SnInfo> snInfoBaseResponse) {
|
||||
Log.e("getSnInfo", "onNext: " + snInfoBaseResponse);
|
||||
if (snInfoBaseResponse.code == 200) {
|
||||
mSnInfoData.setValue(snInfoBaseResponse.data);
|
||||
SnInfo snInfo = snInfoBaseResponse.data;
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_GENDER_KEY, snInfo.getSex());
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_NAME_KEY, snInfo.getSn_name());
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_SCHOOL_KEY, snInfo.getSchool());
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_GRADE_KEY, snInfo.getGrade());
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_CLASS_KEY, snInfo.getClass_name());
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_AVATAR_KEY, snInfo.getGrade());
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_MOBILE_KEY, snInfo.getMobile());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onNext(BaseResponse response) {
|
||||
if (response.code == 200) {
|
||||
mSnInfoData.setValue((SnInfo) response.data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getSnInfo", "onError: ");
|
||||
}
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getSnInfo", "onComplete: ");
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import com.tencent.mmkv.MMKV;
|
||||
import com.xwad.os.R;
|
||||
import com.xwad.os.activity.activation.ActivationActivity;
|
||||
import com.xwad.os.activity.download.DownloadActivity;
|
||||
import com.xwad.os.activity.exit.ExitCodeActivity;
|
||||
import com.xwad.os.activity.login.LoginActivity;
|
||||
import com.xwad.os.base.mvvm.fragment.BaseMvvmFragment;
|
||||
import com.xwad.os.bean.UserInfo;
|
||||
@@ -148,6 +149,31 @@ public class AccountFragment extends BaseMvvmFragment<AccountViewModel, Fragment
|
||||
}
|
||||
});
|
||||
|
||||
private ActivityResultLauncher<Intent> mLoginOutLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() {
|
||||
@Override
|
||||
public void onActivityResult(ActivityResult result) {
|
||||
Log.e(TAG, "onActivityResult: mLoginLauncher = " + result);
|
||||
if (result != null) {
|
||||
Intent intent = result.getData();
|
||||
if (intent != null && result.getResultCode() == Activity.RESULT_OK) {
|
||||
mMMKV.encode(CommonConfig.ACCOUNT_LOGIN_STATU, 0);
|
||||
mMMKV.remove(CommonConfig.ACCOUNT_LOGIN_TOKEN);
|
||||
mMMKV.remove(CommonConfig.ACCOUNT_LOGIN_MOBILE);
|
||||
mMMKV.remove(CommonConfig.ACCOUNT_LOGIN_ID);
|
||||
|
||||
mViewDataBinding.setUserInfo(null);
|
||||
mLoginStatu = 0;
|
||||
mViewDataBinding.tvPhone.setText("点击登录");
|
||||
mViewDataBinding.tvVipName.setText("普通会员");
|
||||
mViewDataBinding.tvVipStatu.setText("点击购买激活");
|
||||
mLoginStatuDialogFragment.dismiss();
|
||||
|
||||
Toaster.show("退出成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
private void getLocalLoginInfo() {
|
||||
mLoginStatu = mMMKV.decodeInt(CommonConfig.ACCOUNT_LOGIN_STATU, 0);
|
||||
|
||||
@@ -192,13 +218,7 @@ public class AccountFragment extends BaseMvvmFragment<AccountViewModel, Fragment
|
||||
mLoginStatuDialogFragment = new LoginStatuDialogFragment(new LoginStatuDialogFragment.ClickCallback() {
|
||||
@Override
|
||||
public void onLoginOut() {
|
||||
mViewDataBinding.setUserInfo(null);
|
||||
mLoginStatu = 0;
|
||||
mViewDataBinding.tvPhone.setText("点击登录");
|
||||
mViewDataBinding.tvVipName.setText("普通会员");
|
||||
mViewDataBinding.tvVipStatu.setText("点击购买激活");
|
||||
mLoginStatuDialogFragment.dismiss();
|
||||
Toaster.show("退出成功");
|
||||
mLoginOutLauncher.launch(new Intent(mContext, ExitCodeActivity.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.xwad.os.fragment.usercenter.device;
|
||||
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
@@ -12,6 +15,10 @@ import com.xwad.os.bean.BaseResponse;
|
||||
import com.xwad.os.databinding.FragmentDeviceBinding;
|
||||
import com.xwad.os.network.NetInterfaceManager;
|
||||
import com.xwad.os.utils.ApkUtils;
|
||||
import com.xwad.os.utils.FileUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
@@ -64,6 +71,65 @@ public class DeviceViewModel extends BaseViewModel<FragmentDeviceBinding, Fragme
|
||||
});
|
||||
}
|
||||
|
||||
public void getTestApp() {
|
||||
NetInterfaceManager.getInstance().getTestAppObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<List<AppInfo>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getTestApp", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<AppInfo>> listBaseResponse) {
|
||||
Log.e("getTestApp", "onNext: " + listBaseResponse);
|
||||
if (listBaseResponse.code == 200) {
|
||||
List<AppInfo> appInfos = listBaseResponse.data;
|
||||
PackageManager pm = getCtx().getPackageManager();
|
||||
appInfos.forEach(new Consumer<AppInfo>() {
|
||||
@Override
|
||||
public void accept(AppInfo appInfo) {
|
||||
String packages = appInfo.getApp_package();
|
||||
long app_version_code = appInfo.getApp_version_code();
|
||||
PackageInfo packageInfo = null;
|
||||
try {
|
||||
packageInfo = pm.getPackageInfo(packages, 0);
|
||||
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (packageInfo != null) {
|
||||
long appVersionCode;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
appVersionCode = packageInfo.getLongVersionCode();
|
||||
} else {
|
||||
appVersionCode = packageInfo.versionCode;
|
||||
}
|
||||
if (app_version_code > appVersionCode) {
|
||||
FileUtils.ariaDownload(getCtx(), appInfo.getApp_url(), appInfo);
|
||||
} else {
|
||||
Log.e("getTestApp", "intallApk: " + packages + " is up to date");
|
||||
}
|
||||
} else {
|
||||
FileUtils.ariaDownload(getCtx(), appInfo.getApp_url(), appInfo);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getTestApp", "onError: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getTestApp", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void checkStoreUpdate(String pkg) {
|
||||
NetInterfaceManager.getInstance().getUpdateObservable(pkg)
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||
|
||||
@@ -2,27 +2,24 @@ package com.xwad.os.fragment.usercenter.info;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.FragmentEvent;
|
||||
import com.xwad.os.base.mvvm.BaseViewModel;
|
||||
import com.xwad.os.bean.BaseResponse;
|
||||
import com.xwad.os.bean.SnInfo;
|
||||
import com.xwad.os.config.CommonConfig;
|
||||
import com.xwad.os.databinding.FragmentInfoBinding;
|
||||
import com.xwad.os.network.NetInterfaceManager;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class InfoViewModel extends BaseViewModel<FragmentInfoBinding, FragmentEvent> {
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
@Override
|
||||
public FragmentInfoBinding getVDBinding() {
|
||||
@@ -37,40 +34,26 @@ public class InfoViewModel extends BaseViewModel<FragmentInfoBinding, FragmentEv
|
||||
public MutableLiveData<SnInfo> mSnInfoData = new MutableLiveData<>();
|
||||
|
||||
public void getSnInfo() {
|
||||
NetInterfaceManager.getInstance().getSnInfoControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<SnInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getSnInfo", "onSubscribe: ");
|
||||
}
|
||||
NetInterfaceManager.getInstance().getSnInfoFragment(getLifecycle(), new NetInterfaceManager.ObserverCallback() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<SnInfo> snInfoBaseResponse) {
|
||||
Log.e("getSnInfo", "onNext: " + snInfoBaseResponse);
|
||||
if (snInfoBaseResponse.code == 200) {
|
||||
mSnInfoData.setValue(snInfoBaseResponse.data);
|
||||
SnInfo snInfo = snInfoBaseResponse.data;
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_GENDER_KEY, snInfo.getSex());
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_NAME_KEY, snInfo.getSn_name());
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_SCHOOL_KEY, snInfo.getSchool());
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_GRADE_KEY, snInfo.getGrade());
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_CLASS_KEY, snInfo.getClass_name());
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_AVATAR_KEY, snInfo.getGrade());
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_MOBILE_KEY, snInfo.getMobile());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onNext(BaseResponse response) {
|
||||
if (response.code == 200) {
|
||||
mSnInfoData.setValue((SnInfo) response.data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getSnInfo", "onError: ");
|
||||
}
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getSnInfo", "onComplete: ");
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public MutableLiveData<Boolean> mSuccessfulData = new MutableLiveData<>();
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.xwad.os.bean.SystemSettings;
|
||||
import com.xwad.os.config.CommonConfig;
|
||||
import com.xwad.os.gson.GsonUtils;
|
||||
import com.xwad.os.mdm.AdminManager;
|
||||
import com.xwad.os.utils.ActivationUtil;
|
||||
import com.xwad.os.utils.JgyUtils;
|
||||
import com.xwad.os.utils.TimeUtils;
|
||||
|
||||
@@ -825,7 +826,9 @@ public class ControlManager {
|
||||
|
||||
public void setDeviceRecover(int status) {
|
||||
Log.e(TAG, "setDeviceRecover: " + status);
|
||||
AdminManager.getInstance().setRestoreFactoryDisabled(status);
|
||||
if (ActivationUtil.getInstance().isLogin()) {
|
||||
AdminManager.getInstance().setRestoreFactoryDisabled(status);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTopNotify(int status) {
|
||||
|
||||
@@ -356,8 +356,10 @@ public class AdminManager {
|
||||
uninstallPackage("com.honor.quickgamecenter");
|
||||
uninstallPackage("com.baidu.homework");
|
||||
uninstallPackage("com.xueersi.abczone");
|
||||
uninstallPackage("com.hihonor.phoneservice");
|
||||
uninstallPackage("com.hihonor.gamecenter");
|
||||
|
||||
// addDisallowedRunningApp("com.hihonor.appmarket");
|
||||
addDisallowedRunningApp("com.hihonor.appmarket");
|
||||
addDisallowedRunningApp("com.hihonor.baidu.browser");
|
||||
addDisallowedRunningApp("com.huawei.android.findmyphone");
|
||||
addDisallowedRunningApp("com.hihonor.phoneservice");
|
||||
@@ -367,6 +369,7 @@ public class AdminManager {
|
||||
addDisallowedRunningApp("com.huawei.android.thememanager");
|
||||
addDisallowedRunningApp("com.huawei.wallet");
|
||||
addDisallowedRunningApp("com.hihonor.popularapps");
|
||||
addDisallowedRunningApp("com.hihonor.parentcontrol");
|
||||
|
||||
emitter.onNext(0);
|
||||
}
|
||||
|
||||
@@ -6,14 +6,19 @@ 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.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.SimpleTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
@@ -29,6 +34,7 @@ import com.xwad.os.bean.AppInfo;
|
||||
import com.xwad.os.bean.AppUploadInfo;
|
||||
import com.xwad.os.bean.BaseResponse;
|
||||
import com.xwad.os.bean.CodeBean;
|
||||
import com.xwad.os.bean.DesktopCustomInfo;
|
||||
import com.xwad.os.bean.GuideBean;
|
||||
import com.xwad.os.bean.HomeworkBean;
|
||||
import com.xwad.os.bean.LessonApp;
|
||||
@@ -57,6 +63,7 @@ import com.xwad.os.network.api.AlarmClockApi;
|
||||
import com.xwad.os.network.api.AppApi;
|
||||
import com.xwad.os.network.api.AppIconApi;
|
||||
import com.xwad.os.network.api.AppUsageRecordApi;
|
||||
import com.xwad.os.network.api.DesktopCustomApi;
|
||||
import com.xwad.os.network.api.FilesApi;
|
||||
import com.xwad.os.network.api.GetWhoisApi;
|
||||
import com.xwad.os.network.api.HomeworkApi;
|
||||
@@ -147,82 +154,56 @@ public class NetInterfaceManager {
|
||||
private NetInterfaceManager(Context context) {
|
||||
this.mContext = context;
|
||||
this.mCacheHelper = new CacheHelper(context);
|
||||
|
||||
if (mOkHttpClient == null) {
|
||||
//如果无法生存缓存文件目录,检测权限使用已经加上,检测手机是否把文件读写权限禁止了
|
||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||
builder.connectTimeout(TIME_OUT, TimeUnit.SECONDS); // 设置连接超时时间
|
||||
builder.writeTimeout(TIME_OUT, TimeUnit.SECONDS);// 设置写入超时时间
|
||||
builder.readTimeout(TIME_OUT, TimeUnit.SECONDS);// 设置读取数据超时时间
|
||||
builder.retryOnConnectionFailure(true);// 设置进行连接失败重试
|
||||
builder.addInterceptor(new RepeatRequestInterceptor());
|
||||
|
||||
// 设置缓存文件路径
|
||||
Cache cache = new Cache(new File(Utils.getCacheDir(mContext) + "/OkHttpCache"), CACHE_SIZE);
|
||||
builder.cache(cache);// 设置缓存
|
||||
mOkHttpClient = builder.build();
|
||||
mOkHttpClient = buildOkHttpClient();
|
||||
}
|
||||
|
||||
if (mRetrofit == null) {
|
||||
mRetrofit = new Retrofit.Builder()
|
||||
.client(mOkHttpClient)
|
||||
.baseUrl(UrlAddress.ROOT_URL)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
|
||||
.build();
|
||||
mRetrofit = buildRetrofit(mOkHttpClient, UrlAddress.ROOT_URL);
|
||||
}
|
||||
|
||||
if (mUiuiosOkHttpClient == null) {
|
||||
//如果无法生存缓存文件目录,检测权限使用已经加上,检测手机是否把文件读写权限禁止了
|
||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||
builder.connectTimeout(TIME_OUT, TimeUnit.SECONDS); // 设置连接超时时间
|
||||
builder.writeTimeout(TIME_OUT, TimeUnit.SECONDS);// 设置写入超时时间
|
||||
builder.readTimeout(TIME_OUT, TimeUnit.SECONDS);// 设置读取数据超时时间
|
||||
builder.retryOnConnectionFailure(true);// 设置进行连接失败重试
|
||||
builder.addInterceptor(new RepeatRequestInterceptor());
|
||||
|
||||
// 设置缓存文件路径
|
||||
Cache cache = new Cache(new File(Utils.getCacheDir(mContext) + "/OkHttpCache"), CACHE_SIZE);
|
||||
builder.cache(cache);// 设置缓存
|
||||
mUiuiosOkHttpClient = builder.build();
|
||||
mUiuiosOkHttpClient = buildOkHttpClient();
|
||||
}
|
||||
|
||||
if (mUiuiosRetrofit == null) {
|
||||
mUiuiosRetrofit = new Retrofit.Builder()
|
||||
.client(mUiuiosOkHttpClient)
|
||||
.baseUrl(UrlAddress.UIUIOS_ROOT_URL)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
|
||||
.build();
|
||||
mUiuiosRetrofit = buildRetrofit(mUiuiosOkHttpClient, UrlAddress.UIUIOS_ROOT_URL);
|
||||
}
|
||||
|
||||
if (mJxwOkHttpClient == null) {
|
||||
//如果无法生存缓存文件目录,检测权限使用已经加上,检测手机是否把文件读写权限禁止了
|
||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||
builder.connectTimeout(TIME_OUT, TimeUnit.SECONDS); // 设置连接超时时间
|
||||
builder.writeTimeout(TIME_OUT, TimeUnit.SECONDS);// 设置写入超时时间
|
||||
builder.readTimeout(TIME_OUT, TimeUnit.SECONDS);// 设置读取数据超时时间
|
||||
builder.retryOnConnectionFailure(true);// 设置进行连接失败重试
|
||||
builder.addInterceptor(new RepeatRequestInterceptor());
|
||||
|
||||
// 设置缓存文件路径
|
||||
Cache cache = new Cache(new File(Utils.getCacheDir(mContext) + "/OkHttpCache"), CACHE_SIZE);
|
||||
builder.cache(cache);// 设置缓存
|
||||
mJxwOkHttpClient = builder.build();
|
||||
mJxwOkHttpClient = buildOkHttpClient();
|
||||
}
|
||||
|
||||
if (mJxwRetrofit == null) {
|
||||
mJxwRetrofit = new Retrofit.Builder()
|
||||
.client(mJxwOkHttpClient)
|
||||
.baseUrl(UrlAddress.JXW_BASE_URL)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
|
||||
.build();
|
||||
mJxwRetrofit = buildRetrofit(mJxwOkHttpClient, UrlAddress.JXW_BASE_URL);
|
||||
}
|
||||
|
||||
mUploadIconPkgs = mMMKV.decodeStringSet(uploadIconPkgsKey, new HashSet<>());
|
||||
Log.e("init", "NetInterfaceManager: mUploadIconPkgs = " + mUploadIconPkgs);
|
||||
}
|
||||
|
||||
private OkHttpClient buildOkHttpClient() {
|
||||
//如果无法生存缓存文件目录,检测权限使用已经加上,检测手机是否把文件读写权限禁止了
|
||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||
builder.connectTimeout(TIME_OUT, TimeUnit.SECONDS); // 设置连接超时时间
|
||||
builder.writeTimeout(TIME_OUT, TimeUnit.SECONDS);// 设置写入超时时间
|
||||
builder.readTimeout(TIME_OUT, TimeUnit.SECONDS);// 设置读取数据超时时间
|
||||
builder.retryOnConnectionFailure(true);// 设置进行连接失败重试
|
||||
builder.addInterceptor(new RepeatRequestInterceptor());
|
||||
|
||||
// 设置缓存文件路径
|
||||
Cache cache = new Cache(new File(Utils.getCacheDir(mContext) + "/OkHttpCache"), CACHE_SIZE);
|
||||
builder.cache(cache);// 设置缓存
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private Retrofit buildRetrofit(OkHttpClient client, String baseUrl) {
|
||||
return new Retrofit.Builder()
|
||||
.client(client)
|
||||
.baseUrl(baseUrl)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印全局统一拦截添加的Http Headers
|
||||
* <p>
|
||||
@@ -353,6 +334,10 @@ public class NetInterfaceManager {
|
||||
return getApiService(AppIconApi.class);
|
||||
}
|
||||
|
||||
public DesktopCustomApi getDesktopCustomApi() {
|
||||
return getApiService(DesktopCustomApi.class);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
@@ -393,7 +378,7 @@ public class NetInterfaceManager {
|
||||
.updateUserInfo(getToken(), params, multipartBody));
|
||||
}
|
||||
|
||||
public Observable<BaseResponse> getupdateAvatarObservable(Map<String, RequestBody> params, MultipartBody.Part multipartBody) {
|
||||
public Observable<BaseResponse> getUpdateAvatarObservable(Map<String, RequestBody> params, MultipartBody.Part multipartBody) {
|
||||
return schedule(getSnInfoApi()
|
||||
.updateAvatar(getToken(), params, multipartBody));
|
||||
}
|
||||
@@ -475,6 +460,14 @@ public class NetInterfaceManager {
|
||||
return schedule(getLoginApi().newCodeLogin(mobile, code, AdminManager.getInstance().getSerial(), BuildConfig.APPLICATION_ID));
|
||||
}
|
||||
|
||||
public Observable<BaseResponse> getLogoutCodeObservable() {
|
||||
return schedule(getLoginApi().getLogoutCode(getToken()));
|
||||
}
|
||||
|
||||
public Observable<BaseResponse> getLogoutObservable(String code) {
|
||||
return schedule(getLoginApi().logout(getToken(), code));
|
||||
}
|
||||
|
||||
public Observable<BaseResponse> getUserLoginObservable(String mobile, String password) {
|
||||
return schedule(getLoginApi().userLogin(mobile, password, AdminManager.getInstance().getSerial()));
|
||||
}
|
||||
@@ -563,6 +556,11 @@ public class NetInterfaceManager {
|
||||
}
|
||||
|
||||
|
||||
public Observable<BaseResponse<DesktopCustomInfo>> getDesktopCustomInfoObservable() {
|
||||
return schedule(getDesktopCustomApi().getInfo(Utils.getSerial()));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* execution
|
||||
@@ -654,7 +652,7 @@ public class NetInterfaceManager {
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_SCHOOL_KEY, snInfo.getSchool());
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_GRADE_KEY, snInfo.getGrade());
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_CLASS_KEY, snInfo.getClass_name());
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_AVATAR_KEY, snInfo.getGrade());
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_AVATAR_KEY, snInfo.getAvatar());
|
||||
mMMKV.encode(CommonConfig.UIUI_USER_MOBILE_KEY, snInfo.getMobile());
|
||||
|
||||
} else if (code == 300) {
|
||||
@@ -699,6 +697,13 @@ public class NetInterfaceManager {
|
||||
.subscribe(getUserAvatarInfoObserver(callback));
|
||||
}
|
||||
|
||||
public void getUserAvatarInfoFragment(BehaviorSubject<FragmentEvent> lifecycle, UserAvatarInfoCallback callback) {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getUserAvatarInfoControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, FragmentEvent.DESTROY))
|
||||
.subscribe(getUserAvatarInfoObserver(callback));
|
||||
}
|
||||
|
||||
public void getUserAvatarInfo(UserAvatarInfoCallback callback) {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getUserAvatarInfoControl()
|
||||
@@ -771,7 +776,7 @@ public class NetInterfaceManager {
|
||||
}
|
||||
if (lessonAppBaseResponse.code == 200) {
|
||||
List<LessonApp.App> app = lessonAppBaseResponse.data.getApp();
|
||||
if (app != null || app.size() != 0) {
|
||||
if (app != null && app.size() != 0) {
|
||||
List<String> appList = app.stream().map(LessonApp.App::getApp_package).collect(Collectors.toList());
|
||||
String pkgs = String.join(",", appList);
|
||||
lessonJson.setPkgs(pkgs);
|
||||
@@ -1491,39 +1496,66 @@ public class NetInterfaceManager {
|
||||
};
|
||||
}
|
||||
|
||||
public void getSystemSettings(BehaviorSubject<ActivityEvent> lifecycle, ObserverCallback callback) {
|
||||
getSettingControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(getSystemSettingsObserver(callback));
|
||||
}
|
||||
|
||||
public void getSystemSettings(ObserverCallback callback) {
|
||||
getSettingControl()
|
||||
.subscribe(getSystemSettingsObserver(callback));
|
||||
}
|
||||
|
||||
public void getSystemSettings() {
|
||||
getSettingControl()
|
||||
.subscribe(new Observer<BaseResponse<SystemSettings>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getSystemSettings", "onSubscribe: ");
|
||||
}
|
||||
.subscribe(getSystemSettingsObserver(null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<SystemSettings> baseresponse) {
|
||||
Log.e("getSystemSettings", "onNext: " + baseresponse);
|
||||
int code = baseresponse.code;
|
||||
if (code == 200) {
|
||||
String data = new Gson().toJson(baseresponse.data);
|
||||
ControlManager.getInstance().setSystemSetting(data);
|
||||
mCacheHelper.put(UrlAddress.GET_SETTINGS, GsonUtils.toJSONString(baseresponse.data));
|
||||
} else {
|
||||
ControlManager.getInstance().setDisableSetting();
|
||||
mCacheHelper.put(UrlAddress.GET_SETTINGS, "");
|
||||
}
|
||||
}
|
||||
private Observer<BaseResponse<SystemSettings>> getSystemSettingsObserver(ObserverCallback callback) {
|
||||
return new Observer<BaseResponse<SystemSettings>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getSystemSettings", "onSubscribe: ");
|
||||
if (callback != null) {
|
||||
callback.onSubscribe(d);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getSystemSettings", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<SystemSettings> baseresponse) {
|
||||
Log.e("getSystemSettings", "onNext: " + baseresponse);
|
||||
if (callback != null) {
|
||||
callback.onNext(baseresponse);
|
||||
}
|
||||
int code = baseresponse.code;
|
||||
if (code == 200) {
|
||||
String data = new Gson().toJson(baseresponse.data);
|
||||
ControlManager.getInstance().setSystemSetting(data);
|
||||
mCacheHelper.put(UrlAddress.GET_SETTINGS, GsonUtils.toJSONString(baseresponse.data));
|
||||
} else {
|
||||
ControlManager.getInstance().setDisableSetting();
|
||||
mCacheHelper.put(UrlAddress.GET_SETTINGS, "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getSystemSettings", "onComplete: ");
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getSystemSettings", "onError: " + e.getMessage());
|
||||
if (callback != null) {
|
||||
callback.onError(e);
|
||||
}
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getSystemSettings", "onComplete: ");
|
||||
if (callback != null) {
|
||||
callback.onComplete();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public interface AppIconCallback {
|
||||
@@ -1589,4 +1621,46 @@ public class NetInterfaceManager {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void getDesktopCustomInfo(BehaviorSubject<ActivityEvent> lifecycle, OnCompleteCallback callback) {
|
||||
getDesktopCustomInfoObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<DesktopCustomInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e(TAG, "getDesktopCustom onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<DesktopCustomInfo> baseResponse) {
|
||||
Log.e(TAG, "getDesktopCustom onNext: " + baseResponse);
|
||||
if (baseResponse.code == 200) {
|
||||
DesktopCustomInfo desktopCustomInfo = baseResponse.data;
|
||||
if (desktopCustomInfo != null && !TextUtils.isEmpty(desktopCustomInfo.getWallpaper())) {
|
||||
Glide.with(mContext)
|
||||
.asBitmap()
|
||||
.load(desktopCustomInfo.getWallpaper())
|
||||
.into(new SimpleTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
boolean success = JgyUtils.getInstance().setSystemLockWallpaper(resource);
|
||||
Log.e(TAG, "getDesktopCustom setSystemLockWallpaper: " + success);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e(TAG, "getDesktopCustom onError: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e(TAG, "getDesktopCustom onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,6 +15,10 @@ public class UrlAddress {
|
||||
public final static String NEW_CODE_LOGIN = "login/new-login";
|
||||
/*账号密码登录*/
|
||||
public final static String USER_LOGIN = "login/user-login";
|
||||
/*发送退出登录验证码*/
|
||||
public final static String GET_LOGOUT_CODE = "user/get-logout-code";
|
||||
/*退出登录(输入验证码后请求这个)*/
|
||||
public final static String LOGOUT = "login/logout";
|
||||
|
||||
|
||||
/*用户会员信息(用于判断是否有VIP)*/
|
||||
@@ -59,6 +63,7 @@ public class UrlAddress {
|
||||
public static final String UPLOAD_APP_IMG = "collectData/uploadAppImg";
|
||||
/*获取应用库是否有图标*/
|
||||
public static final String GET_IS_APP_IMG = "collectData/getIsAppImg";
|
||||
public static final String DESKTOP_CUSTOM_INFO = "desktop-custom/info";
|
||||
|
||||
/*设备信息接口*/
|
||||
public static final String SNINFO = "sn/getSnInfo";
|
||||
@@ -83,8 +88,6 @@ public class UrlAddress {
|
||||
public static final String UPLOAD_CONTROL_SCREENSHOT = "sn/uploadControlScreenshot";
|
||||
|
||||
|
||||
|
||||
|
||||
/*获取统计*/
|
||||
public static final String GET_STUDY_STAT = "Sn/getStudyStat";
|
||||
/*上传地址信息*/
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.xwad.os.network.api;
|
||||
|
||||
import com.xwad.os.bean.BaseResponse;
|
||||
import com.xwad.os.bean.DesktopCustomInfo;
|
||||
import com.xwad.os.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface DesktopCustomApi {
|
||||
@GET(UrlAddress.DESKTOP_CUSTOM_INFO)
|
||||
Observable<BaseResponse<DesktopCustomInfo>> getInfo(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Header;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
@@ -41,4 +42,16 @@ public interface LoginApi {
|
||||
@Field("sn") String sn,
|
||||
@Field("desktop_package") String desktop_package
|
||||
);
|
||||
|
||||
@GET(UrlAddress.GET_LOGOUT_CODE)
|
||||
Observable<BaseResponse> getLogoutCode(
|
||||
@Header("token") String token
|
||||
);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(UrlAddress.LOGOUT)
|
||||
Observable<BaseResponse> logout(
|
||||
@Header("token") String token,
|
||||
@Field("code") String code
|
||||
);
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public class DownloadService extends Service {
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID)
|
||||
.setSmallIcon(R.mipmap.ic_launcher)
|
||||
.setContentTitle("学习超人365正在运行")
|
||||
.setContentTitle("双系统学习管理中心正在运行")
|
||||
// .setContentText("测试内容")
|
||||
.setAutoCancel(false)
|
||||
.setShowWhen(false)
|
||||
|
||||
@@ -65,6 +65,8 @@ public class MainSContact {
|
||||
void getSystemSettings();
|
||||
/*获取锁屏密码*/
|
||||
void getLockScreenPwd();
|
||||
|
||||
void getDesktopCustomInfo();
|
||||
}
|
||||
|
||||
public interface MainSView extends BaseView {
|
||||
@@ -99,5 +101,8 @@ public class MainSContact {
|
||||
void setAppNetwork();
|
||||
void setSystemSettings();
|
||||
void setLockScreenPwd();
|
||||
|
||||
void getDesktopCustomInfoFinish();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -520,5 +520,15 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDesktopCustomInfo() {
|
||||
NetInterfaceManager.getInstance().getDesktopCustomInfo(lifecycle, new NetInterfaceManager.OnCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.getDesktopCustomInfoFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -156,7 +156,7 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
|
||||
mPresenter.get365Admin();
|
||||
mPresenter.getSystemSettings();
|
||||
mPresenter.getLockScreenPwd();
|
||||
|
||||
mPresenter.getDesktopCustomInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -212,7 +212,7 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID)
|
||||
.setSmallIcon(R.mipmap.ic_launcher)
|
||||
.setContentTitle("学习超人365正在运行")
|
||||
.setContentTitle("双系统学习管理中心正在运行")
|
||||
// .setContentText("测试内容")
|
||||
.setAutoCancel(false)
|
||||
.setShowWhen(false)
|
||||
@@ -446,4 +446,10 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDesktopCustomInfoFinish() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.xwad.os.utils;
|
||||
|
||||
import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.ActivityTaskManager;
|
||||
import android.app.WallpaperManager;
|
||||
import android.app.role.RoleManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentResolver;
|
||||
@@ -16,6 +19,8 @@ import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.media.AudioManager;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
@@ -69,8 +74,6 @@ import io.reactivex.rxjava3.core.ObservableOnSubscribe;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE;
|
||||
|
||||
public class JgyUtils {
|
||||
private static final String TAG = "JgyUtils";
|
||||
|
||||
@@ -1084,6 +1087,128 @@ public class JgyUtils {
|
||||
mContext.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置系统桌面壁纸(主屏幕),通过资源 ID
|
||||
*/
|
||||
public boolean setSystemWallpaper(int resId) {
|
||||
try {
|
||||
WallpaperManager manager = WallpaperManager.getInstance(mContext);
|
||||
if (manager == null) {
|
||||
return false;
|
||||
}
|
||||
manager.setResource(resId);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置系统桌面壁纸(主屏幕),通过 Bitmap
|
||||
*/
|
||||
public boolean setSystemWallpaper(Bitmap bitmap) {
|
||||
if (bitmap == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
WallpaperManager manager = WallpaperManager.getInstance(mContext);
|
||||
if (manager == null) {
|
||||
return false;
|
||||
}
|
||||
manager.setBitmap(bitmap);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置系统桌面壁纸(主屏幕),通过图片文件绝对路径
|
||||
*/
|
||||
public boolean setSystemWallpaper(String filePath) {
|
||||
if (filePath == null || filePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
Bitmap bitmap = BitmapFactory.decodeFile(filePath);
|
||||
if (bitmap == null) {
|
||||
return false;
|
||||
}
|
||||
boolean result = setSystemWallpaper(bitmap);
|
||||
bitmap.recycle();
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置系统锁屏壁纸(Android N 及以上支持,低版本回退到桌面壁纸)
|
||||
*/
|
||||
public boolean setSystemLockWallpaper(int resId) {
|
||||
try {
|
||||
WallpaperManager manager = WallpaperManager.getInstance(mContext);
|
||||
if (manager == null) {
|
||||
return false;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
manager.setResource(resId, WallpaperManager.FLAG_LOCK);
|
||||
} else {
|
||||
manager.setResource(resId);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置系统锁屏壁纸(Android N 及以上支持),通过 Bitmap
|
||||
*/
|
||||
public boolean setSystemLockWallpaper(Bitmap bitmap) {
|
||||
if (bitmap == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
WallpaperManager manager = WallpaperManager.getInstance(mContext);
|
||||
if (manager == null) {
|
||||
return false;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
manager.setBitmap(bitmap, null, true, WallpaperManager.FLAG_SYSTEM | WallpaperManager.FLAG_LOCK);
|
||||
} else {
|
||||
manager.setBitmap(bitmap);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 同时设置系统桌面与锁屏壁纸(Android N 及以上支持)
|
||||
*/
|
||||
public boolean setSystemWallpaperBoth(int resId) {
|
||||
try {
|
||||
WallpaperManager manager = WallpaperManager.getInstance(mContext);
|
||||
if (manager == null) {
|
||||
return false;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
// 使用按位或组合标志位
|
||||
int flags = WallpaperManager.FLAG_SYSTEM | WallpaperManager.FLAG_LOCK;
|
||||
manager.setResource(resId, flags);
|
||||
} else {
|
||||
manager.setResource(resId);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e(TAG, "setSystemWallpaperBoth: " + e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void getLauncherClassName(String pkg) {
|
||||
|
||||
}
|
||||
@@ -1300,7 +1425,7 @@ public class JgyUtils {
|
||||
mContext.startForegroundService(new Intent(mContext, MainService.class));
|
||||
// Log.e(TAG, "setDefault: startServices time = " + (System.currentTimeMillis() - time) + "ms");
|
||||
} else {
|
||||
mContext.startService(new Intent(mContext, MainService.class));
|
||||
mContext.startService(new Intent(mContext, MainService.class));
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.8 MiB |
@@ -14,7 +14,7 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/mine_wallpaper">
|
||||
android:background="@drawable/img_home_bg_0">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="18dp"
|
||||
|
||||
@@ -0,0 +1,243 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".activity.exit.ExitCodeActivity">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="com.xwad.os.activity.exit.ExitCodeActivity.BtnClick" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout18"
|
||||
android:layout_width="345dp"
|
||||
android:layout_height="206dp"
|
||||
android:background="@drawable/icon_logon_background"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingBottom="12dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="验证码退出系统"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:visibility="gone"
|
||||
android:layout_weight="1">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="32dp"
|
||||
android:background="@drawable/edit_background"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_phone"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_login_phone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view1"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:background="#cbdaee"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_phone"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_mobile"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="4dp"
|
||||
android:background="@null"
|
||||
android:hint="手机号"
|
||||
android:inputType="phone"
|
||||
android:textColor="@color/black"
|
||||
android:textColorHint="#cbdaee"
|
||||
android:textSize="11sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/view1"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="32dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/edit_background"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_sms"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_login_sms"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view2"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:background="#cbdaee"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_sms"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_code"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="4dp"
|
||||
android:background="@null"
|
||||
android:hint="验证码"
|
||||
android:inputType="number"
|
||||
android:textColor="@color/black"
|
||||
android:textColorHint="#cbdaee"
|
||||
android:textSize="11sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/view2"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_get_code"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:onClick="@{click::getCode}"
|
||||
android:singleLine="true"
|
||||
android:text="获取"
|
||||
android:textColor="@color/default_blue"
|
||||
android:textSize="11sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@+id/et_code"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="110dp"
|
||||
android:layout_height="25dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:onClick="@{click::codeExit}"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_activation_confirm"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="4dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="*输入已绑定手机号验证后方可退出系统"
|
||||
android:textColor="#9bb2cc"
|
||||
android:textSize="8sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
@@ -15,7 +15,7 @@
|
||||
android:id="@+id/ll_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/mine_wallpaper"
|
||||
android:background="@drawable/img_home_bg_0"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/mine_wallpaper">
|
||||
android:background="@drawable/img_home_bg_0">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/mine_wallpaper">
|
||||
android:background="@drawable/img_home_bg_0">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:visibility="visible"
|
||||
android:layout_marginTop="16dp">
|
||||
|
||||
<TextView
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -7,7 +7,7 @@
|
||||
<string name="unbind">未绑定</string>
|
||||
<string name="notset">未设置</string>
|
||||
<string name="device_unauthorized">设备未经授权</string>
|
||||
<string name="default_nickname">小学王</string>
|
||||
<string name="default_nickname">学习超人</string>
|
||||
<string name="default_grade">一年级</string>
|
||||
<string name="default_class">1班</string>
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
<item name="android:windowBackground">@drawable/mine_wallpaper</item>
|
||||
<item name="android:windowBackground">@drawable/img_home_bg_0</item>
|
||||
<item name="android:windowDisablePreview">false</item>
|
||||
</style>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<resources>
|
||||
|
||||
<!-- Your custom size defind by references, can be writted in anywhere, any module, any values/*.xml, for example: -->
|
||||
<dimen name="card_common_margin_left">@dimen/dp_15</dimen>
|
||||
<!-- <dimen name="card_common_margin_left">@dimen/dp_15</dimen>-->
|
||||
|
||||
<!-- dp and sp values, must be defind in this file! -->
|
||||
<!-- view size,you can add if there is no one -->
|
||||
@@ -15,7 +15,6 @@
|
||||
<dimen name="dp_m_5">-5dp</dimen>
|
||||
<dimen name="dp_m_2">-2dp</dimen>
|
||||
<dimen name="dp_m_1">-1dp</dimen>
|
||||
<dimen name="dp_0">0dp</dimen>
|
||||
<dimen name="dp_0_1">0.1dp</dimen>
|
||||
<dimen name="dp_0_5">0.5dp</dimen>
|
||||
<dimen name="dp_1">1dp</dimen>
|
||||
|
||||
Reference in new issue
Block a user