version:6.4.7
fix: update:增加绑定手机和绑定状态,增加扫码绑定
This commit is contained in:
@@ -69,6 +69,8 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
private static final String TAG = MainActivity.class.getSimpleName();
|
||||
|
||||
public static final String UPDATE_LOCKED_STATUS = "UPDATE_LOCKED_STATUS";
|
||||
public static final String REFRESHACTION = BuildConfig.APPLICATION_ID + ".REFRESH";
|
||||
|
||||
|
||||
@BindView(R.id.iv_back)
|
||||
ImageView back;
|
||||
@@ -125,6 +127,8 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
|
||||
@BindView(R.id.tv_bind_statu)
|
||||
TextView tv_bind_statu;
|
||||
@BindView(R.id.tv_bind_status)
|
||||
TextView tv_bind_status;
|
||||
@BindView(R.id.iv_qrcode)
|
||||
ImageView iv_qrcode;
|
||||
@BindView(R.id.tv_bind_time)
|
||||
@@ -397,6 +401,13 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
String classes = studesInfo.getClasses();
|
||||
String batch = studesInfo.getBatch();
|
||||
String head_img = studesInfo.getHead_img();
|
||||
int bind_statu = studesInfo.getBind_status();
|
||||
if (bind_statu == 1) {
|
||||
String phone = studesInfo.getBind_mobile();
|
||||
tv_bind_status.setText("绑定号码:" + phone);
|
||||
} else {
|
||||
tv_bind_status.setText("未绑定");
|
||||
}
|
||||
|
||||
|
||||
settradeType(trade_type);
|
||||
@@ -430,17 +441,17 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
|
||||
@Override
|
||||
public void getEBagCodeFinish(boolean activation) {
|
||||
if (activation){
|
||||
if (activation) {
|
||||
mMainAPresenter.getExclusiveAdminApp();
|
||||
Log.e(TAG, "getEBagCodeFinish: "+"已激活" );
|
||||
}else {
|
||||
Log.e(TAG, "getEBagCodeFinish: "+"未激活" );
|
||||
Log.e(TAG, "getEBagCodeFinish: " + "已激活");
|
||||
} else {
|
||||
Log.e(TAG, "getEBagCodeFinish: " + "未激活");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getExclusiveAdminAppFinish() {
|
||||
Log.e(TAG, "getAdminAppFinish: " );
|
||||
Log.e(TAG, "getAdminAppFinish: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,6 +19,8 @@ public class StudentsInfo implements Serializable {
|
||||
String head_img;
|
||||
/*1教育,2商用*/
|
||||
int trade_type;
|
||||
String bind_mobile;
|
||||
int bind_status;
|
||||
|
||||
public String getBatch() {
|
||||
return batch;
|
||||
@@ -76,6 +78,22 @@ public class StudentsInfo implements Serializable {
|
||||
this.trade_type = trade_type;
|
||||
}
|
||||
|
||||
public String getBind_mobile() {
|
||||
return bind_mobile;
|
||||
}
|
||||
|
||||
public void setBind_mobile(String bind_mobile) {
|
||||
this.bind_mobile = bind_mobile;
|
||||
}
|
||||
|
||||
public int getBind_status() {
|
||||
return bind_status;
|
||||
}
|
||||
|
||||
public void setBind_status(int bind_status) {
|
||||
this.bind_status = bind_status;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
@@ -24,6 +24,7 @@ public class CommonConfig {
|
||||
public final static String STUDENT_ID = "sno";
|
||||
/*头像*/
|
||||
public final static String HEAD_IMG = "head_img";
|
||||
public final static String USER_PHONE = "user_phone_key";
|
||||
//保存的用户信息
|
||||
|
||||
/*首次启动app*/
|
||||
|
||||
254
app/src/main/java/com/aoleyun/sn/dialog/CustomDialog.java
Normal file
254
app/src/main/java/com/aoleyun/sn/dialog/CustomDialog.java
Normal file
@@ -0,0 +1,254 @@
|
||||
package com.aoleyun.sn.dialog;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import com.aoleyun.sn.R;
|
||||
|
||||
|
||||
/**
|
||||
* description:自定义dialog
|
||||
*/
|
||||
|
||||
public class CustomDialog extends AlertDialog {
|
||||
/**
|
||||
* 显示的图片
|
||||
*/
|
||||
private ImageView imageIv;
|
||||
|
||||
/**
|
||||
* 显示的标题
|
||||
*/
|
||||
private TextView titleTv;
|
||||
|
||||
/**
|
||||
* 显示的消息
|
||||
*/
|
||||
private TextView messageTv;
|
||||
|
||||
/**
|
||||
* 确认和取消按钮
|
||||
*/
|
||||
private TextView negtiveBn, positiveBn;
|
||||
|
||||
/**
|
||||
* 按钮之间的分割线
|
||||
*/
|
||||
// private View columnLineView;
|
||||
|
||||
private Context mContext;
|
||||
|
||||
public CustomDialog(Context context) {
|
||||
super(context, R.style.CustomDialog);
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* 都是内容数据
|
||||
*/
|
||||
private String message;
|
||||
private String title;
|
||||
private String positive, negtive;
|
||||
private int imageResId = -1;
|
||||
|
||||
/**
|
||||
* 底部是否只有一个按钮
|
||||
*/
|
||||
private boolean isSingle = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.dialog_custom);
|
||||
//按空白处不能取消动画
|
||||
setCanceledOnTouchOutside(false);
|
||||
//初始化界面控件
|
||||
initView();
|
||||
//初始化界面数据
|
||||
refreshView();
|
||||
//初始化界面控件的事件
|
||||
initEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化界面的确定和取消监听器
|
||||
*/
|
||||
private void initEvent() {
|
||||
//设置确定按钮被点击后,向外界提供监听
|
||||
positiveBn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (onClickBottomListener != null) {
|
||||
onClickBottomListener.onPositiveClick();
|
||||
}
|
||||
}
|
||||
});
|
||||
//设置取消按钮被点击后,向外界提供监听
|
||||
negtiveBn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (onClickBottomListener != null) {
|
||||
onClickBottomListener.onNegtiveClick();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化界面控件的显示数据
|
||||
*/
|
||||
private void refreshView() {
|
||||
//如果用户自定了title和message
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
titleTv.setText(title);
|
||||
titleTv.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
titleTv.setVisibility(View.GONE);
|
||||
}
|
||||
if (!TextUtils.isEmpty(message)) {
|
||||
messageTv.setText(message);
|
||||
}
|
||||
//如果设置按钮的文字
|
||||
if (!TextUtils.isEmpty(positive)) {
|
||||
positiveBn.setText(positive);
|
||||
} else {
|
||||
positiveBn.setText("确定");
|
||||
}
|
||||
if (!TextUtils.isEmpty(negtive)) {
|
||||
negtiveBn.setText(negtive);
|
||||
} else {
|
||||
negtiveBn.setText("取消");
|
||||
}
|
||||
|
||||
if (imageResId != -1) {
|
||||
imageIv.setImageResource(imageResId);
|
||||
imageIv.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
imageIv.setVisibility(View.GONE);
|
||||
}
|
||||
/**
|
||||
* 只显示一个按钮的时候隐藏取消按钮,回掉只执行确定的事件
|
||||
*/
|
||||
if (isSingle) {
|
||||
// columnLineView.setVisibility(View.GONE);
|
||||
negtiveBn.setVisibility(View.GONE);
|
||||
} else {
|
||||
negtiveBn.setVisibility(View.VISIBLE);
|
||||
// columnLineView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
refreshView();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化界面控件
|
||||
*/
|
||||
private void initView() {
|
||||
negtiveBn = findViewById(R.id.negtive);
|
||||
positiveBn = findViewById(R.id.positive);
|
||||
titleTv = findViewById(R.id.title);
|
||||
messageTv = findViewById(R.id.message);
|
||||
imageIv = findViewById(R.id.image);
|
||||
// columnLineView = findViewById(R.id.column_line);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置确定取消按钮的回调
|
||||
*/
|
||||
private OnClickBottomListener onClickBottomListener;
|
||||
|
||||
public void setOnClickBottomListener(OnClickBottomListener onClickBottomListener) {
|
||||
this.onClickBottomListener = onClickBottomListener;
|
||||
}
|
||||
|
||||
public interface OnClickBottomListener {
|
||||
/**
|
||||
* 点击确定按钮事件
|
||||
*/
|
||||
void onPositiveClick();
|
||||
|
||||
/**
|
||||
* 点击取消按钮事件
|
||||
*/
|
||||
void onNegtiveClick();
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public CustomDialog setMessage(String message) {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public CustomDialog setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPositive() {
|
||||
return positive;
|
||||
}
|
||||
|
||||
public CustomDialog setPositive(String positive) {
|
||||
this.positive = positive;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNegtive() {
|
||||
return negtive;
|
||||
}
|
||||
|
||||
public CustomDialog setNegtive(String negtive) {
|
||||
this.negtive = negtive;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CustomDialog setNegtiveText(String negtive) {
|
||||
negtiveBn.setText(negtive);
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getImageResId() {
|
||||
return imageResId;
|
||||
}
|
||||
|
||||
public boolean isSingle() {
|
||||
return isSingle;
|
||||
}
|
||||
|
||||
public CustomDialog setSingle(boolean single) {
|
||||
isSingle = single;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CustomDialog setImageResId(int imageResId) {
|
||||
this.imageResId = imageResId;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
// Intent intent = new Intent(mContext, MainActivity.class);
|
||||
// intent.setAction(MainActivity.REFRESHACTION);
|
||||
// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
// mContext.startActivity(intent);
|
||||
}
|
||||
}
|
||||
@@ -101,6 +101,7 @@ import com.aoleyun.sn.network.api.post.SendDownloadTimesApi;
|
||||
import com.aoleyun.sn.network.api.post.SendRestoreTimesApi;
|
||||
import com.aoleyun.sn.network.api.post.SendScreenshotApi;
|
||||
import com.aoleyun.sn.network.api.post.SendScreenshotCall;
|
||||
import com.aoleyun.sn.network.api.post.SnConfirmBindApi;
|
||||
import com.aoleyun.sn.network.api.post.StudentsInfoApi;
|
||||
import com.aoleyun.sn.network.api.post.SystemSettingApi;
|
||||
import com.aoleyun.sn.network.api.post.UpdateDeviceInfoApi;
|
||||
@@ -669,6 +670,8 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* API
|
||||
@@ -751,6 +754,10 @@ public class NetInterfaceManager {
|
||||
return mRetrofit.create(BatteryInfoApi.class);
|
||||
}
|
||||
|
||||
public SnConfirmBindApi getSnConfirmBindApi() {
|
||||
return mRetrofit.create(SnConfirmBindApi.class);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* execution
|
||||
@@ -1241,8 +1248,12 @@ public class NetInterfaceManager {
|
||||
cacheHelper.put(UrlAddress.GET_DESKTOP, "");
|
||||
// String whiteList = Settings.System.getString(mContext.getContentResolver(), JGYActions.ACTION_JGY_SHORTCUTLIST);
|
||||
for (String s : ApkUtils.desktopAPP) {
|
||||
if (!BuildConfig.DEBUG)
|
||||
if ("com.aoleyunos.dop3".equals(s)){
|
||||
continue;
|
||||
}
|
||||
if (!BuildConfig.DEBUG) {
|
||||
ApkUtils.UninstallAPP(mContext, s);
|
||||
}
|
||||
Log.e("getDefaultDesktop", "UninstallAPP: " + s);
|
||||
}
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.AH6016Platform) {
|
||||
@@ -1823,50 +1834,69 @@ public class NetInterfaceManager {
|
||||
getSystemSettingObservable()
|
||||
.observeOn(Schedulers.io())
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("setSystemSetting", "onSubscribe: ");
|
||||
}
|
||||
.subscribe(setSystemSettingObserver(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse baseResponse) {
|
||||
Log.e("setSystemSetting", "onNext: " + baseResponse);
|
||||
SPUtils.put(mContext, CommonConfig.JGY_FIRST_CONNECT, 1);
|
||||
if (baseResponse.code == OK) {
|
||||
String data = GsonUtils.toJSONString(baseResponse.data);
|
||||
Log.e("setSystemSetting", "onNext: " + data);
|
||||
cacheHelper.put(UrlAddress.GET_FIRMWARE, data);
|
||||
//结果保存到本地
|
||||
JGYUtils.getInstance().SettingSysData(data);
|
||||
} else {
|
||||
//没有数据全部关闭
|
||||
public void setSystemSetting(BehaviorSubject<ActivityEvent> lifecycle) {
|
||||
getSystemSettingObservable()
|
||||
.observeOn(Schedulers.io())
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(setSystemSettingObserver(null));
|
||||
}
|
||||
|
||||
public void setSystemSetting() {
|
||||
getSystemSettingObservable()
|
||||
.observeOn(Schedulers.io())
|
||||
.subscribe(setSystemSettingObserver(null));
|
||||
}
|
||||
|
||||
public Observer<BaseResponse> setSystemSettingObserver(onCompleteCallback callback) {
|
||||
return new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("setSystemSetting", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse baseResponse) {
|
||||
Log.e("setSystemSetting", "onNext: " + baseResponse);
|
||||
SPUtils.put(mContext, CommonConfig.JGY_FIRST_CONNECT, 1);
|
||||
if (baseResponse.code == OK) {
|
||||
String data = GsonUtils.toJSONString(baseResponse.data);
|
||||
Log.e("setSystemSetting", "onNext: " + data);
|
||||
cacheHelper.put(UrlAddress.GET_FIRMWARE, data);
|
||||
//结果保存到本地
|
||||
JGYUtils.getInstance().SettingSysData(data);
|
||||
} else {
|
||||
//没有数据全部关闭
|
||||
// SysSettingUtils.setDisableSetting(mContext);
|
||||
// SPUtils.put(mContext, "SystemSettingData", "");
|
||||
JGYUtils.getInstance().SettingSysData("");
|
||||
cacheHelper.put(UrlAddress.GET_FIRMWARE, "");
|
||||
//获取系统管控先不要关闭开发人员选项
|
||||
if (!BuildConfig.DEBUG) {
|
||||
Settings.System.putInt(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 1);
|
||||
}
|
||||
}
|
||||
JGYUtils.getInstance().SettingSysData("");
|
||||
cacheHelper.put(UrlAddress.GET_FIRMWARE, "");
|
||||
//获取系统管控先不要关闭开发人员选项
|
||||
if (!BuildConfig.DEBUG) {
|
||||
Settings.System.putInt(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("setSystemSetting", "onError: " + e.getMessage());
|
||||
String oldData = (String) SPUtils.get(mContext, "SystemSettingData", "");
|
||||
Log.e("setSystemSetting", "oldData: " + oldData);
|
||||
JGYUtils.getInstance().SettingSysData(oldData);
|
||||
onComplete();
|
||||
}
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("setSystemSetting", "onError: " + e.getMessage());
|
||||
String oldData = (String) SPUtils.get(mContext, "SystemSettingData", "");
|
||||
Log.e("setSystemSetting", "oldData: " + oldData);
|
||||
JGYUtils.getInstance().SettingSysData(oldData);
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("setSystemSetting", "onComplete: ");
|
||||
callback.onComplete();
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("setSystemSetting", "onComplete: ");
|
||||
if (callback != null) {
|
||||
callback.onComplete();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void getEBagCode(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
||||
|
||||
@@ -17,6 +17,9 @@ public class UrlAddress {
|
||||
public static final String GET_DEVICES_LOCKED = "lock/index";
|
||||
/*获取设备标签*/
|
||||
public static final String GET_DEVICES_TAGS = "Sn/getSnTag";
|
||||
/*绑定设备*/
|
||||
public static final String SN_CONFIRM_BIND = "And/sn/snConfirmBind";
|
||||
|
||||
|
||||
/*获取批次*/
|
||||
@Deprecated
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.aoleyun.sn.network.api.post;
|
||||
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface SnConfirmBindApi {
|
||||
@FormUrlEncoded
|
||||
@POST(UrlAddress.SN_CONFIRM_BIND)
|
||||
Observable<BaseResponse> snConfirmBind(
|
||||
@Field("sn") String sn,
|
||||
@Field("userId") String userId,
|
||||
@Field("type") int type
|
||||
);
|
||||
}
|
||||
@@ -19,8 +19,11 @@ import android.os.PowerManager;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.activity.main.MainActivity;
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.bean.BatteryInfo;
|
||||
import com.aoleyun.sn.bean.DownloadInfo;
|
||||
@@ -28,6 +31,7 @@ import com.aoleyun.sn.bean.RemoteDebug;
|
||||
import com.aoleyun.sn.bean.ScreenLockState;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.aoleyun.sn.comm.JGYActions;
|
||||
import com.aoleyun.sn.dialog.CustomDialog;
|
||||
import com.aoleyun.sn.disklrucache.CacheHelper;
|
||||
import com.aoleyun.sn.gson.GsonUtils;
|
||||
import com.aoleyun.sn.gson.NullStringToEmptyAdapterFactory;
|
||||
@@ -67,13 +71,16 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.core.ObservableEmitter;
|
||||
import io.reactivex.rxjava3.core.ObservableOnSubscribe;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.functions.Consumer;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.MultipartBody;
|
||||
@@ -84,6 +91,8 @@ import retrofit2.Response;
|
||||
public class PushManager {
|
||||
private static final String TAG = PushManager.class.getSimpleName();
|
||||
|
||||
public static final String ACTION_REFRESH_BINDING_STATUS = "RefreshBindingStatus";
|
||||
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static PushManager sInstance;
|
||||
@@ -212,10 +221,30 @@ public class PushManager {
|
||||
private static final String TAKE_FRONT_PICTURE = "58";
|
||||
/*时间管控*/
|
||||
private static final String TIME_CONTROL2 = "59";
|
||||
/*应用安装总开关*/
|
||||
private static final String INSTALL_CONTROL = "60";
|
||||
/*usb传输*/
|
||||
private static final String USB_CONTROL = "61";
|
||||
/*专注模式*/
|
||||
private static final String FOCUS_MODE = "62";
|
||||
/*修改锁屏密码*/
|
||||
private static final String CHANGE_LOCKED_PASSWD = "63";
|
||||
/*蓝牙传输管控*/
|
||||
private static final String BLUETOOTH_CONTROL = "64";
|
||||
/*开发者选项*/
|
||||
private static final String DEVELOPER_CONTROL = "65";
|
||||
/*恢复出厂模式*/
|
||||
private static final String FACTORY_CONTROL = "66";
|
||||
/*通知栏开关*/
|
||||
private static final String SETTING_STATUSBAR = "67";
|
||||
/*导航栏管控*/
|
||||
private static final String SETTING_NAVIGATION = "68";
|
||||
/*存储卡管控*/
|
||||
private static final String SETTING_TF_CARD = "69";
|
||||
|
||||
/*绑定设备*/
|
||||
private static final String BIND_DEVICE = "71";
|
||||
|
||||
|
||||
public void setPushContent(String title, String extras) {
|
||||
switch (title) {
|
||||
@@ -597,6 +626,18 @@ public class PushManager {
|
||||
case FOCUS_MODE:
|
||||
refreshFocusMode();
|
||||
break;
|
||||
case INSTALL_CONTROL:
|
||||
case BLUETOOTH_CONTROL:
|
||||
case DEVELOPER_CONTROL:
|
||||
case FACTORY_CONTROL:
|
||||
case SETTING_STATUSBAR:
|
||||
case SETTING_NAVIGATION:
|
||||
case SETTING_TF_CARD:
|
||||
NetInterfaceManager.getInstance().setSystemSetting();
|
||||
break;
|
||||
case BIND_DEVICE:
|
||||
bindService(extras);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
@@ -1269,4 +1310,130 @@ public class PushManager {
|
||||
context.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
private Disposable subscribe;
|
||||
private long cutdownTime = 30;
|
||||
private CustomDialog dialog;
|
||||
|
||||
void bindService(final String jsonString) {
|
||||
ToastUtil.betaShow("收到绑定设备请求");
|
||||
JsonObject object = GsonUtils.getJsonObject(jsonString);
|
||||
// String userName = object.get("member_name").getAsString();
|
||||
final String id = object.get("userId").getAsString();
|
||||
String phoneNum = object.get("mobile").getAsString();
|
||||
if (dialog == null) {
|
||||
dialog = new CustomDialog(mContext);
|
||||
subscribe = Observable.interval(1, TimeUnit.SECONDS)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<Long>() {
|
||||
@Override
|
||||
public void accept(Long aLong) throws Exception {
|
||||
// Log.e("TAG", "倒计时:" + aLong);
|
||||
if (aLong < cutdownTime && !subscribe.isDisposed()) {
|
||||
dialog.setNegtiveText("拒绝" + "(" + (cutdownTime - aLong) + ")");
|
||||
} else {
|
||||
bind(id, 0);
|
||||
dialog.dismiss();
|
||||
dialog = null;
|
||||
subscribe.dispose();
|
||||
subscribe = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
dialog.setMessage(phoneNum + "请求绑定你的设备")
|
||||
.setTitle("设备绑定请求")
|
||||
.setPositive("允许")
|
||||
.setNegtive("拒绝")
|
||||
// .setSingle(true)
|
||||
.setOnClickBottomListener(new CustomDialog.OnClickBottomListener() {
|
||||
@Override
|
||||
public void onPositiveClick() {
|
||||
bind(id, 1);
|
||||
dialog.dismiss();
|
||||
dialog = null;
|
||||
subscribe.dispose();
|
||||
subscribe = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNegtiveClick() {
|
||||
bind(id, 2);
|
||||
ToastUtil.show("设备取消绑定");
|
||||
dialog.dismiss();
|
||||
dialog = null;
|
||||
subscribe.dispose();
|
||||
subscribe = null;
|
||||
}
|
||||
});
|
||||
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
|
||||
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);
|
||||
}
|
||||
|
||||
// new CountDownTimer(30000, 1000) {
|
||||
// @Override
|
||||
// public void onTick(long l) {
|
||||
// String value = String.valueOf((int) (l / 1000));
|
||||
// dialog_info.setNegtiveText("拒绝" + "(" + value + ")");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFinish() {
|
||||
// bind(context, id, 0);
|
||||
// dialog_info.dismiss();
|
||||
// }
|
||||
// }.start();
|
||||
}
|
||||
|
||||
private void bind(final String id, int type) {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getSnConfirmBindApi()
|
||||
.snConfirmBind(Utils.getSerial(mContext), id, type)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("bind", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse baseResponse) {
|
||||
int code = baseResponse.code;
|
||||
Log.e("bind", "onNext: " + baseResponse);
|
||||
String msg = baseResponse.msg;
|
||||
// Log.e("bind", baseResponse.toString());
|
||||
if (code == 200) {
|
||||
ToastUtil.show("绑定成功");
|
||||
sendRefreshIntent();
|
||||
} else if (code == 301) {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("bind", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("bind", "onComplete: ");
|
||||
// NetInterfaceManager.getInstance().getSnInfo();
|
||||
Intent serviceIntent = new Intent(MainService.RefreshReceiver.REFRESH_RECEIVER_ACTION);
|
||||
mContext.sendBroadcast(serviceIntent);
|
||||
Intent activityIntent = new Intent(MainActivity.REFRESHACTION);
|
||||
mContext.sendBroadcast(activityIntent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void sendRefreshIntent() {
|
||||
Intent intent = new Intent(ACTION_REFRESH_BINDING_STATUS);
|
||||
intent.setPackage("com.teclast.zyos");
|
||||
mContext.sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,8 +399,8 @@ public class SysSettingUtils {
|
||||
|
||||
//状态栏显示开关
|
||||
int setting_statusbar = changeNum(jsonObject.get("setting_statusbar").getAsInt());
|
||||
int oldNum = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, 0);
|
||||
if (oldNum != setting_statusbar) {
|
||||
// int oldNum = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, 0);
|
||||
// if (oldNum != setting_statusbar) {
|
||||
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
|
||||
boolean aole_hide_statusBar = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, setting_statusbar);
|
||||
Log.e(TAG, "aole_hide_statusBar: " + aole_hide_statusBar);
|
||||
@@ -417,7 +417,7 @@ public class SysSettingUtils {
|
||||
Intent statusIntent = new Intent(statusbarStatus);
|
||||
// Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
|
||||
context.sendBroadcast(statusIntent);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
private static void setCamera(Context context, int state) {
|
||||
|
||||
Reference in New Issue
Block a user