version:3.4.6
fix: update:样式修改
@@ -41,12 +41,25 @@ android {
|
||||
// 还可以添加 'x86', 'x86_64', 'mips', 'mips64'
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
includeCompileClasspath true
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
checkReleaseBuilds false
|
||||
}
|
||||
|
||||
dataBinding {
|
||||
enabled true
|
||||
}
|
||||
|
||||
manifestPlaceholders = [
|
||||
XG_ACCESS_ID : "1500031216",
|
||||
XG_ACCESS_KEY: "A1HBG2922B9Z",
|
||||
@@ -55,15 +68,6 @@ android {
|
||||
buildConfigField "String", "WEBSOCKET_URL", '"wss://as.fuyingy.com:3018"'
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
checkReleaseBuilds false
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
//多版本
|
||||
productFlavors {
|
||||
// beta {
|
||||
@@ -74,8 +78,8 @@ android {
|
||||
|
||||
official {
|
||||
flavorDimensions "default"
|
||||
versionCode 85
|
||||
versionName "3.4.5"
|
||||
versionCode 86
|
||||
versionName "3.4.6"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,12 +509,6 @@ dependencies {
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
|
||||
//BindView
|
||||
implementation 'com.jakewharton:butterknife:10.2.3'
|
||||
// If you are using Kotlin, replace annotationProcessor with kapt.
|
||||
// annotationProcessor rootProject.ext.dependencies["butterknife-compiler"]
|
||||
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3'
|
||||
|
||||
//okhttp
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
|
||||
//Retrofit
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
<activity
|
||||
android:name=".activity.main.MainActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait">
|
||||
android:screenOrientation="landscape">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
<activity
|
||||
android:name=".activity.SplashActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="landscape" />
|
||||
|
||||
<service
|
||||
android:name=".service.ControlPanelService"
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.fuying.sn.activity.main;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import com.fuying.sn.base.BasePresenter;
|
||||
import com.fuying.sn.base.BaseView;
|
||||
import com.fuying.sn.bean.BaseResponse;
|
||||
import com.fuying.sn.bean.SnInfo;
|
||||
|
||||
public class MainAContact {
|
||||
interface Presenter extends BasePresenter<MainView> {
|
||||
/*获取设备信息*/
|
||||
void getSnInfo();
|
||||
/*获取二维码*/
|
||||
void getQRCode();
|
||||
//获取所有app包名
|
||||
void getAllApp();
|
||||
/*检查更新*/
|
||||
void checkUpdate();
|
||||
/*检查扶小鹰App更新*/
|
||||
void checkFXYUpdate();
|
||||
/*获取所有全局更新*/
|
||||
void getOverallApp();
|
||||
}
|
||||
|
||||
public interface MainView extends BaseView {
|
||||
void setSnInfo(BaseResponse<SnInfo> response);
|
||||
void setQRCode(Bitmap bitmap);
|
||||
void getAllAppFinish();
|
||||
void checkUpdateFinish();
|
||||
void checkFXYUpdateFinish();
|
||||
void setOverallApp();
|
||||
}
|
||||
}
|
||||
@@ -18,8 +18,6 @@ import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
@@ -27,15 +25,17 @@ 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.base.BaseActivity;
|
||||
import com.fuying.sn.base.mvvm.BaseMvvmActivity;
|
||||
import com.fuying.sn.bean.AppInfo;
|
||||
import com.fuying.sn.bean.BaseResponse;
|
||||
import com.fuying.sn.bean.SnInfo;
|
||||
import com.fuying.sn.config.CommonConfig;
|
||||
import com.fuying.sn.databinding.ActivityMainBinding;
|
||||
import com.fuying.sn.dialog.UserDebugDialog;
|
||||
import com.fuying.sn.fragment.AppletQRCodeFragment;
|
||||
import com.fuying.sn.fragment.BaseFragmentPagerAdapter;
|
||||
import com.fuying.sn.fragment.QRCodeFragment;
|
||||
import com.fuying.sn.fragment.dialog.RestartFragment;
|
||||
import com.fuying.sn.gson.GsonUtils;
|
||||
import com.fuying.sn.manager.ControlManager;
|
||||
import com.fuying.sn.manager.DeviceManager;
|
||||
@@ -54,40 +54,20 @@ import com.fuying.sn.utils.Utils;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class MainActivity extends BaseActivity implements MainAContact.MainView, NetworkUtils.OnNetworkStatusChangedListener {
|
||||
public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBinding> implements NetworkUtils.OnNetworkStatusChangedListener {
|
||||
private static final String TAG = "MainActivity";
|
||||
|
||||
@BindView(R.id.tv_exit)
|
||||
TextView tv_exit;
|
||||
@BindView(R.id.tv_title)
|
||||
TextView tv_title;
|
||||
@BindView(R.id.tv_customversion)
|
||||
TextView tv_customversion;
|
||||
@BindView(R.id.tv_sn)
|
||||
TextView tv_sn;
|
||||
@BindView(R.id.tv_version)
|
||||
TextView tv_version;
|
||||
@BindView(R.id.qr_code)
|
||||
ImageView qr_code;
|
||||
@BindView(R.id.iv_appqrcode)
|
||||
ImageView iv_appqrcode;
|
||||
@BindView(R.id.iv_exit)
|
||||
ImageView iv_exit;
|
||||
@BindView(R.id.tv_update)
|
||||
TextView tv_update;
|
||||
|
||||
private MainAPresenter mPresenter;
|
||||
@Override
|
||||
public boolean setNightMode() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisconnected() {
|
||||
@@ -97,8 +77,7 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
@Override
|
||||
public void onConnected(NetworkUtils.NetworkType networkType) {
|
||||
Log.e(TAG, "onConnected: ");
|
||||
timeMillis = System.currentTimeMillis();
|
||||
mPresenter.getSnInfo();
|
||||
mViewModel.getSnInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -106,16 +85,19 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
return R.layout.activity_main;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDataBinding() {
|
||||
mViewModel.setCtx(this);
|
||||
mViewModel.setLifecycle(getLifecycleSubject());
|
||||
mViewModel.setVDBinding(mViewDataBinding);
|
||||
mViewDataBinding.setClick(new BtnClick());
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
public void initView() {
|
||||
Utils.getAndroiodScreenProperty(this);
|
||||
|
||||
ButterKnife.bind(this);
|
||||
mPresenter = new MainAPresenter(this);
|
||||
mPresenter.setLifecycle(lifecycleSubject);
|
||||
mPresenter.attachView(this);
|
||||
|
||||
// Settings.Global.putInt(getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
|
||||
// Settings.Global.putInt(getContentResolver(), Settings.Global.ADB_ENABLED, 1);
|
||||
|
||||
@@ -128,17 +110,16 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
Log.e(TAG, "initView: " + e.getMessage());
|
||||
}
|
||||
|
||||
setOnClickListener();
|
||||
tv_customversion.setText(JGYUtils.getCustomVersion());
|
||||
mViewDataBinding.tvBuildVersion.setText(JGYUtils.getCustomVersion());
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G13Platform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.iPlay50SEPlatform
|
||||
) {
|
||||
tv_sn.setText("SN:" + Utils.getSerial());
|
||||
mViewDataBinding.tvImei.setText("SN:" + Utils.getSerial());
|
||||
} else {
|
||||
tv_sn.setText("IMEI:" + Utils.getIMEI(MainActivity.this));
|
||||
mViewDataBinding.tvImei.setText("IMEI:" + Utils.getIMEI(MainActivity.this));
|
||||
}
|
||||
|
||||
tv_version.setText(BuildConfig.VERSION_NAME);
|
||||
mViewDataBinding.tvAppVersion.setText(BuildConfig.VERSION_NAME);
|
||||
|
||||
task = new TimeTask();
|
||||
task.execute("ntp.aliyun.com");
|
||||
@@ -153,26 +134,13 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
|
||||
Utils.getBattery(this);
|
||||
Utils.getBatterymAh(this);
|
||||
|
||||
tv_update.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
mPresenter.getAllApp();
|
||||
if (mCheckUpdate) {
|
||||
ToastUtil.show("您已检查过更新,请稍后再试");
|
||||
} else {
|
||||
ToastUtil.show("正在检查更新");
|
||||
checkUpdate();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean mCheckUpdate = false;
|
||||
|
||||
private void checkUpdate() {
|
||||
NetInterfaceManager.getInstance().getUpdateObservable(BuildConfig.APPLICATION_ID)
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycleSubject, ActivityEvent.DESTROY))
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycleSubject(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<AppInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
@@ -225,11 +193,46 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
}
|
||||
}
|
||||
|
||||
//执行所有接口耗时
|
||||
long timeMillis;
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
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;
|
||||
NetInterfaceManager.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());
|
||||
@@ -243,7 +246,6 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
}
|
||||
startService();
|
||||
registerReceiver();
|
||||
timeMillis = System.currentTimeMillis();
|
||||
Intent intent = new Intent(MainActivity.this, MainService.class);
|
||||
bindService(intent, mMainServiceConnection, BIND_AUTO_CREATE);
|
||||
startService(intent);
|
||||
@@ -272,7 +274,7 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
Log.e(TAG, "onResume: ");
|
||||
mPresenter.getSnInfo();
|
||||
mViewModel.getSnInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -285,7 +287,6 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
super.onDestroy();
|
||||
task.cancel(true);
|
||||
task = null;
|
||||
mPresenter.detachView();
|
||||
NetworkUtils.unregisterNetworkStatusChangedListener(this);
|
||||
startService();
|
||||
}
|
||||
@@ -295,7 +296,7 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
super.onNewIntent(intent);
|
||||
Log.e(TAG, "onNewIntent: ");
|
||||
if (REFRESHACTION.equals(intent.getAction())) {
|
||||
mPresenter.getSnInfo();
|
||||
mViewModel.getSnInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -368,15 +369,6 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
BaseFragmentPagerAdapter adapter = new BaseFragmentPagerAdapter(fragmentManager, fragmentList);
|
||||
}
|
||||
|
||||
private void setOnClickListener() {
|
||||
iv_exit.setOnClickListener(view -> lazyExit());
|
||||
tv_title.setOnClickListener(view -> {
|
||||
if (isDebugMode()) {
|
||||
enterUserDebug();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private long mPreClickTime;
|
||||
|
||||
private void lazyExit() {
|
||||
@@ -432,56 +424,52 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Log.e("RefreshReceiver", "onReceive: ");
|
||||
if (REFRESHACTION.equals(intent.getAction())) {
|
||||
mPresenter.getSnInfo();
|
||||
mViewModel.getSnInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSnInfo(BaseResponse<SnInfo> response) {
|
||||
if (response != null) {
|
||||
//设备已经绑定
|
||||
if (response.code == 200) {
|
||||
SnInfo snInfo = response.data;
|
||||
NetInterfaceManager.getInstance().checkDeviceType(snInfo.getType_id());
|
||||
}
|
||||
//设备没有绑定
|
||||
else if (response.code == 300) {
|
||||
ControlManager.getInstance().setDisableSetting();
|
||||
}
|
||||
//没有授权的设备
|
||||
else if (response.code == 400) {
|
||||
ToastUtil.show(getString(R.string.device_unauthorized));
|
||||
Log.e(TAG, "setSnInfo: " + getString(R.string.device_unauthorized));
|
||||
ControlManager.getInstance().setDisableSetting();
|
||||
}
|
||||
}
|
||||
mPresenter.getQRCode();
|
||||
public class BtnClick {
|
||||
|
||||
public void exit(View view) {
|
||||
lazyExit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQRCode(@NotNull Bitmap bitmap) {
|
||||
qr_code.setImageBitmap(bitmap);
|
||||
mPresenter.getAllApp();
|
||||
public void debug(View view) {
|
||||
if (isDebugMode()) {
|
||||
enterUserDebug();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAllAppFinish() {
|
||||
mPresenter.checkUpdate();
|
||||
public void checkAppUpdate(View view) {
|
||||
mViewModel.getAllApp();
|
||||
if (mCheckUpdate) {
|
||||
ToastUtil.show("您已检查过更新,请稍后再试");
|
||||
} else {
|
||||
ToastUtil.show("正在检查更新");
|
||||
checkUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkUpdateFinish() {
|
||||
mPresenter.checkFXYUpdate();
|
||||
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("打开失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkFXYUpdateFinish() {
|
||||
mPresenter.getOverallApp();
|
||||
public void restart(View view) {
|
||||
// Utils.triggerRebirth(MainActivity.this);
|
||||
new RestartFragment().show(getSupportFragmentManager(), "RestartFragment");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOverallApp() {
|
||||
Log.e(TAG, "SettingFinish: " + (System.currentTimeMillis() - timeMillis) + " ms");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package com.fuying.sn.activity.main;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.fuying.sn.base.mvvm.BaseViewModel;
|
||||
import com.fuying.sn.bean.BaseResponse;
|
||||
import com.fuying.sn.bean.SnInfo;
|
||||
import com.fuying.sn.config.CommonConfig;
|
||||
import com.fuying.sn.databinding.ActivityMainBinding;
|
||||
import com.fuying.sn.disklrucache.CacheHelper;
|
||||
import com.fuying.sn.network.NetInterfaceManager;
|
||||
import com.fuying.sn.network.UrlAddress;
|
||||
@@ -19,56 +22,35 @@ import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
/**
|
||||
* @author jgy02
|
||||
*/
|
||||
public class MainAPresenter implements MainAContact.Presenter {
|
||||
private static final String TAG = "MainAPresenter";
|
||||
public class MainViewModel extends BaseViewModel<ActivityMainBinding, ActivityEvent> {
|
||||
|
||||
private MainAContact.MainView mView;
|
||||
private Context mContext;
|
||||
private CacheHelper mCacheHelper;
|
||||
|
||||
public MainAPresenter(Context context) {
|
||||
this.mContext = context;
|
||||
this.mCacheHelper = new CacheHelper(context);
|
||||
}
|
||||
|
||||
private BehaviorSubject<ActivityEvent> lifecycle;
|
||||
|
||||
public void setLifecycle(BehaviorSubject<ActivityEvent> lifecycle) {
|
||||
this.lifecycle = lifecycle;
|
||||
}
|
||||
|
||||
public BehaviorSubject<ActivityEvent> getLifecycle() {
|
||||
return lifecycle;
|
||||
@Override
|
||||
public ActivityMainBinding getVDBinding() {
|
||||
return binding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachView(MainAContact.MainView view) {
|
||||
this.mView = view;
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachView() {
|
||||
this.mView = null;
|
||||
}
|
||||
public MutableLiveData<BaseResponse<SnInfo>> mSnInfoData = new MutableLiveData<>();
|
||||
|
||||
@Override
|
||||
public void getSnInfo() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getSnInfo(getLifecycle(), new NetInterfaceManager.ObserverCallback() {
|
||||
.getSnInfo(getLifecycle(), new NetInterfaceManager.ObserverCallback<SnInfo>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getSnInfo", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse response) {
|
||||
public void onNext(BaseResponse<SnInfo> response) {
|
||||
Log.e("getSnInfo", "onNext: " + response);
|
||||
mView.setSnInfo(response);
|
||||
mSnInfoData.setValue(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -79,7 +61,7 @@ public class MainAPresenter implements MainAContact.Presenter {
|
||||
Type type = new TypeToken<BaseResponse<SnInfo>>() {
|
||||
}.getType();
|
||||
BaseResponse<SnInfo> userInfoBaseResponse = gson.fromJson(jsonString, type);
|
||||
mView.setSnInfo(userInfoBaseResponse);
|
||||
mSnInfoData.setValue(userInfoBaseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,35 +71,31 @@ public class MainAPresenter implements MainAContact.Presenter {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public MutableLiveData<Bitmap> mQRCodeData = new MutableLiveData<>();
|
||||
|
||||
public void getQRCode() {
|
||||
String encryptString = CXAESUtil.encrypt(CommonConfig.AES_KEY, Utils.getIMEI(mContext));
|
||||
String encryptString = CXAESUtil.encrypt(CommonConfig.AES_KEY, Utils.getIMEI(getCtx()));
|
||||
Log.e("getQRCode", "setImageAndText: " + encryptString);
|
||||
Bitmap bitmap = Utils.createQRImage(encryptString, 400, 400);
|
||||
mView.setQRCode(bitmap);
|
||||
mQRCodeData.setValue(bitmap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAllApp() {
|
||||
NetInterfaceManager.getInstance().getAppWhiteList(new NetInterfaceManager.WhiteListCallback() {
|
||||
@Override
|
||||
public void onComplet() {
|
||||
mView.getAllAppFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkUpdate() {
|
||||
NetInterfaceManager.getInstance().checkAllAppUpdate(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.checkUpdateFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkFXYUpdate() {
|
||||
// NetInterfaceManager.getInstance().checkFXYAppUpdate(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
|
||||
// @Override
|
||||
@@ -125,15 +103,12 @@ public class MainAPresenter implements MainAContact.Presenter {
|
||||
// mView.checkFXYUpdateFinish();
|
||||
// }
|
||||
// });
|
||||
mView.checkFXYUpdateFinish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getOverallApp() {
|
||||
NetInterfaceManager.getInstance().getOverallApp(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.setOverallApp();
|
||||
}
|
||||
});
|
||||
}
|
||||
44
app/src/main/java/com/fuying/sn/base/BaseDialogFragment.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package com.fuying.sn.base;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.fuying.sn.base.rx.BaseRxDialogFragment;
|
||||
|
||||
public abstract class BaseDialogFragment extends BaseRxDialogFragment {
|
||||
|
||||
protected boolean isViewInitiated;
|
||||
protected boolean isVisibleToUser;
|
||||
protected boolean isDataInitiated;
|
||||
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
isViewInitiated = true;
|
||||
prepareFetchData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUserVisibleHint(boolean isVisibleToUser) {
|
||||
super.setUserVisibleHint(isVisibleToUser);
|
||||
this.isVisibleToUser = isVisibleToUser;
|
||||
prepareFetchData();
|
||||
}
|
||||
|
||||
public abstract void fetchData();
|
||||
|
||||
public boolean prepareFetchData() {
|
||||
return prepareFetchData(false);
|
||||
}
|
||||
|
||||
public boolean prepareFetchData(boolean forceUpdate) {
|
||||
if (isVisibleToUser && isViewInitiated && (!isDataInitiated || forceUpdate)) {
|
||||
fetchData();
|
||||
//注释掉保证每次都更新数据
|
||||
// isDataInitiated = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.fuying.sn.base;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.CallSuper;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.fuying.sn.R;
|
||||
import com.fuying.sn.base.rx.BaseRxActivity;
|
||||
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;
|
||||
|
||||
public abstract class BaseTransparentActivity extends BaseRxActivity {
|
||||
|
||||
public BaseTransparentActivity() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// StatusBarUtil.init(this);
|
||||
UltimateBarX.statusBar(this)
|
||||
.transparent()
|
||||
.colorRes(R.color.colorPrimaryDark)
|
||||
.light(setNightMode())
|
||||
.fitWindow(setfitWindow())
|
||||
.apply();
|
||||
UltimateBarX.navigationBar(this)
|
||||
.transparent()
|
||||
.colorRes(R.color.colorPrimaryDark)
|
||||
.light(setNightMode())
|
||||
.fitWindow(setfitWindow())
|
||||
.apply();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置布局
|
||||
*/
|
||||
protected abstract int getLayoutId();
|
||||
|
||||
/**
|
||||
* @return 是否是黑色状态栏
|
||||
*/
|
||||
// protected abstract boolean setNightMode();
|
||||
public boolean setNightMode() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 是否是入侵
|
||||
*/
|
||||
// protected abstract boolean setNightMode();
|
||||
public boolean setfitWindow() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package com.fuying.sn.base;
|
||||
|
||||
public interface BaseView {
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fuying.sn.base;
|
||||
package com.fuying.sn.base.mvp;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.os.Build;
|
||||
@@ -12,19 +12,18 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.fuying.sn.R;
|
||||
import com.trello.rxlifecycle4.LifecycleProvider;
|
||||
import com.trello.rxlifecycle4.LifecycleTransformer;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.trello.rxlifecycle4.android.RxLifecycleAndroid;
|
||||
import com.fuying.sn.BuildConfig;
|
||||
import com.fuying.sn.R;
|
||||
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
|
||||
@Deprecated
|
||||
public abstract class BaseActivity extends AppCompatActivity implements LifecycleProvider<ActivityEvent> {
|
||||
public final BehaviorSubject<ActivityEvent> lifecycleSubject = BehaviorSubject.create();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.fuying.sn.base;
|
||||
package com.fuying.sn.base.mvp;
|
||||
|
||||
@Deprecated
|
||||
public interface BasePresenter<V extends BaseView> {
|
||||
void attachView(V view);
|
||||
|
||||
5
app/src/main/java/com/fuying/sn/base/mvp/BaseView.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package com.fuying.sn.base.mvp;
|
||||
|
||||
@Deprecated
|
||||
public interface BaseView {
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.fuying.sn.base.mvvm;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ViewDataBinding;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.fuying.sn.base.BaseTransparentActivity;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
|
||||
public abstract class BaseMvvmActivity<VM extends ViewModel, VDB extends ViewDataBinding> extends BaseTransparentActivity {
|
||||
private static final String TAG = "BaseMvvmActivity";
|
||||
|
||||
protected VM mViewModel;
|
||||
protected VDB mViewDataBinding;
|
||||
protected Class<VM> vmClass;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
//ViewDataBinding
|
||||
mViewDataBinding = DataBindingUtil.setContentView(this, getLayoutId());
|
||||
mViewDataBinding.setLifecycleOwner(this);
|
||||
//ViewModel
|
||||
vmClass = (Class<VM>) ((ParameterizedType) this.getClass().getGenericSuperclass()).getActualTypeArguments()[0];
|
||||
boolean isAbstract = Modifier.isAbstract(vmClass.getModifiers());
|
||||
Log.e(TAG, "isLocalClass:" + vmClass.getSimpleName().equals(ViewModel.class.getSimpleName()) + " isAbstract:" + isAbstract);
|
||||
if (!isAbstract) {//不是一个抽象类
|
||||
mViewModel = new ViewModelProvider(this).get(vmClass);
|
||||
}
|
||||
initDataBinding();
|
||||
initView();
|
||||
initData();
|
||||
}
|
||||
|
||||
protected abstract void initDataBinding();
|
||||
|
||||
/**
|
||||
* 初始化视图
|
||||
*/
|
||||
protected abstract void initView();
|
||||
|
||||
/**
|
||||
* 初始化数据
|
||||
*/
|
||||
protected abstract void initData();
|
||||
}
|
||||
71
app/src/main/java/com/fuying/sn/base/mvvm/BaseViewModel.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package com.fuying.sn.base.mvvm;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.databinding.ViewDataBinding;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
/**
|
||||
* 所有viewmodel的基类
|
||||
*/
|
||||
public abstract class BaseViewModel<VDB extends ViewDataBinding, T> extends ViewModel implements ViewDataBindingCallback {
|
||||
|
||||
/**
|
||||
* 当前viewmodel对应的页面binding
|
||||
*/
|
||||
protected VDB binding;
|
||||
|
||||
@Override
|
||||
public void setVDBinding(ViewDataBinding vdBinding) {
|
||||
|
||||
binding = (VDB) vdBinding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VDB getVDBinding() {
|
||||
if (binding == null) {
|
||||
throw new NullPointerException("BaseViewModel >> getVDBinding >> null!!!");
|
||||
}
|
||||
return binding;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上下文
|
||||
*/
|
||||
private WeakReference<Context> ctx;
|
||||
|
||||
@Override
|
||||
public void setCtx(Context context) {
|
||||
if (ctx == null) {
|
||||
ctx = new WeakReference<>(context);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Context getCtx() {
|
||||
if (ctx == null) {
|
||||
throw new NullPointerException("BaseViewModel >> getCtx >> null!!!");
|
||||
}
|
||||
return ctx.get();
|
||||
}
|
||||
|
||||
|
||||
public abstract void onDestroy();
|
||||
|
||||
private BehaviorSubject<T> mBehaviorSubject;
|
||||
|
||||
@Override
|
||||
public void setLifecycle(BehaviorSubject subject) {
|
||||
this.mBehaviorSubject = (BehaviorSubject<T>) subject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BehaviorSubject<T> getLifecycle() {
|
||||
return mBehaviorSubject;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.fuying.sn.base.mvvm;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.databinding.ViewDataBinding;
|
||||
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
public interface ViewDataBindingCallback<VDB extends ViewDataBinding, T> {
|
||||
|
||||
void setVDBinding(VDB binding);
|
||||
|
||||
VDB getVDBinding() throws NullPointerException;
|
||||
|
||||
void setCtx(Context context);
|
||||
|
||||
Context getCtx() throws NullPointerException;
|
||||
|
||||
void setLifecycle(BehaviorSubject<T> subject);
|
||||
|
||||
BehaviorSubject<T> getLifecycle();
|
||||
}
|
||||
94
app/src/main/java/com/fuying/sn/base/rx/BaseRxActivity.java
Normal file
@@ -0,0 +1,94 @@
|
||||
package com.fuying.sn.base.rx;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.CallSuper;
|
||||
import androidx.annotation.CheckResult;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.trello.rxlifecycle4.LifecycleProvider;
|
||||
import com.trello.rxlifecycle4.LifecycleTransformer;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.trello.rxlifecycle4.android.RxLifecycleAndroid;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
/**
|
||||
* {@link com.trello.rxlifecycle4.components.RxActivity}
|
||||
* copied form RxActivity}
|
||||
*/
|
||||
public abstract class BaseRxActivity extends AppCompatActivity implements LifecycleProvider<ActivityEvent> {
|
||||
private final BehaviorSubject<ActivityEvent> lifecycleSubject = BehaviorSubject.create();
|
||||
|
||||
public BehaviorSubject<ActivityEvent> getLifecycleSubject() {
|
||||
return lifecycleSubject;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
@CheckResult
|
||||
public final Observable<ActivityEvent> lifecycle() {
|
||||
return lifecycleSubject.hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
@CheckResult
|
||||
public final <T> LifecycleTransformer<T> bindUntilEvent(@NonNull ActivityEvent event) {
|
||||
return RxLifecycle.bindUntilEvent(lifecycleSubject, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
@CheckResult
|
||||
public final <T> LifecycleTransformer<T> bindToLifecycle() {
|
||||
return RxLifecycleAndroid.bindActivity(lifecycleSubject);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
lifecycleSubject.onNext(ActivityEvent.CREATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
lifecycleSubject.onNext(ActivityEvent.START);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
lifecycleSubject.onNext(ActivityEvent.RESUME);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
protected void onPause() {
|
||||
lifecycleSubject.onNext(ActivityEvent.PAUSE);
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
protected void onStop() {
|
||||
lifecycleSubject.onNext(ActivityEvent.STOP);
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
protected void onDestroy() {
|
||||
lifecycleSubject.onNext(ActivityEvent.DESTROY);
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
package com.fuying.sn.base.rx;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.CallSuper;
|
||||
import androidx.annotation.CheckResult;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import com.trello.rxlifecycle4.LifecycleProvider;
|
||||
import com.trello.rxlifecycle4.LifecycleTransformer;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.FragmentEvent;
|
||||
import com.trello.rxlifecycle4.android.RxLifecycleAndroid;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
/**
|
||||
* {@link com.trello.rxlifecycle4.components.RxFragment}
|
||||
* copied form RxFragment}
|
||||
*/
|
||||
public class BaseRxDialogFragment extends DialogFragment implements LifecycleProvider<FragmentEvent> {
|
||||
private final BehaviorSubject<FragmentEvent> lifecycleSubject = BehaviorSubject.create();
|
||||
|
||||
public BehaviorSubject<FragmentEvent> getLifecycleSubject() {
|
||||
return lifecycleSubject;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
@CheckResult
|
||||
public final Observable<FragmentEvent> lifecycle() {
|
||||
return lifecycleSubject.hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
@CheckResult
|
||||
public final <T> LifecycleTransformer<T> bindUntilEvent(@NonNull FragmentEvent event) {
|
||||
return RxLifecycle.bindUntilEvent(lifecycleSubject, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
@CheckResult
|
||||
public final <T> LifecycleTransformer<T> bindToLifecycle() {
|
||||
return RxLifecycleAndroid.bindFragment(lifecycleSubject);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onAttach(android.app.Activity activity) {
|
||||
super.onAttach(activity);
|
||||
lifecycleSubject.onNext(FragmentEvent.ATTACH);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
lifecycleSubject.onNext(FragmentEvent.CREATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
lifecycleSubject.onNext(FragmentEvent.CREATE_VIEW);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
lifecycleSubject.onNext(FragmentEvent.START);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
lifecycleSubject.onNext(FragmentEvent.RESUME);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onPause() {
|
||||
lifecycleSubject.onNext(FragmentEvent.PAUSE);
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onStop() {
|
||||
lifecycleSubject.onNext(FragmentEvent.STOP);
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onDestroyView() {
|
||||
lifecycleSubject.onNext(FragmentEvent.DESTROY_VIEW);
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onDestroy() {
|
||||
lifecycleSubject.onNext(FragmentEvent.DESTROY);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onDetach() {
|
||||
lifecycleSubject.onNext(FragmentEvent.DETACH);
|
||||
super.onDetach();
|
||||
}
|
||||
}
|
||||
|
||||
123
app/src/main/java/com/fuying/sn/base/rx/BaseRxFragment.java
Normal file
@@ -0,0 +1,123 @@
|
||||
package com.fuying.sn.base.rx;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.CallSuper;
|
||||
import androidx.annotation.CheckResult;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.trello.rxlifecycle4.LifecycleProvider;
|
||||
import com.trello.rxlifecycle4.LifecycleTransformer;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.FragmentEvent;
|
||||
import com.trello.rxlifecycle4.android.RxLifecycleAndroid;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
/**
|
||||
* {@link com.trello.rxlifecycle4.components.RxFragment}
|
||||
* copied form RxFragment}
|
||||
*/
|
||||
public class BaseRxFragment extends Fragment implements LifecycleProvider<FragmentEvent> {
|
||||
private final BehaviorSubject<FragmentEvent> lifecycleSubject = BehaviorSubject.create();
|
||||
|
||||
public BehaviorSubject<FragmentEvent> getLifecycleSubject() {
|
||||
return lifecycleSubject;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
@CheckResult
|
||||
public final Observable<FragmentEvent> lifecycle() {
|
||||
return lifecycleSubject.hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
@CheckResult
|
||||
public final <T> LifecycleTransformer<T> bindUntilEvent(@NonNull FragmentEvent event) {
|
||||
return RxLifecycle.bindUntilEvent(lifecycleSubject, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
@CheckResult
|
||||
public final <T> LifecycleTransformer<T> bindToLifecycle() {
|
||||
return RxLifecycleAndroid.bindFragment(lifecycleSubject);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onAttach(android.app.Activity activity) {
|
||||
super.onAttach(activity);
|
||||
lifecycleSubject.onNext(FragmentEvent.ATTACH);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
lifecycleSubject.onNext(FragmentEvent.CREATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
lifecycleSubject.onNext(FragmentEvent.CREATE_VIEW);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
lifecycleSubject.onNext(FragmentEvent.START);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
lifecycleSubject.onNext(FragmentEvent.RESUME);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onPause() {
|
||||
lifecycleSubject.onNext(FragmentEvent.PAUSE);
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onStop() {
|
||||
lifecycleSubject.onNext(FragmentEvent.STOP);
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onDestroyView() {
|
||||
lifecycleSubject.onNext(FragmentEvent.DESTROY_VIEW);
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onDestroy() {
|
||||
lifecycleSubject.onNext(FragmentEvent.DESTROY);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onDetach() {
|
||||
lifecycleSubject.onNext(FragmentEvent.DETACH);
|
||||
super.onDetach();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,22 +342,23 @@ public class RunningAppManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void getConfig() {
|
||||
public void getConfig() {
|
||||
int min = 300;
|
||||
int max = 1800;
|
||||
Random random = new Random();
|
||||
int randomNumber = random.nextInt(max - min + 1) + min; // 公式:nextInt(范围跨度) + 最小值
|
||||
Observable.timer(randomNumber, TimeUnit.SECONDS)
|
||||
Observable.timer(randomNumber, TimeUnit.MILLISECONDS)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<Long>() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
|
||||
Log.e("getConfig", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@io.reactivex.rxjava3.annotations.NonNull Long aLong) {
|
||||
Log.e("getConfig", "onNext: " + aLong);
|
||||
//清除数据保证及时性
|
||||
mMMKV.encode(RemainingTimeMap, "");
|
||||
mMMKV.encode(GlobalUsageTimeMap, "");
|
||||
@@ -371,12 +372,12 @@ public class RunningAppManager {
|
||||
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
|
||||
Log.e("getConfig", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
Log.e("getConfig", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -759,6 +760,7 @@ public class RunningAppManager {
|
||||
this.add("com.sprd.engineermode");
|
||||
this.add("com.teclast.update");
|
||||
this.add("com.incar.update");
|
||||
this.add("com.adups.fota");
|
||||
}};
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.fuying.sn.fragment.dialog;
|
||||
|
||||
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.base.BaseDialogFragment;
|
||||
import com.fuying.sn.databinding.FragmentDialogRestartBinding;
|
||||
import com.fuying.sn.utils.Utils;
|
||||
|
||||
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) {
|
||||
Utils.triggerRebirth(mContext);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fetchData() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -572,10 +572,10 @@ public class NetInterfaceManager {
|
||||
|
||||
}
|
||||
|
||||
public interface ObserverCallback {
|
||||
public interface ObserverCallback<T> {
|
||||
void onSubscribe(Disposable d);
|
||||
|
||||
void onNext(BaseResponse response);
|
||||
void onNext(BaseResponse<T> response);
|
||||
|
||||
void onError(Throwable e);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.fuying.sn.service.main;
|
||||
|
||||
import com.fuying.sn.base.BasePresenter;
|
||||
import com.fuying.sn.base.BaseView;
|
||||
import com.fuying.sn.base.mvp.BasePresenter;
|
||||
import com.fuying.sn.base.mvp.BaseView;
|
||||
import com.fuying.sn.bean.BaseResponse;
|
||||
import com.fuying.sn.bean.SnInfo;
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.fuying.sn.base.rx.BaseRxService;
|
||||
import com.fuying.sn.bean.BaseResponse;
|
||||
import com.fuying.sn.bean.SnInfo;
|
||||
import com.fuying.sn.config.CommonConfig;
|
||||
import com.fuying.sn.desktop.RunningAppManager;
|
||||
import com.fuying.sn.manager.AmapManager;
|
||||
import com.fuying.sn.manager.ControlManager;
|
||||
import com.fuying.sn.network.NetInterfaceManager;
|
||||
@@ -491,8 +492,8 @@ public class MainService extends BaseRxService implements MainSContact.MainView,
|
||||
if (TimeUtils.isTodayWithJavaTime(lastTime)) {
|
||||
Log.e(TAG, "getAppControl: requests have been made today");
|
||||
} else {
|
||||
Log.e(TAG, "getAppControl: getAppTimeControl");
|
||||
mPresenter.getAppTimeControl();
|
||||
Log.e(TAG, "getAppControl: getConfig");
|
||||
RunningAppManager.getInstance().getConfig();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ import android.net.wifi.WifiManager;
|
||||
import android.os.BatteryManager;
|
||||
import android.os.Build;
|
||||
import android.os.StatFs;
|
||||
import android.os.SystemClock;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
@@ -48,14 +47,6 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.qrcode.QRCodeWriter;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.fuying.sn.BuildConfig;
|
||||
import com.fuying.sn.R;
|
||||
import com.fuying.sn.Statistics.AppInformation;
|
||||
@@ -64,6 +55,14 @@ import com.fuying.sn.bean.AppUsed;
|
||||
import com.fuying.sn.config.CommonConfig;
|
||||
import com.fuying.sn.gson.GsonUtils;
|
||||
import com.fuying.sn.network.NetInterfaceManager;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.qrcode.QRCodeWriter;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
@@ -222,7 +221,7 @@ public class Utils {
|
||||
// get md5 bytes
|
||||
byte[] p_md5Data = m.digest();
|
||||
// create a hex string
|
||||
String m_szUniqueID = new String();
|
||||
String m_szUniqueID = "";
|
||||
for (int i = 0; i < p_md5Data.length; i++) {
|
||||
int b = (0xFF & p_md5Data[i]);
|
||||
// if it is a single digit, make sure it have 0 in front (proper padding)
|
||||
@@ -311,9 +310,7 @@ public class Utils {
|
||||
return true;
|
||||
if (s.length() == 0)
|
||||
return true;
|
||||
if (s.trim().length() == 0)
|
||||
return true;
|
||||
return false;
|
||||
return s.trim().length() == 0;
|
||||
}
|
||||
|
||||
// 手动隐藏键盘
|
||||
@@ -443,7 +440,7 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return diff > 0 ? true : false;
|
||||
return diff > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -502,13 +499,9 @@ public class Utils {
|
||||
int top = leftTop[1];
|
||||
int bottom = top + v.getHeight();
|
||||
int right = left + v.getWidth();
|
||||
if (event.getX() > left && event.getX() < right
|
||||
&& event.getY() > top && event.getY() < bottom) {
|
||||
// 点击的是输入框区域,保留点击EditText的事件
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return !(event.getX() > left) || !(event.getX() < right)
|
||||
|| !(event.getY() > top) || !(event.getY() < bottom);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -524,10 +517,7 @@ public class Utils {
|
||||
// 检查网络连接,如果无网络可用,就不需要进行连网操作等
|
||||
NetworkInfo networkinfo = manager.getActiveNetworkInfo();
|
||||
|
||||
if (networkinfo == null || !networkinfo.isAvailable()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return networkinfo != null && networkinfo.isAvailable();
|
||||
}
|
||||
|
||||
public static String getTime(int time) {
|
||||
@@ -560,7 +550,6 @@ public class Utils {
|
||||
try {
|
||||
packInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
|
||||
String version = packInfo.versionName.replaceAll("[a-zA-Z]", "").trim();
|
||||
;
|
||||
return version;
|
||||
} catch (NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
@@ -917,9 +906,7 @@ public class Utils {
|
||||
}
|
||||
//去掉已经安装的
|
||||
} else {
|
||||
if (!allList.contains(s)) {
|
||||
allList.add(s);
|
||||
}
|
||||
//没有安装就加入进去
|
||||
//没有加入会导致安装后卸载不能再安装的情况
|
||||
}
|
||||
@@ -1190,10 +1177,7 @@ public class Utils {
|
||||
@Override
|
||||
public boolean accept(File pathname) {
|
||||
// Check if filename is "cpu", followed by a single digit number
|
||||
if (Pattern.matches("cpu[0-9]", pathname.getName())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return Pattern.matches("cpu[0-9]", pathname.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1384,4 +1368,14 @@ public class Utils {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*重启自身*/
|
||||
public static void triggerRebirth(Context context) {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
Intent intent = packageManager.getLaunchIntentForPackage(context.getPackageName()); //
|
||||
ComponentName componentName = intent.getComponent();
|
||||
Intent mainIntent = Intent.makeRestartActivityTask(componentName); //
|
||||
context.startActivity(mainIntent);
|
||||
Runtime.getRuntime().exit(0); //
|
||||
}
|
||||
}
|
||||
BIN
app/src/main/res/drawable-hdpi/fly_fooing.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
app/src/main/res/drawable-hdpi/fly_qrcode.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_diagnosis.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
24
app/src/main/res/drawable/card_background.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<!-- 填充的颜色:这里设置背景透明 -->
|
||||
<solid android:color="#FFFFFF" />
|
||||
<!-- 边框的颜色 :不能和窗口背景色一样 -->
|
||||
|
||||
<!-- 设置按钮的四个角为弧形 -->
|
||||
<!-- android:radius 弧形的半径 -->
|
||||
<corners
|
||||
android:bottomLeftRadius="@dimen/dp_8"
|
||||
android:bottomRightRadius="@dimen/dp_8"
|
||||
android:topLeftRadius="@dimen/dp_8"
|
||||
android:topRightRadius="@dimen/dp_8" />
|
||||
|
||||
<!-- padding:Button里面的文字与Button边界的间隔 -->
|
||||
<!-- <padding-->
|
||||
<!-- android:bottom="10dp"-->
|
||||
<!-- android:left="10dp"-->
|
||||
<!-- android:right="10dp"-->
|
||||
<!-- android:top="10dp" />-->
|
||||
|
||||
</shape>
|
||||
@@ -1,40 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<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.main.MainActivity">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="com.fuying.sn.activity.main.MainActivity.BtnClick" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#ffffff"
|
||||
tools:context=".activity.main.MainActivity"
|
||||
tools:ignore="MissingDefaultResource">
|
||||
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_28"
|
||||
android:layout_height="@dimen/dp_36"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_exit"
|
||||
android:layout_width="@dimen/dp_44"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="返回"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_15"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="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"
|
||||
@@ -46,110 +42,289 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="我的设备"
|
||||
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_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="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/tv_version"
|
||||
android:id="@+id/textView11"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:text="version"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:text="设备码"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_8"
|
||||
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"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tv_customversion"
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout">
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_weight="4"
|
||||
android:background="@drawable/card_background"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/qr_code"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:layout_marginTop="@dimen/dp_44"
|
||||
android:layout_width="@dimen/dp_59"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/qrcode_shape"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/logo"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
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" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_sn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:text="sn"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/qr_code" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_32"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/bind_applet"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_bind"
|
||||
tools:layout_editor_absoluteX="0dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_update"
|
||||
android:layout_width="@dimen/dp_150"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_marginBottom="@dimen/dp_32"
|
||||
android:background="@drawable/bt_selector"
|
||||
android:gravity="center"
|
||||
android:text="检查更新"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_appqrcode"
|
||||
android:layout_width="@dimen/dp_300"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:layout_marginBottom="@dimen/dp_44"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/applet_qrcode"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/fly_qrcode"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.367" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_customversion"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_4"
|
||||
android:layout_marginBottom="@dimen/dp_4"
|
||||
android:textColor="@color/lightgrey"
|
||||
android:textSize="@dimen/sp_9"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
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,40 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<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.main.MainActivity">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="com.fuying.sn.activity.main.MainActivity.BtnClick" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#ffffff"
|
||||
tools:context=".activity.main.MainActivity"
|
||||
tools:ignore="MissingDefaultResource">
|
||||
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_28"
|
||||
android:layout_height="@dimen/dp_36"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_exit"
|
||||
android:layout_width="@dimen/dp_44"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="返回"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_15"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="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"
|
||||
@@ -46,110 +42,289 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="我的设备"
|
||||
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_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="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/tv_version"
|
||||
android:id="@+id/textView11"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:text="version"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:text="设备码"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_8"
|
||||
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"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tv_customversion"
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout">
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_weight="4"
|
||||
android:background="@drawable/card_background"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/qr_code"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:layout_marginTop="@dimen/dp_44"
|
||||
android:layout_width="@dimen/dp_59"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/qrcode_shape"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/logo"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
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" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_sn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:text="sn"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/qr_code" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_32"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/bind_applet"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_bind"
|
||||
tools:layout_editor_absoluteX="0dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_update"
|
||||
android:layout_width="@dimen/dp_150"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_marginBottom="@dimen/dp_32"
|
||||
android:background="@drawable/bt_selector"
|
||||
android:gravity="center"
|
||||
android:text="检查更新"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_appqrcode"
|
||||
android:layout_width="@dimen/dp_300"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:layout_marginBottom="@dimen/dp_44"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/applet_qrcode"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/fly_qrcode"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.367" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_customversion"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_4"
|
||||
android:layout_marginBottom="@dimen/dp_4"
|
||||
android:textColor="@color/lightgrey"
|
||||
android:textSize="@dimen/sp_9"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
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>
|
||||
101
app/src/main/res/layout/fragment_dialog_restart.xml
Normal file
@@ -0,0 +1,101 @@
|
||||
<?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=".fragment.dialog.RestartFragment">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="com.fuying.sn.fragment.dialog.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/activation_color"
|
||||
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>
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 24 KiB |
@@ -18,4 +18,6 @@
|
||||
|
||||
<color name="float_window_color">#E5000000</color>
|
||||
|
||||
<color name="text_gray">#9a9a9a</color>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<resources>
|
||||
<string name="app_name">我的设备</string>
|
||||
<string name="app_name">家长守护</string>
|
||||
<string name="download_btn_had">打开</string>
|
||||
<string name="open_app_fail">打开失败!</string>
|
||||
<string name="search_edit">请输入应用名称或关键字</string>
|
||||
@@ -20,4 +20,7 @@
|
||||
<string name="bind_succeed">设备已绑定成功</string>
|
||||
<string name="device_unauthorized">设备未经授权</string>
|
||||
<string name="locked_hint">家长设置了屏幕锁定,你可以联系家长解锁屏幕,或通过密码解锁</string>
|
||||
|
||||
<string name="unknown">—</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
<item name="android:windowBackground">@color/colorPrimary</item>
|
||||
<!-- <item name="android:windowBackground">@color/colorPrimary</item>-->
|
||||
<item name="android:fitsSystemWindows">true</item>
|
||||
<item name="android:navigationBarColor">?attr/colorPrimary</item>
|
||||
</style>
|
||||
|
||||