version:1.7.0
fix:0918 add:
This commit is contained in:
@@ -1,7 +1,4 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
|
||||||
apply plugin: 'kotlin-android-extensions'
|
|
||||||
apply plugin: 'kotlin-kapt'
|
|
||||||
|
|
||||||
def appName() {
|
def appName() {
|
||||||
return "SnInfo"
|
return "SnInfo"
|
||||||
@@ -18,8 +15,8 @@ android {
|
|||||||
applicationId "com.info.sn"
|
applicationId "com.info.sn"
|
||||||
minSdkVersion 24
|
minSdkVersion 24
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 70
|
versionCode 73
|
||||||
versionName "1.7.0"
|
versionName "1.7.3"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
ndk {
|
ndk {
|
||||||
@@ -166,7 +163,7 @@ dependencies {
|
|||||||
// implementation fileTree(dir: 'libs', include: ['*.jar'])
|
// implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
compileOnly files('src/main/libs/classes.jar')
|
compileOnly files('src/main/libs/classes.jar')
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||||
//implementation 'com.android.support:multidex:1.0.3'
|
//implementation 'com.android.support:multidex:1.0.3'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||||
@@ -201,7 +198,7 @@ dependencies {
|
|||||||
|
|
||||||
//implementation 'com.blankj:utilcode:1.26.0'
|
//implementation 'com.blankj:utilcode:1.26.0'
|
||||||
implementation 'com.arialyy.aria:core:3.8.15'
|
implementation 'com.arialyy.aria:core:3.8.15'
|
||||||
kapt 'com.arialyy.aria:compiler:3.8.15'
|
annotationProcessor 'com.arialyy.aria:compiler:3.8.15'
|
||||||
|
|
||||||
implementation "org.java-websocket:Java-WebSocket:1.4.1"
|
implementation "org.java-websocket:Java-WebSocket:1.4.1"
|
||||||
|
|
||||||
@@ -222,7 +219,7 @@ dependencies {
|
|||||||
implementation 'com.jakewharton:butterknife:10.2.1'
|
implementation 'com.jakewharton:butterknife:10.2.1'
|
||||||
// If you are using Kotlin, replace annotationProcessor with kapt.
|
// If you are using Kotlin, replace annotationProcessor with kapt.
|
||||||
// annotationProcessor rootProject.ext.dependencies["butterknife-compiler"]
|
// annotationProcessor rootProject.ext.dependencies["butterknife-compiler"]
|
||||||
kapt 'com.jakewharton:butterknife-compiler:10.2.1'
|
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,12 @@
|
|||||||
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
|
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
|
||||||
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
|
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!-- Required -->
|
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||||
|
<!-- Required -->
|
||||||
<permission
|
<permission
|
||||||
android:name="com.info.sn.permission.JPUSH_MESSAGE"
|
android:name="com.info.sn.permission.JPUSH_MESSAGE"
|
||||||
android:protectionLevel="signature" /> <!-- Required 一些系统要求的权限,如访问网络等 -->
|
android:protectionLevel="signature" /> <!-- Required 一些系统要求的权限,如访问网络等 -->
|
||||||
<uses-permission android:name="com.info.sn.permission.JPUSH_MESSAGE" />
|
<uses-permission android:name="${JPUSH_PKGNAME}.permission.JPUSH_MESSAGE" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
|
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
|
||||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
@@ -57,6 +58,7 @@
|
|||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:networkSecurityConfig="@xml/network"
|
android:networkSecurityConfig="@xml/network"
|
||||||
android:roundIcon="@mipmap/ic_launcher"
|
android:roundIcon="@mipmap/ic_launcher"
|
||||||
|
android:requestLegacyExternalStorage="true"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity
|
<activity
|
||||||
|
|||||||
@@ -67,7 +67,9 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
@@ -167,6 +169,7 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
|||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
mPresenter.setProvider(this);
|
mPresenter.setProvider(this);
|
||||||
mPresenter.attachView(this);
|
mPresenter.attachView(this);
|
||||||
|
mPresenter.setAlias();
|
||||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||||
|
|
||||||
setOnClickListener();
|
setOnClickListener();
|
||||||
@@ -180,6 +183,13 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
|||||||
TimeTask task = new TimeTask();
|
TimeTask task = new TimeTask();
|
||||||
task.execute("ntp.aliyun.com");
|
task.execute("ntp.aliyun.com");
|
||||||
|
|
||||||
|
//更新设备信息之后停止停止这两个应用以免获取不到信息
|
||||||
|
int versionCode = (int) SPUtils.get(this, "versionCode", 0);
|
||||||
|
if (versionCode < BuildConfig.VERSION_CODE) {
|
||||||
|
JGYUtils.getInstance().killBackgroundProcesses(this, "com.jiaoguanyi.os");
|
||||||
|
JGYUtils.getInstance().killBackgroundProcesses(this, "com.gankao.gkwxhd");
|
||||||
|
SPUtils.put(this, "versionCode", BuildConfig.VERSION_CODE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TimeTask extends AsyncTask<String, Long, Long> {
|
private class TimeTask extends AsyncTask<String, Long, Long> {
|
||||||
@@ -336,21 +346,8 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
|||||||
ToastUtil.debugShow("RegId:" + rid);
|
ToastUtil.debugShow("RegId:" + rid);
|
||||||
Log.e("RegId", rid);
|
Log.e("RegId", rid);
|
||||||
}
|
}
|
||||||
setAlias();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAlias() {
|
|
||||||
String alias = Utils.getSerial();
|
|
||||||
int action = ACTION_SET;
|
|
||||||
TagAliasBean tagAliasBean = new TagAliasBean();
|
|
||||||
tagAliasBean.action = action;
|
|
||||||
TagAliasOperatorHelper.sequence++;
|
|
||||||
tagAliasBean.alias = alias;
|
|
||||||
tagAliasBean.isAliasAction = true;
|
|
||||||
TagAliasOperatorHelper.getInstance().handleAction(MainActivity.this, TagAliasOperatorHelper.sequence, tagAliasBean);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private long mExitTime;
|
private long mExitTime;
|
||||||
|
|
||||||
private void exit() {
|
private void exit() {
|
||||||
@@ -371,6 +368,8 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
|||||||
tv_grade.setText(grade);
|
tv_grade.setText(grade);
|
||||||
int statu = (int) SPUtils.get(this, Configs.isLogined, 0);
|
int statu = (int) SPUtils.get(this, Configs.isLogined, 0);
|
||||||
switch (statu) {
|
switch (statu) {
|
||||||
|
default:
|
||||||
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
// tv_note.setText("设备未绑定");
|
// tv_note.setText("设备未绑定");
|
||||||
break;
|
break;
|
||||||
@@ -590,6 +589,39 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAlias() {
|
||||||
|
setJpushAlias();
|
||||||
|
Log.e(TAG, "setAlias: " + "finish");
|
||||||
|
mPresenter.getBatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setJpushAlias() {
|
||||||
|
String alias = Utils.getSerial();
|
||||||
|
TagAliasOperatorHelper.TagAliasBean tagAliasBean = new TagAliasOperatorHelper.TagAliasBean();
|
||||||
|
tagAliasBean.action = ACTION_SET;
|
||||||
|
TagAliasOperatorHelper.sequence++;
|
||||||
|
tagAliasBean.alias = alias;
|
||||||
|
tagAliasBean.isAliasAction = true;
|
||||||
|
TagAliasOperatorHelper.getInstance().handleAction(this, TagAliasOperatorHelper.sequence, tagAliasBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTag(Set set) {
|
||||||
|
TagAliasOperatorHelper.TagAliasBean tagAliasBean = new TagAliasOperatorHelper.TagAliasBean();
|
||||||
|
tagAliasBean.action = ACTION_SET;
|
||||||
|
TagAliasOperatorHelper.sequence++;
|
||||||
|
tagAliasBean.tags = set;
|
||||||
|
tagAliasBean.isAliasAction = false;
|
||||||
|
TagAliasOperatorHelper.getInstance().handleAction(this, TagAliasOperatorHelper.sequence, tagAliasBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBatch(String batch) {
|
||||||
|
HashSet hashSet = new HashSet();
|
||||||
|
hashSet.add(batch);
|
||||||
|
setTag(hashSet);
|
||||||
|
}
|
||||||
|
|
||||||
private void toGankaoApp() {
|
private void toGankaoApp() {
|
||||||
String gankaoUID = (String) SPUtils.get(MainActivity.this, "gankaoUID", "");
|
String gankaoUID = (String) SPUtils.get(MainActivity.this, "gankaoUID", "");
|
||||||
if (TextUtils.isEmpty(gankaoUID)) {
|
if (TextUtils.isEmpty(gankaoUID)) {
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ public class MainContact {
|
|||||||
void setAvailableProduct(List<AvailableProduct> availableProductList, String gankaoUID);
|
void setAvailableProduct(List<AvailableProduct> availableProductList, String gankaoUID);
|
||||||
void activeUserFinish(int code);
|
void activeUserFinish(int code);
|
||||||
|
|
||||||
|
void setAlias();
|
||||||
|
void setBatch(String batch);
|
||||||
void setQRCode(Bitmap bitmap);
|
void setQRCode(Bitmap bitmap);
|
||||||
void setSnInfo(BaseResponse<UserInfo> response);
|
void setSnInfo(BaseResponse<UserInfo> response);
|
||||||
void setSnUid(JSONObject jsonObject);
|
void setSnUid(JSONObject jsonObject);
|
||||||
@@ -44,6 +46,10 @@ public class MainContact {
|
|||||||
void queryAvailableProduct(String gankaoUID);
|
void queryAvailableProduct(String gankaoUID);
|
||||||
void activeUser(AvailableProduct product, String gankaoUID);
|
void activeUser(AvailableProduct product, String gankaoUID);
|
||||||
|
|
||||||
|
//设置别名
|
||||||
|
void setAlias();
|
||||||
|
//获取班级id
|
||||||
|
void getBatch();
|
||||||
//获取二维码
|
//获取二维码
|
||||||
void getQRCode();
|
void getQRCode();
|
||||||
//获取设备信息
|
//获取设备信息
|
||||||
|
|||||||
@@ -33,10 +33,12 @@ import com.info.sn.bean.zuoye.UserAvatarInfo;
|
|||||||
import com.info.sn.bean.zuoye.UserInfo;
|
import com.info.sn.bean.zuoye.UserInfo;
|
||||||
import com.info.sn.config.Configs;
|
import com.info.sn.config.Configs;
|
||||||
import com.info.sn.config.Scheme;
|
import com.info.sn.config.Scheme;
|
||||||
|
import com.info.sn.jpush.TagAliasOperatorHelper;
|
||||||
import com.info.sn.manager.AmapManager;
|
import com.info.sn.manager.AmapManager;
|
||||||
import com.info.sn.manager.ControlManager;
|
import com.info.sn.manager.ControlManager;
|
||||||
import com.info.sn.manager.NetInterfaceManager;
|
import com.info.sn.manager.NetInterfaceManager;
|
||||||
import com.info.sn.network.HTTPInterface;
|
import com.info.sn.network.HTTPInterface;
|
||||||
|
import com.info.sn.service.MainService;
|
||||||
import com.info.sn.service.ManagerService;
|
import com.info.sn.service.ManagerService;
|
||||||
import com.info.sn.service.RemoteService;
|
import com.info.sn.service.RemoteService;
|
||||||
import com.info.sn.utils.ApkUtils;
|
import com.info.sn.utils.ApkUtils;
|
||||||
@@ -58,12 +60,16 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import io.reactivex.Observer;
|
import io.reactivex.Observer;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.disposables.Disposable;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
|
||||||
|
import static com.info.sn.jpush.TagAliasOperatorHelper.ACTION_SET;
|
||||||
|
import static com.info.sn.jpush.TagAliasOperatorHelper.sequence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jgy02
|
* @author jgy02
|
||||||
*/
|
*/
|
||||||
@@ -359,6 +365,59 @@ public class MainPresenter implements MainContact.Presenter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAlias() {
|
||||||
|
mView.setAlias();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getBatch() {
|
||||||
|
NetInterfaceManager.getInstance()
|
||||||
|
.getBatchApiControl()
|
||||||
|
.subscribe(new Observer<BaseResponse>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
Log.e("getBatch", "onSubscribe: ");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(BaseResponse baseResponse) {
|
||||||
|
Log.e("getBatch", "onNext: ");
|
||||||
|
if (baseResponse.code == 200) {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
JsonObject jsonObject = JsonParser.parseString(gson.toJson(baseResponse.data)).getAsJsonObject();
|
||||||
|
int batch_id = jsonObject.get("batch_id").getAsInt();
|
||||||
|
Log.e("getBatch", "onNext: " + batch_id);
|
||||||
|
mView.setBatch(String.valueOf(batch_id));
|
||||||
|
} else {
|
||||||
|
Log.e("getBatch", "onNext: " + baseResponse.msg);
|
||||||
|
mView.setBatch("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
Log.e("getBatch", "onError: " + e.getMessage());
|
||||||
|
mView.setBatch("");
|
||||||
|
onComplete();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
Log.e("getBatch", "onComplete: ");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void setTag(Set set) {
|
||||||
|
TagAliasOperatorHelper.TagAliasBean tagAliasBean = new TagAliasOperatorHelper.TagAliasBean();
|
||||||
|
tagAliasBean.action = ACTION_SET;
|
||||||
|
TagAliasOperatorHelper.sequence++;
|
||||||
|
tagAliasBean.tags = set;
|
||||||
|
tagAliasBean.isAliasAction = false;
|
||||||
|
TagAliasOperatorHelper.getInstance().handleAction(mContext, TagAliasOperatorHelper.sequence, tagAliasBean);
|
||||||
|
}
|
||||||
|
|
||||||
// private void sendUid(AvailableProduct product, String gankaoUID) {
|
// private void sendUid(AvailableProduct product, String gankaoUID) {
|
||||||
// NetInterfaceManager.getInstance()
|
// NetInterfaceManager.getInstance()
|
||||||
@@ -655,9 +714,12 @@ public class MainPresenter implements MainContact.Presenter {
|
|||||||
allPkgSet.add(pkg.getApp_package());
|
allPkgSet.add(pkg.getApp_package());
|
||||||
}
|
}
|
||||||
String allPkgString = String.join(",", allPkgSet);
|
String allPkgString = String.join(",", allPkgSet);
|
||||||
|
Settings.System.putString(mContext.getContentResolver(), "only_jgy_shortcut_list", allPkgString);
|
||||||
|
Log.e(TAG + "getAllApp", "onNext: " + allPkgString);
|
||||||
ApkUtils.writeAppPackageList(mContext, allPkgString);
|
ApkUtils.writeAppPackageList(mContext, allPkgString);
|
||||||
HTTPInterface.getAppStart(mContext, appInfoList);
|
HTTPInterface.getAppStart(mContext, appInfoList);
|
||||||
}
|
}
|
||||||
|
JGYUtils.getInstance().deleteOtherApp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -757,16 +819,16 @@ public class MainPresenter implements MainContact.Presenter {
|
|||||||
@Override
|
@Override
|
||||||
public void getSystemSettings() {
|
public void getSystemSettings() {
|
||||||
NetInterfaceManager.getInstance()
|
NetInterfaceManager.getInstance()
|
||||||
.getsettingKTControl()
|
.getsettingControl()
|
||||||
.compose(getProvider().bindUntilEvent(ActivityEvent.DESTROY))
|
.compose(getProvider().bindUntilEvent(ActivityEvent.DESTROY))
|
||||||
.subscribe(new Observer<BaseResponse<SystemSettings>>() {
|
.subscribe(new Observer<BaseResponse>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(Disposable d) {
|
public void onSubscribe(Disposable d) {
|
||||||
Log.e(TAG + "getSystemSettings", "onSubscribe: ");
|
Log.e(TAG + "getSystemSettings", "onSubscribe: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(BaseResponse<SystemSettings> systemSettingsBaseResponse) {
|
public void onNext(BaseResponse systemSettingsBaseResponse) {
|
||||||
Log.e(TAG + "getSystemSettings", "onNext: ");
|
Log.e(TAG + "getSystemSettings", "onNext: ");
|
||||||
SPUtils.put(mContext, "is_first_connection", 0);
|
SPUtils.put(mContext, "is_first_connection", 0);
|
||||||
int code = systemSettingsBaseResponse.code;
|
int code = systemSettingsBaseResponse.code;
|
||||||
|
|||||||
@@ -26,8 +26,12 @@ import com.info.sn.utils.SPUtils;
|
|||||||
import com.info.sn.utils.ToastUtil;
|
import com.info.sn.utils.ToastUtil;
|
||||||
import com.info.sn.utils.Utils;
|
import com.info.sn.utils.Utils;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
@@ -328,7 +332,7 @@ public class SelecteGradeActivity extends BaseActivity implements SelecteGradeCo
|
|||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("card_info", powerUser.getAuthorityName());
|
jsonObject.put("card_info", powerUser.getAuthorityName());
|
||||||
jsonObject.put("grade", powerUser.getGrade());
|
jsonObject.put("grade", powerUser.getGrade());
|
||||||
jsonObject.put("activate_time", powerUser.getAuthorizationDate());
|
jsonObject.put("activate_time", getTime(powerUser.getAuthorizationDate()));
|
||||||
jsonObject.put("user_power_id", powerUser.getAuthorizationNumber());
|
jsonObject.put("user_power_id", powerUser.getAuthorizationNumber());
|
||||||
jsonObject.put("specification_id", mAvailableProductHashMap.get(powerUser.getAuthorityName()));
|
jsonObject.put("specification_id", mAvailableProductHashMap.get(powerUser.getAuthorityName()));
|
||||||
jsonArray.add(jsonObject);
|
jsonArray.add(jsonObject);
|
||||||
@@ -338,6 +342,20 @@ public class SelecteGradeActivity extends BaseActivity implements SelecteGradeCo
|
|||||||
mPresenter.sendUid(jsonArray.toJSONString(), grade);
|
mPresenter.sendUid(jsonArray.toJSONString(), grade);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getTime(String timestamp) {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S'Z'");
|
||||||
|
sdf.setTimeZone(TimeZone.getTimeZone("GMT+00"));
|
||||||
|
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
try {
|
||||||
|
Date date = sdf.parse(timestamp);//拿到Date对象.
|
||||||
|
String str = sdf2.format(date);
|
||||||
|
return str;
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return timestamp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendUidFinish(int code) {
|
public void sendUidFinish(int code) {
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package com.info.sn.base;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
|
|
||||||
|
import com.info.sn.utils.StatusBarUtil;
|
||||||
import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;
|
import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;
|
||||||
|
|
||||||
|
|
||||||
@@ -12,6 +12,7 @@ public abstract class BaseActivity extends RxAppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
StatusBarUtil.init(this);
|
||||||
setContentView(this.getLayoutId());
|
setContentView(this.getLayoutId());
|
||||||
initView();
|
initView();
|
||||||
initData();
|
initData();
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.info.sn.base;
|
|||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
import android.os.Process;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.arialyy.aria.core.Aria;
|
import com.arialyy.aria.core.Aria;
|
||||||
@@ -13,21 +14,31 @@ import com.info.sn.manager.NetInterfaceManager;
|
|||||||
import com.info.sn.manager.ControlManager;
|
import com.info.sn.manager.ControlManager;
|
||||||
import com.info.sn.manager.DeviceManager;
|
import com.info.sn.manager.DeviceManager;
|
||||||
import com.info.sn.utils.JGYUtils;
|
import com.info.sn.utils.JGYUtils;
|
||||||
|
import com.info.sn.utils.SystemUtils;
|
||||||
|
|
||||||
|
import cn.jpush.android.api.JPushInterface;
|
||||||
|
|
||||||
public class BaseApplication extends Application {
|
public class BaseApplication extends Application {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
if (!getPackageName().equals(ProcessUtils.getCurrentProcessName())) {
|
// if (!getPackageName().equals(ProcessUtils.getCurrentProcessName())) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
if (SystemUtils.isMainProcessName(this, Process.myPid())) {
|
||||||
|
//非主进程不初始化
|
||||||
utilsInint();
|
utilsInint();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void utilsInint() {
|
private void utilsInint() {
|
||||||
if (!BuildConfig.DEBUG) {
|
if (!BuildConfig.DEBUG) {
|
||||||
catchException();
|
catchException();
|
||||||
}
|
}
|
||||||
|
// 设置开启日志,发布时请关闭日志
|
||||||
|
JPushInterface.setDebugMode(true);
|
||||||
|
JPushInterface.requestPermission(this);
|
||||||
|
|
||||||
Aria.init(this);
|
Aria.init(this);
|
||||||
Aria.download(this).resumeAllTask();
|
Aria.download(this).resumeAllTask();
|
||||||
JGYUtils.init(this);
|
JGYUtils.init(this);
|
||||||
|
|||||||
@@ -3,8 +3,12 @@ package com.info.sn.bean.zuoye;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
public class AppUploadInfo implements Serializable {
|
public class AppUploadInfo implements Serializable {
|
||||||
|
private static final long serialVersionUID = -6920148363520647811L;
|
||||||
|
|
||||||
String app_package;
|
String app_package;
|
||||||
long app_version_code;
|
long app_version_code;
|
||||||
|
long firstInstallTime;
|
||||||
|
long lastUpdateTime;
|
||||||
|
|
||||||
public String getApp_package() {
|
public String getApp_package() {
|
||||||
return app_package;
|
return app_package;
|
||||||
@@ -21,4 +25,20 @@ public class AppUploadInfo implements Serializable {
|
|||||||
public void setApp_version_code(long app_version_code) {
|
public void setApp_version_code(long app_version_code) {
|
||||||
this.app_version_code = app_version_code;
|
this.app_version_code = app_version_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getFirstInstallTime() {
|
||||||
|
return firstInstallTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstInstallTime(long firstInstallTime) {
|
||||||
|
this.firstInstallTime = firstInstallTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getLastUpdateTime() {
|
||||||
|
return lastUpdateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastUpdateTime(long lastUpdateTime) {
|
||||||
|
this.lastUpdateTime = lastUpdateTime;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ package com.info.sn.bean.zuoye;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
@@ -16,10 +20,8 @@ public class BaseResponse<T> implements Serializable {
|
|||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "{\n" +//
|
Gson gson = new Gson();
|
||||||
"\tcode=" + code + "\n" +//
|
JsonObject jsonObject = JsonParser.parseString(gson.toJson(this)).getAsJsonObject();
|
||||||
"\tmsg='" + msg + "\'\n" +//
|
return jsonObject.toString();
|
||||||
"\tdata=" + data + "\n" +//
|
|
||||||
'}';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,8 +3,11 @@ package com.info.sn.jpush;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.util.Log;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
|
|
||||||
|
import com.info.sn.utils.ToastUtil;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -239,6 +242,8 @@ public class TagAliasOperatorHelper {
|
|||||||
setActionCache.remove(sequence);
|
setActionCache.remove(sequence);
|
||||||
String logs = getActionStr(tagAliasBean.action)+" tags success";
|
String logs = getActionStr(tagAliasBean.action)+" tags success";
|
||||||
Logger.i(TAG,logs);
|
Logger.i(TAG,logs);
|
||||||
|
Log.e(TAG,"Tag绑定成功: " + jPushMessage.getTags());
|
||||||
|
ToastUtil.debugShow("Tag绑定成功: " + jPushMessage.getTags());
|
||||||
ExampleUtil.showToast(logs, context);
|
ExampleUtil.showToast(logs, context);
|
||||||
}else{
|
}else{
|
||||||
String logs = "Failed to " + getActionStr(tagAliasBean.action)+" tags";
|
String logs = "Failed to " + getActionStr(tagAliasBean.action)+" tags";
|
||||||
@@ -292,6 +297,8 @@ public class TagAliasOperatorHelper {
|
|||||||
setActionCache.remove(sequence);
|
setActionCache.remove(sequence);
|
||||||
String logs = getActionStr(tagAliasBean.action)+" alias success";
|
String logs = getActionStr(tagAliasBean.action)+" alias success";
|
||||||
Logger.i(TAG,logs);
|
Logger.i(TAG,logs);
|
||||||
|
Log.e(TAG,"Alias绑定成功: "+jPushMessage.getAlias());
|
||||||
|
ToastUtil.debugShow("Alias绑定成功: "+jPushMessage.getAlias());
|
||||||
ExampleUtil.showToast(logs, context);
|
ExampleUtil.showToast(logs, context);
|
||||||
}else{
|
}else{
|
||||||
String logs = "Failed to " + getActionStr(tagAliasBean.action)+" alias, errorCode:" + jPushMessage.getErrorCode();
|
String logs = "Failed to " + getActionStr(tagAliasBean.action)+" alias, errorCode:" + jPushMessage.getErrorCode();
|
||||||
|
|||||||
@@ -7,28 +7,23 @@ import android.os.Environment;
|
|||||||
import com.info.sn.bean.zuoye.AppInfo;
|
import com.info.sn.bean.zuoye.AppInfo;
|
||||||
import com.info.sn.bean.zuoye.AppStart;
|
import com.info.sn.bean.zuoye.AppStart;
|
||||||
import com.info.sn.bean.zuoye.BaseResponse;
|
import com.info.sn.bean.zuoye.BaseResponse;
|
||||||
import com.info.sn.bean.zuoye.SystemSettings;
|
|
||||||
import com.info.sn.bean.zuoye.UserAvatarInfo;
|
import com.info.sn.bean.zuoye.UserAvatarInfo;
|
||||||
import com.info.sn.bean.zuoye.UserInfo;
|
import com.info.sn.bean.zuoye.UserInfo;
|
||||||
import com.info.sn.network.UrlAddress;
|
import com.info.sn.network.UrlAddress;
|
||||||
import com.info.sn.network.api.APPJump;
|
import com.info.sn.network.api.APPJump;
|
||||||
import com.info.sn.network.api.gankao.ActiveUserApi;
|
|
||||||
import com.info.sn.network.api.AddAppInstall;
|
import com.info.sn.network.api.AddAppInstall;
|
||||||
import com.info.sn.network.api.AppUsedApi;
|
import com.info.sn.network.api.AppUsedApi;
|
||||||
import com.info.sn.network.api.BindDevices;
|
import com.info.sn.network.api.BindDevices;
|
||||||
import com.info.sn.network.api.Browser;
|
import com.info.sn.network.api.Browser;
|
||||||
import com.info.sn.network.api.gankao.CancelUserPowerApi;
|
|
||||||
import com.info.sn.network.api.gankao.CreateUserApi;
|
|
||||||
import com.info.sn.network.api.ForceInstall;
|
|
||||||
import com.info.sn.network.api.BrowserLabel;
|
import com.info.sn.network.api.BrowserLabel;
|
||||||
|
import com.info.sn.network.api.ForceInstall;
|
||||||
|
import com.info.sn.network.api.GetBatchApi;
|
||||||
import com.info.sn.network.api.GetGuideApi;
|
import com.info.sn.network.api.GetGuideApi;
|
||||||
import com.info.sn.network.api.GetSnUidApi;
|
import com.info.sn.network.api.GetSnUidApi;
|
||||||
import com.info.sn.network.api.NewestAppUpdate;
|
import com.info.sn.network.api.NewestAppUpdate;
|
||||||
import com.info.sn.network.api.QRCodeApi;
|
import com.info.sn.network.api.QRCodeApi;
|
||||||
import com.info.sn.network.api.QueryAllApp;
|
import com.info.sn.network.api.QueryAllApp;
|
||||||
import com.info.sn.network.api.QueryAppInside;
|
import com.info.sn.network.api.QueryAppInside;
|
||||||
import com.info.sn.network.api.gankao.QueryPowerUserListApi;
|
|
||||||
import com.info.sn.network.api.gankao.QueryProductApi;
|
|
||||||
import com.info.sn.network.api.QuerySnAppStart;
|
import com.info.sn.network.api.QuerySnAppStart;
|
||||||
import com.info.sn.network.api.RunningApp;
|
import com.info.sn.network.api.RunningApp;
|
||||||
import com.info.sn.network.api.SNInfoApi;
|
import com.info.sn.network.api.SNInfoApi;
|
||||||
@@ -36,11 +31,15 @@ import com.info.sn.network.api.SaveSnUidApi;
|
|||||||
import com.info.sn.network.api.ScreenLock;
|
import com.info.sn.network.api.ScreenLock;
|
||||||
import com.info.sn.network.api.ScreenState;
|
import com.info.sn.network.api.ScreenState;
|
||||||
import com.info.sn.network.api.Setting;
|
import com.info.sn.network.api.Setting;
|
||||||
import com.info.sn.network.api.SettingKT;
|
|
||||||
import com.info.sn.network.api.TimeControl;
|
import com.info.sn.network.api.TimeControl;
|
||||||
import com.info.sn.network.api.UpdateAdminSn;
|
import com.info.sn.network.api.UpdateAdminSn;
|
||||||
import com.info.sn.network.api.UploadScreenshot;
|
import com.info.sn.network.api.UploadScreenshot;
|
||||||
import com.info.sn.network.api.UserInfoControl;
|
import com.info.sn.network.api.UserInfoControl;
|
||||||
|
import com.info.sn.network.api.gankao.ActiveUserApi;
|
||||||
|
import com.info.sn.network.api.gankao.CancelUserPowerApi;
|
||||||
|
import com.info.sn.network.api.gankao.CreateUserApi;
|
||||||
|
import com.info.sn.network.api.gankao.QueryPowerUserListApi;
|
||||||
|
import com.info.sn.network.api.gankao.QueryProductApi;
|
||||||
import com.info.sn.network.api.gankao.UpgradeUserPowerApi;
|
import com.info.sn.network.api.gankao.UpgradeUserPowerApi;
|
||||||
import com.info.sn.network.api.gankao.UserProductsApi;
|
import com.info.sn.network.api.gankao.UserProductsApi;
|
||||||
import com.info.sn.utils.Utils;
|
import com.info.sn.utils.Utils;
|
||||||
@@ -135,13 +134,6 @@ public class NetInterfaceManager {
|
|||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Observable<BaseResponse<SystemSettings>> getsettingKTControl() {
|
|
||||||
return mRetrofit.create(SettingKT.class)
|
|
||||||
.getSetting(Utils.getSerial())
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
|
||||||
}
|
|
||||||
|
|
||||||
public Observable<BaseResponse<List<AppInfo>>> getForceInstallControl() {
|
public Observable<BaseResponse<List<AppInfo>>> getForceInstallControl() {
|
||||||
return mRetrofit.create(ForceInstall.class)
|
return mRetrofit.create(ForceInstall.class)
|
||||||
.getForceInstall(Utils.getSerial())
|
.getForceInstall(Utils.getSerial())
|
||||||
@@ -267,6 +259,13 @@ public class NetInterfaceManager {
|
|||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Observable<BaseResponse> getBatchApiControl() {
|
||||||
|
return mRetrofit.create(GetBatchApi.class)
|
||||||
|
.getBatch(Utils.getSerial())
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
|
}
|
||||||
|
|
||||||
//赶考
|
//赶考
|
||||||
|
|
||||||
public CreateUserApi getCreateUserControl() {
|
public CreateUserApi getCreateUserControl() {
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import java.util.HashMap;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.jpush.android.api.JPushInterface;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
import io.reactivex.ObservableOnSubscribe;
|
import io.reactivex.ObservableOnSubscribe;
|
||||||
import io.reactivex.Observer;
|
import io.reactivex.Observer;
|
||||||
@@ -58,7 +59,7 @@ public class HTTPInterface {
|
|||||||
// Log.e("SendAppInstall", installOrRemove + "return: " + packages);
|
// Log.e("SendAppInstall", installOrRemove + "return: " + packages);
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
Log.e(TAG, "SendAppInstall: " + jsonString);
|
// Log.e(TAG, "SendAppInstall: " + jsonString);
|
||||||
NetInterfaceManager.getInstance()
|
NetInterfaceManager.getInstance()
|
||||||
.getAddAppInstallControl()
|
.getAddAppInstallControl()
|
||||||
.installorRemove(
|
.installorRemove(
|
||||||
@@ -556,11 +557,21 @@ public class HTTPInterface {
|
|||||||
String machine = Utils.getMachine(context);
|
String machine = Utils.getMachine(context);
|
||||||
String hardware = Utils.getHardware(context);
|
String hardware = Utils.getHardware(context);
|
||||||
Log.e(TAG, "updateAdminInfo: getHardware = " + hardware);
|
Log.e(TAG, "updateAdminInfo: getHardware = " + hardware);
|
||||||
|
JSONObject softwareJson = new JSONObject();
|
||||||
|
softwareJson.put("appstore_version", ApkUtils.getAPPVersionName(context, "com.appstore.uiui"));
|
||||||
|
softwareJson.put("updatetools_version", ApkUtils.getAPPVersionName(context, "com.uiuios.updatetools"));
|
||||||
|
softwareJson.put("info_version", ApkUtils.getAPPVersionName(context, "com.info.sn"));
|
||||||
|
softwareJson.put("jiaoguanyi_version", ApkUtils.getAPPVersionName(context, "com.gankao.gkwxhd"));
|
||||||
|
softwareJson.put("gankao_version", ApkUtils.getAPPVersionName(context, "com.jiaoguanyi.os"));
|
||||||
|
softwareJson.put("learning_version", ApkUtils.getAPPVersionName(context, "com.info.learning"));
|
||||||
|
softwareJson.put("chat_version", ApkUtils.getAPPVersionName(context, "com.info.chat"));
|
||||||
|
softwareJson.put("jpush_id", JPushInterface.getRegistrationID(context));
|
||||||
UpdateAdminSn updateAdminSn = NetInterfaceManager.getInstance().getUpdateAdminSnControl();
|
UpdateAdminSn updateAdminSn = NetInterfaceManager.getInstance().getUpdateAdminSnControl();
|
||||||
updateAdminSn.sendAdminSn(Utils.getSerial(),
|
updateAdminSn.sendAdminSn(Utils.getSerial(),
|
||||||
jsonObject.toJSONString(),
|
jsonObject.toJSONString(),
|
||||||
machine,
|
machine,
|
||||||
hardware
|
hardware,
|
||||||
|
softwareJson.toJSONString()
|
||||||
).subscribeOn(Schedulers.io())
|
).subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new Observer<BaseResponse>() {
|
.subscribe(new Observer<BaseResponse>() {
|
||||||
@@ -611,7 +622,7 @@ public class HTTPInterface {
|
|||||||
allAppPkg.add(appInfo.getApp_package());
|
allAppPkg.add(appInfo.getApp_package());
|
||||||
}
|
}
|
||||||
String allPkgSet = String.join(",", allAppPkg);
|
String allPkgSet = String.join(",", allAppPkg);
|
||||||
SPUtils.put(context, "only_jgy_shortcut_list", allPkgSet);
|
Settings.System.putString(context.getContentResolver(), "only_jgy_shortcut_list", allPkgSet);
|
||||||
ApkUtils.writeAppPackageList(context, allPkgSet);
|
ApkUtils.writeAppPackageList(context, allPkgSet);
|
||||||
HTTPInterface.getAppStart(context, appInfoList);
|
HTTPInterface.getAppStart(context, appInfoList);
|
||||||
} else {
|
} else {
|
||||||
@@ -997,6 +1008,8 @@ public class HTTPInterface {
|
|||||||
} else {
|
} else {
|
||||||
uploadInfo.setApp_version_code(info.versionCode);
|
uploadInfo.setApp_version_code(info.versionCode);
|
||||||
}
|
}
|
||||||
|
uploadInfo.setFirstInstallTime(info.firstInstallTime / 1000);
|
||||||
|
uploadInfo.setLastUpdateTime(info.lastUpdateTime / 1000);
|
||||||
uploadInfos.add(uploadInfo);
|
uploadInfos.add(uploadInfo);
|
||||||
}
|
}
|
||||||
emitter.onNext(uploadInfos);
|
emitter.onNext(uploadInfos);
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.info.sn.network;
|
|||||||
public class UrlAddress {
|
public class UrlAddress {
|
||||||
//主页接口
|
//主页接口
|
||||||
public static final String ROOT_URL = "http://homework.uiuios.com/android/";
|
public static final String ROOT_URL = "http://homework.uiuios.com/android/";
|
||||||
|
//获取班级ID
|
||||||
|
public static final String GET_BATCH = ROOT_URL + "sn/getBatch";
|
||||||
//设备信息接口
|
//设备信息接口
|
||||||
public static final String SNINFO = ROOT_URL + "sn/getSnInfo";
|
public static final String SNINFO = ROOT_URL + "sn/getSnInfo";
|
||||||
//发送app信息
|
//发送app信息
|
||||||
@@ -59,7 +61,6 @@ public class UrlAddress {
|
|||||||
public static final String GET_OPERATION_GUIDE = "file/getFiles";
|
public static final String GET_OPERATION_GUIDE = "file/getFiles";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//赶考
|
//赶考
|
||||||
public static final String GANKAN_ROOT_URL = "https://www.gankao.com/api/service/";
|
public static final String GANKAN_ROOT_URL = "https://www.gankao.com/api/service/";
|
||||||
//创建/查询用户
|
//创建/查询用户
|
||||||
|
|||||||
16
app/src/main/java/com/info/sn/network/api/GetBatchApi.java
Normal file
16
app/src/main/java/com/info/sn/network/api/GetBatchApi.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package com.info.sn.network.api;
|
||||||
|
|
||||||
|
import com.info.sn.bean.zuoye.BaseResponse;
|
||||||
|
import com.info.sn.network.UrlAddress;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
import retrofit2.http.GET;
|
||||||
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
|
public interface GetBatchApi {
|
||||||
|
@GET(UrlAddress.GET_BATCH)
|
||||||
|
Observable<BaseResponse> getBatch(
|
||||||
|
@Query("sn") String sn
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package com.info.sn.network.api
|
|
||||||
|
|
||||||
import com.info.sn.bean.zuoye.BaseResponse
|
|
||||||
import com.info.sn.bean.zuoye.SystemSettings
|
|
||||||
import com.info.sn.network.UrlAddress
|
|
||||||
import io.reactivex.Observable
|
|
||||||
import retrofit2.http.GET
|
|
||||||
import retrofit2.http.Query
|
|
||||||
|
|
||||||
interface SettingKT {
|
|
||||||
@GET(UrlAddress.GET_SETTINGS)
|
|
||||||
fun getSetting(
|
|
||||||
@Query("sn") sn: String
|
|
||||||
): Observable<BaseResponse<SystemSettings>>
|
|
||||||
}
|
|
||||||
@@ -15,6 +15,7 @@ public interface UpdateAdminSn {
|
|||||||
@Field("sn") String sn,
|
@Field("sn") String sn,
|
||||||
@Field("address") String address,
|
@Field("address") String address,
|
||||||
@Field("machine") String machine,
|
@Field("machine") String machine,
|
||||||
@Field("hardware") String hardware
|
@Field("hardware") String hardware,
|
||||||
|
@Field("software") String software
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import com.info.sn.network.HTTPInterface;
|
|||||||
import com.info.sn.manager.NetInterfaceManager;
|
import com.info.sn.manager.NetInterfaceManager;
|
||||||
import com.info.sn.network.api.BindDevices;
|
import com.info.sn.network.api.BindDevices;
|
||||||
import com.info.sn.network.api.UploadScreenshot;
|
import com.info.sn.network.api.UploadScreenshot;
|
||||||
|
import com.info.sn.service.MainService;
|
||||||
import com.info.sn.service.ManagerService;
|
import com.info.sn.service.ManagerService;
|
||||||
import com.info.sn.utils.ApkUtils;
|
import com.info.sn.utils.ApkUtils;
|
||||||
import com.info.sn.utils.CacheUtils;
|
import com.info.sn.utils.CacheUtils;
|
||||||
@@ -168,6 +169,9 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
private static final String JIGUANG_CANCEL_COMBO = "42";
|
private static final String JIGUANG_CANCEL_COMBO = "42";
|
||||||
//升级套餐
|
//升级套餐
|
||||||
private static final String JIGUANG_UPGRADE_COMBO = "44";
|
private static final String JIGUANG_UPGRADE_COMBO = "44";
|
||||||
|
//设备授权和解除
|
||||||
|
private static final String JIGUANG_BIND_UNBIND = "45";
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
@@ -211,6 +215,8 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
// HTTPInterface.checkDevicesInfo(context);
|
// HTTPInterface.checkDevicesInfo(context);
|
||||||
Log.e(TAG, "processCustomMessage: " + message);
|
Log.e(TAG, "processCustomMessage: " + message);
|
||||||
switch (message) {
|
switch (message) {
|
||||||
|
default:
|
||||||
|
break;
|
||||||
case JIGUANG_GET_DRIVELINE:
|
case JIGUANG_GET_DRIVELINE:
|
||||||
ToastUtil.debugShow("收到推送消息: 获取在线信息");
|
ToastUtil.debugShow("收到推送消息: 获取在线信息");
|
||||||
// HTTPInterface.getDriveState(member_id, sn_id);
|
// HTTPInterface.getDriveState(member_id, sn_id);
|
||||||
@@ -239,8 +245,13 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
Handler.getMain().postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
HTTPInterface.getBrowserWhiteList(context);
|
HTTPInterface.getBrowserWhiteList(context);
|
||||||
HTTPInterface.getBrowserLabel(context);
|
HTTPInterface.getBrowserLabel(context);
|
||||||
|
}
|
||||||
|
}, 2000);
|
||||||
break;
|
break;
|
||||||
case JIGUANG_APP_NETWORKSTATE:
|
case JIGUANG_APP_NETWORKSTATE:
|
||||||
ToastUtil.debugShow("收到推送消息: 应用联网管控");
|
ToastUtil.debugShow("收到推送消息: 应用联网管控");
|
||||||
@@ -294,14 +305,19 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
Handler.getMain().postDelayed(() -> HTTPInterface.getAllappPackage(context), 2000);
|
Handler.getMain().postDelayed(() -> HTTPInterface.getAllappPackage(context), 2000);
|
||||||
break;
|
break;
|
||||||
case JIGUANG_BROWSER_LABEL:
|
case JIGUANG_BROWSER_LABEL:
|
||||||
|
ToastUtil.debugShow("收到推送消息: 浏览器书签");
|
||||||
try {
|
try {
|
||||||
new CacheUtils().cleanApplicationUserData(context, "com.android.browser");
|
new CacheUtils().cleanApplicationUserData(context, "com.android.browser");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
ToastUtil.debugShow("收到推送消息: 浏览器书签");
|
Handler.getMain().postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
HTTPInterface.getBrowserWhiteList(context);
|
HTTPInterface.getBrowserWhiteList(context);
|
||||||
HTTPInterface.getBrowserLabel(context);
|
HTTPInterface.getBrowserLabel(context);
|
||||||
|
}
|
||||||
|
}, 2000);
|
||||||
break;
|
break;
|
||||||
case JIGUANG_SYSTEM_SETTING:
|
case JIGUANG_SYSTEM_SETTING:
|
||||||
ToastUtil.debugShow("收到推送消息: 系统管控");
|
ToastUtil.debugShow("收到推送消息: 系统管控");
|
||||||
@@ -372,20 +388,28 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
setPhone(context, extras);
|
setPhone(context, extras);
|
||||||
break;
|
break;
|
||||||
case JIGUANG_CHANGE_COMBO:
|
case JIGUANG_CHANGE_COMBO:
|
||||||
|
ToastUtil.debugShow("更换套餐");
|
||||||
changeCombo(context, extras);
|
changeCombo(context, extras);
|
||||||
break;
|
break;
|
||||||
case JIGUANG_CANCEL_COMBO:
|
case JIGUANG_CANCEL_COMBO:
|
||||||
|
ToastUtil.debugShow("取消套餐");
|
||||||
cancleCombo(context, extras);
|
cancleCombo(context, extras);
|
||||||
break;
|
break;
|
||||||
case JIGUANG_UPGRADE_COMBO:
|
case JIGUANG_UPGRADE_COMBO:
|
||||||
|
ToastUtil.debugShow("升级套餐");
|
||||||
upgradeCombo(context, extras);
|
upgradeCombo(context, extras);
|
||||||
case JIGUANG_APP_BROWSER:
|
case JIGUANG_APP_BROWSER:
|
||||||
ToastUtil.debugShow("收到推送消息: 系统APP管控");
|
ToastUtil.debugShow("收到推送消息: 系统APP管控");
|
||||||
Log.e(TAG, "processCustomMessage: " + extras);
|
Log.e(TAG, "processCustomMessage: " + extras);
|
||||||
hideDesktopIcon(context);
|
hideDesktopIcon(context);
|
||||||
break;
|
break;
|
||||||
default:
|
case JIGUANG_BIND_UNBIND:
|
||||||
|
ToastUtil.debugShow("老师授权/取消授权");
|
||||||
|
MainService.getPresenter().getAllApp();
|
||||||
|
MainService.getPresenter().getForceInstall();
|
||||||
|
DeviceManager.doMasterClear();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -945,7 +969,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
Log.e(TAG, "searchTopic: " + jsonString);
|
Log.e(TAG, "searchTopic: " + jsonString);
|
||||||
JSONObject jsonObject = JSON.parseObject(jsonString);
|
JSONObject jsonObject = JSON.parseObject(jsonString);
|
||||||
int search_topic = jsonObject.getIntValue("search_topic");
|
int search_topic = jsonObject.getIntValue("search_topic");
|
||||||
SPUtils.put(context, "search_topic", search_topic);
|
Log.e(TAG, "searchTopic: put = " + SPUtils.put(context, "search_topic", search_topic));
|
||||||
JGYUtils.updateForbidList(context);
|
JGYUtils.updateForbidList(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,9 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import cn.jpush.android.api.JPushInterface;
|
import cn.jpush.android.api.JPushInterface;
|
||||||
@@ -54,7 +56,7 @@ import static com.info.sn.jpush.TagAliasOperatorHelper.sequence;
|
|||||||
*/
|
*/
|
||||||
public class MainService extends Service implements MainContact.MainView, NetworkUtils.OnNetworkStatusChangedListener, LifecycleProvider<ActivityEvent> {
|
public class MainService extends Service implements MainContact.MainView, NetworkUtils.OnNetworkStatusChangedListener, LifecycleProvider<ActivityEvent> {
|
||||||
private String TAG = MainService.class.getSimpleName();
|
private String TAG = MainService.class.getSimpleName();
|
||||||
private MainPresenter mPresenter = new MainPresenter(this);
|
private static MainPresenter mPresenter ;
|
||||||
|
|
||||||
//执行所有请求的时间
|
//执行所有请求的时间
|
||||||
long runningTime = 0;
|
long runningTime = 0;
|
||||||
@@ -85,6 +87,7 @@ public class MainService extends Service implements MainContact.MainView, Networ
|
|||||||
private interface Start {
|
private interface Start {
|
||||||
void onstar(long time);
|
void onstar(long time);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Start start;
|
private Start start;
|
||||||
|
|
||||||
private final ObservableOnSubscribe<Long> subscribe = new ObservableOnSubscribe<Long>() {
|
private final ObservableOnSubscribe<Long> subscribe = new ObservableOnSubscribe<Long>() {
|
||||||
@@ -117,7 +120,7 @@ public class MainService extends Service implements MainContact.MainView, Networ
|
|||||||
HTTPInterface.sendRunningApp(MainService.this);
|
HTTPInterface.sendRunningApp(MainService.this);
|
||||||
HTTPInterface.getAPPinfo(MainService.this);
|
HTTPInterface.getAPPinfo(MainService.this);
|
||||||
startService();
|
startService();
|
||||||
setAlias();
|
mPresenter.setAlias();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -141,6 +144,7 @@ public class MainService extends Service implements MainContact.MainView, Networ
|
|||||||
super.onCreate();
|
super.onCreate();
|
||||||
lifecycleSubject.onNext(ActivityEvent.CREATE);
|
lifecycleSubject.onNext(ActivityEvent.CREATE);
|
||||||
JPushInterface.init(this);
|
JPushInterface.init(this);
|
||||||
|
mPresenter = new MainPresenter(this);
|
||||||
mPresenter.setProvider(this);
|
mPresenter.setProvider(this);
|
||||||
mPresenter.attachView(this);
|
mPresenter.attachView(this);
|
||||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||||
@@ -155,6 +159,7 @@ public class MainService extends Service implements MainContact.MainView, Networ
|
|||||||
Log.e(TAG, "onCreate: " + e.getMessage());
|
Log.e(TAG, "onCreate: " + e.getMessage());
|
||||||
}
|
}
|
||||||
ControlManager.getInstance().setDefaultUSBstate();
|
ControlManager.getInstance().setDefaultUSBstate();
|
||||||
|
mPresenter.setAlias();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -199,15 +204,11 @@ public class MainService extends Service implements MainContact.MainView, Networ
|
|||||||
startService(new Intent(this, MyDownloadService.class));
|
startService(new Intent(this, MyDownloadService.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAlias() {
|
public static MainPresenter getPresenter(){
|
||||||
TagAliasOperatorHelper.TagAliasBean tagAliasBean = new TagAliasOperatorHelper.TagAliasBean();
|
return mPresenter;
|
||||||
tagAliasBean.action = ACTION_SET;
|
|
||||||
sequence++;
|
|
||||||
tagAliasBean.alias = Utils.getSerial();
|
|
||||||
tagAliasBean.isAliasAction = true;
|
|
||||||
TagAliasOperatorHelper.getInstance().handleAction(MainService.this, TagAliasOperatorHelper.sequence, tagAliasBean);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPowerUserList(String date) {
|
public void setPowerUserList(String date) {
|
||||||
|
|
||||||
@@ -233,6 +234,39 @@ public class MainService extends Service implements MainContact.MainView, Networ
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAlias() {
|
||||||
|
setJpushAlias();
|
||||||
|
Log.e(TAG, "setAlias: " + "finish");
|
||||||
|
mPresenter.getBatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setJpushAlias() {
|
||||||
|
String alias = Utils.getSerial();
|
||||||
|
TagAliasOperatorHelper.TagAliasBean tagAliasBean = new TagAliasOperatorHelper.TagAliasBean();
|
||||||
|
tagAliasBean.action = ACTION_SET;
|
||||||
|
TagAliasOperatorHelper.sequence++;
|
||||||
|
tagAliasBean.alias = alias;
|
||||||
|
tagAliasBean.isAliasAction = true;
|
||||||
|
TagAliasOperatorHelper.getInstance().handleAction(this, TagAliasOperatorHelper.sequence, tagAliasBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTag(Set set) {
|
||||||
|
TagAliasOperatorHelper.TagAliasBean tagAliasBean = new TagAliasOperatorHelper.TagAliasBean();
|
||||||
|
tagAliasBean.action = ACTION_SET;
|
||||||
|
TagAliasOperatorHelper.sequence++;
|
||||||
|
tagAliasBean.tags = set;
|
||||||
|
tagAliasBean.isAliasAction = false;
|
||||||
|
TagAliasOperatorHelper.getInstance().handleAction(this, TagAliasOperatorHelper.sequence, tagAliasBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBatch(String batch) {
|
||||||
|
HashSet hashSet = new HashSet();
|
||||||
|
hashSet.add(batch);
|
||||||
|
setTag(hashSet);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setQRCode(Bitmap bitmap) {
|
public void setQRCode(Bitmap bitmap) {
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ public class ManagerService extends Service {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
Log.e("getScreenLockState", "onError: ");
|
Log.e("getScreenLockState", "onError: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ public class ApkUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 安装一个apk文件
|
* 安装一个apk文件
|
||||||
*/
|
*/
|
||||||
@@ -672,7 +671,7 @@ public class ApkUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void addShortcut(Context context) {
|
public static void addShortcut(Context context) {
|
||||||
String packageList = (String) SPUtils.get(context, "only_jgy_shortcut_list", "Invalid");
|
String packageList = Settings.System.getString(context.getContentResolver(), "only_jgy_shortcut_list");
|
||||||
if (TextUtils.isEmpty(packageList)) {
|
if (TextUtils.isEmpty(packageList)) {
|
||||||
JGYUtils.putString(context.getContentResolver(), "qch_launcher_icon_app", "");
|
JGYUtils.putString(context.getContentResolver(), "qch_launcher_icon_app", "");
|
||||||
return;
|
return;
|
||||||
@@ -834,4 +833,28 @@ public class ApkUtils {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取第三方应用
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<String> queryFilterAppInfo(Context context) {
|
||||||
|
PackageManager pm = context.getPackageManager();
|
||||||
|
// 查询所有已经安装的应用程序
|
||||||
|
List<ApplicationInfo> appInfos = pm.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);// GET_UNINSTALLED_PACKAGES代表已删除,但还有安装目录的
|
||||||
|
List<String> applicationInfos = new ArrayList<>();
|
||||||
|
for (ApplicationInfo app : appInfos) {
|
||||||
|
// Logutils.e("queryFilterAppInfo", String.valueOf(app.flags));
|
||||||
|
// Logutils.e("queryFilterAppInfo", String.valueOf((app.flags & mask)));
|
||||||
|
if ((app.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
|
||||||
|
//通过flag排除系统应用,会将电话、短信也排除掉
|
||||||
|
} else {
|
||||||
|
applicationInfos.add(app.packageName);
|
||||||
|
Log.e("queryFilterAppInfo", app.packageName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return applicationInfos;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import android.provider.Settings;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.info.sn.BuildConfig;
|
import com.info.sn.BuildConfig;
|
||||||
import com.info.sn.service.RemoteService;
|
import com.info.sn.service.RemoteService;
|
||||||
|
|
||||||
@@ -561,7 +562,11 @@ public class JGYUtils {
|
|||||||
|
|
||||||
public static ArrayList<String> getForbidList(Context context) {
|
public static ArrayList<String> getForbidList(Context context) {
|
||||||
ArrayList<String> disableApp = new ArrayList<>();
|
ArrayList<String> disableApp = new ArrayList<>();
|
||||||
if ((int) SPUtils.get(context, "search_topic", 0) == 0) {
|
int search_topic = (int) SPUtils.get(context, "search_topic", 0);
|
||||||
|
Log.e(TAG, "getForbidList: search_topic = " + search_topic);
|
||||||
|
Log.e(TAG, "getForbidList: " + JSONObject.toJSONString(SPUtils.getAll(context)));
|
||||||
|
|
||||||
|
if (search_topic == 0) {
|
||||||
disableApp.add("拍照搜题");
|
disableApp.add("拍照搜题");
|
||||||
}
|
}
|
||||||
if (JGYUtils.getInt(context.getContentResolver(), "qch_app_camera", 0) == 1) {
|
if (JGYUtils.getInt(context.getContentResolver(), "qch_app_camera", 0) == 1) {
|
||||||
@@ -580,6 +585,9 @@ public class JGYUtils {
|
|||||||
if (JGYUtils.getInt(context.getContentResolver(), "qch_app_music", 0) == 1) {
|
if (JGYUtils.getInt(context.getContentResolver(), "qch_app_music", 0) == 1) {
|
||||||
disableApp.add("com.android.music");
|
disableApp.add("com.android.music");
|
||||||
}
|
}
|
||||||
|
if (JGYUtils.getInt(context.getContentResolver(), "qch_app_browser", 0) == 1) {
|
||||||
|
disableApp.add("com.android.browser");
|
||||||
|
}
|
||||||
Log.e(TAG, "getForbidAPP: " + disableApp);
|
Log.e(TAG, "getForbidAPP: " + disableApp);
|
||||||
return disableApp;
|
return disableApp;
|
||||||
}
|
}
|
||||||
@@ -589,6 +597,7 @@ public class JGYUtils {
|
|||||||
public static void updateForbidList(Context context) {
|
public static void updateForbidList(Context context) {
|
||||||
Intent intent = new Intent(UPDATE_FORBID_APP);
|
Intent intent = new Intent(UPDATE_FORBID_APP);
|
||||||
intent.putStringArrayListExtra("forbid_app_list", getForbidList(context));
|
intent.putStringArrayListExtra("forbid_app_list", getForbidList(context));
|
||||||
|
Log.e(TAG, "updateForbidList: " + getForbidList(context));
|
||||||
intent.setPackage("com.jiaoguanyi.os");
|
intent.setPackage("com.jiaoguanyi.os");
|
||||||
intent.setPackage("com.tt.ttutils");
|
intent.setPackage("com.tt.ttutils");
|
||||||
context.sendBroadcast(intent);
|
context.sendBroadcast(intent);
|
||||||
@@ -603,6 +612,7 @@ public class JGYUtils {
|
|||||||
return new ArrayList<>(Arrays.asList(appString.split(",")));
|
return new ArrayList<>(Arrays.asList(appString.split(",")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String UPDATE_HIDE_APP = "UPDATE_HIDE_APP";
|
private static final String UPDATE_HIDE_APP = "UPDATE_HIDE_APP";
|
||||||
|
|
||||||
public static void updateHideList(Context context) {
|
public static void updateHideList(Context context) {
|
||||||
@@ -736,6 +746,50 @@ public class JGYUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//删除用户除了在应用市场的其他应用
|
||||||
|
public void deleteOtherApp() {
|
||||||
|
int locked = Settings.System.getInt(mContext.getContentResolver(), "qch_unlock_ipad", 0);
|
||||||
|
if (locked == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Log.e(TAG, "deleteOtherApp: " + "start");
|
||||||
|
//获取后台应用白名单
|
||||||
|
String only_jgy_shortcut_list = Settings.System.getString(mContext.getContentResolver(), "only_jgy_shortcut_list");
|
||||||
|
//获取可以被安装的包名
|
||||||
|
String qch_app_forbid = Settings.System.getString(mContext.getContentResolver(), "qch_app_forbid");
|
||||||
|
Log.e("deleteOtherApp", "only_jgy_shortcut_list:" + only_jgy_shortcut_list);
|
||||||
|
Log.e("deleteOtherApp", "qch_app_forbid:" + qch_app_forbid);
|
||||||
|
String[] result_white = only_jgy_shortcut_list.split(",");
|
||||||
|
String[] result_forbid = qch_app_forbid.split(",");
|
||||||
|
List<String> resulWhitetList = new ArrayList<>(Arrays.asList(result_white));
|
||||||
|
List<String> resulForbidtList = new ArrayList<>(Arrays.asList(result_forbid));
|
||||||
|
resulWhitetList.addAll(resulForbidtList);
|
||||||
|
HashSet<String> allWhitePkg = new HashSet<>(resulWhitetList);
|
||||||
|
List<String> installedPackageList = ApkUtils.queryFilterAppInfo(mContext);
|
||||||
|
|
||||||
|
Log.e("deleteOtherApp", "installedPackageList:" + installedPackageList.toString());
|
||||||
|
if (allWhitePkg.size() > 0) {
|
||||||
|
for (final String packageName : installedPackageList) {
|
||||||
|
if (ApkUtils.isSystemApp(mContext, packageName)) {
|
||||||
|
Log.e("deleteOtherApp", "is systemApp:" + packageName);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// if (ApkUtils.desktopAPP.contains(packageName)) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// if (ApkUtils.canremove_systemapp.contains(packageName)) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
if ("com.jiaoguanyi.appstore".equals(packageName) || "com.jiaoguanyi.store".equals(packageName)
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!allWhitePkg.contains(packageName)) {
|
||||||
|
ApkUtils.uninstallApp(mContext, packageName);
|
||||||
|
Log.e("deleteOtherApp", "uninstall apkName:" + packageName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Log.e(TAG, "deleteOtherApp: " + "end");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import android.graphics.Bitmap;
|
|||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
|
import android.util.Log;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
@@ -26,11 +27,12 @@ public class SPUtils {
|
|||||||
* 保存在手机里面的文件名
|
* 保存在手机里面的文件名
|
||||||
*/
|
*/
|
||||||
public static final String FILE_NAME = "share_data";
|
public static final String FILE_NAME = "share_data";
|
||||||
|
private static String TAG = SPUtils.class.getSimpleName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存数据的方法,我们需要拿到保存数据的具体类型,然后根据类型调用不同的保存方法
|
* 保存数据的方法,我们需要拿到保存数据的具体类型,然后根据类型调用不同的保存方法
|
||||||
*/
|
*/
|
||||||
public static void put(Context context, String key, Object object) {
|
public static boolean put(Context context, String key, Object object) {
|
||||||
|
|
||||||
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
|
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
|
||||||
Context.MODE_PRIVATE);
|
Context.MODE_PRIVATE);
|
||||||
@@ -50,7 +52,7 @@ public class SPUtils {
|
|||||||
editor.putString(key, object.toString());
|
editor.putString(key, object.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPreferencesCompat.apply(editor);
|
return SharedPreferencesCompat.apply(editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -183,17 +185,17 @@ public class SPUtils {
|
|||||||
/**
|
/**
|
||||||
* 如果找到则使用apply执行,否则使用commit
|
* 如果找到则使用apply执行,否则使用commit
|
||||||
*/
|
*/
|
||||||
public static void apply(SharedPreferences.Editor editor) {
|
public static boolean apply(SharedPreferences.Editor editor) {
|
||||||
try {
|
try {
|
||||||
if (sApplyMethod != null) {
|
if (sApplyMethod != null) {
|
||||||
|
Log.e(TAG, "apply: false");
|
||||||
sApplyMethod.invoke(editor);
|
sApplyMethod.invoke(editor);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException e) {
|
||||||
} catch (IllegalAccessException e) {
|
Log.e(TAG, "apply: " + e.getStackTrace());
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
}
|
}
|
||||||
editor.commit();
|
return editor.commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
344
app/src/main/java/com/info/sn/utils/StatusBarUtil.java
Normal file
344
app/src/main/java/com/info/sn/utils/StatusBarUtil.java
Normal file
@@ -0,0 +1,344 @@
|
|||||||
|
package com.info.sn.utils;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
|
import android.view.Display;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
public class StatusBarUtil {
|
||||||
|
public static int screenWidth;
|
||||||
|
public static int screenHeight;
|
||||||
|
public static int navigationHeight = 0;
|
||||||
|
|
||||||
|
private static DisplayMetrics mMetrics;
|
||||||
|
public static final String HOME_CURRENT_TAB_POSITION = "HOME_CURRENT_TAB_POSITION";
|
||||||
|
|
||||||
|
public static final String SYS_EMUI = "sys_emui";
|
||||||
|
public static final String SYS_MIUI = "sys_miui";
|
||||||
|
public static final String SYS_FLYME = "sys_flyme";
|
||||||
|
private static final String KEY_MIUI_VERSION_CODE = "ro.miui.ui.version.code";
|
||||||
|
private static final String KEY_MIUI_VERSION_NAME = "ro.miui.ui.version.name";
|
||||||
|
private static final String KEY_MIUI_INTERNAL_STORAGE = "ro.miui.internal.storage";
|
||||||
|
private static final String KEY_EMUI_API_LEVEL = "ro.build.hw_emui_api_level";
|
||||||
|
private static final String KEY_EMUI_VERSION = "ro.build.version.emui";
|
||||||
|
private static final String KEY_EMUI_CONFIG_HW_SYS_VERSION = "ro.confg.hw_systemversion";
|
||||||
|
|
||||||
|
public static void init(Activity activity) {
|
||||||
|
ViewGroup contentLayout = activity.getWindow().getDecorView().findViewById(Window.ID_ANDROID_CONTENT);
|
||||||
|
StatusBarUtil.setStatusBar(activity, false, true);
|
||||||
|
StatusBarUtil.setStatusTextColor(true, activity);
|
||||||
|
StatusBarUtil.setStatusBarPadding(activity, contentLayout);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
activity.getWindow().setStatusBarColor(activity.getResources().getColor(android.R.color.transparent));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过反射的方式获取状态栏高度
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static int getStatusBarHeight(Context context) {
|
||||||
|
try {
|
||||||
|
Class<?> c = Class.forName("com.android.internal.R$dimen");
|
||||||
|
Object obj = c.newInstance();
|
||||||
|
Field field = c.getField("status_bar_height");
|
||||||
|
int x = Integer.parseInt(field.get(obj).toString());
|
||||||
|
return context.getResources().getDimensionPixelSize(x);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取底部导航栏高度
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static int getNavigationBarHeight(Context context) {
|
||||||
|
Resources resources = context.getResources();
|
||||||
|
int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||||
|
//获取NavigationBar的高度
|
||||||
|
navigationHeight = resources.getDimensionPixelSize(resourceId);
|
||||||
|
return navigationHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取是否存在NavigationBar
|
||||||
|
public static boolean checkDeviceHasNavigationBar(Context context) {
|
||||||
|
boolean hasNavigationBar = false;
|
||||||
|
Resources rs = context.getResources();
|
||||||
|
int id = rs.getIdentifier("config_showNavigationBar", "bool", "android");
|
||||||
|
if (id > 0) {
|
||||||
|
hasNavigationBar = rs.getBoolean(id);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Class systemPropertiesClass = Class.forName("android.os.SystemProperties");
|
||||||
|
Method m = systemPropertiesClass.getMethod("get", String.class);
|
||||||
|
String navBarOverride = (String) m.invoke(systemPropertiesClass, "qemu.hw.mainkeys");
|
||||||
|
if ("1".equals(navBarOverride)) {
|
||||||
|
hasNavigationBar = false;
|
||||||
|
} else if ("0".equals(navBarOverride)) {
|
||||||
|
hasNavigationBar = true;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return hasNavigationBar;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param activity
|
||||||
|
* @param useThemestatusBarColor 是否要状态栏的颜色,不设置则为透明色
|
||||||
|
* @param withoutUseStatusBarColor 是否不需要使用状态栏为暗色调
|
||||||
|
*/
|
||||||
|
public static void setStatusBar(Activity activity, boolean useThemestatusBarColor, boolean withoutUseStatusBarColor) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {//5.0及以上
|
||||||
|
View decorView = activity.getWindow().getDecorView();
|
||||||
|
int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||||
|
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
|
||||||
|
decorView.setSystemUiVisibility(option);
|
||||||
|
if (useThemestatusBarColor) {
|
||||||
|
activity.getWindow().setStatusBarColor(activity.getResources().getColor(android.R.color.white));
|
||||||
|
} else {
|
||||||
|
activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
|
||||||
|
}
|
||||||
|
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {//4.4到5.0
|
||||||
|
WindowManager.LayoutParams localLayoutParams = activity.getWindow().getAttributes();
|
||||||
|
localLayoutParams.flags = (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | localLayoutParams.flags);
|
||||||
|
}
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !withoutUseStatusBarColor) {
|
||||||
|
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void reMeasure(Activity activity) {
|
||||||
|
Display display = activity.getWindowManager().getDefaultDisplay();
|
||||||
|
mMetrics = new DisplayMetrics();
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= 17) {
|
||||||
|
display.getRealMetrics(mMetrics);
|
||||||
|
} else {
|
||||||
|
display.getMetrics(mMetrics);
|
||||||
|
}
|
||||||
|
|
||||||
|
screenWidth = mMetrics.widthPixels;
|
||||||
|
screenHeight = mMetrics.heightPixels;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 改变魅族的状态栏字体为黑色,要求FlyMe4以上
|
||||||
|
*/
|
||||||
|
private static void processFlyMe(boolean isLightStatusBar, Activity activity) {
|
||||||
|
WindowManager.LayoutParams lp = activity.getWindow().getAttributes();
|
||||||
|
try {
|
||||||
|
Class<?> instance = Class.forName("android.view.WindowManager$LayoutParams");
|
||||||
|
int value = instance.getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON").getInt(lp);
|
||||||
|
Field field = instance.getDeclaredField("meizuFlags");
|
||||||
|
field.setAccessible(true);
|
||||||
|
int origin = field.getInt(lp);
|
||||||
|
if (isLightStatusBar) {
|
||||||
|
field.set(lp, origin | value);
|
||||||
|
} else {
|
||||||
|
field.set(lp, (~value) & origin);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 改变小米的状态栏字体颜色为黑色, 要求MIUI6以上 lightStatusBar为真时表示黑色字体
|
||||||
|
*/
|
||||||
|
private static void processMIUI(boolean lightStatusBar, Activity activity) {
|
||||||
|
Class<? extends Window> clazz = activity.getWindow().getClass();
|
||||||
|
try {
|
||||||
|
int darkModeFlag;
|
||||||
|
Class<?> layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams");
|
||||||
|
Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE");
|
||||||
|
darkModeFlag = field.getInt(layoutParams);
|
||||||
|
Method extraFlagField = clazz.getMethod("setExtraFlags", int.class, int.class);
|
||||||
|
extraFlagField.invoke(activity.getWindow(), lightStatusBar ? darkModeFlag : 0, darkModeFlag);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置OPPO手机状态栏字体为黑色(colorOS3.0,6.0以下部分手机)
|
||||||
|
*
|
||||||
|
* @param lightStatusBar
|
||||||
|
* @param activity
|
||||||
|
*/
|
||||||
|
private static final int SYSTEM_UI_FLAG_OP_STATUS_BAR_TINT = 0x00000010;
|
||||||
|
|
||||||
|
private static void setOPPOStatusTextColor(boolean lightStatusBar, Activity activity) {
|
||||||
|
Window window = activity.getWindow();
|
||||||
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||||
|
int vis = window.getDecorView().getSystemUiVisibility();
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
if (lightStatusBar) {
|
||||||
|
vis |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
|
||||||
|
} else {
|
||||||
|
vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
|
||||||
|
}
|
||||||
|
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
if (lightStatusBar) {
|
||||||
|
vis |= SYSTEM_UI_FLAG_OP_STATUS_BAR_TINT;
|
||||||
|
} else {
|
||||||
|
vis &= ~SYSTEM_UI_FLAG_OP_STATUS_BAR_TINT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.getDecorView().setSystemUiVisibility(vis);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断手机是否是小米
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean isMIUI() {
|
||||||
|
return SYS_MIUI.equals(getSystem());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断手机是否是魅族
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean isFlyme() {
|
||||||
|
try {
|
||||||
|
// Invoke Build.hasSmartBar()
|
||||||
|
final Method method = Build.class.getMethod("hasSmartBar");
|
||||||
|
return method != null;
|
||||||
|
} catch (final Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置状态栏文字色值为深色调
|
||||||
|
*
|
||||||
|
* @param useDart 是否使用深色调
|
||||||
|
* @param activity
|
||||||
|
*/
|
||||||
|
public static void setStatusTextColor(boolean useDart, Activity activity) {
|
||||||
|
if (isFlyme()) {
|
||||||
|
processFlyMe(useDart, activity);
|
||||||
|
} else if (isMIUI()) {
|
||||||
|
processMIUI(useDart, activity);
|
||||||
|
} else if (Build.MANUFACTURER.equalsIgnoreCase("OPPO")) {
|
||||||
|
//OPPO
|
||||||
|
setOPPOStatusTextColor(useDart, activity);
|
||||||
|
} else {
|
||||||
|
if (useDart) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
activity.getWindow().getDecorView().setSystemUiVisibility(
|
||||||
|
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||||
|
}
|
||||||
|
activity.getWindow().getDecorView().findViewById(android.R.id.content).setPadding(0, 0, 0, navigationHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作者:Loyea
|
||||||
|
* 链接:https://www.jianshu.com/p/abd021c22728
|
||||||
|
* 來源:简书
|
||||||
|
* 简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
|
||||||
|
*/
|
||||||
|
public static void setAndroidNativeLightStatusBar(Activity activity, boolean dark) {
|
||||||
|
View decor = activity.getWindow().getDecorView();
|
||||||
|
if (dark) {
|
||||||
|
decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
} else {
|
||||||
|
// We want to change tint color to white again.
|
||||||
|
// You can also record the flags in advance so that you can turn UI back completely if
|
||||||
|
// you have set other flags before, such as translucent or full screen.
|
||||||
|
decor.setSystemUiVisibility(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getSystem() {
|
||||||
|
String SYS = "";
|
||||||
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) {
|
||||||
|
if (!TextUtils.isEmpty(getSystemProperty(KEY_MIUI_VERSION_CODE, ""))
|
||||||
|
|| !TextUtils.isEmpty(getSystemProperty(KEY_MIUI_VERSION_NAME, ""))
|
||||||
|
|| !TextUtils.isEmpty(getSystemProperty(KEY_MIUI_INTERNAL_STORAGE, ""))) {
|
||||||
|
SYS = SYS_MIUI;//小米
|
||||||
|
} else if (!TextUtils.isEmpty(getSystemProperty(KEY_EMUI_API_LEVEL, ""))
|
||||||
|
|| !TextUtils.isEmpty(getSystemProperty(KEY_EMUI_VERSION, ""))
|
||||||
|
|| !TextUtils.isEmpty(getSystemProperty(KEY_EMUI_CONFIG_HW_SYS_VERSION, ""))) {
|
||||||
|
SYS = SYS_EMUI;//华为
|
||||||
|
} else if (getMeizuFlymeOSFlag().toLowerCase().contains("flyme")) {
|
||||||
|
SYS = SYS_FLYME;//魅族
|
||||||
|
}
|
||||||
|
return SYS;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
Properties prop = new Properties();
|
||||||
|
prop.load(new FileInputStream(new File(Environment.getRootDirectory(), "build.prop")));
|
||||||
|
if (prop.getProperty(KEY_MIUI_VERSION_CODE, null) != null
|
||||||
|
|| prop.getProperty(KEY_MIUI_VERSION_NAME, null) != null
|
||||||
|
|| prop.getProperty(KEY_MIUI_INTERNAL_STORAGE, null) != null) {
|
||||||
|
SYS = SYS_MIUI;//小米
|
||||||
|
} else if (prop.getProperty(KEY_EMUI_API_LEVEL, null) != null
|
||||||
|
|| prop.getProperty(KEY_EMUI_VERSION, null) != null
|
||||||
|
|| prop.getProperty(KEY_EMUI_CONFIG_HW_SYS_VERSION, null) != null) {
|
||||||
|
SYS = SYS_EMUI;//华为
|
||||||
|
} else if (getMeizuFlymeOSFlag().toLowerCase().contains("flyme")) {
|
||||||
|
SYS = SYS_FLYME;//魅族
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return SYS;
|
||||||
|
} finally {
|
||||||
|
return SYS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getSystemProperty(String key, String defaultValue) {
|
||||||
|
try {
|
||||||
|
Class<?> clz = Class.forName("android.os.SystemProperties");
|
||||||
|
Method get = clz.getMethod("get", String.class, String.class);
|
||||||
|
return (String) get.invoke(clz, key, defaultValue);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getMeizuFlymeOSFlag() {
|
||||||
|
return getSystemProperty("ro.build.display.id", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全屏模式下 针对刘海屏向下移动view
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param view 需要设置padding的view
|
||||||
|
*/
|
||||||
|
public static void setStatusBarPadding(Context context, View view) {
|
||||||
|
if (view != null) {
|
||||||
|
view.setPadding(0, getStatusBarHeight(context), 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
24
app/src/main/java/com/info/sn/utils/SystemUtils.java
Normal file
24
app/src/main/java/com/info/sn/utils/SystemUtils.java
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package com.info.sn.utils;
|
||||||
|
|
||||||
|
import android.app.ActivityManager;
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SystemUtils {
|
||||||
|
|
||||||
|
public static boolean isMainProcessName(Context cxt, int pid) {
|
||||||
|
String packageName = cxt.getPackageName();
|
||||||
|
ActivityManager am = (ActivityManager) cxt.getSystemService(Context.ACTIVITY_SERVICE);
|
||||||
|
List<ActivityManager.RunningAppProcessInfo> runningApps = am.getRunningAppProcesses();
|
||||||
|
if (runningApps == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (ActivityManager.RunningAppProcessInfo procInfo : runningApps) {
|
||||||
|
if (procInfo.pid == pid) {
|
||||||
|
return procInfo.processName.equals(packageName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,6 +31,7 @@ public class URLUtils {
|
|||||||
private static String TAG = URLUtils.class.getSimpleName();
|
private static String TAG = URLUtils.class.getSimpleName();
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private HashSet<String> baseURLList = new HashSet<>();
|
private HashSet<String> baseURLList = new HashSet<>();
|
||||||
|
private HashSet<String> nohttpURLList = new HashSet<>();
|
||||||
|
|
||||||
public URLUtils(Context context) {
|
public URLUtils(Context context) {
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
@@ -39,6 +40,7 @@ public class URLUtils {
|
|||||||
public void setBrowserList() {
|
public void setBrowserList() {
|
||||||
String whiteList = JGYUtils.getString(mContext.getContentResolver(), "DeselectBrowserArray");
|
String whiteList = JGYUtils.getString(mContext.getContentResolver(), "DeselectBrowserArray");
|
||||||
String homePage = JGYUtils.getString(mContext.getContentResolver(), "homepagURL");
|
String homePage = JGYUtils.getString(mContext.getContentResolver(), "homepagURL");
|
||||||
|
Log.e(TAG, "setBrowserList old: " + whiteList);
|
||||||
|
|
||||||
HashSet<String> URLList = new HashSet<>();
|
HashSet<String> URLList = new HashSet<>();
|
||||||
if (!TextUtils.isEmpty(whiteList)){
|
if (!TextUtils.isEmpty(whiteList)){
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = "1.4.10"
|
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
@@ -11,7 +10,6 @@ buildscript {
|
|||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.6.4'
|
classpath 'com.android.tools.build:gradle:3.6.4'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
}
|
}
|
||||||
@@ -34,5 +32,5 @@ allprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
task clean(type: Delete) {
|
||||||
delete rootProject.buildDir
|
// delete rootProject.buildDir
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user