refactor(feature): 删除已废弃的 feature/main 与 feature/splash
MainActivity/MainViewModel/RestartFragment 与 SplashActivity 均未在清单中启用,HomeActivity 才是唯一启动页,整条链路为死代码;同步删除仅被其引用的布局与清单注释块。 验证::app:assembleOfficialZhanRuiRelease 编译通过。
This commit is contained in:
1 parent
bdbd97e113
commit
7ba07db63d
8 files changed
-1531
No files matched your search
@@ -99,16 +99,6 @@
|
||||
android:theme="@style/ImmerseTheme"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:replace="android:allowBackup">
|
||||
<!-- <activity-->
|
||||
<!-- android:name=".feature.main.MainActivity"-->
|
||||
<!-- android:launchMode="singleTask"-->
|
||||
<!-- android:screenOrientation="landscape">-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="android.intent.action.MAIN" />-->
|
||||
|
||||
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </activity>-->
|
||||
<activity
|
||||
android:name=".feature.home.HomeActivity"
|
||||
android:launchMode="singleTask">
|
||||
@@ -119,9 +109,6 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- <activity-->
|
||||
<!-- android:name=".feature.splash.SplashActivity"-->
|
||||
<!-- android:launchMode="singleTask" />-->
|
||||
<activity
|
||||
android:name=".feature.update.UpdateActivity"
|
||||
android:launchMode="singleTask"
|
||||
|
||||
@@ -1,479 +0,0 @@
|
||||
package com.fuying.sn.feature.main;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.IBinder;
|
||||
import android.os.SystemClock;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.blankj.utilcode.util.NetworkUtils;
|
||||
import com.fuying.sn.BuildConfig;
|
||||
import com.fuying.sn.R;
|
||||
import com.fuying.sn.core.base.mvvm.BaseMvvmActivity;
|
||||
import com.fuying.sn.core.common.config.CommonConfig;
|
||||
import com.fuying.sn.core.common.gson.GsonUtils;
|
||||
import com.fuying.sn.core.common.crypto.DebugPasswordVerifier;
|
||||
import com.fuying.sn.core.common.system.ReceiverCompat;
|
||||
import com.fuying.sn.core.common.ui.ToastUtil;
|
||||
import com.fuying.sn.core.common.device.DeviceIdUtils;
|
||||
import com.fuying.sn.core.common.device.HardwareInfoUtils;
|
||||
import com.fuying.sn.platform.app.AppProcessUtils;
|
||||
import com.fuying.sn.core.data.dto.AppInfo;
|
||||
import com.fuying.sn.core.data.dto.BaseResponse;
|
||||
import com.fuying.sn.core.data.dto.SnInfo;
|
||||
import com.fuying.sn.core.data.local.prefs.SPUtils;
|
||||
import com.fuying.sn.core.data.repository.DeviceRepository;
|
||||
import com.fuying.sn.databinding.ActivityMainBinding;
|
||||
|
||||
|
||||
import com.fuying.sn.feature.debug.UserDebugDialog;
|
||||
import com.fuying.sn.feature.qrcode.AppletQRCodeFragment;
|
||||
import com.fuying.sn.feature.qrcode.BaseFragmentPagerAdapter;
|
||||
import com.fuying.sn.feature.qrcode.QRCodeFragment;
|
||||
import com.fuying.sn.platform.control.ControlManager;
|
||||
import com.fuying.sn.platform.system.DeviceManager;
|
||||
import com.fuying.sn.platform.system.JgyUtils;
|
||||
import com.fuying.sn.platform.time.TimeUtils;
|
||||
import com.fuying.sn.runtime.service.DownloadService;
|
||||
import com.fuying.sn.runtime.service.ManagerService;
|
||||
import com.fuying.sn.runtime.service.SocketService;
|
||||
import com.fuying.sn.runtime.service.main.MainService;
|
||||
import com.fuying.sn.runtime.sync.AppUpdateCoordinator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.observers.DisposableObserver;
|
||||
|
||||
@Deprecated
|
||||
public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBinding> implements NetworkUtils.OnNetworkStatusChangedListener {
|
||||
private final DeviceRepository mRepository = DeviceRepository.getInstance();
|
||||
private final CompositeDisposable mDisposables = new CompositeDisposable();
|
||||
private static final String TAG = "MainActivity";
|
||||
|
||||
@Override
|
||||
public boolean setNightMode() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisconnected() {
|
||||
Log.e(TAG, "onDisconnected: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected(NetworkUtils.NetworkType networkType) {
|
||||
Log.e(TAG, "onConnected: ");
|
||||
mViewModel.getSnInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.activity_main;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<MainViewModel> getViewModelClass() {
|
||||
return MainViewModel.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDataBinding() {
|
||||
mViewDataBinding.setClick(new BtnClick());
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
public void initView() {
|
||||
HardwareInfoUtils.getAndroiodScreenProperty(this);
|
||||
|
||||
// Settings.Global.putInt(getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
|
||||
// Settings.Global.putInt(getContentResolver(), Settings.Global.ADB_ENABLED, 1);
|
||||
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
|
||||
try {
|
||||
PackageManager pm = getPackageManager();
|
||||
pm.setApplicationEnabledSetting("com.uiui.os", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "initView: " + e.getMessage());
|
||||
}
|
||||
|
||||
mViewDataBinding.tvBuildVersion.setText(JgyUtils.getCustomVersion());
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.G13Platform
|
||||
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.iPlay50SEPlatform
|
||||
) {
|
||||
mViewDataBinding.tvImei.setText("SN:" + DeviceIdUtils.getSerial());
|
||||
} else {
|
||||
mViewDataBinding.tvImei.setText("IMEI:" + DeviceIdUtils.getIMEI(MainActivity.this));
|
||||
}
|
||||
|
||||
mViewDataBinding.tvAppVersion.setText(BuildConfig.VERSION_NAME);
|
||||
|
||||
task = new TimeTask();
|
||||
task.execute("ntp.aliyun.com");
|
||||
|
||||
//更新设备信息之后停止停止这两个应用以免获取不到信息
|
||||
int versionCode = (int) SPUtils.get(this, "versionCode", 0);
|
||||
if (versionCode < BuildConfig.VERSION_CODE) {
|
||||
SPUtils.put(this, "versionCode", BuildConfig.VERSION_CODE);
|
||||
}
|
||||
JgyUtils.getInstance().wakeUpAppstore();
|
||||
JgyUtils.getInstance().wakeUpUpdateTools();
|
||||
|
||||
HardwareInfoUtils.getBattery(this);
|
||||
HardwareInfoUtils.getBatterymAh(this);
|
||||
}
|
||||
|
||||
|
||||
private boolean mCheckUpdate = false;
|
||||
|
||||
private void checkUpdate() {
|
||||
Disposable disposable = mRepository.getUpdateObservable(BuildConfig.APPLICATION_ID)
|
||||
.subscribeWith(new DisposableObserver<BaseResponse<AppInfo>>() {
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<AppInfo> appInfoBaseResponse) {
|
||||
Log.e("checkUpdate", "onSubscribe: " + appInfoBaseResponse);
|
||||
if (appInfoBaseResponse.code == 200) {
|
||||
AppInfo appInfo = appInfoBaseResponse.data;
|
||||
if (appInfo.getApp_version_code() > BuildConfig.VERSION_CODE) {
|
||||
ToastUtil.show("正在下载更新");
|
||||
} else {
|
||||
ToastUtil.show("已是最新版本");
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show("没有找到更新");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("checkUpdate", "onError: " + e.getMessage());
|
||||
ToastUtil.show("请稍后重试");
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("checkUpdate", "onComplete: ");
|
||||
mCheckUpdate = true;
|
||||
}
|
||||
});
|
||||
mDisposables.add(disposable);
|
||||
}
|
||||
|
||||
private TimeTask task;
|
||||
|
||||
private static class TimeTask extends AsyncTask<String, Long, Long> {
|
||||
@Override
|
||||
protected Long doInBackground(String... strings) {
|
||||
return TimeUtils.getTimeFromNtpServer(strings[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Long aLong) {
|
||||
super.onPostExecute(aLong);
|
||||
SystemClock.setCurrentTimeMillis(aLong);
|
||||
Log.e(TAG, "getTimeFromNtpServer: " + aLong);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void observeViewModel() {
|
||||
mViewModel.mSnInfoData.observe(this, new androidx.lifecycle.Observer<BaseResponse<SnInfo>>() {
|
||||
@Override
|
||||
public void onChanged(BaseResponse<SnInfo> snInfoBaseResponse) {
|
||||
if (snInfoBaseResponse != null) {
|
||||
//设备已经绑定
|
||||
if (snInfoBaseResponse.code == 200) {
|
||||
SnInfo snInfo = snInfoBaseResponse.data;
|
||||
AppUpdateCoordinator.getInstance().checkDeviceType(snInfo.getType_id());
|
||||
mViewDataBinding.tvBindStatu.setText("设备已绑定");
|
||||
}
|
||||
//设备没有绑定
|
||||
else if (snInfoBaseResponse.code == 300) {
|
||||
ControlManager.getInstance().setDisableSetting();
|
||||
mViewDataBinding.tvBindStatu.setText("设备未绑定");
|
||||
}
|
||||
//没有授权的设备
|
||||
else if (snInfoBaseResponse.code == 400) {
|
||||
ToastUtil.show(getString(R.string.device_unauthorized));
|
||||
Log.e(TAG, "setSnInfo: " + getString(R.string.device_unauthorized));
|
||||
ControlManager.getInstance().setDisableSetting();
|
||||
mViewDataBinding.tvBindStatu.setText("设备未绑定");
|
||||
}
|
||||
}
|
||||
mViewModel.getAllApp();
|
||||
mViewModel.checkUpdate();
|
||||
mViewModel.checkFXYUpdate();
|
||||
mViewModel.getOverallApp();
|
||||
}
|
||||
});
|
||||
|
||||
mViewModel.mQRCodeData.observe(this, new androidx.lifecycle.Observer<Bitmap>() {
|
||||
@Override
|
||||
public void onChanged(Bitmap bitmap) {
|
||||
// mViewDataBinding.qrCode.setImageBitmap(bitmap);
|
||||
}
|
||||
});
|
||||
mViewModel.getQRCode();
|
||||
|
||||
if (DeviceManager.isDebugMode()) {
|
||||
Log.e(TAG, "getAllSPUtils: " + GsonUtils.toJSONString(SPUtils.getAll(this)));
|
||||
Log.e(TAG, "getWeekDay: " + TimeUtils.inWeekDay());
|
||||
Log.e(TAG, "getWeekDay: " + TimeUtils.inWeekDay(1627702095000L));
|
||||
Log.e(TAG, "getWeekDayString: " + new TimeUtils().getWeekDayString());
|
||||
Log.e(TAG, "getWeekDayString: " + new TimeUtils().getWeekDayString(1627702095000L));
|
||||
Log.e(TAG, "initData: sn = " + DeviceIdUtils.getSerial());
|
||||
}
|
||||
if (DeviceManager.isDebugMode()) {
|
||||
Settings.System.putInt(getContentResolver(), CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 0);
|
||||
}
|
||||
startService();
|
||||
registerReceiver();
|
||||
Intent intent = new Intent(MainActivity.this, MainService.class);
|
||||
bindService(intent, mMainServiceConnection, BIND_AUTO_CREATE);
|
||||
startService(intent);
|
||||
}
|
||||
|
||||
MainService.MainBinder mMainBinder;
|
||||
|
||||
private MainServiceConnection mMainServiceConnection = new MainServiceConnection();
|
||||
|
||||
private class MainServiceConnection implements ServiceConnection {
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
|
||||
Log.e(TAG, "onServiceConnected: ");
|
||||
mMainBinder = (MainService.MainBinder) iBinder;
|
||||
// mMainBinder.getService().getLocked();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName componentName) {
|
||||
Log.e(TAG, "onServiceDisconnected: ");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
Log.e(TAG, "onResume: ");
|
||||
mViewModel.getSnInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
ReceiverCompat.unregisterReceiver(this, mRefreshReceiver);
|
||||
mDisposables.dispose();
|
||||
super.onDestroy();
|
||||
task.cancel(true);
|
||||
task = null;
|
||||
NetworkUtils.unregisterNetworkStatusChangedListener(this);
|
||||
startService();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
Log.e(TAG, "onNewIntent: ");
|
||||
if (REFRESHACTION.equals(intent.getAction())) {
|
||||
mViewModel.getSnInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == KeyEvent.ACTION_DOWN) {
|
||||
lazyExit();
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
private boolean isDebugMode() {
|
||||
if (DeviceManager.isDebugMode()) {
|
||||
return true;
|
||||
} else {
|
||||
return (boolean) SPUtils.get(this, CommonConfig.userDebugMode, false);
|
||||
}
|
||||
}
|
||||
|
||||
final static int DEBUGCOUNTS = 8;//点击次数
|
||||
final static long DEBUGDURATION = 4 * 1000;//规定有效时间
|
||||
long[] mDEBUGHits = new long[DEBUGCOUNTS];
|
||||
|
||||
private void enterUserDebug() {
|
||||
//每次点击时,数组向前移动一位
|
||||
System.arraycopy(mDEBUGHits, 1, mDEBUGHits, 0, mDEBUGHits.length - 1);
|
||||
//为数组最后一位赋值
|
||||
mDEBUGHits[mDEBUGHits.length - 1] = SystemClock.uptimeMillis();
|
||||
if (mDEBUGHits[0] >= SystemClock.uptimeMillis() - DEBUGDURATION) {
|
||||
mDEBUGHits = new long[DEBUGCOUNTS]; //重新初始化数组
|
||||
if ((boolean) SPUtils.get(MainActivity.this, CommonConfig.EnableDebug, false)) {
|
||||
ToastUtil.show("已经是Debug模式");
|
||||
} else {
|
||||
showDebugDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void showDebugDialog() {
|
||||
UserDebugDialog dialog = new UserDebugDialog(this);
|
||||
dialog.setOnClickBottomListener(new UserDebugDialog.OnClickBottomListener() {
|
||||
@Override
|
||||
public void onPositiveClick() {
|
||||
if (DebugPasswordVerifier.verify(dialog.getEdittext())) {
|
||||
SPUtils.put(MainActivity.this, CommonConfig.EnableDebug, true);
|
||||
ToastUtil.show("进入用户Debug模式");
|
||||
} else {
|
||||
ToastUtil.show("密码错误");
|
||||
}
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNegtiveClick() {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
dialog.getWindow().setGravity(Gravity.CENTER);
|
||||
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
||||
}
|
||||
|
||||
private void initTabLayout() {
|
||||
List<Fragment> fragmentList = new ArrayList<>();
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
fragmentList.add(new AppletQRCodeFragment());
|
||||
fragmentList.add(new QRCodeFragment());
|
||||
BaseFragmentPagerAdapter adapter = new BaseFragmentPagerAdapter(fragmentManager, fragmentList);
|
||||
}
|
||||
|
||||
private long mPreClickTime;
|
||||
|
||||
private void lazyExit() {
|
||||
if (System.currentTimeMillis() - mPreClickTime > 3000) {
|
||||
ToastUtil.show("再按一次,退出");
|
||||
mPreClickTime = System.currentTimeMillis();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
private final int COUNTS = 4; // 点击次数
|
||||
private final long DURATION = 2 * 1000; // 规定有效时间
|
||||
private long[] mHits = new long[COUNTS];
|
||||
|
||||
private void continuousClick(int count, long time) {
|
||||
//每次点击时,数组向前移动一位
|
||||
System.arraycopy(mHits, 1, mHits, 0, mHits.length - 1);
|
||||
//为数组最后一位赋值
|
||||
mHits[mHits.length - 1] = SystemClock.uptimeMillis();
|
||||
if (mHits[0] >= SystemClock.uptimeMillis() - DURATION) {
|
||||
mHits = new long[COUNTS]; //重新初始化数组
|
||||
ToastUtil.show("正在检查更新");
|
||||
}
|
||||
}
|
||||
|
||||
private void startService() {
|
||||
startService(new Intent(this, MainService.class));
|
||||
startService(new Intent(this, SocketService.class));
|
||||
startService(new Intent(this, DownloadService.class));
|
||||
startService(new Intent(this, ManagerService.class));
|
||||
}
|
||||
|
||||
private void registerReceiver() {
|
||||
registerRefreshReceiver();
|
||||
}
|
||||
|
||||
public static final String REFRESHACTION = BuildConfig.APPLICATION_ID + ".REFRESH";
|
||||
|
||||
private RefreshReceiver mRefreshReceiver = new RefreshReceiver();
|
||||
|
||||
private void registerRefreshReceiver() {
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||
filter.addAction(REFRESHACTION);
|
||||
ReceiverCompat.registerReceiver(this, mRefreshReceiver, filter, ReceiverCompat.RECEIVER_NOT_EXPORTED);
|
||||
}
|
||||
|
||||
class RefreshReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Log.e("RefreshReceiver", "onReceive: ");
|
||||
if (REFRESHACTION.equals(intent.getAction())) {
|
||||
mViewModel.getSnInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class BtnClick {
|
||||
|
||||
public void exit(View view) {
|
||||
lazyExit();
|
||||
}
|
||||
|
||||
public void debug(View view) {
|
||||
if (isDebugMode()) {
|
||||
enterUserDebug();
|
||||
}
|
||||
}
|
||||
|
||||
public void checkAppUpdate(View view) {
|
||||
mViewModel.getAllApp();
|
||||
if (mCheckUpdate) {
|
||||
ToastUtil.show("您已检查过更新,请稍后再试");
|
||||
} else {
|
||||
ToastUtil.show("正在检查更新");
|
||||
checkUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public void openOta(View view) {
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
ComponentName componentName = new ComponentName("com.adups.fota", "com.adups.fota.GoogleOtaClient");
|
||||
intent.setComponent(componentName);
|
||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
try {
|
||||
startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "openComponentNameApp: " + e.getMessage());
|
||||
ToastUtil.show("打开失败");
|
||||
}
|
||||
}
|
||||
|
||||
public void restart(View view) {
|
||||
// AppProcessUtils.triggerRebirth(MainActivity.this);
|
||||
new RestartFragment().show(getSupportFragmentManager(), "RestartFragment");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
package com.fuying.sn.feature.main;
|
||||
|
||||
import android.app.Application;
|
||||
import android.graphics.Bitmap;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.fuying.sn.core.base.mvvm.BaseAndroidViewModel;
|
||||
import com.fuying.sn.core.common.image.BitmapUtils;
|
||||
import com.fuying.sn.core.common.crypto.CXAESUtil;
|
||||
import com.fuying.sn.core.common.device.DeviceIdUtils;
|
||||
import com.fuying.sn.core.data.dto.BaseResponse;
|
||||
import com.fuying.sn.core.data.dto.SnInfo;
|
||||
import com.fuying.sn.core.data.remote.RequestCompletion;
|
||||
import com.fuying.sn.core.data.repository.DeviceRepository;
|
||||
import com.fuying.sn.runtime.sync.AppInventorySync;
|
||||
import com.fuying.sn.runtime.sync.AppUpdateCoordinator;
|
||||
import com.fuying.sn.runtime.sync.DeviceProfileSync;
|
||||
import com.fuying.sn.runtime.sync.RequestCallbacks;
|
||||
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
@Deprecated
|
||||
public class MainViewModel extends BaseAndroidViewModel {
|
||||
private final DeviceRepository mRepository = DeviceRepository.getInstance();
|
||||
|
||||
public MainViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
}
|
||||
|
||||
public MutableLiveData<BaseResponse<SnInfo>> mSnInfoData = new MutableLiveData<>();
|
||||
|
||||
public void getSnInfo() {
|
||||
Disposable disposable = DeviceProfileSync.getInstance()
|
||||
.getSnInfoRequest(new DeviceProfileSync.ObserverCallback<SnInfo>() {
|
||||
@Override
|
||||
public void onNext(BaseResponse<SnInfo> response) {
|
||||
Log.e("getSnInfo", "onNext: " + response);
|
||||
mSnInfoData.setValue(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getSnInfo", "onError: " + e.getMessage());
|
||||
Disposable disposable = mRepository.getCachedSnInfo()
|
||||
.subscribe(mSnInfoData::setValue,
|
||||
error -> Log.e("MainViewModel", "getCachedSnInfo: ", error),
|
||||
() -> mSnInfoData.setValue(null));
|
||||
mDisposables.add(disposable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getSnInfo", "onComplete: ");
|
||||
}
|
||||
})
|
||||
.subscribeWith(new RequestCompletion(mDisposables, "getSnInfo"));
|
||||
mDisposables.add(disposable);
|
||||
}
|
||||
|
||||
public MutableLiveData<Bitmap> mQRCodeData = new MutableLiveData<>();
|
||||
|
||||
public void getQRCode() {
|
||||
String encryptString = CXAESUtil.encrypt(DeviceIdUtils.getIMEI(getAppContext()));
|
||||
Log.e("getQRCode", "setImageAndText: " + encryptString);
|
||||
Bitmap bitmap = BitmapUtils.createQRImage(encryptString, 400, 400);
|
||||
mQRCodeData.setValue(bitmap);
|
||||
}
|
||||
|
||||
public void getAllApp() {
|
||||
Disposable disposable = AppInventorySync.getInstance().getAppWhiteListRequest(new AppInventorySync.WhiteListCallback() {
|
||||
@Override
|
||||
public void onComplet() {
|
||||
}
|
||||
})
|
||||
.subscribeWith(new RequestCompletion(mDisposables, "getAppWhiteList"));
|
||||
mDisposables.add(disposable);
|
||||
}
|
||||
|
||||
public void checkUpdate() {
|
||||
Disposable disposable = AppUpdateCoordinator.getInstance().checkAllAppUpdateRequest(new RequestCallbacks.CompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
})
|
||||
.subscribeWith(new RequestCompletion(mDisposables, "checkAllAppUpdate"));
|
||||
mDisposables.add(disposable);
|
||||
}
|
||||
|
||||
public void checkFXYUpdate() {
|
||||
// AppUpdateCoordinator.getInstance().checkFXYAppUpdate(new RequestCallbacks.CompleteCallback() {
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
// mView.checkFXYUpdateFinish();
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
public void getOverallApp() {
|
||||
Disposable disposable = AppUpdateCoordinator.getInstance().getOverallAppRequest(new RequestCallbacks.CompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
})
|
||||
.subscribeWith(new RequestCompletion(mDisposables, "getOverallApp"));
|
||||
mDisposables.add(disposable);
|
||||
}
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
package com.fuying.sn.feature.main;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.fuying.sn.R;
|
||||
import com.fuying.sn.core.base.BaseDialogFragment;
|
||||
import com.fuying.sn.databinding.FragmentDialogRestartBinding;
|
||||
import com.fuying.sn.platform.app.AppProcessUtils;
|
||||
|
||||
public class RestartFragment extends BaseDialogFragment {
|
||||
private static final String TAG = "RestartFragment";
|
||||
|
||||
|
||||
private FragmentDialogRestartBinding mBinding;
|
||||
private View rootView;
|
||||
private Context mContext;
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
Log.e(TAG, "onCreateView: ");
|
||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_dialog_restart, container, false);
|
||||
mBinding.setClick(new BtnClick());
|
||||
rootView = mBinding.getRoot();
|
||||
mContext = rootView.getContext();
|
||||
initView();
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
return super.onCreateDialog(savedInstanceState);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
mBinding.tvContent.setText("应用将会重启并重新获取数据");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (getDialog() != null) {
|
||||
Window window = getDialog().getWindow();
|
||||
if (window == null) return;
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.gravity = Gravity.CENTER;
|
||||
window.setAttributes(params);
|
||||
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
getDialog().setCancelable(true);
|
||||
getDialog().setCanceledOnTouchOutside(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(FragmentManager manager, String tag) {
|
||||
DialogFragment fragment = (DialogFragment) manager.findFragmentByTag(tag);
|
||||
if (fragment != null && fragment.isAdded()
|
||||
&& fragment.getDialog() != null && fragment.getDialog().isShowing()) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
FragmentTransaction ft = manager.beginTransaction();
|
||||
ft.add(this, tag);
|
||||
ft.commitAllowingStateLoss();
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "show: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
super.onDismiss(dialog);
|
||||
|
||||
}
|
||||
|
||||
public class BtnClick {
|
||||
public void cancel(View view) {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
public void restart(View view) {
|
||||
AppProcessUtils.triggerRebirth(mContext);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fetchData() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.fuying.sn.feature.splash;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.fuying.sn.R;
|
||||
import com.fuying.sn.feature.main.MainActivity;
|
||||
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;
|
||||
|
||||
public class SplashActivity extends AppCompatActivity {
|
||||
private static final String TAG = "SplashActivity";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
setBar();
|
||||
setContentView(R.layout.activity_home);
|
||||
|
||||
new Handler().postDelayed(() -> {
|
||||
startActivity(new Intent(SplashActivity.this, MainActivity.class));
|
||||
finish();
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
private void setBar() {
|
||||
UltimateBarX.statusBar(this)
|
||||
.transparent()
|
||||
.colorRes(R.color.colorPrimaryDark)
|
||||
.light(true)
|
||||
.apply();
|
||||
UltimateBarX.navigationBar(this)
|
||||
.transparent()
|
||||
.colorRes(R.color.colorPrimaryDark)
|
||||
.light(true)
|
||||
.apply();
|
||||
}
|
||||
}
|
||||
@@ -1,330 +0,0 @@
|
||||
<?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=".feature.main.MainActivity">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="com.fuying.sn.feature.main.MainActivity.BtnClick" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:background="#EBEBEB"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_36"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_exit"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:onClick="@{click::exit}"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/bt_return"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:onClick="@{click::debug}"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="#4b4b4b"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.015"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_exit"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.5" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:layout_marginBottom="@dimen/dp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:layout_weight="3"
|
||||
android:background="@drawable/card_background"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView11"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:text="设备码"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_goneMarginStart="@dimen/dp_16" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_imei"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:ellipsize="end"
|
||||
android:maxLength="30"
|
||||
android:singleLine="true"
|
||||
android:text="@string/unknown"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:background="@color/text_gray"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_number"
|
||||
android:layout_width="match_parent"
|
||||
android:onClick="@{click::checkAppUpdate}"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:text="软件版本"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_goneMarginStart="@dimen/dp_16" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_app_version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:ellipsize="end"
|
||||
android:maxLength="30"
|
||||
android:singleLine="true"
|
||||
android:text="@string/unknown"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:background="@color/text_gray"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_class"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:onClick="@{click::openOta}"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView9"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:text="系统版本"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_goneMarginStart="@dimen/dp_16" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_build_version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:ellipsize="end"
|
||||
android:maxLength="30"
|
||||
android:singleLine="true"
|
||||
android:text="@string/unknown"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:background="@color/text_gray"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:onClick="@{click::restart}"
|
||||
android:background="@drawable/card_background">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:layout_width="@dimen/dp_64"
|
||||
android:layout_height="@dimen/dp_64"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_diagnosis"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.505"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.25" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="一键诊断"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView2" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_weight="4"
|
||||
android:background="@drawable/card_background"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_59"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:src="@drawable/fly_fooing"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/fly_qrcode"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.367" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="扫码关注公众号"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintEnd_toEndOf="@+id/imageView"
|
||||
app:layout_constraintStart_toStartOf="@+id/imageView"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_bind_statu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="设备未绑定"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
@@ -1,330 +0,0 @@
|
||||
<?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=".feature.main.MainActivity">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="com.fuying.sn.feature.main.MainActivity.BtnClick" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:background="#EBEBEB"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_36"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_exit"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:onClick="@{click::exit}"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/bt_return"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:onClick="@{click::debug}"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="#4b4b4b"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.015"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_exit"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.5" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:layout_marginBottom="@dimen/dp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:layout_weight="3"
|
||||
android:background="@drawable/card_background"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView11"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:text="设备码"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_goneMarginStart="@dimen/dp_16" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_imei"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:ellipsize="end"
|
||||
android:maxLength="30"
|
||||
android:singleLine="true"
|
||||
android:text="@string/unknown"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:background="@color/text_gray"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_number"
|
||||
android:layout_width="match_parent"
|
||||
android:onClick="@{click::checkAppUpdate}"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:text="软件版本"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_goneMarginStart="@dimen/dp_16" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_app_version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:ellipsize="end"
|
||||
android:maxLength="30"
|
||||
android:singleLine="true"
|
||||
android:text="@string/unknown"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:background="@color/text_gray"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_class"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:onClick="@{click::openOta}"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView9"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:text="系统版本"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_goneMarginStart="@dimen/dp_16" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_build_version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:ellipsize="end"
|
||||
android:maxLength="30"
|
||||
android:singleLine="true"
|
||||
android:text="@string/unknown"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:background="@color/text_gray"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:onClick="@{click::restart}"
|
||||
android:background="@drawable/card_background">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:layout_width="@dimen/dp_64"
|
||||
android:layout_height="@dimen/dp_64"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_diagnosis"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.505"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.25" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="一键诊断"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView2" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_weight="4"
|
||||
android:background="@drawable/card_background"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_59"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:src="@drawable/fly_fooing"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/fly_qrcode"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.367" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="扫码关注公众号"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintEnd_toEndOf="@+id/imageView"
|
||||
app:layout_constraintStart_toStartOf="@+id/imageView"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_bind_statu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="设备未绑定"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
@@ -1,101 +0,0 @@
|
||||
<?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=".feature.main.RestartFragment">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="com.fuying.sn.feature.main.RestartFragment.BtnClick" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="@dimen/dp_180"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/card_background"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:text="温馨提示"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:layout_marginBottom="@dimen/dp_16"
|
||||
app:layout_constraintBottom_toTopOf="@+id/linearLayout5"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_title">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_10"
|
||||
tools:text="内容文本" />
|
||||
</ScrollView>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_8"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_cancel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:onClick="@{click::cancel}"
|
||||
android:text="取消"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_11"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_confirm"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:onClick="@{click::restart}"
|
||||
android:text="确定"
|
||||
android:textColor="@color/default_blue"
|
||||
android:textSize="@dimen/sp_11"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@+id/tv_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_content" />
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
Reference in new issue
Block a user