version:3.4.8

fix:
update:修改主页ui
This commit is contained in:
2026-03-03 16:58:44 +08:00
parent b8b951650b
commit d62f7ea042
91 changed files with 8580 additions and 1279 deletions

View File

@@ -50,7 +50,7 @@
<!-- 允许程序读取或写入系统设置 -->
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<!-- android 9.0上使用前台服务,需要添加权限 -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<!-- <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />-->
<!-- 用于读取手机当前的状态 -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!-- 读取缓存数据 -->
@@ -73,13 +73,6 @@
<!-- 如果您的应用需要后台定位权限,且有可能运行在Android Q设备上,并且设置了target>28,必须增加这个权限声明 -->
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<!-- 【必须】 移动推送 TPNS SDK VIP版本所需权限 -->
<permission
android:name="com.fuying.sn.permission.XGPUSH_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.fuying.sn.permission.XGPUSH_RECEIVE" />
<!-- 【必须】 移动推送 TPNS SDK 所需权限 -->
<!-- <uses-permission android:name="android.permission.INTERNET" />-->
<!-- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />-->
@@ -104,20 +97,33 @@
android:theme="@style/ImmerseTheme"
android:usesCleartextTraffic="true"
tools:replace="android:allowBackup">
<!-- <activity-->
<!-- android:name=".activity.main.MainActivity"-->
<!-- android:launchMode="singleTask"-->
<!-- android:screenOrientation="landscape">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<!-- </intent-filter>-->
<!-- </activity>-->
<activity
android:name=".activity.main.MainActivity"
android:launchMode="singleTask"
android:screenOrientation="landscape">
android:name=".activity.home.HomeActivity"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activity.SplashActivity"
android:launchMode="singleTask" />
<activity
android:name=".activity.update.UpdateActivity"
android:launchMode="singleTask"
android:screenOrientation="landscape" />
android:theme="@style/DialogCloseOnTouchOutside" />
<service
android:name=".service.ControlPanelService"
@@ -214,30 +220,11 @@
android:resource="@xml/file_paths" />
</provider>
<!-- 声明service组件 -->
<service
android:name="com.baidu.location.f"
android:enabled="true"
android:process=":remote" />
<!-- 应用的其它配置 -->
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
<!-- 【可选】APP实现的Receiver,用于接收消息透传和操作结果的回调,请根据需要添加 -->
<!-- YOUR_PACKAGE_PATH.CustomPushReceiver需要改为自己的Receiver: -->
<receiver android:name=".push.tpush.MessageReceiver">
<intent-filter>
<!-- 接收消息透传 -->
<action android:name="com.tencent.android.xg.vip.action.PUSH_MESSAGE" />
<!-- 监听注册、反注册、设置/删除标签、通知被点击等处理结果 -->
<action android:name="com.tencent.android.xg.vip.action.FEEDBACK" />
</intent-filter>
</receiver>
<receiver
android:name=".push.alipush.AliyunMessageReceiver"
android:exported="false">
@@ -266,19 +253,16 @@
<!-- </intent-filter> -->
<!-- </service> -->
<!-- 【必须】 请修改为 APP 的 AccessId,“15”开头的10位数字,中间没空格 -->
<meta-data
android:name="XG_V2_ACCESS_ID"
android:value="1500031216" />
<!-- 【必须】 请修改为APP的AccessKey,“A”开头的12位字符串,中间没空格 -->
<meta-data
android:name="XG_V2_ACCESS_KEY"
android:value="A1HBG2922B9Z" />
<!-- 定位需要的服务 适配Android Q需要加上android:foregroundServiceType="location"-->
<service
android:name="com.amap.api.location.APSService"
android:foregroundServiceType="location" />
<!-- 设置key -->
<meta-data
android:name="com.baidu.lbsapi.API_KEY"
android:value="${AK}" />
android:name="com.amap.api.v2.apikey"
android:value="${AMAP_KEY}" />
<!-- 请填写你自己的- appKey -->
<meta-data

View File

@@ -0,0 +1,250 @@
package com.fuying.sn.activity.home;
import android.content.Intent;
import android.os.SystemClock;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.viewpager.widget.ViewPager;
import com.blankj.utilcode.util.NetworkUtils;
import com.fuying.sn.R;
import com.fuying.sn.base.mvvm.BaseMvvmActivity;
import com.fuying.sn.bean.BaseResponse;
import com.fuying.sn.bean.SnInfo;
import com.fuying.sn.config.CommonConfig;
import com.fuying.sn.databinding.ActivityHomeBinding;
import com.fuying.sn.dialog.UserDebugDialog;
import com.fuying.sn.fragment.BaseFragmentPagerAdapter;
import com.fuying.sn.fragment.device.DeviceFragment;
import com.fuying.sn.manager.ControlManager;
import com.fuying.sn.manager.DeviceManager;
import com.fuying.sn.network.NetInterfaceManager;
import com.fuying.sn.utils.SPUtils;
import com.fuying.sn.utils.ToastUtil;
import java.util.ArrayList;
import java.util.List;
public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBinding> implements NetworkUtils.OnNetworkStatusChangedListener {
private static final String TAG = "MainActivity";
private String[] mAllTitle = new String[]{
// "使用统计",
"设备信息",};
private List<Fragment> mFragments;
private FragmentManager mFragmentManager;
private BaseFragmentPagerAdapter mBaseFragmentPagerAdapter;
private ViewPager.OnPageChangeListener mListener;
private int defaultCurrent = 0;
@Override
public boolean setNightMode() {
return true;
}
@Override
public void onDisconnected() {
Log.e(TAG, "onDisconnected: ");
}
@Override
public void onConnected(NetworkUtils.NetworkType networkType) {
Log.e(TAG, "onConnected: ");
}
@Override
public int getLayoutId() {
return R.layout.activity_home;
}
@Override
protected void initDataBinding() {
mViewModel.setCtx(this);
mViewModel.setLifecycle(getLifecycleSubject());
mViewModel.setVDBinding(mViewDataBinding);
mViewDataBinding.setClick(new BtnClick());
}
@Override
public void initView() {
mFragments = new ArrayList<>();
// mFragments.add(new UsageFragment());
mFragments.add(new DeviceFragment());
mFragmentManager = getSupportFragmentManager();
mBaseFragmentPagerAdapter = new BaseFragmentPagerAdapter(mFragmentManager, mFragments);
mViewDataBinding.viewPager.setAdapter(mBaseFragmentPagerAdapter);
mViewDataBinding.viewPager.setOnPageChangeListener(mListener);
mViewDataBinding.viewPager.setOffscreenPageLimit(4);
mViewDataBinding.mainSlidingTabLayout.setViewPager(mViewDataBinding.viewPager, mAllTitle);
}
@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();
}
});
}
@Override
protected void onResume() {
super.onResume();
Log.e(TAG, "onResume: ");
}
@Override
protected void onPause() {
super.onPause();
Log.e(TAG, "onPause: ");
}
@Override
protected void onDestroy() {
super.onDestroy();
Log.e(TAG, "onDestroy: ");
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
Log.e(TAG, "onNewIntent: ");
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == KeyEvent.ACTION_DOWN) {
lazyExit();
return true;
}
return super.onKeyDown(keyCode, event);
}
private boolean isDebugMode() {
if (DeviceManager.isDebugMode()) {
return true;
} else {
return (boolean) SPUtils.get(this, CommonConfig.userDebugMode, false);
}
}
final static int DEBUGCOUNTS = 8;//点击次数
final static long DEBUGDURATION = 4 * 1000;//规定有效时间
long[] mDEBUGHits = new long[DEBUGCOUNTS];
private void enterUserDebug() {
//每次点击时,数组向前移动一位
System.arraycopy(mDEBUGHits, 1, mDEBUGHits, 0, mDEBUGHits.length - 1);
//为数组最后一位赋值
mDEBUGHits[mDEBUGHits.length - 1] = SystemClock.uptimeMillis();
if (mDEBUGHits[0] >= SystemClock.uptimeMillis() - DEBUGDURATION) {
mDEBUGHits = new long[DEBUGCOUNTS]; //重新初始化数组
if ((boolean) SPUtils.get(HomeActivity.this, CommonConfig.EnableDebug, false)) {
ToastUtil.show("已经是Debug模式");
} else {
showDebugDialog();
}
}
}
private void showDebugDialog() {
UserDebugDialog dialog = new UserDebugDialog(this);
dialog.setOnClickBottomListener(new UserDebugDialog.OnClickBottomListener() {
@Override
public void onPositiveClick() {
if ("53680320".equals(dialog.getEdittext())) {
SPUtils.put(HomeActivity.this, CommonConfig.EnableDebug, true);
ToastUtil.show("进入用户Debug模式");
} else {
ToastUtil.show("密码错误");
}
dialog.dismiss();
}
@Override
public void onNegtiveClick() {
dialog.dismiss();
}
});
dialog.show();
dialog.getWindow().setGravity(Gravity.CENTER);
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}
private long mPreClickTime;
private void lazyExit() {
if (System.currentTimeMillis() - mPreClickTime > 3000) {
ToastUtil.show("再按一次,退出");
mPreClickTime = System.currentTimeMillis();
} else {
finish();
}
}
private final int COUNTS = 4; // 点击次数
private final long DURATION = 2 * 1000; // 规定有效时间
private long[] mHits = new long[COUNTS];
private void continuousClick(int count, long time) {
//每次点击时,数组向前移动一位
System.arraycopy(mHits, 1, mHits, 0, mHits.length - 1);
//为数组最后一位赋值
mHits[mHits.length - 1] = SystemClock.uptimeMillis();
if (mHits[0] >= SystemClock.uptimeMillis() - DURATION) {
mHits = new long[COUNTS]; //重新初始化数组
ToastUtil.show("正在检查更新");
}
}
public class BtnClick {
public void exit(View view) {
lazyExit();
}
public void debug(View view) {
if (isDebugMode()) {
enterUserDebug();
}
}
}
}

View File

@@ -0,0 +1,109 @@
package com.fuying.sn.activity.home;
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.ActivityHomeBinding;
import com.fuying.sn.network.NetInterfaceManager;
import com.fuying.sn.utils.CXAESUtil;
import com.fuying.sn.utils.Utils;
import com.trello.rxlifecycle4.android.ActivityEvent;
import io.reactivex.rxjava3.disposables.Disposable;
public class HomeViewModel extends BaseViewModel<ActivityHomeBinding, ActivityEvent> {
@Override
public ActivityHomeBinding getVDBinding() {
return binding;
}
@Override
public void onDestroy() {
}
public MutableLiveData<BaseResponse<SnInfo>> mSnInfoData = new MutableLiveData<>();
public void getSnInfo() {
NetInterfaceManager.getInstance()
.getSnInfo(getLifecycle(), new NetInterfaceManager.ObserverCallback<SnInfo>() {
@Override
public void onSubscribe(Disposable d) {
Log.e("getSnInfo", "onSubscribe: ");
}
@Override
public void onNext(BaseResponse<SnInfo> response) {
Log.e("getSnInfo", "onNext: " + response);
mSnInfoData.setValue(response);
}
@Override
public void onError(Throwable e) {
Log.e("getSnInfo", "onError: " + e.getMessage());
// String jsonString = mCacheHelper.getAsString(UrlAddress.SN_INFO);
// Gson gson = new Gson();
// Type type = new TypeToken<BaseResponse<SnInfo>>() {
// }.getType();
// BaseResponse<SnInfo> userInfoBaseResponse = gson.fromJson(jsonString, type);
// mSnInfoData.setValue(userInfoBaseResponse);
}
@Override
public void onComplete() {
Log.e("getSnInfo", "onComplete: ");
}
});
}
public MutableLiveData<Bitmap> mQRCodeData = new MutableLiveData<>();
public void getQRCode() {
String encryptString = CXAESUtil.encrypt(CommonConfig.AES_KEY, Utils.getIMEI(getCtx()));
Log.e("getQRCode", "setImageAndText: " + encryptString);
Bitmap bitmap = Utils.createQRImage(encryptString, 400, 400);
mQRCodeData.setValue(bitmap);
}
public void getAllApp() {
NetInterfaceManager.getInstance().getAppWhiteList(new NetInterfaceManager.WhiteListCallback() {
@Override
public void onComplet() {
}
});
}
public void checkUpdate() {
NetInterfaceManager.getInstance().checkAllAppUpdate(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
@Override
public void onComplete() {
}
});
}
public void checkFXYUpdate() {
// NetInterfaceManager.getInstance().checkFXYAppUpdate(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
// @Override
// public void onComplete() {
// mView.checkFXYUpdateFinish();
// }
// });
}
public void getOverallApp() {
NetInterfaceManager.getInstance().getOverallApp(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
@Override
public void onComplete() {
}
});
}
}

View File

@@ -46,7 +46,7 @@ import com.fuying.sn.service.GuardService;
import com.fuying.sn.service.ManagerService;
import com.fuying.sn.service.StepService;
import com.fuying.sn.service.main.MainService;
import com.fuying.sn.utils.JGYUtils;
import com.fuying.sn.utils.JgyUtils;
import com.fuying.sn.utils.SPUtils;
import com.fuying.sn.utils.TimeUtils;
import com.fuying.sn.utils.ToastUtil;
@@ -110,9 +110,9 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
Log.e(TAG, "initView: " + e.getMessage());
}
mViewDataBinding.tvBuildVersion.setText(JGYUtils.getCustomVersion());
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G13Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.iPlay50SEPlatform
mViewDataBinding.tvBuildVersion.setText(JgyUtils.getCustomVersion());
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.G13Platform
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.iPlay50SEPlatform
) {
mViewDataBinding.tvImei.setText("SN:" + Utils.getSerial());
} else {
@@ -129,8 +129,8 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
if (versionCode < BuildConfig.VERSION_CODE) {
SPUtils.put(this, "versionCode", BuildConfig.VERSION_CODE);
}
JGYUtils.getInstance().wakeUpAppstore();
JGYUtils.getInstance().wakeUpUpdateTools();
JgyUtils.getInstance().wakeUpAppstore();
JgyUtils.getInstance().wakeUpUpdateTools();
Utils.getBattery(this);
Utils.getBatterymAh(this);

View File

@@ -56,7 +56,7 @@ public class MainViewModel extends BaseViewModel<ActivityMainBinding, ActivityEv
@Override
public void onError(Throwable e) {
Log.e("getSnInfo", "onError: " + e.getMessage());
String jsonString = mCacheHelper.getAsString(UrlAddress.SNINFO);
String jsonString = mCacheHelper.getAsString(UrlAddress.SN_INFO);
Gson gson = new Gson();
Type type = new TypeToken<BaseResponse<SnInfo>>() {
}.getType();
@@ -109,6 +109,7 @@ public class MainViewModel extends BaseViewModel<ActivityMainBinding, ActivityEv
NetInterfaceManager.getInstance().getOverallApp(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
@Override
public void onComplete() {
}
});
}

View File

@@ -0,0 +1,90 @@
package com.fuying.sn.activity.update;
import android.content.Intent;
import android.view.View;
import com.arialyy.aria.core.Aria;
import com.arialyy.aria.core.download.DownloadEntity;
import com.fuying.sn.R;
import com.fuying.sn.base.mvvm.BaseMvvmActivity;
import com.fuying.sn.bean.AppInfo;
import com.fuying.sn.databinding.ActivityUpdateBinding;
import com.fuying.sn.service.DownloadService;
import com.fuying.sn.utils.ApkUtils;
import com.hjq.toast.Toaster;
import static com.arialyy.aria.core.inf.IEntity.STATE_RUNNING;
public class UpdateActivity extends BaseMvvmActivity<UpdateViewModel, ActivityUpdateBinding> {
private AppInfo mAppInfoData;
@Override
protected int getLayoutId() {
return R.layout.activity_update;
}
@Override
protected void initDataBinding() {
mViewModel.setCtx(this);
mViewModel.setLifecycle(getLifecycleSubject());
mViewModel.setVDBinding(mViewDataBinding);
mViewDataBinding.setClick(new BtnClick());
}
@Override
protected void initView() {
}
@Override
protected void initData() {
Intent intent = getIntent();
mAppInfoData = (AppInfo) intent.getSerializableExtra("appInfo");
mViewDataBinding.setAppUpdateInfo(mAppInfoData);
mViewDataBinding.setMsg("检测到新版本,是否更新");
}
public class BtnClick {
public void empty(View view) {
}
public void exit(View view) {
finish();
}
public void upgrade(View view) {
Intent intent = new Intent(UpdateActivity.this, DownloadService.class);
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// startForegroundService(intent);
// } else {
startService(intent);
// }
if (mAppInfoData != null) {
DownloadEntity entity = Aria.download(this).getFirstDownloadEntity(mAppInfoData.getApp_url());
if (null != entity) {
if (entity.isComplete()) {
ApkUtils.installApp(UpdateActivity.this, entity.getFilePath());
} else {
if (entity.getState() == STATE_RUNNING) {
Toaster.show("文件正在下载中");
finish();
} else {
Aria.download(this).resumeAllTask();
Toaster.show("正在下载");
finish();
}
}
} else {
ApkUtils.checkAppUpdate(UpdateActivity.this, mAppInfoData);
Toaster.show("正在下载更新");
finish();
}
}
}
}
}

View File

@@ -0,0 +1,18 @@
package com.fuying.sn.activity.update;
import com.fuying.sn.base.mvvm.BaseViewModel;
import com.fuying.sn.databinding.ActivityUpdateBinding;
import com.trello.rxlifecycle4.android.ActivityEvent;
public class UpdateViewModel extends BaseViewModel<ActivityUpdateBinding, ActivityEvent> {
@Override
public ActivityUpdateBinding getVDBinding() {
return binding;
}
@Override
public void onDestroy() {
}
}

View File

@@ -31,18 +31,13 @@ import com.fuying.sn.service.ManagerService;
import com.fuying.sn.service.StepService;
import com.fuying.sn.service.main.MainService;
import com.fuying.sn.utils.AppUsedTimeUtils;
import com.fuying.sn.utils.JGYUtils;
import com.fuying.sn.utils.JgyUtils;
import com.fuying.sn.utils.SystemUtils;
import com.fuying.sn.utils.Utils;
import com.tencent.android.tpush.XGIOperateCallback;
import com.tencent.android.tpush.XGPushConfig;
import com.tencent.android.tpush.XGPushManager;
import com.hjq.toast.Toaster;
import com.tencent.bugly.crashreport.CrashReport;
import com.tencent.mmkv.MMKV;
import java.util.ArrayList;
import java.util.List;
public class BaseApplication extends Application {
private static final String TAG = "BaseApplication";
@@ -79,9 +74,9 @@ public class BaseApplication extends Application {
PushManager.init(this);
aliyunPushInit();
tPushInit();
JGYUtils.init(this);
Toaster.init(this);
JgyUtils.init(this);
CrashReport.initCrashReport(getApplicationContext(), "e5f026c8d5", false);
CrashReport.setDeviceId(this, Utils.getSerial());
@@ -97,7 +92,7 @@ public class BaseApplication extends Application {
AmapManager.init(this);
NetInterfaceManager.init(this);
AppUsedTimeUtils.init(this);
JGYUtils.hookWebView();
JgyUtils.hookWebView();
startService();
}
@@ -196,36 +191,4 @@ public class BaseApplication extends Application {
});
}
private void tPushInit() {
XGPushConfig.enableDebug(this, true);
XGPushConfig.enablePullUpOtherApp(this, false);
XGPushManager.registerPush(this, new XGIOperateCallback() {
@Override
public void onSuccess(Object data, int flag) {
//token在设备卸载重装的时候有可能会变
Log.e("TPush", "注册成功,设备token为:" + data);
List<XGPushManager.AccountInfo> accountInfoList = new ArrayList<>();
Log.e("TPush", "onSuccess: " + Utils.getSerial());
accountInfoList.add(new XGPushManager.AccountInfo(XGPushManager.AccountType.CUSTOM.getValue(), Utils.getSerial()));
// accountInfoList.add(new XGPushManager.AccountInfo(XGPushManager.AccountType.CUSTOM.getValue(), Utils.getIMEI(getApplicationContext())));
XGPushManager.upsertAccounts(getApplicationContext(), accountInfoList, new XGIOperateCallback() {
@Override
public void onSuccess(Object data, int flag) {
Log.e("TPush", "upsertAccounts onSuccess, data:" + data + ", flag:" + flag);
NetInterfaceManager.getInstance().setPushTags();
}
@Override
public void onFail(Object data, int errCode, String msg) {
Log.e("TPush", "upsertAccounts onFail, data:" + data + ", code:" + errCode + ", msg:" + msg);
}
});
}
@Override
public void onFail(Object data, int errCode, String msg) {
Log.e("TPush", "注册失败,错误码:" + errCode + ",错误信息:" + msg);
}
});
}
}

View File

@@ -0,0 +1,44 @@
package com.fuying.sn.base;
import android.os.Bundle;
import com.fuying.sn.base.rx.BaseRxFragment;
public abstract class BaseFragment extends BaseRxFragment {
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;
}
}

View File

@@ -0,0 +1,184 @@
package com.fuying.sn.base.mvvm.fragment;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
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.BaseDialogFragment;
import java.lang.ref.WeakReference;
import java.lang.reflect.ParameterizedType;
/**
* @author: lml
* @date: 2021/12/15
*/
public abstract class BaseMvvmDialogFragment<VM extends ViewModel, VDB extends ViewDataBinding> extends BaseDialogFragment {
protected String mTag = this.getClass().getSimpleName();
/**
* 是否顯示了
*/
protected boolean mIsVisible;
/**
* 是否準備好了-Created
*/
protected boolean mHasPrepare;
protected VM mViewModel;
protected VDB mViewDataBinding;
protected Class<VM> vmClass;
//
// protected Toolbar toolbar;
// protected View statusBarView;
//
protected Bundle bundle;//来自getArguments()
protected Bundle savedInstanceState;
// protected Context context;
/**
* 上下文
*/
private WeakReference<Context> ctx;
public Context getCtx() {
return ctx == null ? null : ctx.get();
}
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
// this.context = context;
ctx = new WeakReference<>(context);
}
/**
* onCreate、onResume里不能调用
*
* @return
*/
public boolean isAttached() {
boolean flag = getCtx() != null && isAdded();
Log.e(" >> isAttached >>", "flag = " + flag);
return flag;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//ViewDataBinding
mViewDataBinding = DataBindingUtil.inflate(inflater, getLayoutId(), container, false);
mViewDataBinding.setLifecycleOwner(this);
//ViewModel
vmClass = (Class<VM>) ((ParameterizedType) this.getClass().getGenericSuperclass()).getActualTypeArguments()[0];
mViewModel = new ViewModelProvider(this).get(vmClass);
return mViewDataBinding.getRoot();
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
initDataBinding();
initView(bundle = getArguments());
initData(this.savedInstanceState = savedInstanceState);
if (mIsVisible) {
onEnter();
}
mHasPrepare = true;
}
@Override
public void onDestroyView() {
super.onDestroyView();
mHasPrepare = false;
mViewDataBinding = null;
}
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (mIsVisible == getUserVisibleHint())
return;
mIsVisible = getUserVisibleHint();
if (mIsVisible) {
if (!mHasPrepare)
return;
onEnter();
} else {
onExit();
}
}
@LayoutRes
protected abstract int getLayoutId();
protected abstract void initDataBinding();
protected abstract void initView(Bundle bundle);
protected abstract void initData(Bundle savedInstanceState);
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
protected void hideInputMethod(Activity activity) {
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
View view = activity.getCurrentFocus();
if (view != null) {
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
protected void hideInputMethod(Activity activity, EditText editText) {
InputMethodManager imm = (InputMethodManager) editText.getContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
View view = activity.getCurrentFocus();
if (view != null) {
imm.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}
}
protected void showInputMethod(EditText editText) {
InputMethodManager imm = (InputMethodManager) editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(editText, InputMethodManager.SHOW_FORCED);
}
/**
* 進入界面
*/
protected void onEnter() {
}
/**
* 離開界面
*/
protected void onExit() {
}
}

View File

@@ -0,0 +1,279 @@
package com.fuying.sn.base.mvvm.fragment;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
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.BaseFragment;
import java.lang.ref.WeakReference;
import java.lang.reflect.ParameterizedType;
/**
* @author: lml
* @date: 2021/12/15
*/
public abstract class BaseMvvmFragment<VM extends ViewModel, VDB extends ViewDataBinding> extends BaseFragment {
protected String mTag = this.getClass().getSimpleName();
/**
* 是否顯示了
*/
protected boolean mIsVisible;
/**
* 是否準備好了-Created
*/
protected boolean mHasPrepare;
protected VM mViewModel;
protected VDB mViewDataBinding;
protected Class<VM> vmClass;
//
// protected Toolbar toolbar;
// protected View statusBarView;
//
protected Bundle bundle;//来自getArguments()
protected Bundle savedInstanceState;
// protected Context context;
/**
* 上下文
*/
private WeakReference<Context> ctx;
public Context getCtx() {
return ctx == null ? null : ctx.get();
}
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
// this.context = context;
ctx = new WeakReference<>(context);
}
/**
* onCreate、onResume里不能调用
*
* @return
*/
public boolean isAttached() {
boolean flag = getCtx() != null && isAdded();
Log.e(" >> isAttached >>", "flag = " + flag);
return flag;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//ViewDataBinding
mViewDataBinding = DataBindingUtil.inflate(inflater, getLayoutId(), container, false);
mViewDataBinding.setLifecycleOwner(this);
//ViewModel
vmClass = (Class<VM>) ((ParameterizedType) this.getClass().getGenericSuperclass()).getActualTypeArguments()[0];
mViewModel = new ViewModelProvider(this).get(vmClass);
//
return mViewDataBinding.getRoot();
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
// if (initStatusBarToolBar()) {
// toolbar = getToolbar();
// }
//注册eventbus
// if (getClass().isAnnotationPresent(BindEventBus.class))
// EventBusManager.register(this);
//
// fitsLayoutOverlap();
initDataBinding();
long time = System.currentTimeMillis();
initView(bundle = getArguments());
Log.e(this.getClass().getSimpleName(), "onViewCreated: initView " + (System.currentTimeMillis() - time) + "ms");
//
long time2 = System.currentTimeMillis();
initData(this.savedInstanceState = savedInstanceState);
Log.e(this.getClass().getSimpleName(), "onViewCreated: initData " + (System.currentTimeMillis() - time2) + "ms");
//
if (mIsVisible) {
onEnter();
}
mHasPrepare = true;
//
// LiveDataBus.get().with(ConstantUtils.DATA_BUS_LOADING_FRAGMENT, Boolean.class).observe(getActivity(), bool -> {
// L.e(" >> LiveDataBus >> DATA_BUS_LOADING_FRAGMENT: %s", bool);
// if(bool) {
// showLoading(R.string.str_please_wait);
// } else {
// hideLoading();
// }
// });
}
@Override
public void onDestroyView() {
super.onDestroyView();
mHasPrepare = false;
mViewDataBinding = null;
//移除eventbus
// if (getClass().isAnnotationPresent(BindEventBus.class))
// EventBusManager.unregister(this);
//
}
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (mIsVisible == getUserVisibleHint())
return;
mIsVisible = getUserVisibleHint();
if (mIsVisible) {
if (!mHasPrepare)
return;
onEnter();
} else {
onExit();
}
}
@LayoutRes
protected abstract int getLayoutId();
// protected abstract Toolbar getToolbar();
// protected View getStatusView() {
// return null;
// }
protected abstract void initDataBinding();
protected abstract void initView(Bundle bundle);
protected abstract void initData(Bundle savedInstanceState);
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// fitsLayoutOverlap();
}
// protected boolean isImmersionBarEnabled() {
// return true;
// }
// protected boolean initStatusBarToolBar() {
// return true;
// }
// private void fitsLayoutOverlap() {
// if (!isImmersionBarEnabled()) return;
// if (statusBarView != null) {
// ImmersionBar.setStatusBarView(getActivity(), statusBarView);
// }
// if (toolbar != null) {
// ImmersionBar.setTitleBar(getActivity(), toolbar);
// }
// }
protected void hideInputMethod(Activity activity) {
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
View view = activity.getCurrentFocus();
if (view != null) {
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
protected void hideInputMethod(Activity activity, EditText editText) {
InputMethodManager imm = (InputMethodManager) editText.getContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
View view = activity.getCurrentFocus();
if (view != null) {
imm.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}
}
protected void showInputMethod(EditText editText) {
InputMethodManager imm = (InputMethodManager) editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(editText, InputMethodManager.SHOW_FORCED);
}
// private CustomDialog mWaitDialog;
//
// public void showLoading(@StringRes int contentID) {
// showLoading(contentID, R.color.white);
// }
//
// public void showLoading(@StringRes int contentID, @ColorRes int color) {
// hideLoading();
// DialogX.init(getActivity());
// if (color == R.color.white) {
// mWaitDialog = DialogXUtil.getInstance().showLoading(getActivity(), getString(contentID), getResources().getColor(color));
// } else {
// mWaitDialog = DialogXUtil.getInstance().showLoading_black(getActivity(), getString(contentID), getResources().getColor(color));
// }
// }
//
// public void updateLoadingTip(@StringRes int messageID, int percent) {
// try {
// if (mWaitDialog != null && mWaitDialog.isShow()) {
// TextView tvTip = mWaitDialog.getCustomView().findViewById(R.id.tv_load_tip);
// if (tvTip != null)
// tvTip.setText(getResources().getString(messageID) + (percent == -1 ? "" : percent + "%"));
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
// public boolean isShowLoading() {
// return mWaitDialog != null && mWaitDialog.isShow();
// }
//
// public void hideLoading() {
// try {
// boolean isShow = isShowLoading();
// L.d(" >> hideLoading :: isShow: %s", isShow);
// if (isShow)
// mWaitDialog.dismiss();
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
/**
* 進入界面
*/
protected void onEnter() {
}
/**
* 離開界面
*/
protected void onExit() {
}
}

View File

@@ -0,0 +1,134 @@
package com.fuying.sn.bean;
import java.io.Serializable;
public class MapBean implements Serializable {
private static final long serialVersionUID = -4356064111098876676L;
double longitude;
double latitude;
String adcode;
String address;
String city;
String cityCode;
String country;
String countryCode;
String district;
String province;
String street;
String streetNumber;
String town;
String locationDescribe;
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public String getAdcode() {
return adcode;
}
public void setAdcode(String adcode) {
this.adcode = adcode;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getCityCode() {
return cityCode;
}
public void setCityCode(String cityCode) {
this.cityCode = cityCode;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getCountryCode() {
return countryCode;
}
public void setCountryCode(String countryCode) {
this.countryCode = countryCode;
}
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getStreet() {
return street;
}
public void setStreet(String street) {
this.street = street;
}
public String getStreetNumber() {
return streetNumber;
}
public void setStreetNumber(String streetNumber) {
this.streetNumber = streetNumber;
}
public String getTown() {
return town;
}
public void setTown(String town) {
this.town = town;
}
public String getLocationDescribe() {
return locationDescribe;
}
public void setLocationDescribe(String locationDescribe) {
this.locationDescribe = locationDescribe;
}
}

View File

@@ -3,6 +3,20 @@ package com.fuying.sn.config;
public class CommonConfig {
public static final String MMKV_ID = "InterProcessKV";
public static final String MAP_LOCATION_JSON_KEY = "MAPLOCATION_JSON_STRING";
public static final String MAP_LONGITUDE_KEY = "map_longitude_key";
public static final String MAP_LATITUDE_KEY = "map_latitude_key";
public static final String MAP_ADDRESS_KEY = "map_address_key";
public static final String MAP_PROVINCE_KEY = "map_province_key";
public static final String MAP_CITY_KEY = "map_city_key";
public static final String MAP_DISTRICT_KEY = "map_district_key";
public static final String MAP_STREET_KEY = "map_street_key";
public static final String MAP_LOCATION_DESCRIBE_KEY = "map_locationDescribe_key";
public static final String MAP_ERROR_KEY = "map_error_key";
public static final String MAP_onLocationChanged_time_KEY = "map_onLocationChanged_time_key";
public static final String MAP_BEAN = "MapBean";
/*首次开机*/
public static final String JGY_FIRST_BOOT = "first_boot";
/*保存的应用版本号*/

View File

@@ -38,7 +38,7 @@ import com.fuying.sn.gson.GsonUtils;
import com.fuying.sn.network.NetInterfaceManager;
import com.fuying.sn.network.UrlAddress;
import com.fuying.sn.utils.AppUsedTimeUtils;
import com.fuying.sn.utils.JGYUtils;
import com.fuying.sn.utils.JgyUtils;
import com.fuying.sn.utils.ToastUtil;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@@ -188,13 +188,13 @@ public class RunningAppManager {
private void checkForegroundAppName() {
String topPackage = getTopActivityInfo();
if ("org.chromium.browser".equals(topPackage)) {
JGYUtils.getInstance().killPackage("org.chromium.browser");
JgyUtils.getInstance().killPackage("org.chromium.browser");
}
String appPackageName = getAppPackageName();
Log.d(TAG, "checkForegroundAppName: topPackage = " + topPackage);
Log.d(TAG, "checkForegroundAppName: appPackageName = " + appPackageName);
if (!JGYUtils.getInstance().isScreenOn()) {
if (!JgyUtils.getInstance().isScreenOn()) {
Log.d(TAG, "checkForegroundAppName: isScreenOn = false");
if (!TextUtils.isEmpty(appPackageName)) {
Log.d(TAG, "checkForegroundAppName: isEmpty = false");
@@ -255,7 +255,7 @@ public class RunningAppManager {
// removeTask(topPackage);
NetInterfaceManager.getInstance().getAppTimeControl();
NetInterfaceManager.getInstance().getSnTimeControl();
JGYUtils.getInstance().killPackage(appPackageName);
JgyUtils.getInstance().killPackage(appPackageName);
killApp();
gotoLauncher();
} else {
@@ -282,7 +282,7 @@ public class RunningAppManager {
Log.i(TAG, "checkForegroundAppName: 没有剩余时间2");
// removeTask(topPackage);
killApp();
JGYUtils.getInstance().killPackage(appPackageName);
JgyUtils.getInstance().killPackage(appPackageName);
gotoLauncher();
NetInterfaceManager.getInstance().getAppTimeControl();
NetInterfaceManager.getInstance().getSnTimeControl();
@@ -302,13 +302,13 @@ public class RunningAppManager {
List<String> appList = launcherApp.stream().map(resolveInfo -> resolveInfo.activityInfo.packageName).collect(Collectors.toList());
Log.e(TAG, "killApp: " + appList);
for (String pkg : appList) {
if (JGYUtils.fuxiaoying.equals(pkg)
if (JgyUtils.fuxiaoying.equals(pkg)
|| BuildConfig.APPLICATION_ID.equals(pkg)
|| "com.android.settings".equals(pkg)
) {
continue;
}
JGYUtils.getInstance().killPackage(pkg);
JgyUtils.getInstance().killPackage(pkg);
}
}
@@ -759,7 +759,7 @@ public class RunningAppManager {
this.add("com.uiui.store");
this.add("com.uiui.info");
this.add("com.tt.ttutils");
this.add(JGYUtils.fuxiaoying);
this.add(JgyUtils.fuxiaoying);
this.add("com.sprd.engineermode");
this.add("com.teclast.update");
this.add("com.incar.update");

View File

@@ -0,0 +1,156 @@
package com.fuying.sn.fragment.device;
import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.text.format.Formatter;
import android.util.Log;
import android.view.View;
import androidx.lifecycle.Observer;
import com.blankj.utilcode.constant.MemoryConstants;
import com.blankj.utilcode.util.ConvertUtils;
import com.fuying.sn.BuildConfig;
import com.fuying.sn.R;
import com.fuying.sn.activity.update.UpdateActivity;
import com.fuying.sn.base.mvvm.fragment.BaseMvvmFragment;
import com.fuying.sn.bean.AppInfo;
import com.fuying.sn.bean.SnInfo;
import com.fuying.sn.config.CommonConfig;
import com.fuying.sn.databinding.FragmentDeviceBinding;
import com.fuying.sn.utils.ApkUtils;
import com.fuying.sn.utils.JgyUtils;
import com.fuying.sn.utils.TimeUtils;
import com.fuying.sn.utils.Utils;
import com.hjq.toast.Toaster;
import com.jakewharton.rxbinding4.view.RxView;
import com.tencent.mmkv.MMKV;
import io.reactivex.rxjava3.disposables.Disposable;
public class DeviceFragment extends BaseMvvmFragment<DeviceViewModel, FragmentDeviceBinding> {
private static final String TAG = "DeviceFragment";
private Activity mContext;
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
private Disposable mClickDisposable;
// 2秒防抖时间
private long windowDurationMs = 60000;
// 记录上次成功触发的时间
private final long[] lastClickTime = {0};
@Override
protected int getLayoutId() {
return R.layout.fragment_device;
}
@Override
protected void initDataBinding() {
mContext = getActivity();
mViewModel.setCtx(getCtx());
mViewModel.setLifecycle(getLifecycleSubject());
mViewModel.setVDBinding(mViewDataBinding);
mViewDataBinding.setClick(new BtnClick());
}
@Override
protected void initView(Bundle bundle) {
Log.e(TAG, "initView: byte2MemorySize = " + ConvertUtils.byte2MemorySize(Utils.getTotalMem(mContext), MemoryConstants.GB));
Log.e(TAG, "initView: getTotalMem = " + ConvertUtils.byte2FitMemorySize(Utils.getTotalMem(mContext)));
Log.e(TAG, "initView: getTotalMemory = " + Formatter.formatFileSize(mContext, Utils.getTotalMemory(mContext)));
setDeviceInfo();
mClickDisposable = RxView.clicks(mViewDataBinding.clUpdate)
.subscribe(o -> {
long currentTime = System.currentTimeMillis();
if (currentTime - lastClickTime[0] >= windowDurationMs) {
// 【情况 A】满足时间间隔:执行核心逻辑
lastClickTime[0] = currentTime;
mViewModel.checkUpdate(true);
} else {
// 【情况 B】在防抖时间内:仅提示
Toaster.show("请稍后再试");
}
});
}
@Override
protected void initData(Bundle savedInstanceState) {
mViewModel.mSnInfoMutableLiveData.observe(this, new Observer<SnInfo>() {
@Override
public void onChanged(SnInfo snInfo) {
if (snInfo != null) {
if (!TextUtils.isEmpty(snInfo.getMobile())) {
mViewDataBinding.tvPhoneNumber.setText(snInfo.getMobile());
}
mViewDataBinding.tvBindTime.setText(TimeUtils.getDate(0));
} else {
mViewDataBinding.tvPhoneNumber.setText("未绑定");
mViewDataBinding.tvBindTime.setText("未绑定");
}
}
});
mViewModel.getSnInfo();
mViewModel.mAppInfoMutableLiveData.observe(this, new Observer<AppInfo>() {
@Override
public void onChanged(AppInfo appInfo) {
if (appInfo != null) {
mViewDataBinding.tvUpdateVersion.setText(appInfo.getApp_version_name());
if (ApkUtils.isUpdate(mContext, appInfo)) {
Intent intent = new Intent(mContext, UpdateActivity.class);
intent.putExtra("appInfo", appInfo);
startActivity(intent);
Toaster.show("有新的版本需要更新");
} else {
// Toaster.show("已是最新版本");
}
} else {
Toaster.show("已是最新版本");
}
}
});
mViewModel.checkUpdate(false);
}
@Override
public void fetchData() {
Log.e(TAG, "fetchData: ");
setDeviceInfo();
}
@Override
public void onDestroyView() {
super.onDestroyView();
if (mClickDisposable != null && !mClickDisposable.isDisposed()) {
mClickDisposable.dispose();
mClickDisposable = null;
}
}
private void setDeviceInfo() {
mViewDataBinding.tvSn.setText(Utils.getSn());
mViewDataBinding.tvImei.setText(Utils.getIMEI(mContext));
mViewDataBinding.tvMac.setText(Utils.getMAC(mContext));
mViewDataBinding.tvRam.setText(Math.ceil(ConvertUtils.byte2MemorySize(Utils.getTotalMem(mContext), MemoryConstants.GB)) + " GB");
mViewDataBinding.tvAndroidVersion.setText("Android " + Build.VERSION.RELEASE);
mViewDataBinding.tvBuildVersion.setText("V" + JgyUtils.getRomVersion());
mViewDataBinding.tvLocalVersion.setText("V" + BuildConfig.VERSION_NAME);
}
public class BtnClick {
public void checkUpdate(View view) {
mViewModel.checkUpdate(true);
}
}
}

View File

@@ -0,0 +1,102 @@
package com.fuying.sn.fragment.device;
import android.util.Log;
import androidx.lifecycle.MutableLiveData;
import com.fuying.sn.BuildConfig;
import com.fuying.sn.base.mvvm.BaseViewModel;
import com.fuying.sn.bean.AppInfo;
import com.fuying.sn.bean.BaseResponse;
import com.fuying.sn.bean.SnInfo;
import com.fuying.sn.databinding.FragmentDeviceBinding;
import com.fuying.sn.network.NetInterfaceManager;
import com.trello.rxlifecycle4.RxLifecycle;
import com.trello.rxlifecycle4.android.FragmentEvent;
import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.Observer;
import io.reactivex.rxjava3.disposables.Disposable;
public class DeviceViewModel extends BaseViewModel<FragmentDeviceBinding, FragmentEvent> {
@Override
public FragmentDeviceBinding getVDBinding() {
return binding;
}
@Override
public void onDestroy() {
}
public MutableLiveData<SnInfo> mSnInfoMutableLiveData = new MutableLiveData<>();
public void getSnInfo() {
NetInterfaceManager.getInstance().getSnInfoControl()
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
.subscribe(new Observer<BaseResponse<SnInfo>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("getSnInfo", "onSubscribe: ");
}
@Override
public void onNext(@NonNull BaseResponse<SnInfo> snInfoBaseResponse) {
Log.e("getSnInfo", "onNext: " + snInfoBaseResponse);
if (snInfoBaseResponse.code == 200) {
SnInfo snInfo = snInfoBaseResponse.data;
mSnInfoMutableLiveData.setValue(snInfo);
} else {
mSnInfoMutableLiveData.setValue(null);
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("getSnInfo", "onError: " + e.getMessage());
}
@Override
public void onComplete() {
Log.e("getSnInfo", "onComplete: ");
}
});
}
public MutableLiveData<AppInfo> mAppInfoMutableLiveData = new MutableLiveData<>();
public void checkUpdate(boolean response) {
NetInterfaceManager.getInstance().getUpdateObservable(BuildConfig.APPLICATION_ID)
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
.subscribe(new Observer<BaseResponse<AppInfo>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("checkUpdate", "onSubscribe: ");
}
@Override
public void onNext(@NonNull BaseResponse<AppInfo> appInfoBaseResponse) {
Log.e("checkUpdate", "onNext: " + appInfoBaseResponse);
if (appInfoBaseResponse.code == 200) {
AppInfo appInfo = appInfoBaseResponse.data;
mAppInfoMutableLiveData.setValue(appInfo);
} else {
if (response) {
mAppInfoMutableLiveData.setValue(null);
}
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("checkUpdate", "onError: " + e.getMessage());
}
@Override
public void onComplete() {
Log.e("checkUpdate", "onComplete: ");
}
});
}
}

View File

@@ -0,0 +1,51 @@
package com.fuying.sn.fragment.usage;
import android.app.Activity;
import android.os.Bundle;
import com.fuying.sn.R;
import com.fuying.sn.base.mvvm.fragment.BaseMvvmFragment;
import com.fuying.sn.config.CommonConfig;
import com.fuying.sn.databinding.FragmentUsageBinding;
import com.tencent.mmkv.MMKV;
public class UsageFragment extends BaseMvvmFragment<UsageViewModel, FragmentUsageBinding> {
private static final String TAG = "UsageFragment";
private Activity mContext;
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
@Override
protected int getLayoutId() {
return R.layout.fragment_usage;
}
@Override
protected void initDataBinding() {
mContext = getActivity();
mViewModel.setCtx(getCtx());
mViewModel.setLifecycle(getLifecycleSubject());
mViewModel.setVDBinding(mViewDataBinding);
mViewDataBinding.setClick(new BtnClick());
}
@Override
protected void initView(Bundle bundle) {
}
@Override
protected void initData(Bundle savedInstanceState) {
}
@Override
public void fetchData() {
}
public class BtnClick {
}
}

View File

@@ -0,0 +1,18 @@
package com.fuying.sn.fragment.usage;
import com.fuying.sn.base.mvvm.BaseViewModel;
import com.fuying.sn.databinding.FragmentUsageBinding;
import com.trello.rxlifecycle4.android.FragmentEvent;
public class UsageViewModel extends BaseViewModel<FragmentUsageBinding, FragmentEvent> {
@Override
public FragmentUsageBinding getVDBinding() {
return binding;
}
@Override
public void onDestroy() {
}
}

View File

@@ -2,29 +2,39 @@ package com.fuying.sn.manager;
import android.annotation.SuppressLint;
import android.content.Context;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import com.baidu.location.BDAbstractLocationListener;
import com.baidu.location.BDLocation;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
import com.fuying.sn.utils.SPUtils;
import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.location.AMapLocationClientOption;
import com.amap.api.location.AMapLocationListener;
import com.fuying.sn.bean.MapBean;
import com.fuying.sn.config.CommonConfig;
import com.fuying.sn.gson.GsonUtils;
import com.fuying.sn.network.NetInterfaceManager;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.jeremyliao.liveeventbus.LiveEventBus;
import com.tencent.mmkv.MMKV;
import java.lang.reflect.Type;
public class AmapManager {
private static final String TAG = "AmapManager";
MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
@SuppressLint("StaticFieldLeak")
private static AmapManager sInstance;
private Context mContext;
@SuppressLint("StaticFieldLeak")
private LocationClient mLocationClient = null;
private LocationClientOption mOption;
private AMapLocationClient mAMapLocationClient;
private AMapLocationClientOption mAMapLocationClientOption;
private MapBean mMapBean;
private AmapManager(Context context) {
this.mContext = context;
// Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "+gps");
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "+network");
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.ASSISTED_GPS_ENABLED, 1);
this.mContext = context.getApplicationContext();
initAmap();
}
@@ -41,161 +51,124 @@ public class AmapManager {
if (sInstance == null) {
throw new IllegalStateException("You must be init AmapManager first");
}
return sInstance;
}
private AMapLocationClientOption getDefaultOption() {
if (mAMapLocationClientOption == null) {
mAMapLocationClientOption = new AMapLocationClientOption();
}
mAMapLocationClientOption.setLocationPurpose(AMapLocationClientOption.AMapLocationPurpose.SignIn);
//设置定位模式为AMapLocationMode.Hight_Accuracy,高精度模式。
mAMapLocationClientOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
mAMapLocationClientOption.setNeedAddress(true);
//获取一次定位结果:
//该方法默认为false。
mAMapLocationClientOption.setOnceLocation(true);
//获取最近3s内精度最高的一次定位结果:
//设置setOnceLocationLatest(boolean b)接口为true,启动定位时SDK会返回最近3s内精度最高的一次定位结果。
// 如果设置其为true,setOnceLocation(boolean b)接口也会被设置为true,反之不会,默认为false。
mAMapLocationClientOption.setOnceLocationLatest(true);
return mAMapLocationClientOption;
}
public void initAmap() {
if (mLocationClient == null) {
mLocationClient = new LocationClient(mContext);
if (mAMapLocationClient == null) {
mAMapLocationClient = new AMapLocationClient(mContext);
}
// Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "+gps");
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "+network");
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.ASSISTED_GPS_ENABLED, 1);
mLocationClient.setLocOption(getDefaultLocationClientOption());
mLocationClient.registerLocationListener(mListener);
mLocationClient.stop();
mLocationClient.start();
mAMapLocationClient.setLocationOption(getDefaultOption());
//设置定位监听
mAMapLocationClient.setLocationListener(mAMapLocationListener);
//设置场景模式后最好调用一次stop,再调用start以保证场景模式生效
startLocation();
String jsonString = mMMKV.decodeString(CommonConfig.MAP_LOCATION_JSON_KEY, "");
if (!TextUtils.isEmpty(jsonString)) {
Gson gson = new Gson();
Type type = new TypeToken<MapBean>() {
}.getType();
mMapBean = gson.fromJson(jsonString, type);
} else {
Log.e(TAG, "initAmap: jsonString is empty");
}
}
public LocationClient getLocationClient() {
if (mLocationClient == null) {
initAmap();
}
return mLocationClient;
public void startLocation() {
mAMapLocationClient.stopLocation();
mAMapLocationClient.startLocation();
Log.e(TAG, "initAmap: " + "startLocation");
}
/***
*
* @return DefaultLocationClientOption 默认O设置
*/
public LocationClientOption getDefaultLocationClientOption() {
if (mOption == null) {
mOption = new LocationClientOption();
mOption.setCoorType("bd09ll"); // 可选,默认gcj02,设置返回的定位结果坐标系,如果配合百度地图使用,建议设置为bd09ll;
mOption.setScanSpan(0); // 可选,默认0,即仅定位一次,设置发起连续定位请求的间隔需要大于等于1000ms才是有效的
mOption.setIsNeedAddress(true); // 可选,设置是否需要地址信息,默认不需要
mOption.setIsNeedLocationDescribe(true); // 可选,设置是否需要地址描述
mOption.setNeedDeviceDirect(false); // 可选,设置是否需要设备方向结果
mOption.setLocationNotify(false); // 可选,默认false,设置是否当gps有效时按照1S1次频率输出GPS结果
mOption.setIgnoreKillProcess(true); // 可选,默认true,定位SDK内部是一个SERVICE,并放到了独立进程,设置是否在stop
mOption.setIsNeedLocationDescribe(true); // 可选,默认false,设置是否需要位置语义化结果,可以在BDLocation
mOption.setIsNeedLocationPoiList(true); // 可选,默认false,设置是否需要POI结果,可以在BDLocation
mOption.SetIgnoreCacheException(false); // 可选,默认false,设置是否收集CRASH信息,默认收集
mOption.setLocationMode(LocationClientOption.LocationMode.Battery_Saving); // 可选,默认高精度,设置定位模式,高精度,低功耗,仅设备,模糊
mOption.setIsNeedAltitude(false); // 可选,默认false,设置定位时是否需要海拔信息,默认不需要,除基础定位版本都可用
// 可选,设置首次定位时选择定位速度优先还是定位准确性优先,默认为速度优先
// mOption.setFirstLocType(LocationClientOption.FirstLocType.SPEED_IN_FIRST_LOC);
}
return mOption;
}
/*****
*
* 定位结果回调,重写onReceiveLocation方法,可以直接拷贝如下代码到自己工程中修改
*
*/
private BDAbstractLocationListener mListener = new BDAbstractLocationListener() {
/**
* 定位请求回调函数
* @param location 定位结果
*/
private AMapLocationListener mAMapLocationListener = new AMapLocationListener() {
@Override
public void onReceiveLocation(BDLocation location) {
if (null != location) {
switch (location.getLocType()) {
case BDLocation.TypeGpsLocation:// GPS定位结果
case BDLocation.TypeNetWorkLocation:// 网络定位结果
case BDLocation.TypeOffLineLocation:// 离线定位结果
Log.e(TAG, "onLocationChanged: " + "定位成功");
Log.e(TAG, "onLocationChanged: " + location.getAddrStr() + location.getLocationDescribe());
SPUtils.put(mContext, "AmapAddress", location.getAddrStr() + location.getLocationDescribe());
SPUtils.put(mContext, "longitude", location.getLongitude());
SPUtils.put(mContext, "latitude", location.getLatitude());
SPUtils.put(mContext, "AmapError", "-");
break;
case BDLocation.TypeServerError:
Log.e(TAG, "onReceiveLocation: " + "服务端网络定位失败");
SPUtils.put(mContext, "AmapError", "服务端网络定位失败,可以反馈IMEI号和大体定位时间到loc-bugs@baidu.com,会有人追查原因");
break;
case BDLocation.TypeNetWorkException:
Log.e(TAG, "onReceiveLocation: " + "网络不同导致定位失败,请检查网络是否通畅");
SPUtils.put(mContext, "AmapError", "网络不同导致定位失败,请检查网络是否通畅");
break;
case BDLocation.TypeCriteriaException:
Log.e(TAG, "onReceiveLocation: " + "无法获取有效定位依据导致定位失败");
SPUtils.put(mContext, "AmapError", "无法获取有效定位依据导致定位失败,一般是由于手机的原因,处于飞行模式下一般会造成这种结果,可以试着重启手机");
break;
default:
}
public void onLocationChanged(AMapLocation aMapLocation) {
StringBuilder sb = new StringBuilder();
//errCode等于0代表定位成功,其他的为定位失败,具体的可以参照官网定位错误码说明
if (aMapLocation.getErrorCode() == 0) {
Log.e(TAG, "onLocationChanged: " + "定位成功");
updateAddress(aMapLocation);
mMapBean = getMapBean(aMapLocation);
saveMapResult(mMapBean);
LiveEventBus.get(CommonConfig.MAP_BEAN)
.post(mMapBean);
LiveEventBus.get(CommonConfig.MAP_ADDRESS_KEY)
.post(mMapBean.getAddress());
Log.e(TAG, "onLocationChanged: " + aMapLocation.getAddress());
sb.append(aMapLocation.getAddress()).append("\n");
mMMKV.encode(CommonConfig.MAP_onLocationChanged_time_KEY, System.currentTimeMillis());
} else {
//定位失败
sb.append("定位失败" + "\n");
sb.append(aMapLocation.getErrorInfo());
mMMKV.encode(CommonConfig.MAP_ERROR_KEY, aMapLocation.getErrorInfo());
Log.e(TAG, "onLocationChanged: " + "定位失败");
}
Log.e(TAG, "AmapAddress: " + SPUtils.get(mContext, "AmapAddress", "-"));
Log.e(TAG, "AmapError: " + SPUtils.get(mContext, "AmapError", "-"));
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "-gps");
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "-network");
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "");
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.ASSISTED_GPS_ENABLED, 0);
mLocationClient.stop();
}
@Override
public void onConnectHotSpotMessage(String s, int i) {
super.onConnectHotSpotMessage(s, i);
}
/**
* 回调定位诊断信息,开发者可以根据相关信息解决定位遇到的一些问题
* @param locType 当前定位类型
* @param diagnosticType 诊断类型(1~9)
* @param diagnosticMessage 具体的诊断信息释义
*/
@Override
public void onLocDiagnosticMessage(int locType, int diagnosticType, String diagnosticMessage) {
super.onLocDiagnosticMessage(locType, diagnosticType, diagnosticMessage);
// int tag = 2;
StringBuffer sb = new StringBuffer(256);
sb.append("诊断结果: ");
if (locType == BDLocation.TypeNetWorkLocation) {
if (diagnosticType == 1) {
sb.append("网络定位成功,没有开启GPS,建议打开GPS会更好");
sb.append("\n" + diagnosticMessage);
} else if (diagnosticType == 2) {
sb.append("网络定位成功,没有开启Wi-Fi,建议打开Wi-Fi会更好");
sb.append("\n" + diagnosticMessage);
}
} else if (locType == BDLocation.TypeOffLineLocationFail) {
if (diagnosticType == 3) {
sb.append("定位失败,请您检查您的网络状态");
sb.append("\n" + diagnosticMessage);
}
} else if (locType == BDLocation.TypeCriteriaException) {
if (diagnosticType == 4) {
sb.append("定位失败,无法获取任何有效定位依据");
sb.append("\n" + diagnosticMessage);
} else if (diagnosticType == 5) {
sb.append("定位失败,无法获取有效定位依据,请检查运营商网络或者Wi-Fi网络是否正常开启,尝试重新请求定位");
sb.append(diagnosticMessage);
} else if (diagnosticType == 6) {
sb.append("定位失败,无法获取有效定位依据,请尝试插入一张sim卡或打开Wi-Fi重试");
sb.append("\n" + diagnosticMessage);
} else if (diagnosticType == 7) {
sb.append("定位失败,飞行模式下无法获取有效定位依据,请关闭飞行模式重试");
sb.append("\n" + diagnosticMessage);
} else if (diagnosticType == 9) {
sb.append("定位失败,无法获取任何有效定位依据");
sb.append("\n" + diagnosticMessage);
}
} else if (locType == BDLocation.TypeServerError) {
if (diagnosticType == 8) {
sb.append("定位失败,请确认您定位的开关打开状态,是否赋予APP定位权限");
sb.append("\n" + diagnosticMessage);
}
}
Log.e(TAG, "onLocationChanged: " + "定位失败");
SPUtils.put(mContext, "AmapError", sb);
Log.e(TAG, "onLocDiagnosticMessage: " + sb);
mLocationClient.stop();
Log.e(TAG, "amap: " + sb.toString());
}
};
private void updateAddress(AMapLocation aMapLocation) {
NetInterfaceManager.getInstance().updateAdminInfo();
}
private MapBean getMapBean(AMapLocation location) {
MapBean mapBean = new MapBean();
mapBean.setLongitude(location.getLongitude());
mapBean.setLatitude(location.getLatitude());
mapBean.setAdcode(location.getAdCode());
mapBean.setAddress(location.getAddress());
mapBean.setCity(location.getCity());
mapBean.setCityCode(location.getCityCode());
mapBean.setCountry(location.getCountry());
mapBean.setCountryCode(location.getAdCode());
mapBean.setDistrict(location.getDistrict());
mapBean.setProvince(location.getProvince());
mapBean.setStreet(location.getStreet());
mapBean.setStreetNumber(location.getStreetNum());
mapBean.setTown(location.getStreet());
mapBean.setLocationDescribe(location.getLocationDetail());
Log.e(TAG, "getMapBean: " + GsonUtils.toJSONString(mapBean));
return mapBean;
}
private void saveMapResult(MapBean mapBean) {
Log.e(TAG, "saveMapResult: " + GsonUtils.toJSONString(mapBean));
mMMKV.encode(CommonConfig.MAP_LOCATION_JSON_KEY, GsonUtils.toJSONString(mapBean));
mMMKV.encode(CommonConfig.MAP_LONGITUDE_KEY, mapBean.getLongitude());
mMMKV.encode(CommonConfig.MAP_LATITUDE_KEY, mapBean.getLatitude());
mMMKV.encode(CommonConfig.MAP_ADDRESS_KEY, mapBean.getAddress());
mMMKV.encode(CommonConfig.MAP_PROVINCE_KEY, mapBean.getProvince());
mMMKV.encode(CommonConfig.MAP_CITY_KEY, mapBean.getCity());
mMMKV.encode(CommonConfig.MAP_DISTRICT_KEY, mapBean.getDistrict());
mMMKV.encode(CommonConfig.MAP_STREET_KEY, mapBean.getStreet());
mMMKV.encode(CommonConfig.MAP_LOCATION_DESCRIBE_KEY, mapBean.getLocationDescribe());
}
}

View File

@@ -14,7 +14,7 @@ import com.fuying.sn.bean.SystemSettings;
import com.fuying.sn.config.CommonConfig;
import com.fuying.sn.gson.GsonUtils;
import com.fuying.sn.utils.ApkUtils;
import com.fuying.sn.utils.JGYUtils;
import com.fuying.sn.utils.JgyUtils;
import com.fuying.sn.utils.SPUtils;
import com.fuying.sn.utils.ToastUtil;
import com.google.gson.JsonObject;
@@ -87,7 +87,7 @@ public class ControlManager {
setAppstoreAdmin(systemSettings);
setDefaultApp(systemSettings);
setIsControl(systemSettings);
JGYUtils.getInstance().updateForbidList();
JgyUtils.getInstance().updateForbidList();
}
}
@@ -117,7 +117,7 @@ public class ControlManager {
setAppstoreAdmin(systemSettings);
setDefaultApp(systemSettings);
setIsControl(systemSettings);
JGYUtils.getInstance().updateForbidList();
JgyUtils.getInstance().updateForbidList();
}
/**
@@ -202,7 +202,7 @@ public class ControlManager {
break;
}
Intent usbIntent = new Intent(usbStatus);
if (JGYUtils.getInstance().checkAppPlatform() != JGYUtils.G11JPlatform) {
if (JgyUtils.getInstance().checkAppPlatform() != JgyUtils.G11JPlatform) {
usbIntent.setPackage("com.android.settings");
}
// if (!BuildConfig.DEBUG)
@@ -246,7 +246,7 @@ public class ControlManager {
boolean aole_white_list_Array = Settings.System.putString(mResolver, CommonConfig.AOLE_ACTION_WHITE_LIST_ARRAY, setting_phones);
Log.e("SystemSetting", "aole_white_list_Array: " + aole_white_list_Array + "=" + setting_phones);
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) {
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.M40sePlatform) {
Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, 0);
} else {
int setting_memory = changeNum(settings.getSetting_memory());
@@ -268,7 +268,7 @@ public class ControlManager {
boolean aole_white_list_Array = Settings.System.putString(mResolver, CommonConfig.AOLE_ACTION_WHITE_LIST_ARRAY, "");
// ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+aole_white_list_Array+"---"+qch_call_forbid);
Log.e(TAG, "aole_white_list_Array:" + aole_white_list_Array + "---" + aole_white_list_Array);
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) {
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.M40sePlatform) {
//在m40se上 开启管控会造成第三方app无法读取sd卡,暂时打开
Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, 0);
} else {
@@ -395,7 +395,7 @@ public class ControlManager {
break;
default:
}
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.T30ProPlatform) {
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.T30ProPlatform) {
Intent navIntent = new Intent(navigationStatus);
mContext.sendBroadcast(navIntent);
} else {
@@ -836,7 +836,7 @@ public class ControlManager {
Log.e(TAG, "setDefaultApp: desktop_app = " + desktop_app);
if (!TextUtils.isEmpty(desktop_app)) {
mMMKV.encode(CommonConfig.DESKTOP_APP_KEY, desktop_app);
JGYUtils.getInstance().setDefaultDesktop(desktop_app);
JgyUtils.getInstance().setDefaultDesktop(desktop_app);
} else {
mMMKV.encode(CommonConfig.DESKTOP_APP_KEY, "");
}
@@ -844,7 +844,7 @@ public class ControlManager {
Log.e(TAG, "setDefaultApp: browser_app = " + browser_app);
if (!TextUtils.isEmpty(browser_app)) {
mMMKV.encode(CommonConfig.BROWSER_APP_KEY, browser_app);
JGYUtils.getInstance().setDefaultBrowser(browser_app);
JgyUtils.getInstance().setDefaultBrowser(browser_app);
} else {
mMMKV.encode(CommonConfig.BROWSER_APP_KEY, "");
}
@@ -852,7 +852,7 @@ public class ControlManager {
Log.e(TAG, "setDefaultApp: typewriting_app = " + typewriting_app);
if (!TextUtils.isEmpty(typewriting_app)) {
mMMKV.encode(CommonConfig.TYPEWRITING_APP_KEY, typewriting_app);
JGYUtils.getInstance().setDefaultInputMethod(typewriting_app);
JgyUtils.getInstance().setDefaultInputMethod(typewriting_app);
} else {
mMMKV.encode(CommonConfig.TYPEWRITING_APP_KEY, "");
}
@@ -865,17 +865,17 @@ public class ControlManager {
String desktop_app = mMMKV.decodeString(CommonConfig.DESKTOP_APP_KEY, "");
Log.e(TAG, "setDefaultApp: desktop_app = " + desktop_app);
if (!TextUtils.isEmpty(desktop_app)) {
JGYUtils.getInstance().setDefaultDesktop(desktop_app);
JgyUtils.getInstance().setDefaultDesktop(desktop_app);
}
String browser_app = mMMKV.decodeString(CommonConfig.BROWSER_APP_KEY, "");
Log.e(TAG, "setDefaultApp: browser_app = " + browser_app);
if (!TextUtils.isEmpty(browser_app)) {
JGYUtils.getInstance().setDefaultBrowser(browser_app);
JgyUtils.getInstance().setDefaultBrowser(browser_app);
}
String typewriting_app = mMMKV.decodeString(CommonConfig.TYPEWRITING_APP_KEY, "");
Log.e(TAG, "setDefaultApp: typewriting_app = " + typewriting_app);
if (!TextUtils.isEmpty(typewriting_app)) {
JGYUtils.getInstance().setDefaultInputMethod(typewriting_app);
JgyUtils.getInstance().setDefaultInputMethod(typewriting_app);
}
}

View File

@@ -81,10 +81,10 @@ import com.fuying.sn.network.api.QueryAllApp;
import com.fuying.sn.network.api.QueryAppInside;
import com.fuying.sn.network.api.QuerySnAppStart;
import com.fuying.sn.network.api.RunningApp;
import com.fuying.sn.network.api.SNInfoApi;
import com.fuying.sn.network.api.ScreenLock;
import com.fuying.sn.network.api.ScreenState;
import com.fuying.sn.network.api.Setting;
import com.fuying.sn.network.api.SnApi;
import com.fuying.sn.network.api.SnBindApi;
import com.fuying.sn.network.api.SnTagApi;
import com.fuying.sn.network.api.TimeControl;
@@ -98,7 +98,7 @@ import com.fuying.sn.utils.ApkUtils;
import com.fuying.sn.utils.AppUsedTimeUtils;
import com.fuying.sn.utils.CmdUtil;
import com.fuying.sn.utils.FileUtils;
import com.fuying.sn.utils.JGYUtils;
import com.fuying.sn.utils.JgyUtils;
import com.fuying.sn.utils.SPUtils;
import com.fuying.sn.utils.StringUtils;
import com.fuying.sn.utils.URLUtils;
@@ -107,8 +107,6 @@ import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;
import com.tencent.android.tpush.XGIOperateCallback;
import com.tencent.android.tpush.XGPushManager;
import com.tencent.mmkv.MMKV;
import com.trello.rxlifecycle4.RxLifecycle;
import com.trello.rxlifecycle4.android.ActivityEvent;
@@ -246,14 +244,14 @@ public class NetInterfaceManager {
*
* */
public Observable<BaseResponse<SnInfo>> getsnInfoControl() {
return mRetrofit.create(SNInfoApi.class)
public Observable<BaseResponse<SnInfo>> getSnInfoControl() {
return mRetrofit.create(SnApi.class)
.getsninfo(Utils.getSerial())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
public Observable<BaseResponse<SystemSettingsSet>> getsettingControl() {
public Observable<BaseResponse<SystemSettingsSet>> getSettingControl() {
return mRetrofit.create(Setting.class)
.getSetting(Utils.getSerial())
.subscribeOn(Schedulers.io())
@@ -353,13 +351,13 @@ public class NetInterfaceManager {
public Observable<BaseResponse<AppInfo>> getUpdateObservable(String packageName) {
return getNewestAppUpdateControl()
.getAppUpdate(packageName, "0", JGYUtils.getInstance().checkAppPlatform())
.getAppUpdate(packageName, "0", JgyUtils.getInstance().checkAppPlatform())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
public Observable<BaseResponse<List<OverallAppBean>>> getOverallAppObservable() {
int platformCode = JGYUtils.getInstance().checkAppPlatform();
int platformCode = JgyUtils.getInstance().checkAppPlatform();
return getOverallAppByPlatformControl()
.getOverallApp(platformCode)
.subscribeOn(Schedulers.io())
@@ -604,10 +602,10 @@ public class NetInterfaceManager {
if (refresh) {
connectMode = ConnectMode.DEFAULT;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.SNINFO, connectMode)) {
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.SN_INFO, connectMode)) {
getSnInfo(lifecycle, callback);
} else {
String jsonString = mCacheHelper.getAsString(UrlAddress.SNINFO);
String jsonString = mCacheHelper.getAsString(UrlAddress.SN_INFO);
//为 "" 是已经请求成功的
if (jsonString == null) {
getSnInfo(lifecycle, callback);
@@ -623,18 +621,18 @@ public class NetInterfaceManager {
}
public void getSnInfo(BehaviorSubject<ActivityEvent> lifecycle, ObserverCallback callback) {
getsnInfoControl()
getSnInfoControl()
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
.subscribe(getSnInfoObserver(callback));
}
public void getSnInfo(ObserverCallback callback) {
getsnInfoControl()
getSnInfoControl()
.subscribe(getSnInfoObserver(callback));
}
public void getSnInfo() {
getsnInfoControl()
getSnInfoControl()
.subscribe(getSnInfoObserver(null));
}
@@ -653,7 +651,7 @@ public class NetInterfaceManager {
SPUtils.put(mContext, CommonConfig.JGY_FIRST_CONNECT, 1);
if (callback != null)
callback.onNext(userInfoBaseResponse);
mCacheHelper.put(UrlAddress.SNINFO, GsonUtils.toJSONString(userInfoBaseResponse));
mCacheHelper.put(UrlAddress.SN_INFO, GsonUtils.toJSONString(userInfoBaseResponse));
int code = userInfoBaseResponse.code;
if (userInfoBaseResponse.code == 200) {
SPUtils.put(mContext, CommonConfig.isLogined, 1);
@@ -671,11 +669,11 @@ public class NetInterfaceManager {
SPUtils.put(mContext, "USERINFO_GRADE", snInfo.getGrade());
}
} else if (code == 300) {
mCacheHelper.put(UrlAddress.SNINFO, "");
mCacheHelper.put(UrlAddress.SN_INFO, "");
SPUtils.put(mContext, CommonConfig.isLogined, 0);
Settings.System.putInt(mContext.getContentResolver(), CommonConfig.KEY_IS_CONTROL, 0);
} else if (code == 401) {
mCacheHelper.put(UrlAddress.SNINFO, "");
mCacheHelper.put(UrlAddress.SN_INFO, "");
SPUtils.put(mContext, CommonConfig.isLogined, 2);
Settings.System.putInt(mContext.getContentResolver(), CommonConfig.KEY_IS_CONTROL, 0);
}
@@ -704,27 +702,27 @@ public class NetInterfaceManager {
*/
public void setPushTags() {
Set<String> set = new HashSet<>();
JGYUtils.getInstance().getAppPlatform(platform -> {
if (platform == JGYUtils.MTKPlatform) {
set.add(JGYUtils.MTKTag);
} else if (platform == JGYUtils.ZhanruiPlatform) {
set.add(JGYUtils.ZhanruiTag);
} else if (platform == JGYUtils.M40sePlatform) {
set.add(JGYUtils.M40SETag);
} else if (platform == JGYUtils.T30ProPlatform) {
set.add(JGYUtils.T30PROTag);
} else if (platform == JGYUtils.MTK8515Platform) {
set.add(JGYUtils.MTK8515Tag);
} else if (platform == JGYUtils.G13Platform) {
set.add(JGYUtils.G13Tag);
} else if (platform == JGYUtils.iPlay50SEPlatform) {
set.add(JGYUtils.iPlay50SETag);
} else if (platform == JGYUtils.G6Platform) {
set.add(JGYUtils.G6Tag);
} else if (platform == JGYUtils.G11JPlatform) {
set.add(JGYUtils.G11JTag);
} else if (platform == JGYUtils.G12NLPlatform) {
set.add(JGYUtils.G12NLTag);
JgyUtils.getInstance().getAppPlatform(platform -> {
if (platform == JgyUtils.MTKPlatform) {
set.add(JgyUtils.MTKTag);
} else if (platform == JgyUtils.ZhanruiPlatform) {
set.add(JgyUtils.ZhanruiTag);
} else if (platform == JgyUtils.M40sePlatform) {
set.add(JgyUtils.M40SETag);
} else if (platform == JgyUtils.T30ProPlatform) {
set.add(JgyUtils.T30PROTag);
} else if (platform == JgyUtils.MTK8515Platform) {
set.add(JgyUtils.MTK8515Tag);
} else if (platform == JgyUtils.G13Platform) {
set.add(JgyUtils.G13Tag);
} else if (platform == JgyUtils.iPlay50SEPlatform) {
set.add(JgyUtils.iPlay50SETag);
} else if (platform == JgyUtils.G6Platform) {
set.add(JgyUtils.G6Tag);
} else if (platform == JgyUtils.G11JPlatform) {
set.add(JgyUtils.G11JTag);
} else if (platform == JgyUtils.G12NLPlatform) {
set.add(JgyUtils.G12NLTag);
}
});
clearAndAppendTags(set);
@@ -733,38 +731,27 @@ public class NetInterfaceManager {
public void setPushTags(String tag) {
Set<String> set = new HashSet<>();
set.add(tag);
JGYUtils.getInstance().getAppPlatform(platform -> {
if (platform == JGYUtils.MTKPlatform) {
set.add(JGYUtils.MTKTag);
} else if (platform == JGYUtils.ZhanruiPlatform) {
set.add(JGYUtils.ZhanruiTag);
} else if (platform == JGYUtils.M40sePlatform) {
set.add(JGYUtils.M40SETag);
} else if (platform == JGYUtils.T30ProPlatform) {
set.add(JGYUtils.T30PROTag);
} else if (platform == JGYUtils.MTK8515Platform) {
set.add(JGYUtils.MTK8515Tag);
} else if (platform == JGYUtils.G13Platform) {
set.add(JGYUtils.G13Tag);
} else if (platform == JGYUtils.iPlay50SEPlatform) {
set.add(JGYUtils.iPlay50SETag);
} else if (platform == JGYUtils.G6Platform) {
set.add(JGYUtils.G6Tag);
} else if (platform == JGYUtils.G11JPlatform) {
set.add(JGYUtils.G11JTag);
} else if (platform == JGYUtils.G12NLPlatform) {
set.add(JGYUtils.G12NLTag);
}
});
XGPushManager.clearAndAppendTags(mContext, "clearAndAppendTags :" + System.currentTimeMillis(), set, new XGIOperateCallback() {
@Override
public void onSuccess(Object o, int i) {
Log.e("clearAndAppendTags", "onSuccess: " + o + " tag " + set);
}
@Override
public void onFail(Object o, int i, String s) {
Log.e("clearAndAppendTags", "onFail: " + o);
JgyUtils.getInstance().getAppPlatform(platform -> {
if (platform == JgyUtils.MTKPlatform) {
set.add(JgyUtils.MTKTag);
} else if (platform == JgyUtils.ZhanruiPlatform) {
set.add(JgyUtils.ZhanruiTag);
} else if (platform == JgyUtils.M40sePlatform) {
set.add(JgyUtils.M40SETag);
} else if (platform == JgyUtils.T30ProPlatform) {
set.add(JgyUtils.T30PROTag);
} else if (platform == JgyUtils.MTK8515Platform) {
set.add(JgyUtils.MTK8515Tag);
} else if (platform == JgyUtils.G13Platform) {
set.add(JgyUtils.G13Tag);
} else if (platform == JgyUtils.iPlay50SEPlatform) {
set.add(JgyUtils.iPlay50SETag);
} else if (platform == JgyUtils.G6Platform) {
set.add(JgyUtils.G6Tag);
} else if (platform == JgyUtils.G11JPlatform) {
set.add(JgyUtils.G11JTag);
} else if (platform == JgyUtils.G12NLPlatform) {
set.add(JgyUtils.G12NLTag);
}
});
@@ -792,17 +779,6 @@ public class NetInterfaceManager {
if (!TextUtils.isEmpty(tag)) {
tagSets.add(tag);
}
XGPushManager.clearAndAppendTags(mContext, "clearAndAppendTags :" + System.currentTimeMillis(), tagSets, new XGIOperateCallback() {
@Override
public void onSuccess(Object o, int i) {
Log.e("clearAndAppendTags", "onSuccess: " + o + " tag " + tagSets);
}
@Override
public void onFail(Object o, int i, String s) {
Log.e("clearAndAppendTags", "onFail: " + o);
}
});
String[] set = new ArrayList<>(tagSets).toArray(new String[tagSets.size()]);
CloudPushService pushService = PushServiceFactory.getCloudPushService();
@@ -836,8 +812,8 @@ public class NetInterfaceManager {
private Set<String> getShowPackages() {
HashSet<String> pkgSet = new HashSet<>();
pkgSet.addAll(showPackages);
pkgSet.addAll(JGYUtils.getInstance().getFXYApp());
pkgSet.addAll(JGYUtils.getInstance().getAppAndWhite());
pkgSet.addAll(JgyUtils.getInstance().getFXYApp());
pkgSet.addAll(JgyUtils.getInstance().getAppAndWhite());
return pkgSet;
}
@@ -946,8 +922,8 @@ public class NetInterfaceManager {
}
public void getElderlyUsersApp() {
Observable.zip(getUpdateObservable(JGYUtils.AIHealth),
getUpdateObservable(JGYUtils.ElderlyDesktop),
Observable.zip(getUpdateObservable(JgyUtils.AIHealth),
getUpdateObservable(JgyUtils.ElderlyDesktop),
new BiFunction<BaseResponse<AppInfo>, BaseResponse<AppInfo>, List<AppInfo>>() {
@Override
public List<AppInfo> apply(BaseResponse<AppInfo> appInfoBaseResponse, BaseResponse<AppInfo> appInfoBaseResponse2) throws Throwable {
@@ -992,7 +968,7 @@ public class NetInterfaceManager {
public void checkUpdate(String packageName, String versionCode) {
Log.e("checkUpdate", "packageName: " + packageName);
getNewestAppUpdateControl()
.getAppUpdate(packageName, versionCode, JGYUtils.getInstance().checkAppPlatform())
.getAppUpdate(packageName, versionCode, JgyUtils.getInstance().checkAppPlatform())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<BaseResponse<AppInfo>>() {
@@ -1035,10 +1011,10 @@ public class NetInterfaceManager {
if (refresh) {
connectMode = ConnectMode.DEFAULT;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_NEWESTAPPUPDATE, connectMode)) {
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_NEWEST_APPUPDATE, connectMode)) {
checkAllAppUpdate(lifecycle, callback);
} else {
String jsonString = mCacheHelper.getAsString(UrlAddress.GET_NEWESTAPPUPDATE);
String jsonString = mCacheHelper.getAsString(UrlAddress.GET_NEWEST_APPUPDATE);
//为 "" 是已经请求成功的
if (jsonString == null) {
checkAllAppUpdate(lifecycle, callback);
@@ -1056,7 +1032,7 @@ public class NetInterfaceManager {
public void checkAllAppUpdate(BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
Observable.zip(
getUpdateObservable(BuildConfig.APPLICATION_ID),
getUpdateObservable(JGYUtils.PACKAGE_APPSTORE),
getUpdateObservable(JgyUtils.PACKAGE_APPSTORE),
// getUpdateObservable(JGYUtils.PACKAGE_OS),
// getUpdateObservable(JGYUtils.PACKAGE_BROWSER),
// getUpdateObservable(JGYUtils.Notifications),
@@ -1091,7 +1067,7 @@ public class NetInterfaceManager {
@Override
public void onNext(@NonNull List<AppInfo> appInfos) {
Log.e("checkAllAppUpdate", "onNext: " + appInfos);
mCacheHelper.put(UrlAddress.GET_NEWESTAPPUPDATE, GsonUtils.toJSONString(appInfos));
mCacheHelper.put(UrlAddress.GET_NEWEST_APPUPDATE, GsonUtils.toJSONString(appInfos));
getAllAppUpdate(appInfos);
}
@@ -1114,11 +1090,11 @@ public class NetInterfaceManager {
if (refresh) {
connectMode = ConnectMode.DEFAULT;
}
if (ConnectManager.getInstance().isNeedConnect(JGYUtils.FUXIAOYING_KEY, connectMode)) {
if (ConnectManager.getInstance().isNeedConnect(JgyUtils.FUXIAOYING_KEY, connectMode)) {
checkFXYAppUpdate(lifecycle, callback);
} else {
//有乱码
String jsonString = mMMKV.decodeString(JGYUtils.FUXIAOYING_KEY + "_mmkv");
String jsonString = mMMKV.decodeString(JgyUtils.FUXIAOYING_KEY + "_mmkv");
Log.e(TAG, "checkFXYAppUpdate: jsonString = " + jsonString);
//为 "" 是已经请求成功的
if (jsonString == null) {
@@ -1136,15 +1112,15 @@ public class NetInterfaceManager {
public void checkFXYAppUpdate(BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
Observable.zip(
getUpdateObservable(JGYUtils.gkwxhd),
getUpdateObservable(JGYUtils.fuxiaoying),
getUpdateObservable(JGYUtils.moshujia),
getUpdateObservable(JGYUtils.english),
getUpdateObservable(JGYUtils.zhiduoke),
getUpdateObservable(JGYUtils.aobama),
getUpdateObservable(JGYUtils.growthspace),
getUpdateObservable(JGYUtils.pandaabc),
getUpdateObservable(JGYUtils.qibenyi),
getUpdateObservable(JgyUtils.gkwxhd),
getUpdateObservable(JgyUtils.fuxiaoying),
getUpdateObservable(JgyUtils.moshujia),
getUpdateObservable(JgyUtils.english),
getUpdateObservable(JgyUtils.zhiduoke),
getUpdateObservable(JgyUtils.aobama),
getUpdateObservable(JgyUtils.growthspace),
getUpdateObservable(JgyUtils.pandaabc),
getUpdateObservable(JgyUtils.qibenyi),
(appInfoBaseResponse, appInfoBaseResponse2, appInfoBaseResponse3, appInfoBaseResponse4, appInfoBaseResponse5, appInfoBaseResponse6, appInfoBaseResponse7, appInfoBaseResponse8, appInfoBaseResponse9) -> {
List<AppInfo> appInfoList = new ArrayList<>();
if (appInfoBaseResponse.code == 200) {
@@ -1188,7 +1164,7 @@ public class NetInterfaceManager {
@Override
public void onNext(@NonNull List<AppInfo> appInfos) {
Log.e("checkFXYAppUpdate", "onNext: " + appInfos);
mCacheHelper.put(JGYUtils.FUXIAOYING_KEY, GsonUtils.toJSONString(appInfos));
mCacheHelper.put(JgyUtils.FUXIAOYING_KEY, GsonUtils.toJSONString(appInfos));
getAllAppUpdate(appInfos);
}
@@ -1839,7 +1815,7 @@ public class NetInterfaceManager {
}
String jsonString = GsonUtils.toJSONString(hideAPPList);
SPUtils.put(mContext, "Hide_APP_List", String.join(",", jsonString));
JGYUtils.getInstance().updateHideList();
JgyUtils.getInstance().updateHideList();
Log.e(TAG, "Hide_APP_List: " + jsonString);
}
}
@@ -1890,16 +1866,17 @@ public class NetInterfaceManager {
}
public void updateAdminInfo() {
String address = String.valueOf(SPUtils.get(mContext, "AmapAddress", "-"));
String longitude = String.valueOf(SPUtils.get(mContext, "longitude", "0"));
String latitude = String.valueOf(SPUtils.get(mContext, "latitude", "0"));
String address = String.valueOf(mMMKV.decodeString(CommonConfig.MAP_ADDRESS_KEY, "-"));
String longitude = String.valueOf(mMMKV.decodeDouble(CommonConfig.MAP_LONGITUDE_KEY, 0L));
String latitude = String.valueOf(mMMKV.decodeDouble(CommonConfig.MAP_LATITUDE_KEY, 0L));
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("address", address);
jsonObject.addProperty("longitude", longitude);
jsonObject.addProperty("latitude", latitude);
JsonObject softwareJson = new JsonObject();
softwareJson.addProperty("appstore_version", ApkUtils.getAPPVersionName(mContext, JGYUtils.PACKAGE_APPSTORE));
softwareJson.addProperty("updatetools_version", ApkUtils.getAPPVersionName(mContext, JGYUtils.PACKAGE_UPDATETOOLS));
softwareJson.addProperty("appstore_version", ApkUtils.getAPPVersionName(mContext, JgyUtils.PACKAGE_APPSTORE));
softwareJson.addProperty("updatetools_version", ApkUtils.getAPPVersionName(mContext, JgyUtils.PACKAGE_UPDATETOOLS));
softwareJson.addProperty("info_version", ApkUtils.getAPPVersionName(mContext, "com.fuying.sn"));
softwareJson.addProperty("jiaoguanyi_version", ApkUtils.getAPPVersionName(mContext, "com.jiaoguanyi.os"));
softwareJson.addProperty("gankao_version", ApkUtils.getAPPVersionName(mContext, "com.gankao.gkwxhd"));
@@ -1921,7 +1898,7 @@ public class NetInterfaceManager {
nowJson.addProperty("hardware", hardware);
nowJson.addProperty("software", software);
String string = GsonUtils.toJSONString(nowJson);
String oldString = mMMKV.decodeString(UrlAddress.UPDATE_SNINFO, "");
String oldString = mMMKV.decodeString(UrlAddress.UPDATE_SN_INFO, "");
Log.e(TAG, "updateAdminInfo: oldString = " + oldString);
Log.e(TAG, "updateAdminInfo: string = " + string);
if (oldString.equals(string)) {
@@ -1945,7 +1922,7 @@ public class NetInterfaceManager {
@Override
public void onNext(@NonNull BaseResponse baseResponse) {
if (baseResponse.code == 200) {
mMMKV.encode(UrlAddress.UPDATE_SNINFO, string);
mMMKV.encode(UrlAddress.UPDATE_SN_INFO, string);
}
Log.e("updateAdminInfo", "onNext: " + baseResponse);
@@ -2127,18 +2104,18 @@ public class NetInterfaceManager {
}
public void getSystemSettings(BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
getsettingControl()
getSettingControl()
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
.subscribe(getSystemSettingsObserver(callback));
}
public void getSystemSettings(CompleteCallback callback) {
getsettingControl()
getSettingControl()
.subscribe(getSystemSettingsObserver(callback));
}
public void getSystemSettings() {
getsettingControl()
getSettingControl()
.subscribe(getSystemSettingsObserver(null));
}
@@ -2308,7 +2285,7 @@ public class NetInterfaceManager {
JsonObject jsonObject = GsonUtils.getJsonObject(jsonString);
String ids = jsonObject.get("ids").getAsString();
String packages = jsonObject.get("package").getAsString();
JGYUtils.getInstance().writeDeselectIDtoSystem(ids, packages);
JgyUtils.getInstance().writeDeselectIDtoSystem(ids, packages);
} else {
Log.e("getAppInside", "onNext: " + baseResponse.msg);
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_APP_FORBID_ID, " ");
@@ -2710,7 +2687,7 @@ public class NetInterfaceManager {
Log.e(TAG, "installOverallApp: " + packageList);
for (OverallAppBean overallAppBean : overallAppBeanList) {
String packages = overallAppBean.getApp_package();
if (!JGYUtils.mGlobalUpdatePkgs.contains(packages)) {
if (!JgyUtils.mGlobalUpdatePkgs.contains(packages)) {
continue;
}
String url = overallAppBean.getApp_url();
@@ -3206,7 +3183,7 @@ public class NetInterfaceManager {
@Override
public void onComplete() {
Log.e("getAppAndWhite", "onComplete: ");
JGYUtils.getInstance().putBuiltInApps();
JgyUtils.getInstance().putBuiltInApps();
if (callback != null) {
callback.onComplete();
}

View File

@@ -4,80 +4,30 @@ public class UrlAddress {
/*主页接口*/
static final String ROOT_URL = "http://47.111.23.154/android/";
//不需要做缓存的接口
/*获取app桌面管控配置*/
public final static String GET_APP_TIME_CONTROL = "Control/getAppTimeControl";
/*获取整机管控配置*/
public final static String GET_SN_TIME_CONTROL = "Control/getSnTimeControl";
/*获取所有应用时间*/
public final static String GET_MY_APP_LIST = "app/myAppList";
//不需要在后台添加sn的接口
/*获取所有全局更新*/
public final static String GE_TOVERALL_APPBYPLATFORM = "app/overallAppByPlatform";
/*获取应用内置白名单*/
public static final String GET_APP_AND_WHITE = "getAppAndWhite";
/*获取管理员上传的应用*/
public final static String GET_ADMIN_APP = "getAdminApp";
/*根据包名获取更新*/
public final static String GET_NEWESTAPPUPDATE = "app/newestAppUpdate";
/*发送设备基本信息*/
public final static String UPDATE_SNINFO = "sn/updateAdminSn";
/*绑定设备消息*/
public final static String BIND_DEVICES = "sn/bindSn";
/*获取设备绑定状态*/
public final static String GET_SN_BIND = "sn/getSnBind";
/*设备信息接口*/
public static final String SN_INFO = "sn/getSnInfo";
/*获取用户头像和信息*/
public static final String GET_USER_AVATAR_INFO = "sn/getUserAvatarInfo";
/*获取批次*/
public static final String GET_BATCH = "sn/getBatch";
/*获取标签*/
public static final String GET_TAG = "sn/get-tag";
/*设备信息接口*/
public static final String SNINFO = "sn/getSnInfo";
/*获取正在运行的app*/
public static final String RUN_NEW_APP = "app/runNewApp";
/*获取所有应用*/
public final static String GET_ALL_PACKAGE = "app/queryAllApp";
/*获取系统设置*/
public final static String GET_SETTINGS = "control/getSetting";
/*浏览器网址管控*/
public final static String SET_BROWSER_URL = "control/getBrowser";
/*浏览器书签管控*/
public final static String SET_BROWSER_LABEL = "control/getLabel";
/*获取强制下载*/
public final static String GET_FORCE_INSTALL = "app/getForceDownload";
/*发送设备基本信息*/
public final static String UPDATE_SN_INFO = "sn/updateAdminSn";
/*获取app管控*/
public final static String GET_APP_START = "sn/querySnAppStart";
/*发app跳转管控*/
/*app跳转管控*/
public final static String GET_APP_JUMP = "sn/querySnJump";
/*全局黑名单列表*/
public final static String GLOBAL_BLACKLIST = "common/blacklist";
/*app内部管控*/
public final static String QUERY_APP_INSIDE = "control/queryAppInside";
/*发送卸载或者安装信息*/
public final static String SEND_INSTALLEDORREMOVED = "app/addAppInstall";
/*获取时间管控*/
public final static String GET_TIME_CONTROL = "sn/getTimeControl";
/*上传屏幕截图*/
public final static String UPLOAD_SCREEN_SNAPSHOT = "sn/uploadScreenshot";
/*获取时间管控*/
public final static String GET_TIME_CONTROL = "sn/getTimeControlControl";
/*获取用户头像和信息*/
public static final String GET_USER_AVATAR_INFO = "sn/getUserAvatarInfo";
/*获取小程序二维码*/
public static final String GET_APPLET_QRCODE = "file/getAppletQrCode";
/*获取操作指南*/
public static final String GET_OPERATION_GUIDE = "file/getFiles";
/*上传控制面版截图*/
public static final String UPLOAD_CONTROL_SCREENSHOT = "sn/uploadControlScreenshot";
/*获取是否为网课模式*/
public static final String GET_CLOUD_LESSON_SETTING = "Control/getCloudLessonSetting";
/*应用使用记录*/
public static final String APP_USAGE_RECORD = "appUsageRecord";
/*获取屏幕管控*/
public final static String GET_SCREEN_LOCK = "sn/getScreenshot";
/*获取锁屏密码*/
@@ -97,6 +47,52 @@ public class UrlAddress {
public static final String UPLOAD_IS_LOG_FILE = "sn/uploadIsLogFile";
/*获取所有应用时间*/
public final static String GET_MY_APP_LIST = "app/myAppList";
/*获取所有全局更新*/
public final static String GE_TOVERALL_APPBYPLATFORM = "app/overallAppByPlatform";
/*根据包名获取更新*/
public final static String GET_NEWEST_APPUPDATE = "app/newestAppUpdate";
/*获取正在运行的app*/
public static final String RUN_NEW_APP = "app/runNewApp";
/*获取所有应用*/
public final static String GET_ALL_PACKAGE = "app/queryAllApp";
/*获取强制下载*/
public final static String GET_FORCE_INSTALL = "app/getForceDownload";
/*发送卸载或者安装信息*/
public final static String SEND_INSTALLEDORREMOVED = "app/addAppInstall";
/*获取系统设置*/
public final static String GET_SETTINGS = "control/getSetting";
/*浏览器网址管控*/
public final static String SET_BROWSER_URL = "control/getBrowser";
/*浏览器书签管控*/
public final static String SET_BROWSER_LABEL = "control/getLabel";
/*app内部管控*/
public final static String QUERY_APP_INSIDE = "control/queryAppInside";
/*获取是否为网课模式*/
public static final String GET_CLOUD_LESSON_SETTING = "Control/getCloudLessonSetting";
/*获取app桌面管控配置*/
public final static String GET_APP_TIME_CONTROL = "Control/getAppTimeControl";
/*获取整机管控配置*/
public final static String GET_SN_TIME_CONTROL = "Control/getSnTimeControl";
/*获取小程序二维码*/
public static final String GET_APPLET_QRCODE = "file/getAppletQrCode";
/*获取操作指南*/
public static final String GET_OPERATION_GUIDE = "file/getFiles";
/*全局黑名单列表*/
public final static String GLOBAL_BLACKLIST = "common/blacklist";
/*获取应用内置白名单*/
public static final String GET_APP_AND_WHITE = "getAppAndWhite";
/*获取管理员上传的应用*/
public final static String GET_ADMIN_APP = "getAdminApp";
/*应用使用记录*/
public static final String APP_USAGE_RECORD = "appUsageRecord";
/*获取公网IP*/
public static final String SHOUHU_CITYJSON = "http://pv.sohu.com/cityjson/";
}

View File

@@ -9,7 +9,7 @@ import retrofit2.http.GET;
import retrofit2.http.Query;
public interface NewestAppUpdate {
@GET(UrlAddress.GET_NEWESTAPPUPDATE)
@GET(UrlAddress.GET_NEWEST_APPUPDATE)
Observable<BaseResponse<AppInfo>> getAppUpdate(
@Query("packageName") String packageName,
@Query("versionCode") String versionCode,

View File

@@ -8,8 +8,8 @@ import io.reactivex.rxjava3.core.Observable;
import retrofit2.http.GET;
import retrofit2.http.Query;
public interface SNInfoApi {
@GET(UrlAddress.SNINFO)
public interface SnApi {
@GET(UrlAddress.SN_INFO)
Observable<BaseResponse<SnInfo>> getsninfo(
@Query("sn") String sn
);

View File

@@ -10,7 +10,7 @@ import retrofit2.http.POST;
public interface UpdateAdminSn {
@FormUrlEncoded
@POST(UrlAddress.UPDATE_SNINFO)
@POST(UrlAddress.UPDATE_SN_INFO)
Observable<BaseResponse> sendAdminSn(
@Field("sn") String sn,
@Field("address") String address,

View File

@@ -4,10 +4,11 @@ import android.text.TextUtils;
import com.blankj.utilcode.util.LogUtils;
import com.fuying.sn.disklrucache.DiskLruCacheHelper;
import com.fuying.sn.utils.JGYUtils;
import com.fuying.sn.utils.JgyUtils;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import okhttp3.Interceptor;
import okhttp3.MediaType;
@@ -62,7 +63,7 @@ public class PostCacheInterceptor implements Interceptor {
}
//没有网络连接的时候读取缓存
if (!JGYUtils.getInstance().isNetworkConnected()) {
if (!JgyUtils.getInstance().isNetworkConnected()) {
LogUtils.d("no network connected jujge cache available");
if (cacheResponse != null) {
LogUtils.d("no network connected, return cache: " + cacheResponse);
@@ -148,7 +149,7 @@ public class PostCacheInterceptor implements Interceptor {
private String createKey(Request request) {
RequestBody requestBody = request.body();
Charset charset = Charset.forName("UTF-8");
Charset charset = StandardCharsets.UTF_8;
String url = request.url().toString();
StringBuilder sb = new StringBuilder();
sb.append(url + "&");
@@ -237,7 +238,7 @@ public class PostCacheInterceptor implements Interceptor {
buffer = source.buffer();
Charset charset = response.body().contentType().charset();
if (charset == null) {
charset = Charset.forName("UTF-8");
charset = StandardCharsets.UTF_8;
}
caches[REPONSE_BODY] = buffer.clone().readString(charset);
} catch (IOException e) {

View File

@@ -37,7 +37,7 @@ import com.fuying.sn.utils.ApkUtils;
import com.fuying.sn.utils.CacheUtils;
import com.fuying.sn.utils.CmdUtil;
import com.fuying.sn.utils.FileUtils;
import com.fuying.sn.utils.JGYUtils;
import com.fuying.sn.utils.JgyUtils;
import com.fuying.sn.utils.SPUtils;
import com.fuying.sn.utils.ServiceAliveUtils;
import com.fuying.sn.utils.ToastUtil;
@@ -319,7 +319,7 @@ public class PushManager {
case JIGUANG_CAMRERA:
ToastUtil.debugShow("收到推送消息: 摄像头管控");
setCameta(extras);
JGYUtils.getInstance().updateForbidList();
JgyUtils.getInstance().updateForbidList();
break;
case JIGUANG_PHONE:
ToastUtil.debugShow("收到推送消息: 电话管控");
@@ -388,8 +388,8 @@ public class PushManager {
ToastUtil.debugShow("收到推送消息: 强制停止应用");
JsonObject killJSONObject = GsonUtils.getJsonObject(extras);
String packages = killJSONObject.get("app_package").getAsString();
JGYUtils.getInstance().killPackage(packages);
JGYUtils.getInstance().gotoLauncher();
JgyUtils.getInstance().killPackage(packages);
JgyUtils.getInstance().gotoLauncher();
Log.e(TAG, extras);
break;
case JIGUANG_LOCK_SCREEN:
@@ -692,7 +692,7 @@ public class PushManager {
NetInterfaceManager.getInstance().SendAppInstallInfo();
NetInterfaceManager.getInstance().getAppAndWhite();
NetInterfaceManager.getInstance().getSnInfo();
if (JGYUtils.getInstance().isScreenOn()) {
if (JgyUtils.getInstance().isScreenOn()) {
NetInterfaceManager.getInstance().screenshot();
}
}
@@ -805,7 +805,7 @@ public class PushManager {
}
JsonObject extra = GsonUtils.getJsonObject(jsonString);
String packages = extra.get("package").getAsString();
JGYUtils.getInstance().addPkgToForbid(packages);
JgyUtils.getInstance().addPkgToForbid(packages);
ToastUtil.debugShow("收到应用安装消息:包名" + packages);
String url = extra.get("url").getAsString();
if (TextUtils.isEmpty(url)) {
@@ -1280,7 +1280,7 @@ public class PushManager {
JsonObject jsonObject = GsonUtils.getJsonObject(jsonString);
int search_topic = jsonObject.get("search_topic").getAsInt();
Log.e(TAG, "searchTopic: put = " + SPUtils.put(mContext, "search_topic", search_topic));
JGYUtils.getInstance().updateForbidList();
JgyUtils.getInstance().updateForbidList();
}
private void setAlarmCLock(String ex) {
@@ -1354,7 +1354,7 @@ public class PushManager {
JsonElement jsonElement = jsonObject.get("desktop_app");
if (jsonElement != null) {
String packeges = jsonElement.getAsString();
JGYUtils.getInstance().setDefaultDesktop(packeges);
JgyUtils.getInstance().setDefaultDesktop(packeges);
} else {
}
@@ -1365,7 +1365,7 @@ public class PushManager {
JsonElement jsonElement = jsonObject.get("browser_app");
if (jsonElement != null) {
String packeges = jsonElement.getAsString();
JGYUtils.getInstance().setDefaultBrowser(packeges);
JgyUtils.getInstance().setDefaultBrowser(packeges);
} else {
Log.e(TAG, "setDefaultBrowser: packeges is NULL");
}
@@ -1374,16 +1374,16 @@ public class PushManager {
private void setDefaultInputMethod(String extras) {
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
String packeges = jsonObject.get("typewriting_app").getAsString();
JGYUtils.getInstance().setDefaultInputMethod(packeges);
JgyUtils.getInstance().setDefaultInputMethod(packeges);
}
private void oneKeyNetwork(String extras) {
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
int is_network = jsonObject.get("is_network").getAsInt();
if (is_network == 1) {
JGYUtils.getInstance().oneKeyDisconnection();
JgyUtils.getInstance().oneKeyDisconnection();
} else {
JGYUtils.getInstance().restorrNetwork();
JgyUtils.getInstance().restorrNetwork();
}
}

View File

@@ -1,17 +0,0 @@
package com.fuying.sn.push.tpush;
/**
* Created by chacewang on 2019/7/5.
*/
public class Constants {
public static final int TEST_LOCAL_NOTIFICATION = 1;
public static final int TEST_NOTIFICATION = 2;
public static final int TEST_SET_TAG = 3;
public static final int TEST_DEL_TAG = 4;
public static final int TEST_SET_ACCOUNT = 5;
public static final int TEST_DEL_ACCOUNT = 6;
public static final String LOCAL_NOTIFICATION_TITLE = "localtest";
public static final String TEST_TAG_NAME = "DiagnosisTag";
}

View File

@@ -1,297 +0,0 @@
package com.fuying.sn.push.tpush;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
import com.fuying.sn.push.tpush.common.NotificationService;
import com.fuying.sn.push.tpush.po.XGNotification;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.tencent.android.tpush.NotificationAction;
import com.tencent.android.tpush.XGPushBaseReceiver;
import com.tencent.android.tpush.XGPushClickedResult;
import com.tencent.android.tpush.XGPushRegisterResult;
import com.tencent.android.tpush.XGPushShowedResult;
import com.tencent.android.tpush.XGPushTextMessage;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class MessageReceiver extends XGPushBaseReceiver {
public static final String UPDATE_LISTVIEW_ACTION = "com.qq.xgdemo.activity.UPDATE_LISTVIEW";
public static final String TEST_ACTION = "com.qq.xgdemo.activity.TEST_ACTION";
public static final String LogTag = "xg.test";
private static final String TAG = "MessageReceiver";
/**
* 消息透传处理
*
* @param context
* @param message 解析自定义的 JSON
*/
@Override
public void onTextMessage(Context context, XGPushTextMessage message) {
String text = "收到消息:" + message.toString();
// 获取自定义key-value
String customContent = message.getCustomContent();
if (customContent != null && customContent.length() != 0) {
JsonObject obj = JsonParser.parseString(customContent).getAsJsonObject();
// key1为前台配置的key
if (!TextUtils.isEmpty(obj.get("key").getAsString())) {
String value = obj.get("key").getAsString();
Log.d(LogTag, "get custom value:" + value);
}
// ...
}
// APP自主处理消息的过程...
Log.e(LogTag, text);
show(context, text);
processCustomMessage(context, message);
}
/**
* 通知展示
*
* @param context
* @param notifiShowedRlt 包含通知的内容
*/
@Override
public void onNotificationShowedResult(Context context, XGPushShowedResult notifiShowedRlt) {
if (context == null || notifiShowedRlt == null) {
return;
}
XGNotification notific = new XGNotification();
notific.setMsg_id(notifiShowedRlt.getMsgId());
notific.setTitle(notifiShowedRlt.getTitle());
notific.setContent(notifiShowedRlt.getContent());
// notificationActionType==1为Activity,2为url,3为intent
notific.setNotificationActionType(notifiShowedRlt
.getNotificationActionType());
// Activity,url,intent都可以通过getActivity()获得
notific.setActivity(notifiShowedRlt.getActivity());
notific.setUpdate_time(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
.format(Calendar.getInstance().getTime()));
NotificationService.getInstance(context).save(notific);
Intent testIntent = new Intent(TEST_ACTION);
if (notifiShowedRlt.getTitle().equals(Constants.LOCAL_NOTIFICATION_TITLE)) {
testIntent.putExtra("step", Constants.TEST_LOCAL_NOTIFICATION);
} else {
testIntent.putExtra("step", Constants.TEST_NOTIFICATION);
}
context.sendBroadcast(testIntent);
Intent viewIntent = new Intent(UPDATE_LISTVIEW_ACTION);
context.sendBroadcast(viewIntent);
show(context, "您有1条新消息, " + "通知被展示 , " + notifiShowedRlt.toString());
Log.d(LogTag, "您有1条新消息, " + "通知被展示 , " + notifiShowedRlt.toString() + ", PushChannel:" + notifiShowedRlt.getPushChannel());
}
/**
* 注册回调
*
* @param context
* @param errorCode 0 为成功,其它为错误码
*/
@Override
public void onRegisterResult(Context context, int errorCode, XGPushRegisterResult message) {
if (context == null || message == null) {
return;
}
String text = "";
if (errorCode == XGPushBaseReceiver.SUCCESS) {
// 在这里拿token
String token = message.getToken();
text = "注册成功1. token:" + token;
} else {
text = message + "注册失败,错误码:" + errorCode;
}
Log.d(LogTag, text);
show(context, text);
}
/**
* 反注册回调
*
* @param context
* @param errorCode 0 为成功,其它为错误码
*/
@Override
public void onUnregisterResult(Context context, int errorCode) {
if (context == null) {
return;
}
String text = "";
if (errorCode == XGPushBaseReceiver.SUCCESS) {
text = "反注册成功";
} else {
text = "反注册失败" + errorCode;
}
Log.d(LogTag, text);
show(context, text);
}
/**
* 设置标签回调
*
* @param context
* @param errorCode 0 为成功,其它为错误码
* @param tagName 设置的 TAG
*/
@Override
public void onSetTagResult(Context context, int errorCode, String tagName) {
if (context == null) {
return;
}
String text = "";
if (errorCode == XGPushBaseReceiver.SUCCESS) {
text = "\"" + tagName + "\"设置成功";
} else {
text = "\"" + tagName + "\"设置失败,错误码:" + errorCode;
}
Log.d(LogTag, text);
show(context, text);
Intent testIntent = new Intent(TEST_ACTION);
testIntent.putExtra("step", Constants.TEST_SET_TAG);
context.sendBroadcast(testIntent);
}
/**
* 删除标签的回调
*
* @param context
* @param errorCode 0 为成功,其它为错误码
* @param tagName 设置的 TAG
*/
@Override
public void onDeleteTagResult(Context context, int errorCode, String tagName) {
if (context == null) {
return;
}
String text = "";
if (errorCode == XGPushBaseReceiver.SUCCESS) {
text = "\"" + tagName + "\"删除成功";
} else {
text = "\"" + tagName + "\"删除失败,错误码:" + errorCode;
}
Log.d(LogTag, text);
show(context, text);
Intent testIntent = new Intent(TEST_ACTION);
testIntent.putExtra("step", Constants.TEST_DEL_TAG);
context.sendBroadcast(testIntent);
}
/**
* 设置账号回调
*
* @param context
* @param errorCode 0 为成功,其它为错误码
* @param account 设置的账号
*/
@Override
public void onSetAccountResult(Context context, int errorCode, String account) {
Intent testIntent = new Intent(TEST_ACTION);
testIntent.putExtra("step", Constants.TEST_SET_ACCOUNT);
context.sendBroadcast(testIntent);
}
/**
* 删除账号回调
*
* @param context
* @param errorCode 0 为成功,其它为错误码
* @param account 设置的账号
*/
@Override
public void onDeleteAccountResult(Context context, int errorCode, String account) {
Intent testIntent = new Intent(TEST_ACTION);
testIntent.putExtra("step", Constants.TEST_DEL_ACCOUNT);
context.sendBroadcast(testIntent);
}
@Override
public void onSetAttributeResult(Context context, int i, String s) {
}
@Override
public void onDeleteAttributeResult(Context context, int i, String s) {
}
@Override
public void onQueryTagsResult(Context context, int errorCode, String data, String operateName) {
Log.i(LogTag, "action - onQueryTagsResult, errorCode:" + errorCode + ", operateName:" + operateName + ", data: " + data);
}
/**
* 通知点击回调 actionType=1为该消息被清除,actionType=0为该消息被点击
*
* @param context
* @param message 包含被点击通知的内容
*/
@Override
public void onNotificationClickedResult(Context context, XGPushClickedResult message) {
if (context == null || message == null) {
return;
}
String text = "";
if (message.getActionType() == NotificationAction.clicked.getType()) {
// 通知在通知栏被点击啦。。。。。
// APP自己处理点击的相关动作
// 这个动作可以在activity的onResume也能监听,请看第3点相关内容
text = "通知被打开 :" + message;
} else if (message.getActionType() == NotificationAction.delete.getType()) {
// 通知被清除啦。。。。
// APP自己处理通知被清除后的相关动作
text = "通知被清除 :" + message;
}
Toast.makeText(context, "广播接收到通知被点击:" + message.toString(),
Toast.LENGTH_SHORT).show();
// 获取自定义key-value
String customContent = message.getCustomContent();
if (customContent != null && customContent.length() != 0) {
JsonObject obj = JsonParser.parseString(customContent).getAsJsonObject();
// key1为前台配置的key
if (!TextUtils.isEmpty(obj.get("key").getAsString())) {
String value = obj.get("key").getAsString();
Log.d(LogTag, "get custom value:" + value);
}
// ...
}
// APP自主处理的过程。。。
Log.d(LogTag, text);
show(context, text);
}
private void show(Context context, String text) {
// Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
}
private void processCustomMessage(Context context, XGPushTextMessage message) {
if (context == null || message == null) {
return;
}
String title = message.getTitle();
String content = message.getContent();
JsonObject extrasJson = JsonParser.parseString(content).getAsJsonObject();
String extras = "";
if (extrasJson.get("extras") != null) {
extras = extrasJson.get("extras").toString();
}
// PushManager.getInstance().setPushContent(title, extras);
}
}

View File

@@ -1,23 +0,0 @@
package com.fuying.sn.push.tpush.common;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class DBOpenHelper extends SQLiteOpenHelper {
public DBOpenHelper(Context context) {
super(context, "XGExample.db", null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE notification (id integer primary key autoincrement,msg_id varchar(64),title varchar(128),activity varchar(256),notificationActionType varchar(512),content text,update_time varchar(16))");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}

View File

@@ -1,134 +0,0 @@
package com.fuying.sn.push.tpush.common;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.fuying.sn.push.tpush.po.XGNotification;
import java.util.ArrayList;
import java.util.List;
public class NotificationService {
private DBOpenHelper dbOpenHelper;
private static NotificationService instance = null;
public NotificationService(Context context) {
this.dbOpenHelper = new DBOpenHelper(context);
}
public synchronized static NotificationService getInstance(Context ctx) {
if (null == instance) {
instance = new NotificationService(ctx);
}
return instance;
}
public void save(XGNotification notification) {
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
ContentValues values = new ContentValues();
values.put("msg_id", notification.getMsg_id());
values.put("title", notification.getTitle());
values.put("content", notification.getContent());
values.put("activity", notification.getActivity());
values.put("notificationActionType", notification.getNotificationActionType());
values.put("update_time", notification.getUpdate_time());
db.insert("notification", null, values);
}
public void delete(Integer id) {
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
db.delete("notification", "id=?", new String[] { id.toString() });
}
public void deleteAll() {
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
db.delete("notification", "", null);
}
public void update(XGNotification notification) {
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
ContentValues values = new ContentValues();
values.put("msg_id", notification.getMsg_id());
values.put("title", notification.getTitle());
values.put("content", notification.getContent());
values.put("activity", notification.getActivity());
values.put("notificationActionType", notification.getNotificationActionType());
values.put("update_time", notification.getUpdate_time());
db.update("notification", values, "id=?", new String[] { notification
.getId().toString() });
}
public XGNotification find(Integer id) {
SQLiteDatabase db = dbOpenHelper.getReadableDatabase();
Cursor cursor = db
.query("notification",
new String[] { "id,msg_id,title,content,activity,notificationActionType,update_time" },
"id=?", new String[] { id.toString() }, null, null,
null, "1");
try {
if (cursor.moveToFirst()) {
return new XGNotification(cursor.getInt(cursor
.getColumnIndex("id")), cursor.getLong(cursor
.getColumnIndex("msg_id")), cursor.getString(cursor
.getColumnIndex("title")), cursor.getString(cursor
.getColumnIndex("content")), cursor.getString(cursor
.getColumnIndex("activity")), cursor.getInt(cursor
.getColumnIndex("notificationActionType")), cursor.getString(cursor
.getColumnIndex("update_time")));
}
return null;
} finally {
cursor.close();
}
}
public List<XGNotification> getScrollData(int currentPage, int lineSize,
String msg_id) {
String firstResult = String.valueOf((currentPage - 1) * lineSize);
SQLiteDatabase db = dbOpenHelper.getReadableDatabase();
Cursor cursor = null;
try {
if (msg_id == null || "".equals(msg_id)) {
cursor = db
.query("notification",
new String[] { "id,msg_id,title,content,activity,notificationActionType,update_time" },
null, null, null, null, "update_time DESC",
firstResult + "," + lineSize);
} else {
cursor = db
.query("notification",
new String[] { "id,msg_id,title,content,activity,notificationActionType,update_time" },
"msg_id like ?", new String[] { msg_id + "%" },
null, null, "update_time DESC", firstResult
+ "," + lineSize);
}
List<XGNotification> notifications = new ArrayList<XGNotification>();
while (cursor.moveToNext()) {
notifications.add(new XGNotification(cursor.getInt(cursor
.getColumnIndex("id")), cursor.getLong(cursor
.getColumnIndex("msg_id")), cursor.getString(cursor
.getColumnIndex("title")), cursor.getString(cursor
.getColumnIndex("content")), cursor.getString(cursor
.getColumnIndex("activity")), cursor.getInt(cursor
.getColumnIndex("notificationActionType")), cursor.getString(cursor
.getColumnIndex("update_time"))));
}
return notifications;
} finally {
cursor.close();
}
}
public int getCount() {
SQLiteDatabase db = dbOpenHelper.getReadableDatabase();
Cursor cursor = db.rawQuery("select count(*) from notification", null);
try {
cursor.moveToFirst();
return cursor.getInt(0);
} finally {
cursor.close();
}
}
}

View File

@@ -1,83 +0,0 @@
package com.fuying.sn.push.tpush.po;
public class XGNotification {
private Integer id;
private Long msg_id;
private String title;
private String content;
private String activity;
private int notificationActionType;
private String update_time;
public XGNotification() {
}
public XGNotification(Integer id, Long msg_id, String title,
String content, String activity, int notificationActionType, String update_time) {
super();
this.id = id;
this.msg_id = msg_id;
this.title = title;
this.content = content;
this.activity = activity;
this.notificationActionType = notificationActionType;
this.update_time = update_time;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Long getMsg_id() {
return msg_id;
}
public void setMsg_id(Long msg_id) {
this.msg_id = msg_id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getUpdate_time() {
return update_time;
}
public void setUpdate_time(String update_time) {
this.update_time = update_time;
}
public String getActivity() {
return activity;
}
public void setActivity(String activity) {
this.activity = activity;
}
public int getNotificationActionType() {
return notificationActionType;
}
public void setNotificationActionType(int notificationActionType) {
this.notificationActionType = notificationActionType;
}
}

View File

@@ -11,7 +11,7 @@ import com.fuying.sn.config.CommonConfig;
import com.fuying.sn.manager.ControlManager;
import com.fuying.sn.network.NetInterfaceManager;
import com.fuying.sn.utils.CacheUtils;
import com.fuying.sn.utils.JGYUtils;
import com.fuying.sn.utils.JgyUtils;
import com.fuying.sn.utils.SPUtils;
import java.util.concurrent.TimeUnit;
@@ -38,7 +38,7 @@ public class APKinstallReceiver extends BroadcastReceiver {
// an Intent broadcast.
String action = intent.getAction();
// ApkUtils.addShortcut(context);
JGYUtils.getInstance().cleanLauncherCache();
JgyUtils.getInstance().cleanLauncherCache();
ControlManager.getInstance().setDefaultApp();
Log.e(TAG, "onReceive: " + "action = " + action);
String state;
@@ -50,8 +50,8 @@ public class APKinstallReceiver extends BroadcastReceiver {
switch (action) {
case Intent.ACTION_PACKAGE_ADDED:
state = "安装了:";
JGYUtils.RemoveTask(context, packageName);
JGYUtils.getInstance().putBuiltInApps();
JgyUtils.RemoveTask(context, packageName);
JgyUtils.getInstance().putBuiltInApps();
break;
case Intent.ACTION_PACKAGE_REPLACED:
cleanLauncher3Cache();
@@ -66,10 +66,10 @@ public class APKinstallReceiver extends BroadcastReceiver {
}
Log.e(TAG, "sendAppInfo: " + state + packageName);
newAppListener.setNewAppListener(packageName);
if (JGYUtils.PACKAGE_APPSTORE.equals(packageName)) {
if (JgyUtils.PACKAGE_APPSTORE.equals(packageName)) {
//启动应用市场
// JGYUtils.getInstance().wakeUpDeviceInfo();
} else if (JGYUtils.PACKAGE_UPDATETOOLS.equals(packageName)) {
} else if (JgyUtils.PACKAGE_UPDATETOOLS.equals(packageName)) {
//启动升级组件
// JGYUtils.getInstance().wakeUpUpdateTools();
}

View File

@@ -5,18 +5,13 @@ import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.baidu.location.BDAbstractLocationListener;
import com.baidu.location.BDLocation;
import com.baidu.location.LocationClient;
import com.fuying.sn.config.CommonConfig;
import com.fuying.sn.manager.AmapManager;
import com.fuying.sn.network.NetInterfaceManager;
import com.fuying.sn.service.ControlPanelService;
import com.fuying.sn.service.GuardService;
import com.fuying.sn.service.main.MainService;
import com.fuying.sn.service.ManagerService;
import com.fuying.sn.service.DownloadService;
import com.fuying.sn.service.GuardService;
import com.fuying.sn.service.ManagerService;
import com.fuying.sn.service.StepService;
import com.fuying.sn.service.main.MainService;
import com.tencent.mmkv.MMKV;

View File

@@ -17,12 +17,12 @@ import com.arialyy.annotations.Download;
import com.arialyy.aria.core.Aria;
import com.arialyy.aria.core.task.DownloadTask;
import com.blankj.utilcode.util.ToastUtils;
import com.google.gson.JsonObject;
import com.fuying.sn.KeepAliveConnection;
import com.fuying.sn.R;
import com.fuying.sn.gson.GsonUtils;
import com.fuying.sn.service.main.MainService;
import com.fuying.sn.utils.ApkUtils;
import com.fuying.sn.gson.GsonUtils;
import com.google.gson.JsonObject;
import java.io.File;
@@ -30,6 +30,15 @@ import java.io.File;
public class DownloadService extends Service {
private static final String TAG = "DownloadService";
@Override
public void onCreate() {
super.onCreate();
Log.e(TAG, "onCreate: ");
Aria.download(this).register();
//恢复所有未完成的下载任务
Aria.download(this).resumeAllTask();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
startService(new Intent(this, StepService.class));
@@ -37,21 +46,14 @@ public class DownloadService extends Service {
startService(new Intent(this, MainService.class));
startService(new Intent(this, ManagerService.class));
startService(new Intent(this, ControlPanelService.class));
Aria.download(this).register();
//恢复所有未完成的下载任务
Aria.download(this).resumeAllTask();
return START_STICKY;
}
@Override
public void onCreate() {
super.onCreate();
}
@Override
public void onDestroy() {
super.onDestroy();
Log.e(TAG, "onDestroy: ");
Aria.download(this).unRegister();
}
@Nullable
@@ -156,6 +158,7 @@ public class DownloadService extends Service {
}
Log.e(TAG, "taskFail: " + packageName + "filepath: " + filepath);
Aria.download(this).load(task.getDownloadEntity().getId()).cancel(true);
// Aria.download(this)
// .load(task.getDownloadEntity().getRealUrl()) //读取下载地址
// .setFilePath(task.getFilePath())

View File

@@ -11,14 +11,6 @@ import com.fuying.sn.BuildConfig;
import com.fuying.sn.IGetInfoInterface;
import com.fuying.sn.config.CommonConfig;
import com.fuying.sn.desktop.RunningAppManager;
import com.fuying.sn.network.NetInterfaceManager;
import com.fuying.sn.utils.Utils;
import com.tencent.android.tpush.XGIOperateCallback;
import com.tencent.android.tpush.XGPushConfig;
import com.tencent.android.tpush.XGPushManager;
import java.util.ArrayList;
import java.util.List;
public class RemoteService extends Service {
private static final String TAG = "RemoteService";
@@ -36,38 +28,6 @@ public class RemoteService extends Service {
public void onCreate() {
super.onCreate();
Log.e(TAG, "onCreate: ");
tPushInit();
}
private void tPushInit() {
XGPushConfig.enableDebug(this, true);
XGPushManager.registerPush(this, new XGIOperateCallback() {
@Override
public void onSuccess(Object data, int flag) {
//token在设备卸载重装的时候有可能会变
Log.e("TPush", "注册成功,设备token为:" + data);
List<XGPushManager.AccountInfo> accountInfoList = new ArrayList<>();
Log.e("TPush", "onSuccess: " + Utils.getSerial());
accountInfoList.add(new XGPushManager.AccountInfo(XGPushManager.AccountType.CUSTOM.getValue(), Utils.getSerial()));
XGPushManager.upsertAccounts(RemoteService.this, accountInfoList, new XGIOperateCallback() {
@Override
public void onSuccess(Object data, int flag) {
Log.e("TPush", "upsertAccounts onSuccess, data:" + data + ", flag:" + flag);
NetInterfaceManager.getInstance().setPushTags();
}
@Override
public void onFail(Object data, int errCode, String msg) {
Log.e("TPush", "upsertAccounts onFail, data:" + data + ", code:" + errCode + ", msg:" + msg);
}
});
}
@Override
public void onFail(Object data, int errCode, String msg) {
Log.e("TPush", "注册失败,错误码:" + errCode + ",错误信息:" + msg);
}
});
}
@Override

View File

@@ -17,16 +17,14 @@ import android.content.ServiceConnection;
import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
import android.os.PowerManager;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Nullable;
import com.blankj.utilcode.util.NetworkUtils;
import com.fuying.sn.BuildConfig;
import com.fuying.sn.KeepAliveConnection;
import com.fuying.sn.utils.JGYUtils;
import com.fuying.sn.utils.JgyUtils;
import com.fuying.sn.utils.ServiceAliveUtils;
import com.fuying.sn.utils.Utils;
import com.fuying.sn.websocket.JWebSocketClient;
@@ -196,7 +194,7 @@ public class StepService extends Service implements NetworkUtils.OnNetworkStatus
Log.i("JWebSocketClientService", "websocket连接关闭:" + reason);
// client.close();
// initSocketClient();
if (JGYUtils.getInstance().isScreenOn()) {
if (JgyUtils.getInstance().isScreenOn()) {
mHandler.postDelayed(heartBeatRunnable, HEART_BEAT_RATE);//开启心跳检测
}
}
@@ -207,7 +205,7 @@ public class StepService extends Service implements NetworkUtils.OnNetworkStatus
Log.i("JWebSocketClientService", "websocket连接错误:" + ex.getMessage());
// client.close();
// initSocketClient();
if (JGYUtils.getInstance().isScreenOn()) {
if (JgyUtils.getInstance().isScreenOn()) {
mHandler.postDelayed(heartBeatRunnable, HEART_BEAT_RATE);//开启心跳检测
} else {
Log.i("JWebSocketClientService", "postDelayed off");
@@ -302,7 +300,7 @@ public class StepService extends Service implements NetworkUtils.OnNetworkStatus
sendMsg();
} else if (client.isClosed()) {
Log.i("JWebSocketClientService", "websocket重连中");
if (JGYUtils.getInstance().isScreenOn()) {
if (JgyUtils.getInstance().isScreenOn()) {
reconnectWs();
} else {
Log.i("JWebSocketClientService", "reconnectWs off");
@@ -314,7 +312,7 @@ public class StepService extends Service implements NetworkUtils.OnNetworkStatus
initSocketClient();
}
//每隔一定的时间,对长连接进行一次心跳检测
if (JGYUtils.getInstance().isScreenOn()) {
if (JgyUtils.getInstance().isScreenOn()) {
mHandler.postDelayed(this, HEART_BEAT_RATE);
} else {
Log.i("JWebSocketClientService", "websocket息屏不重连");

View File

@@ -15,7 +15,7 @@ import com.fuying.sn.disklrucache.CacheHelper;
import com.fuying.sn.gson.GsonUtils;
import com.fuying.sn.network.NetInterfaceManager;
import com.fuying.sn.service.ManagerService;
import com.fuying.sn.utils.JGYUtils;
import com.fuying.sn.utils.JgyUtils;
import com.fuying.sn.utils.SPUtils;
import com.fuying.sn.utils.ServiceAliveUtils;
import com.fuying.sn.utils.Utils;
@@ -177,7 +177,7 @@ public class MainSPresenter implements MainSContact.Presenter {
JsonObject jsonObject = GsonUtils.getJsonObject(jsonString);
String ids = jsonObject.get("ids").getAsString();
String packages = jsonObject.get("package").getAsString();
JGYUtils.getInstance().writeDeselectIDtoSystem(ids, packages);
JgyUtils.getInstance().writeDeselectIDtoSystem(ids, packages);
} else {
Log.e("getAppInside", "onNext: " + baseResponse.msg);
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID_ID, " ");

View File

@@ -19,9 +19,6 @@ import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import com.baidu.location.BDAbstractLocationListener;
import com.baidu.location.BDLocation;
import com.baidu.location.LocationClient;
import com.blankj.utilcode.util.NetworkUtils;
import com.fuying.sn.BuildConfig;
import com.fuying.sn.base.rx.BaseRxService;
@@ -39,22 +36,17 @@ import com.fuying.sn.service.GuardService;
import com.fuying.sn.service.StepService;
import com.fuying.sn.utils.ApkUtils;
import com.fuying.sn.utils.CacheUtils;
import com.fuying.sn.utils.JGYUtils;
import com.fuying.sn.utils.JgyUtils;
import com.fuying.sn.utils.NetStateUtils;
import com.fuying.sn.utils.SPUtils;
import com.fuying.sn.utils.TimeUtils;
import com.fuying.sn.utils.ToastUtil;
import com.fuying.sn.utils.Utils;
import com.tencent.android.tpush.XGIOperateCallback;
import com.tencent.android.tpush.XGPushConfig;
import com.tencent.android.tpush.XGPushManager;
import com.tencent.mmkv.MMKV;
import com.trello.rxlifecycle4.LifecycleProvider;
import com.trello.rxlifecycle4.android.ActivityEvent;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import io.reactivex.rxjava3.core.Observable;
@@ -99,7 +91,7 @@ public class MainService extends BaseRxService implements MainSContact.MainView,
@Override
public void run() {
// TODO: 2025/11/11 不确定某些机型状态获取是否正常
if (JGYUtils.getInstance().isScreenOn()) {
if (JgyUtils.getInstance().isScreenOn()) {
Log.e(TAG, "getSnInfo1");
NetInterfaceManager.getInstance().getAppWhiteList(() -> {
Log.e("onConnected", "onNext: getAppWhiteList");
@@ -109,7 +101,6 @@ public class MainService extends BaseRxService implements MainSContact.MainView,
NetInterfaceManager.getInstance().updateAdminInfo();
NetInterfaceManager.getInstance().SendAppInstallInfo();
SPUtils.put(MainService.this, CommonConfig.JGY_FIRST_BOOT, 1);
tPushInit();
}
}
}, 15000);
@@ -154,7 +145,7 @@ public class MainService extends BaseRxService implements MainSContact.MainView,
boolean reboot = mMMKV.decodeBool(CommonConfig.DEVICES_REBOOT, false);
Log.e(TAG, "onCreate: reboot = " + reboot);
boolean networkConnected = JGYUtils.getInstance().isNetworkConnected();
boolean networkConnected = JgyUtils.getInstance().isNetworkConnected();
Log.e(TAG, "onCreate: networkConnected = " + networkConnected);
// if (networkConnected && reboot) {
Log.e(TAG, "onCreate run: 20秒后请求网络");
@@ -205,7 +196,7 @@ public class MainService extends BaseRxService implements MainSContact.MainView,
startService();
Settings.System.putString(getContentResolver(), CommonConfig.APP_SOURCE_WHITE_LIST, DEFAULT_SOURCE);
JGYUtils.getInstance().putBuiltInApps();
JgyUtils.getInstance().putBuiltInApps();
}
private static final String DEFAULT_SOURCE = "com.fuying.sn,com.fuying.appstore,com.fuying.fuxiaoying";
@@ -220,7 +211,7 @@ public class MainService extends BaseRxService implements MainSContact.MainView,
ApkUtils.writeAppPackageList(MainService.this, aole_app_forbid);
new CacheUtils().cleanApplicationUserData(this, "com.aoleyun.os");
File file = new File(JGYUtils.getInstance().getDownLoadPath());
File file = new File(JgyUtils.getInstance().getDownLoadPath());
Log.e(TAG, "versionIsUpdate: " + file.getAbsolutePath());
String[] fileList = file.list();
if (fileList != null) {
@@ -247,18 +238,8 @@ public class MainService extends BaseRxService implements MainSContact.MainView,
}
private void initConfig() {
tPushInit();
// Utils.getPublicIP(MainService.this);
LocationClient locationClient = AmapManager.getInstance().getLocationClient();
locationClient.stop();
locationClient.start();
locationClient.registerLocationListener(new BDAbstractLocationListener() {
@Override
public void onReceiveLocation(BDLocation bdLocation) {
Log.e("initConfig", "onReceiveLocation: ");
locationClient.stop();
}
});
AmapManager.getInstance().startLocation();
}
private interface ConfigStart {
@@ -324,40 +305,9 @@ public class MainService extends BaseRxService implements MainSContact.MainView,
// am.setTime(aLong);
SystemClock.setCurrentTimeMillis(aLong);
Log.e(TAG, "getTimeFromNtpServer: " + aLong);
tPushInit();
}
}
private void tPushInit() {
XGPushConfig.enableDebug(this, true);
XGPushManager.registerPush(this, new XGIOperateCallback() {
@Override
public void onSuccess(Object data, int flag) {
//token在设备卸载重装的时候有可能会变
Log.e("TPush", "注册成功,设备token为:" + data);
List<XGPushManager.AccountInfo> accountInfoList = new ArrayList<>();
Log.e("TPush", "onSuccess: " + Utils.getSerial());
accountInfoList.add(new XGPushManager.AccountInfo(XGPushManager.AccountType.CUSTOM.getValue(), Utils.getSerial()));
XGPushManager.upsertAccounts(MainService.this, accountInfoList, new XGIOperateCallback() {
@Override
public void onSuccess(Object data, int flag) {
Log.e("TPush", "upsertAccounts onSuccess, data:" + data + ", flag:" + flag);
NetInterfaceManager.getInstance().setPushTags();
}
@Override
public void onFail(Object data, int errCode, String msg) {
Log.e("TPush", "upsertAccounts onFail, data:" + data + ", code:" + errCode + ", msg:" + msg);
}
});
}
@Override
public void onFail(Object data, int errCode, String msg) {
Log.e("TPush", "注册失败,错误码:" + errCode + ",错误信息:" + msg);
}
});
}
private void registerReceivers() {
registerWiFiReceiver();

View File

@@ -25,10 +25,11 @@ import android.view.View;
import androidx.annotation.RequiresApi;
import androidx.core.content.FileProvider;
import com.fuying.sn.BuildConfig;
import com.fuying.sn.R;
import com.fuying.sn.bean.AppInfo;
import com.fuying.sn.config.CommonConfig;
import com.fuying.sn.gson.GsonUtils;
import com.fuying.sn.receiver.InstallResultReceiver;
import java.io.BufferedReader;
@@ -97,11 +98,7 @@ public class ApkUtils {
os.writeBytes("exit\n");
os.flush();
int exitValue = process.waitFor();
if (exitValue == 0) {
return true;
} else {
return false;
}
return exitValue == 0;
} catch (Exception e) {
Log.e("*** DEBUG ***", "Unexpected error - Here is what I know: "
+ e.getMessage());
@@ -419,11 +416,11 @@ public class ApkUtils {
Method method;
try {
activityTherad = Class.forName("android.app.ActivityThread");
Class<?> paramTypes[] = getParamTypes(activityTherad, "getPackageManager");
Class<?>[] paramTypes = getParamTypes(activityTherad, "getPackageManager");
method = activityTherad.getMethod("getPackageManager", paramTypes);
Object PackageManagerService = method.invoke(activityTherad);
pmService = PackageManagerService.getClass();
Class<?> paramTypes1[] = getParamTypes(pmService, "installPackageAsUser");
Class<?>[] paramTypes1 = getParamTypes(pmService, "installPackageAsUser");
method = pmService.getMethod("installPackageAsUser", paramTypes1);
method.invoke(PackageManagerService, installPath, null, 0x00000040, packageName, getUserId(Binder.getCallingUid()));//getUserId
} catch (ClassNotFoundException e) {
@@ -629,11 +626,11 @@ public class ApkUtils {
Method method;
try {
activityTherad = Class.forName("android.app.ActivityThread");
Class<?> paramTypes[] = getParamTypes(activityTherad, "getPackageManager");
Class<?>[] paramTypes = getParamTypes(activityTherad, "getPackageManager");
method = activityTherad.getMethod("getPackageManager", paramTypes);
Object PackageManagerService = method.invoke(activityTherad);
pmService = PackageManagerService.getClass();
Class<?> paramTypes1[] = getParamTypes(pmService, "deletePackageAsUser");
Class<?>[] paramTypes1 = getParamTypes(pmService, "deletePackageAsUser");
method = pmService.getMethod("deletePackageAsUser", paramTypes1);
//getUserId
method.invoke(PackageManagerService, packageName, null, getUserId(Binder.getCallingUid()), 0x00000040);
@@ -649,7 +646,7 @@ public class ApkUtils {
}
private static Class<?>[] getParamTypes(Class<?> cls, String mName) {
Class<?> cs[] = null;
Class<?>[] cs = null;
Method[] mtd = cls.getMethods();
for (int i = 0; i < mtd.length; i++) {
if (!mtd[i].getName().equals(mName)) {
@@ -858,9 +855,9 @@ public class ApkUtils {
Log.e(TAG, "writeAppPackageList: " + result);
// addShortcut(context);//开机之后添加图标到桌面
HashSet<String> factoryAppList = new HashSet<>();
factoryAppList.addAll(JGYUtils.getInstance().getOwnApp());
factoryAppList.addAll(JGYUtils.getInstance().getFXYApp());
factoryAppList.addAll(JGYUtils.getInstance().getAppAndWhite());
factoryAppList.addAll(JgyUtils.getInstance().getOwnApp());
factoryAppList.addAll(JgyUtils.getInstance().getFXYApp());
factoryAppList.addAll(JgyUtils.getInstance().getAppAndWhite());
Log.e("writeAppPackageList", "factoryAppList: " + factoryAppList);
if (!TextUtils.isEmpty(result)) {
HashSet<String> writeAppSet = new HashSet<>(Arrays.asList(result.split(",")));
@@ -950,11 +947,7 @@ public class ApkUtils {
for (ResolveInfo info : infos) {
hashMap.put(info.activityInfo.packageName, info);
}
if (hashMap.get(pkg) == null) {
return false;
} else {
return true;
}
return hashMap.get(pkg) != null;
}
@@ -982,4 +975,63 @@ public class ApkUtils {
return applicationInfos;
}
public static boolean isUpdate(Context context, AppInfo appUpdateInfo) {
String packageName = appUpdateInfo.getApp_package();
long versionCode = appUpdateInfo.getApp_version_code();
return isUpdate(context, packageName, versionCode);
}
public static boolean isUpdate(Context context, String packageName, long versionCode) {
PackageInfo packageInfo = null;
try {
packageInfo = context.getPackageManager().getPackageInfo(packageName, 0);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
if (packageInfo == null) {
return true;
} else {
long appVersionCode;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
appVersionCode = packageInfo.getLongVersionCode();
} else {
appVersionCode = packageInfo.versionCode;
}
if (appVersionCode < versionCode) {
return true;
} else {
Log.e(TAG, "checkUpdate: " + packageName + "\t已经是最新版");
return false;
}
}
}
public static void checkAppUpdate(Context context, AppInfo appInfo) {
String packageName = appInfo.getApp_package();
long versionCode = appInfo.getApp_version_code();
String url = appInfo.getApp_url();
PackageInfo packageInfo = null;
try {
packageInfo = context.getPackageManager().getPackageInfo(packageName, 0);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
if (packageInfo == null) {
FileUtils.ariaDownload(context, url, GsonUtils.getJsonObject(GsonUtils.toJSONString(appInfo)));
} else {
long appVersionCode;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
appVersionCode = packageInfo.getLongVersionCode();
} else {
appVersionCode = packageInfo.versionCode;
}
if (appVersionCode < versionCode) {
FileUtils.ariaDownload(context, url, GsonUtils.getJsonObject(GsonUtils.toJSONString(appInfo)));
} else {
Log.e(TAG, "checkUpdate: " + packageName + "\t已经是最新版");
}
}
}
}

View File

@@ -36,7 +36,7 @@ public class FileUtils {
}
MessageDigest digest = null;
FileInputStream in = null;
byte buffer[] = new byte[1024];
byte[] buffer = new byte[1024];
int len;
try {
digest = MessageDigest.getInstance("MD5");
@@ -76,7 +76,7 @@ public class FileUtils {
} else {
Aria.download(context)
.load(url) //读取下载地址
.setFilePath(JGYUtils.getInstance().getDownLoadPath() + fileName)
.setFilePath(JgyUtils.getInstance().getDownLoadPath() + fileName)
.ignoreFilePathOccupy()
.setExtendField(jsonObject.toString())
.create(); //启动下载}
@@ -85,7 +85,7 @@ public class FileUtils {
} else {
Aria.download(context)
.load(url) //读取下载地址
.setFilePath(JGYUtils.getInstance().getDownLoadPath() + fileName)
.setFilePath(JgyUtils.getInstance().getDownLoadPath() + fileName)
.ignoreFilePathOccupy()
.setExtendField(jsonObject.toString())
.create(); //启动下载}

View File

@@ -80,11 +80,11 @@ import io.reactivex.rxjava3.schedulers.Schedulers;
import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE;
public class JGYUtils {
public class JgyUtils {
private static final String TAG = "JGYUtils";
@SuppressLint("StaticFieldLeak")
private static JGYUtils sInstance;
private static JgyUtils sInstance;
private Context mContext;
private ContentResolver resolver;
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
@@ -232,7 +232,7 @@ public class JGYUtils {
}
}
private JGYUtils(Context context) {
private JgyUtils(Context context) {
if (context == null) {
throw new RuntimeException("Context is NULL");
}
@@ -242,11 +242,11 @@ public class JGYUtils {
public static void init(Context context) {
if (sInstance == null) {
sInstance = new JGYUtils(context);
sInstance = new JgyUtils(context);
}
}
public static JGYUtils getInstance() {
public static JgyUtils getInstance() {
if (sInstance == null) {
throw new IllegalStateException("You must be init JGYUtils first");
}
@@ -259,17 +259,17 @@ public class JGYUtils {
public static boolean isOfficialVersion() {
String channelValue = JGYUtils.getInstance().getStringMetaData();
String channelValue = JgyUtils.getInstance().getStringMetaData();
return "official".equals(channelValue);
}
public static boolean isNewlyVersion() {
String channelValue = JGYUtils.getInstance().getStringMetaData();
String channelValue = JgyUtils.getInstance().getStringMetaData();
return "beta".equals(channelValue);
}
public static boolean isBetaVersion() {
String channelValue = JGYUtils.getInstance().getStringMetaData();
String channelValue = JgyUtils.getInstance().getStringMetaData();
return "beta".equals(channelValue);
}
@@ -611,15 +611,15 @@ public class JGYUtils {
}
public static String getCustomVersion() {
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZhanruiPlatform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.T30ProPlatform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MTK8515Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G13Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.iPlay50SEPlatform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G6Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G11JPlatform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G12NLPlatform
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.ZhanruiPlatform
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.M40sePlatform
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.T30ProPlatform
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.MTK8515Platform
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.G13Platform
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.iPlay50SEPlatform
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.G6Platform
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.G11JPlatform
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.G12NLPlatform
) {
return getProperty("ro.build.display.id", "获取失败");
} else {
@@ -628,8 +628,8 @@ public class JGYUtils {
}
public static String getRomVersion() {
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZhanruiPlatform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) {
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.ZhanruiPlatform
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.M40sePlatform) {
return getProperty("ro.build.id", "获取失败");
} else {
return getProperty("ro.build.display.id", "获取失败");
@@ -854,7 +854,7 @@ public class JGYUtils {
UserHandle user = Process.myUserHandle();
Log.i("settingssssssstemf", (add ? "Adding" : "Removing") + " package as role holder, role: "
+ roleName + ", package: " + packageName);
if (JGYUtils.getInstance().checkAppPlatform() != JGYUtils.MTKPlatform) {
if (JgyUtils.getInstance().checkAppPlatform() != JgyUtils.MTKPlatform) {
RoleManager roleManager = context.getSystemService(RoleManager.class);
Executor executor = context.getMainExecutor();
Consumer<Boolean> callback = successful -> {
@@ -953,7 +953,7 @@ public class JGYUtils {
Intent intent = new Intent("setDefaultLauncher");
intent.putExtra("package", pkg);
intent.putExtra("className", className);
if (JGYUtils.getInstance().checkAppPlatform() == MTKPlatform) {
if (JgyUtils.getInstance().checkAppPlatform() == MTKPlatform) {
Log.e(TAG, "setDefaultDesktop: MTK");
//爱华定制
intent.setComponent(new ComponentName("com.android.settings", "com.android.settings.AoleReceiver"));

View File

@@ -304,14 +304,14 @@ public class Utils {
return weeks[week_index];
}
// 非空判断
public static boolean isEmpty(String s) {
if (null == s)
return true;
if (s.length() == 0)
return true;
return s.trim().length() == 0;
}
// // 非空判断
// public static boolean isEmpty(String s) {
// if (null == s)
// return true;
// if (s.length() == 0)
// return true;
// return s.trim().length() == 0;
// }
// 手动隐藏键盘
public static void CloseKeyBoard(Context context) {
@@ -604,12 +604,12 @@ public class Utils {
* @return
*/
public static String getSerial() {
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G13Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.iPlay50SEPlatform
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.G13Platform
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.iPlay50SEPlatform
) {
return getSn();
} else {
return JGYUtils.getInstance().getIMEI();
return JgyUtils.getInstance().getIMEI();
}
}
@@ -1102,10 +1102,21 @@ public class Utils {
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
// 当前系统可用内存 ,将获得的内存大小规格化
Log.e(TAG, "getAvailMemory: " + memoryInfo.availMem);
return memoryInfo.availMem;
}
public static long getTotalMem(Context context) {
// 获取android当前可用内存大小
ActivityManager activityManager = (ActivityManager) context
.getSystemService(Context.ACTIVITY_SERVICE);
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
// 当前系统可用内存 ,将获得的内存大小规格化
Log.e(TAG, "getTotalMem: " + memoryInfo.totalMem);
return memoryInfo.totalMem;
}
/**
* 描述:总内存.
*
@@ -1199,8 +1210,8 @@ public class Utils {
String imei = getIMEI(context);
Log.e(TAG, "getMachine: " + imei);
String system_version = Build.VERSION.RELEASE;
String firmware_version = JGYUtils.getRomVersion();
String rom = JGYUtils.getCustomVersion();
String firmware_version = JgyUtils.getRomVersion();
String rom = JgyUtils.getCustomVersion();
String screen_rate = getAndroiodScreenProperty(context);
JsonObject jsonObject = new JsonObject();
@@ -1237,7 +1248,7 @@ public class Utils {
jsonObject.addProperty("memory", memory);
jsonObject.addProperty("mac", getMAC(context));
jsonObject.addProperty("storage", storage);
jsonObject.addProperty("is_wifi", JGYUtils.getInstance().isWifiConnect());
jsonObject.addProperty("is_wifi", JgyUtils.getInstance().isWifiConnect());
jsonObject.addProperty("CPU", CPU + "核");
jsonObject.addProperty("use_space", use_space);
jsonObject.addProperty("use_ram", use_ram);

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

View File

@@ -2,8 +2,7 @@
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 内部颜色 -->
<solid
android:color="@color/activation_color" />
<solid android:color="@color/default_blue" />
<!-- 圆角的幅度 -->
<corners
android:topLeftRadius="24dp"

View File

@@ -2,8 +2,7 @@
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 内部颜色 -->
<solid
android:color="@color/activation_color" />
<solid android:color="@color/default_blue" />
<!-- 圆角的幅度 -->
<corners
android:topLeftRadius="24dp"

View File

@@ -3,7 +3,7 @@
android:shape="rectangle">
<!-- 填充的颜色:这里设置背景透明 -->
<solid android:color="#FFFFFF" />
<solid android:color="#99FFFFFF" />
<!-- 边框的颜色 :不能和窗口背景色一样 -->
<!-- 设置按钮的四个角为弧形 -->

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffff" />
<stroke
android:width="0.8dp"
android:color="#ffffff" />
<!-- 圆角 -->
<corners android:radius="@dimen/dp_8" />
</shape>

View File

@@ -2,8 +2,7 @@
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 内部颜色 -->
<solid
android:color="@color/activation_color" />
<solid android:color="@color/default_blue" />
<!-- 圆角的幅度 -->
<corners
android:topLeftRadius="24dp"

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 内部颜色 -->
<solid android:color="@color/default_blue" />
<!-- 圆角的幅度 -->
<corners android:radius="@dimen/dp_12" />
<padding
android:bottom="4dp"
android:left="20dp"
android:right="20dp"
android:top="4dp" />
</shape>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 内部颜色 -->
<solid android:color="@color/lightGray" />
<!-- 圆角的幅度 -->
<corners android:radius="@dimen/dp_12" />
<padding
android:bottom="4dp"
android:left="20dp"
android:right="20dp"
android:top="4dp" />
</shape>

View File

@@ -1,7 +1,79 @@
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>
xmlns:tools="http://schemas.android.com/tools"
tools:context=".activity.home.HomeActivity">
<data>
<variable
name="click"
type="com.fuying.sn.activity.home.HomeActivity.BtnClick" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:background="@drawable/main_background"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_32"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:layout_marginStart="16dp"
android:adjustViewBounds="true"
android:onClick="@{click::exit}"
android:scaleType="centerCrop"
android:src="@drawable/icon_blue_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.flyco.tablayout.SlidingTabLayout
android:id="@+id/main_sliding_tab_layout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tl_indicator_color="@color/default_blue"
app:tl_indicator_height="@dimen/dp_2"
app:tl_indicator_style="NORMAL"
app:tl_indicator_width_equal_title="true"
app:tl_tab_gravity="Center"
app:tl_tab_horizontal_gravity="Center"
app:tl_tab_space_equal="false"
app:tl_textBold="SELECT"
app:tl_textSelectColor="@color/black"
app:tl_textSelectSize="@dimen/sp_13"
app:tl_textSize="@dimen/sp_13"
app:tl_textUnSelectColor="@color/gray"
app:tl_textUnSelectSize="@dimen/sp_14" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout">
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
android:layout_marginStart="@dimen/dp_32"
android:layout_marginEnd="@dimen/dp_32"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@@ -238,7 +238,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="@string/hint"
android:textColor="@color/activation_color" />
android:textColor="@color/default_blue" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"

View File

@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".activity.update.UpdateActivity">
<data>
<variable
name="appUpdateInfo"
type="com.fuying.sn.bean.AppInfo" />
<variable
name="msg"
type="String" />
<variable
name="click"
type="com.fuying.sn.activity.update.UpdateActivity.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_240"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/dialog_background"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:layout_width="@dimen/dp_16"
android:layout_height="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_16"
android:layout_marginEnd="@dimen/dp_16"
android:adjustViewBounds="true"
android:onClick="@{click::exit}"
android:scaleType="centerCrop"
android:src="@drawable/icon_close"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_16"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_vertical"
android:text="检查更新"
android:textColor="@color/black"
android:textSize="@dimen/sp_12"
android:textStyle="bold"
android:visibility="visible" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_8"
android:layout_marginBottom="@dimen/dp_8"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/linearLayout3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout2">
<TextView
android:id="@+id/message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_24"
android:layout_marginEnd="@dimen/dp_24"
android:gravity="center"
android:lineSpacingExtra="@dimen/dp_2"
android:lineSpacingMultiplier="1.2"
android:minHeight="@dimen/dp_50"
android:minLines="2"
android:text="@{msg}"
android:textColor="@color/black"
android:textSize="@dimen/sp_11"
tools:text="提示消息提示消息提示消息提示消息提示消息" />
<ImageView
android:layout_width="@dimen/dp_48"
android:layout_height="@dimen/dp_48"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_8"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@mipmap/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_8"
android:text="@{appUpdateInfo.app_version_name}"
android:textColor="@color/text_gray"
android:textSize="@dimen/sp_10" />
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_16"
app:layout_constraintBottom_toBottomOf="parent">
<TextView
android:id="@+id/negtive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_24"
android:layout_weight="1"
android:background="@drawable/update_cancel_background"
android:gravity="center"
android:onClick="@{click::exit}"
android:singleLine="true"
android:text="取消"
android:textColor="@color/white"
android:textSize="@dimen/sp_10"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/positive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_24"
android:layout_weight="1"
android:background="@drawable/update_background"
android:gravity="center"
android:onClick="@{click::upgrade}"
android:singleLine="true"
android:text="更新"
android:textColor="@color/white"
android:textSize="@dimen/sp_10"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@@ -0,0 +1,648 @@
<?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.device.DeviceFragment">
<data>
<variable
name="click"
type="com.fuying.sn.fragment.device.DeviceFragment.BtnClick" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/dp_8"
android:layout_marginTop="@dimen/dp_8"
android:layout_marginEnd="@dimen/dp_4"
android:layout_marginBottom="@dimen/dp_8"
android:layout_weight="1"
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">
<ImageView
android:id="@+id/imageView1"
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:layout_marginStart="@dimen/dp_16"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/main_device"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_8"
android:text="设备信息"
android:textColor="@color/device_title_color"
android:textSize="@dimen/sp_12"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView1"
app:layout_constraintTop_toTopOf="parent"
app:layout_goneMarginStart="@dimen/dp_16" />
<View
android:layout_width="0dp"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginEnd="@dimen/dp_16"
android:background="@color/device_line_color"
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:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:text="设备SN码:"
android:textColor="@color/device_name_color"
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_sn"
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/device_info_color"
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_16"
android:layout_marginEnd="@dimen/dp_16"
android:background="@color/device_line_color"
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:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:text="设备IMEI码:"
android:textColor="@color/device_name_color"
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/device_info_color"
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_16"
android:layout_marginEnd="@dimen/dp_16"
android:background="@color/device_line_color"
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:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:text="MAC地址:"
android:textColor="@color/device_name_color"
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_mac"
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/device_info_color"
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_16"
android:layout_marginEnd="@dimen/dp_16"
android:background="@color/device_line_color"
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:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:text="设备内存:"
android:textColor="@color/device_name_color"
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_ram"
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/device_info_color"
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_16"
android:layout_marginEnd="@dimen/dp_16"
android:background="@color/device_line_color"
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:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:text="系统:"
android:textColor="@color/device_name_color"
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_android_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/device_info_color"
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_16"
android:layout_marginEnd="@dimen/dp_16"
android:background="@color/device_line_color"
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:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:text="系统版本:"
android:textColor="@color/device_name_color"
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/device_info_color"
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_16"
android:layout_marginEnd="@dimen/dp_16"
android:background="@color/device_line_color"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/dp_4"
android:layout_marginTop="@dimen/dp_8"
android:layout_marginEnd="@dimen/dp_8"
android:layout_marginBottom="@dimen/dp_8"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="@dimen/dp_4"
android:layout_weight="1"
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">
<ImageView
android:id="@+id/imageView2"
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:layout_marginStart="@dimen/dp_16"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/main_device"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_8"
android:text="绑定守护家长信息"
android:textColor="@color/device_title_color"
android:textSize="@dimen/sp_12"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView2"
app:layout_constraintTop_toTopOf="parent"
app:layout_goneMarginStart="@dimen/dp_16" />
<View
android:layout_width="0dp"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginEnd="@dimen/dp_16"
android:background="@color/device_line_color"
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:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:text="绑定家长信息:"
android:textColor="@color/device_name_color"
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_phone_number"
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/device_info_color"
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_16"
android:layout_marginEnd="@dimen/dp_16"
android:background="@color/device_line_color"
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:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:text="绑定时间:"
android:textColor="@color/device_name_color"
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_bind_time"
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/device_info_color"
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_16"
android:layout_marginEnd="@dimen/dp_16"
android:background="@color/device_line_color"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="@dimen/dp_4"
android:layout_weight="1"
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">
<ImageView
android:id="@+id/imageView3"
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:layout_marginStart="@dimen/dp_16"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/main_device"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_8"
android:text="设备守护更新"
android:textColor="@color/device_title_color"
android:textSize="@dimen/sp_12"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView3"
app:layout_constraintTop_toTopOf="parent"
app:layout_goneMarginStart="@dimen/dp_16" />
<View
android:layout_width="0dp"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginEnd="@dimen/dp_16"
android:background="@color/device_line_color"
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:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:text="当前版本:"
android:textColor="@color/device_name_color"
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_local_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/device_info_color"
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_16"
android:layout_marginEnd="@dimen/dp_16"
android:background="@color/device_line_color"
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:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="@+id/cl_update">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:text="最新版本:"
android:textColor="@color/device_name_color"
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_update_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/device_info_color"
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_16"
android:layout_marginEnd="@dimen/dp_16"
android:background="@color/device_line_color"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@@ -89,7 +89,7 @@
android:gravity="center"
android:onClick="@{click::restart}"
android:text="确定"
android:textColor="@color/activation_color"
android:textColor="@color/default_blue"
android:textSize="@dimen/sp_11"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/tv_content"

View File

@@ -0,0 +1,183 @@
<?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.usage.UsageFragment">
<data>
<variable
name="click"
type="com.fuying.sn.fragment.usage.UsageFragment.BtnClick" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="3"
android:background="@drawable/card_background"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:id="@+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:text="设备码"
android:textColor="@color/black"
android:textSize="@dimen/sp_10"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_goneMarginStart="@dimen/dp_16" />
<TextView
android:id="@+id/tv_imei"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_16"
android:ellipsize="end"
android:maxLength="30"
android:singleLine="true"
android:text="@string/unknown"
android:textColor="@color/text_gray"
android:textSize="@dimen/sp_10"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="0dp"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_8"
android:layout_marginEnd="@dimen/dp_8"
android:background="@color/text_gray"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_number"
android:layout_width="match_parent"
android: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_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_class"
android:layout_width="match_parent"
android:layout_height="0dp"
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>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@@ -7,17 +7,258 @@
<!-- <color name="colorPrimaryDark">#00574B</color>-->
<!-- <color name="colorAccent">#D81B60</color>-->
<color name="white">#ffffff</color>
<color name="black">#000000</color>
<color name="gray">#80808080</color>
<color name="lightgrey">#D3D3D3</color>
<color name="toast_color">#CD000000</color>
<color name="check_activation_color">#D3D3D3</color>
<color name="activation_color">#4880ff</color>
<color name="default_blue">#4880ff</color>
<color name="float_window_color">#E5000000</color>
<color name="text_gray">#9a9a9a</color>
<color name="device_title_color">#000000</color>
<color name="device_name_color">#000000</color>
<color name="device_info_color">#000000</color>
<color name="device_line_color">#d3d3d3</color>
<!--https://www.jianshu.com/p/8dc258dfd189-->
<color name="transparent">#00000000</color><!--透明色-->
<color name="colorYang">#FFE2C59B</color><!--羊皮纸色-->
<color name="ivory">#FFFFFFF0</color><!--象牙色-->
<color name="lightYellow">#FFFFFFE0</color><!--亮黄色-->
<color name="yellow">#FFFFFF00</color><!--黄色-->
<color name="snow">#FFFFFAFA</color><!--雪白色-->
<color name="floralWhite">#FFFFFAF0</color><!--花白色-->
<color name="lemonChiffon">#FFFFFACD</color><!--柠檬绸色-->
<color name="cornSilk">#FFFFF8DC</color><!--米绸色-->
<color name="seashell">#FFFFF5EE</color><!--海贝色-->
<color name="lavenderBlush">#FFFFF0F5</color><!--淡紫红色-->
<color name="papayaWhip">#FFFFEFD5</color><!--番木色-->
<color name="blanchedAlmond">#FFFFEBCD</color><!--白杏色-->
<color name="mistyRose">#FFFFE4E1</color><!--浅玫瑰色-->
<color name="bisque">#FFFFE4C4</color><!--桔黄色-->
<color name="moccasin">#FFFFE4B5</color><!--鹿皮色-->
<color name="navajoWhite">#FFFFDEAD</color><!--纳瓦白-->
<color name="peachPuff">#FFFFDAB9</color><!--桃色-->
<color name="gold">#FFFFD700</color><!--金色-->
<color name="pink">#FFFFC0CB</color><!--粉红色-->
<color name="lightPink">#FFFFB6C1</color><!--亮粉红色-->
<color name="orange">#FFFFA500</color><!--橙色-->
<color name="lightSalmon">#FFFFA07A</color><!--亮肉色-->
<color name="darkOrange">#FFFF8C00</color><!--暗桔黄色-->
<color name="coral">#FFFF7F50</color><!--珊瑚色-->
<color name="hotPink">#FFFF69B4</color><!--热粉红色-->
<color name="tomato">#FFFF6347</color><!--西红柿色-->
<color name="orangeRed">#FFFF4500</color><!--红橙色-->
<color name="deepPink">#FFFF1493</color><!--深粉红色-->
<color name="fuchsia">#FFFF00FF</color><!--紫红色-->
<color name="red">#FFFF0000</color><!--红色-->
<color name="oldLace">#FFFDF5E6</color><!--老花色-->
<color name="lightGoldenrodYellow">#FFFAFAD2</color><!--亮金黄色-->
<color name="linen">#FFFAF0E6</color><!--亚麻色-->
<color name="antiqueWhite">#FFFAEBD7</color><!--古董白色-->
<color name="salmon">#FFFA8072</color><!--鲜肉色-->
<color name="ghostWhite">#FFF8F8FF</color><!--幽灵白-->
<color name="mintCream">#FFF5FFFA</color><!--薄荷色-->
<color name="whiteSmoke">#FFF5F5F5</color><!--烟白色-->
<color name="beige">#FFF5F5DC</color><!--米色-->
<color name="wheat">#FFF5DEB3</color><!--浅黄色-->
<color name="sandyBrown">#FFF4A460</color><!--沙褐色-->
<color name="azure">#FFF0FFFF</color><!--天蓝色-->
<color name="aliceBlue">#FFF0F8FF</color><!--艾利斯兰色-->
<color name="khaki">#FFF0E68C</color><!--黄褐色-->
<color name="lightCoral">#FFF08080</color><!--亮珊瑚色-->
<color name="paleGoldenrod">#FFEEE8AA</color><!--苍麒麟色-->
<color name="violet">#FFEE82EE</color><!--紫罗兰色-->
<color name="darkSalmon">#FFE9967A</color><!--暗肉色-->
<color name="lavender">#FFE6E6FA</color><!--淡紫色-->
<color name="lightCyan">#FFE0FFFF</color><!--亮青色-->
<color name="burlyWood">#FFDEB887</color><!--实木色-->
<color name="plum">#FFDDA0DD</color><!--洋李色-->
<color name="lightGrey">#FFDCDCDC</color><!--淡灰色-->
<color name="crimson">#FFDC143C</color><!--暗深红色-->
<color name="paleVioletRed">#FFDB7093</color><!--苍紫罗兰色-->
<color name="goldenrod">#FFDAA520</color><!--金麒麟色-->
<color name="orchid">#FFDA70D6</color><!--淡紫色-->
<color name="thistle">#FFD8BFD8</color><!--蓟色-->
<color name="lightGray">#FFD3D3D3</color><!--亮灰色-->
<color name="tan">#FFD2B48C</color><!--茶色-->
<color name="chocolate">#FFD2691E</color><!--巧可力色-->
<color name="peru">#FFCD853F</color><!--秘鲁色-->
<color name="indianRed">#FFCD5C5C</color><!--印第安红色-->
<color name="mediumVioletRed">#FFC71585</color><!--中紫罗兰色-->
<color name="silver">#FFC0C0C0</color><!--银色-->
<color name="darkKhaki">#FFBDB76B</color><!--暗黄褐色-->
<color name="rosyBrown">#FFBC8F8F</color><!--褐玫瑰红色-->
<color name="mediumOrchid">#FFBA55D3</color><!--中粉紫色-->
<color name="darkGoldenrod">#FFB8860B</color><!--暗金黄色-->
<color name="firebrick">#FFB22222</color><!--火砖色-->
<color name="powderBlue">#FFB0E0E6</color><!--粉蓝色-->
<color name="lightSteelBlue">#FFB0C4DE</color><!--亮钢兰色-->
<color name="paleTurquoise">#FFAFEEEE</color><!--苍宝石绿色-->
<color name="greenYellow">#FFADFF2F</color><!--黄绿色-->
<color name="lightBlue">#FFADD8E6</color><!--亮蓝色-->
<color name="darkGray">#FFA9A9A9</color><!--暗灰色-->
<color name="brown">#FFA52A2A</color><!--褐色-->
<color name="sienna">#FFA0522D</color><!--赭色-->
<color name="darkOrchid">#FF9932CC</color><!--暗紫色-->
<color name="paleGreen">#FF98FB98</color><!--苍绿色-->
<color name="darkViolet">#FF9400D3</color><!--暗紫罗兰色-->
<color name="mediumPurple">#FF9370DB</color><!--中紫色-->
<color name="lightGreen">#FF90EE90</color><!--亮绿色-->
<color name="darkSeaGreen">#FF8FBC8F</color><!--暗海兰色-->
<color name="saddleBrown">#FF8B4513</color><!--重褐色-->
<color name="darkMagenta">#FF8B008B</color><!--暗洋红色-->
<color name="darkRed">#FF8B0000</color><!--暗红色-->
<color name="blueViolet">#FF8A2BE2</color><!--紫罗兰蓝色-->
<color name="lightSkyBlue">#FF87CEFA</color><!--亮天蓝色-->
<color name="skyBlue">#FF87CEEB</color><!--天蓝色-->
<color name="gray">#FF808080</color><!--灰色-->
<color name="olive">#FF808000</color><!--橄榄色-->
<color name="purple">#FF800080</color><!--紫色-->
<color name="maroon">#FF800000</color><!--粟色-->
<color name="aquamarine">#FF7FFFD4</color><!--碧绿色-->
<color name="chartreuse">#FF7FFF00</color><!--黄绿色-->
<color name="lawnGreen">#FF7CFC00</color><!--草绿色-->
<color name="mediumSlateBlue">#FF7B68EE</color><!--中暗蓝色-->
<color name="lightSlateGray">#FF778899</color><!--亮蓝灰色-->
<color name="slateGray">#FF708090</color><!--灰石色-->
<color name="oliveDrab">#FF6B8E23</color><!--深绿褐色-->
<color name="slateBlue">#FF6A5ACD</color><!--石蓝色-->
<color name="dimGray">#FF696969</color><!--暗灰色-->
<color name="mediumAquamarine">#FF66CDAA</color><!--中绿色-->
<color name="cornFlowerBlue">#FF6495ED</color><!--菊兰色-->
<color name="cadetBlue">#FF5F9EA0</color><!--军兰色-->
<color name="darkOliveGreen">#FF556B2F</color><!--暗橄榄绿色-->
<color name="indigo">#FF4B0082</color><!--靛青色-->
<color name="mediumTurquoise">#FF48D1CC</color><!--中绿宝石色-->
<color name="darkSlateBlue">#FF483D8B</color><!--暗灰蓝色-->
<color name="steelBlue">#FF4682B4</color><!--钢兰色-->
<color name="royalBlue">#FF4169E1</color><!--皇家蓝色-->
<color name="turquoise">#FF40E0D0</color><!--青绿色-->
<color name="mediumSeaGreen">#FF3CB371</color><!--中海蓝色-->
<color name="limeGreen">#FF32CD32</color><!--橙绿色-->
<color name="darkSlateGray">#FF2F4F4F</color><!--暗瓦灰色-->
<color name="seaGreen">#FF2E8B57</color><!--海绿色-->
<color name="forestGreen">#FF228B22</color><!--森林绿色-->
<color name="lightSeaGreen">#FF20B2AA</color><!--亮海蓝色-->
<color name="dodgerBlue">#FF1E90FF</color><!--闪兰色-->
<color name="midnightBlue">#FF191970</color><!--中灰兰色-->
<color name="aqua">#FF00FFFF</color><!--浅绿色-->
<color name="springGreen">#FF00FF7F</color><!--春绿色-->
<color name="lime">#FF00FF00</color><!--酸橙色-->
<color name="mediumSpringGreen">#FF00FA9A</color><!--中春绿色-->
<color name="darkTurquoise">#FF00CED1</color><!--暗宝石绿色-->
<color name="deepSkyBlue">#FF00BFFF</color><!--深天蓝色-->
<color name="darkCyan">#FF008B8B</color><!--暗青色-->
<color name="teal">#FF008080</color><!--水鸭色-->
<color name="green">#FF008000</color><!--绿色-->
<color name="darkGreen">#FF006400</color><!--暗绿色-->
<color name="blue">#FF0000FF</color><!--蓝色-->
<color name="mediumBlue">#FF0000CD</color><!--中兰色-->
<color name="darkBlue">#FF00008B</color><!--暗蓝色-->
<color name="navy">#FF000080</color><!--海军色-->
<color name="unBlack">#FF2B2B2B</color><!--不知名黑色-->
<!--https://www.cnblogs.com/elleniou/archive/2012/04/25/2469676.html-->
<color name="white">#ffffff</color><!--白色 -->
<color name="lightyellow">#ffffe0</color><!--亮黄色 -->
<color name="floralwhite">#fffaf0</color><!--花白色 -->
<color name="lemonchiffon">#fffacd</color><!--柠檬绸色 -->
<color name="cornsilk">#fff8dc</color><!--米绸色 -->
<color name="seaShell">#fff5ee</color><!--海贝色 -->
<color name="lavenderblush">#fff0f5</color><!--淡紫红 -->
<color name="papayawhip">#ffefd5</color><!--番木色 -->
<color name="blanchedalmond">#ffebcd</color><!--白杏色 -->
<color name="mistyrose">#ffe4e1</color><!--浅玫瑰色 -->
<color name="navajowhite">#ffdead</color><!--纳瓦白 -->
<color name="peachpuff">#ffdab9</color><!--桃色 -->
<color name="lightpink">#ffb6c1</color><!--亮粉红色 -->
<color name="lightsalmon">#ffa07a</color><!--亮肉色 -->
<color name="darkorange">#ff8c00</color><!--暗桔黄色 -->
<color name="hotpink">#ff69b4</color><!--热粉红色 -->
<color name="orangered">#ff4500</color><!--红橙色 -->
<color name="deeppink">#ff1493</color><!--深粉红色 -->
<color name="magenta">#ff00ff</color><!--红紫色 -->
<color name="oldlace">#fdf5e6</color><!--老花色 -->
<color name="lightgoldenrodyellow">#fafad2</color><!--亮金黄色 -->
<color name="antiquewhite">#faebd7</color><!--古董白 -->
<color name="ghostwhite">#f8f8ff</color><!--幽灵白 -->
<color name="mintcream">#f5fffa</color><!--薄荷色 -->
<color name="whitesmoke">#f5f5f5</color><!--烟白色 -->
<color name="sandybrown">#f4a460</color><!--沙褐色 -->
<color name="honeydew">#f0fff0</color><!--蜜色 -->
<color name="aliceblue">#f0f8ff</color><!--艾利斯兰 -->
<color name="lightcoral">#f08080</color><!--亮珊瑚色 -->
<color name="palegoldenrod">#eee8aa</color><!--苍麒麟色 -->
<color name="darksalmon">#e9967a</color><!--暗肉色 -->
<color name="lightcyan">#e0ffff</color><!--亮青色 -->
<color name="burlywood">#deb887</color><!--实木色 -->
<color name="gainsboro">#dcdcdc</color><!--淡灰色 -->
<color name="palevioletred">#db7093</color><!--苍紫罗兰色 -->
<color name="lightgray">#d3d3d3</color><!--亮灰色 -->
<color name="lightgrey">#d3d3d3</color><!--亮灰色 -->
<color name="indianred">#cd5c5c</color><!--印第安红 -->
<color name="mediumvioletred">#c71585</color><!--中紫罗兰色 -->
<color name="darkkhaki">#bdb76b</color><!--暗黄褐色 -->
<color name="rosybrown">#bc8f8f</color><!--褐玫瑰红 -->
<color name="mediumorchid">#ba55d3</color><!--中粉紫色 -->
<color name="darkgoldenrod">#b8860b</color><!--暗金黄色 -->
<color name="powderblue">#b0e0e6</color><!--粉蓝色 -->
<color name="lightsteelblue">#b0c4de</color><!--亮钢兰色 -->
<color name="paleturquoise">#afeeee</color><!--苍宝石绿 -->
<color name="greenyellow">#adff2f</color><!--黄绿色 -->
<color name="lightblue">#add8e6</color><!--亮蓝色 -->
<color name="darkgray">#a9a9a9</color><!--暗灰色 -->
<color name="darkgrey">#a9a9a9</color><!--暗灰色 -->
<color name="darkorchid">#9932cc</color><!--暗紫色 -->
<color name="palegreen">#98fb98</color><!--苍绿色 -->
<color name="darkviolet">#9400d3</color><!--暗紫罗兰色 -->
<color name="mediumpurple">#9370db</color><!--中紫色 -->
<color name="lightgreen">#90ee90</color><!--亮绿色 -->
<color name="darkseagreen">#8fbc8f</color><!--暗海兰色 -->
<color name="saddlebrown">#8b4513</color><!--重褐色 -->
<color name="darkmagenta">#8b008b</color><!--暗洋红 -->
<color name="darkred">#8b0000</color><!--暗红色 -->
<color name="blueviolet">#8a2be2</color><!--紫罗兰蓝色 -->
<color name="lightskyblue">#87cefa</color><!--亮天蓝色 -->
<color name="skyblue">#87ceeb</color><!--天蓝色 -->
<color name="grey">#808080</color><!--灰色 -->
<color name="lawngreen">#7cfc00</color><!--草绿色 -->
<color name="mediumslateblue">#7b68ee</color><!--中暗蓝色 -->
<color name="lightslategray">#778899</color><!--亮蓝灰 -->
<color name="lightslategrey">#778899</color><!--亮蓝灰 -->
<color name="slategray">#708090</color><!--灰石色 -->
<color name="slategrey">#708090</color><!--灰石色 -->
<color name="olivedrab">#6b8e23</color><!--深绿褐色 -->
<color name="slateblue">#6a5acd</color><!--石蓝色 -->
<color name="dimgray">#696969</color><!--暗灰色 -->
<color name="dimgrey">#696969</color><!--暗灰色 -->
<color name="mediumaquamarine">#66cdaa</color><!--中绿色 -->
<color name="cornflowerblue">#6495ed</color><!--菊兰色 -->
<color name="cadetblue">#5f9ea0</color><!--军兰色 -->
<color name="darkolivegreen">#556b2f</color><!--暗橄榄绿 -->
<color name="mediumturquoise">#48d1cc</color><!--中绿宝石 -->
<color name="darkslateblue">#483d8b</color><!--暗灰蓝色 -->
<color name="steelblue">#4682b4</color><!--钢兰色 -->
<color name="royalblue">#4169e1</color><!--皇家蓝 -->
<color name="mediumseagreen">#3cb371</color><!--中海蓝 -->
<color name="limegreen">#32cd32</color><!--橙绿色 -->
<color name="darkslategray">#2f4f4f</color><!--暗瓦灰色 -->
<color name="darkslategrey">#2f4f4f</color><!--暗瓦灰色 -->
<color name="seagreen">#2e8b57</color><!--海绿色 -->
<color name="forestgreen">#228b22</color><!--森林绿 -->
<color name="lightseagreen">#20b2aa</color><!--亮海蓝色 -->
<color name="dodgerblue">#1e90ff</color><!--闪兰色 -->
<color name="midnightblue">#191970</color><!--中灰兰色 -->
<color name="cyan">#00ffff</color><!--青色 -->
<color name="springgreen">#00ff7f</color><!--春绿色 -->
<color name="mediumspringgreen">#00fa9a</color><!--中春绿色 -->
<color name="darkturquoise">#00ced1</color><!--暗宝石绿 -->
<color name="deepskyblue">#00bfff</color><!--深天蓝色 -->
<color name="darkcyan">#008b8b</color><!--暗青色 -->
<color name="darkgreen">#006400</color><!--暗绿色 -->
<color name="mediumblue">#0000cd</color><!--中兰色 -->
<color name="darkblue">#00008b</color><!--暗蓝色 -->
<color name="black">#000000</color><!--黑色 -->
</resources>

View File

@@ -66,4 +66,25 @@
<item name="android:backgroundDimEnabled">true</item>
</style>
<style name="DialogCloseOnTouchOutside" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- <item name="android:windowFullscreen">true</item>-->
<!--设置dialog的背景-->
<item name="android:windowBackground">@android:color/transparent</item>
<!--设置Dialog的windowFrame框为无-->
<item name="android:windowFrame">@null</item>
<!--设置无标题-->
<item name="windowNoTitle">true</item>
<!--是否浮现在activity之上-->
<!--为false会导致windowCloseOnTouchOutside 失效-->
<item name="android:windowIsFloating">true</item>
<!--是否半透明-->
<item name="android:windowIsTranslucent">true</item>
<!--设置窗口内容不覆盖-->
<item name="android:windowContentOverlay">@null</item>
<!--设置动画,在这里使用让它继承系统的Animation.Dialog-->
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<!--背景是否模糊显示-->
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowCloseOnTouchOutside">true</item>
</style>
</resources>