version:1.1.3
fix: update:优化支付问题,增加九学王激活逻辑
This commit is contained in:
@@ -5,7 +5,6 @@ import android.text.Editable;
|
||||
import android.text.InputFilter;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.DigitsKeyListener;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.lifecycle.Observer;
|
||||
@@ -17,6 +16,7 @@ import com.xwad.os.bean.OrderInfo;
|
||||
import com.xwad.os.bean.PayInfo;
|
||||
import com.xwad.os.bean.VipInfo;
|
||||
import com.xwad.os.databinding.ActivityActivationBinding;
|
||||
import com.xwad.os.utils.ActivationUtil;
|
||||
import com.xwad.os.utils.BitmapUtils;
|
||||
|
||||
import java.util.List;
|
||||
@@ -83,7 +83,9 @@ public class ActivationActivity extends BaseMvvmActivity<ActivationViewModel, Ac
|
||||
Optional<VipInfo> optional = vipInfos.stream().findFirst();
|
||||
if (optional.isPresent()) {
|
||||
VipInfo vipInfo = optional.get();
|
||||
mViewDataBinding.tvPrice.setText(vipInfo.getPrice());
|
||||
mViewDataBinding.tvPrice.setText("¥" + vipInfo.getPrice());
|
||||
mViewDataBinding.tvVipName.setText(vipInfo.getName());
|
||||
mViewDataBinding.tvVipPrice.setText("¥" + vipInfo.getPrice());
|
||||
mViewModel.getPayInfo(vipInfo.getId());
|
||||
}
|
||||
}
|
||||
@@ -112,6 +114,25 @@ public class ActivationActivity extends BaseMvvmActivity<ActivationViewModel, Ac
|
||||
}
|
||||
});
|
||||
|
||||
mViewModel.mCodeActivationData.observe(this, new Observer<Boolean>() {
|
||||
@Override
|
||||
public void onChanged(Boolean aBoolean) {
|
||||
if (aBoolean) {
|
||||
mViewModel.getActivation();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mViewModel.mGetCodeData.observe(this, new Observer<Boolean>() {
|
||||
@Override
|
||||
public void onChanged(Boolean aBoolean) {
|
||||
if (aBoolean) {
|
||||
ActivationUtil.getInstance().startJxwLauncher();
|
||||
finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public class BtnClick {
|
||||
|
||||
@@ -5,15 +5,19 @@ import android.util.Log;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.xwad.os.base.mvvm.BaseViewModel;
|
||||
import com.xwad.os.bean.BaseResponse;
|
||||
import com.xwad.os.bean.CodeBean;
|
||||
import com.xwad.os.bean.OrderInfo;
|
||||
import com.xwad.os.bean.PayInfo;
|
||||
import com.xwad.os.bean.VipInfo;
|
||||
import com.xwad.os.config.CommonConfig;
|
||||
import com.xwad.os.databinding.ActivityActivationBinding;
|
||||
import com.xwad.os.network.NetInterfaceManager;
|
||||
import com.xwad.os.utils.ActivationUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -23,6 +27,8 @@ import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class ActivationViewModel extends BaseViewModel<ActivityActivationBinding, ActivityEvent> {
|
||||
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
@Override
|
||||
public ActivityActivationBinding getVDBinding() {
|
||||
return binding;
|
||||
@@ -135,6 +141,8 @@ public class ActivationViewModel extends BaseViewModel<ActivityActivationBinding
|
||||
});
|
||||
}
|
||||
|
||||
public MutableLiveData<Boolean> mCodeActivationData = new MutableLiveData<>();
|
||||
|
||||
public void codeActivation(String code) {
|
||||
NetInterfaceManager.getInstance().getCodeActivationControl(code)
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
@@ -147,6 +155,11 @@ public class ActivationViewModel extends BaseViewModel<ActivityActivationBinding
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse baseResponse) {
|
||||
Log.e("codeActivation", "onNext: " + baseResponse);
|
||||
if (baseResponse.code == 200) {
|
||||
mCodeActivationData.setValue(true);
|
||||
} else {
|
||||
Toaster.show(baseResponse.msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -160,4 +173,39 @@ public class ActivationViewModel extends BaseViewModel<ActivityActivationBinding
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public MutableLiveData<Boolean> mGetCodeData = new MutableLiveData<>();
|
||||
|
||||
public void getActivation() {
|
||||
NetInterfaceManager.getInstance().getActivationCodeControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<CodeBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getActivation", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<CodeBean> baseResponse) {
|
||||
if (baseResponse.code == 200) {
|
||||
CodeBean codeBean = baseResponse.data;
|
||||
mMMKV.encode(CommonConfig.ACTIVATIONBEAN_CODE_KEY, codeBean.getCode());
|
||||
mGetCodeData.setValue(true);
|
||||
ActivationUtil.getInstance().setActivation(1);
|
||||
} else {
|
||||
ActivationUtil.getInstance().setActivation(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getActivation", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getActivation", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import com.xwad.os.activity.permission.PermissionActivity;
|
||||
import com.xwad.os.activity.update.UpdateActivity;
|
||||
import com.xwad.os.base.mvvm.BaseMvvmActivity;
|
||||
import com.xwad.os.bean.AppUpdateInfo;
|
||||
import com.xwad.os.bean.UserInfo;
|
||||
import com.xwad.os.bean.jxw.TabBean;
|
||||
import com.xwad.os.config.CommonConfig;
|
||||
import com.xwad.os.databinding.ActivityHomeBinding;
|
||||
@@ -64,6 +65,7 @@ import com.xwad.os.jxw.event.UpdateGradeEvent;
|
||||
import com.xwad.os.jxw.fragment.SztzFragment;
|
||||
import com.xwad.os.manager.DeviceSNManager;
|
||||
import com.xwad.os.manager.RemoteManager;
|
||||
import com.xwad.os.utils.ActivationUtil;
|
||||
import com.xwad.os.utils.ApkUtils;
|
||||
import com.xwad.os.utils.DataUtil;
|
||||
import com.xwad.os.utils.OpenApkUtils;
|
||||
@@ -217,7 +219,22 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
|
||||
}
|
||||
});
|
||||
mViewModel.checkUpdate();
|
||||
mViewModel.mGetCodeData.observe(this, new Observer<Boolean>() {
|
||||
@Override
|
||||
public void onChanged(Boolean aBoolean) {
|
||||
if (aBoolean) {
|
||||
ActivationUtil.getInstance().startJxwLauncher();
|
||||
}
|
||||
}
|
||||
});
|
||||
mViewModel.getActivation();
|
||||
mViewModel.mUserInfoData.observe(this, new Observer<UserInfo>() {
|
||||
@Override
|
||||
public void onChanged(UserInfo userInfo) {
|
||||
|
||||
}
|
||||
});
|
||||
mViewModel.getUserInfo();
|
||||
initDatas();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,13 +10,16 @@ import com.hjq.toast.Toaster;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.trello.rxlifecycle4.android.FragmentEvent;
|
||||
import com.xwad.os.BuildConfig;
|
||||
import com.xwad.os.R;
|
||||
import com.xwad.os.base.mvvm.BaseViewModel;
|
||||
import com.xwad.os.bean.AppUpdateInfo;
|
||||
import com.xwad.os.bean.BaseResponse;
|
||||
import com.xwad.os.bean.CodeBean;
|
||||
import com.xwad.os.bean.SnInfo;
|
||||
import com.xwad.os.bean.SystemSettings;
|
||||
import com.xwad.os.bean.UserInfo;
|
||||
import com.xwad.os.config.CommonConfig;
|
||||
import com.xwad.os.databinding.ActivityHomeBinding;
|
||||
import com.xwad.os.jxw.SPUtils;
|
||||
@@ -232,4 +235,73 @@ public class HomeViewModel extends BaseViewModel<ActivityHomeBinding, ActivityEv
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public MutableLiveData<Boolean> mGetCodeData = new MutableLiveData<>();
|
||||
|
||||
public void getActivation() {
|
||||
NetInterfaceManager.getInstance().getActivationCodeControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<CodeBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getActivation", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<CodeBean> baseResponse) {
|
||||
if (baseResponse.code == 200) {
|
||||
CodeBean codeBean = baseResponse.data;
|
||||
mMMKV.encode(CommonConfig.ACTIVATIONBEAN_CODE_KEY, codeBean.getCode());
|
||||
mGetCodeData.setValue(true);
|
||||
ActivationUtil.getInstance().setActivation(1);
|
||||
} else {
|
||||
ActivationUtil.getInstance().setActivation(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getActivation", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getActivation", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public MutableLiveData<UserInfo> mUserInfoData = new MutableLiveData<>();
|
||||
|
||||
public void getUserInfo() {
|
||||
NetInterfaceManager.getInstance().getUserInfoControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<UserInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getUserInfo", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<UserInfo> userInfoBaseResponse) {
|
||||
Log.e("getUserInfo", "onNext: " + userInfoBaseResponse);
|
||||
if (userInfoBaseResponse.code == 200) {
|
||||
UserInfo userInfo = userInfoBaseResponse.data;
|
||||
|
||||
mUserInfoData.setValue(userInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getUserInfo", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getUserInfo", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.xwad.os.bean.LoginInfo;
|
||||
import com.xwad.os.bean.LoginInfoDevice;
|
||||
import com.xwad.os.config.CommonConfig;
|
||||
import com.xwad.os.databinding.ActivityLoginBinding;
|
||||
import com.xwad.os.manager.DeviceSNManager;
|
||||
import com.xwad.os.network.NetInterfaceManager;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
@@ -67,7 +68,7 @@ public class LoginViewModel extends BaseViewModel<ActivityLoginBinding, Activity
|
||||
public MutableLiveData<LoginInfo> mLoginInfoData = new MutableLiveData<>();
|
||||
|
||||
public void codeLogin(String mobile, String code) {
|
||||
NetInterfaceManager.getInstance().getCodeLoginObservable(mobile, code)
|
||||
NetInterfaceManager.getInstance().getNewCodeLoginObservable(mobile, code)
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<LoginInfo>>() {
|
||||
@Override
|
||||
@@ -85,6 +86,7 @@ public class LoginViewModel extends BaseViewModel<ActivityLoginBinding, Activity
|
||||
mMMKV.encode(CommonConfig.ACCOUNT_LOGIN_MOBILE, loginInfo.getMobile());
|
||||
mMMKV.encode(CommonConfig.ACCOUNT_LOGIN_ID, loginInfo.getId());
|
||||
LoginInfoDevice loginInfoDevice = loginInfo.getDevice();
|
||||
DeviceSNManager.saveDeviceSN(loginInfoDevice.getSn());
|
||||
mMMKV.encode(CommonConfig.ACCOUNT_DEVICE_ID, loginInfoDevice.getId());
|
||||
mMMKV.encode(CommonConfig.ACCOUNT_DEVICE_SN, loginInfoDevice.getSn());
|
||||
mLoginInfoData.setValue(loginInfo);
|
||||
|
||||
17
app/src/main/java/com/xwad/os/bean/CodeBean.java
Normal file
17
app/src/main/java/com/xwad/os/bean/CodeBean.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.xwad.os.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class CodeBean implements Serializable {
|
||||
private static final long serialVersionUID = -611537935984225372L;
|
||||
|
||||
String code;
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,9 @@ public class CommonConfig {
|
||||
public static final String UIUI_CODE_TYPE_KEY = "iflytek_uiui_code_type";
|
||||
/*体验到期时间戳*/
|
||||
public static final String UIUI_EXPIRE_TIME_KEY = "iflytek_uiui_expire_time";
|
||||
/*保存激活码*/
|
||||
public static final String ACTIVATIONBEAN_CODE_KEY = "UIUI_ACTIVATIONBEAN_CODE";
|
||||
|
||||
/*是否显示返回Android按钮*/
|
||||
public static final String UIUI_RETURN_ANDROID_KEY = "iflytek_uiui_is_return_android";
|
||||
|
||||
|
||||
@@ -27,14 +27,20 @@ public class DeviceSNManager {
|
||||
public static String getDeviceSN() {
|
||||
String existingSN = mMMKV.decodeString(SN_KEY, "");
|
||||
|
||||
if (!TextUtils.isEmpty(existingSN)) {
|
||||
// if (!TextUtils.isEmpty(existingSN)) {
|
||||
return existingSN;
|
||||
}
|
||||
String newSN = generateNewSN();
|
||||
mMMKV.encode(SN_KEY, newSN);
|
||||
return newSN;
|
||||
// }
|
||||
|
||||
// String newSN = generateNewSN();
|
||||
// mMMKV.encode(SN_KEY, newSN);
|
||||
// return newSN;
|
||||
}
|
||||
|
||||
public static void saveDeviceSN(String sn) {
|
||||
mMMKV.encode(SN_KEY, sn);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成新的设备SN
|
||||
* 格式:CDSN202511T923852225
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.xwad.os.bean.AlarmClockData;
|
||||
import com.xwad.os.bean.AppInfo;
|
||||
import com.xwad.os.bean.AppUpdateInfo;
|
||||
import com.xwad.os.bean.BaseResponse;
|
||||
import com.xwad.os.bean.CodeBean;
|
||||
import com.xwad.os.bean.GuideBean;
|
||||
import com.xwad.os.bean.HomeworkBean;
|
||||
import com.xwad.os.bean.LessonApp;
|
||||
@@ -381,6 +382,13 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<LoginInfo>> getNewCodeLoginObservable(String mobile, String code) {
|
||||
return mRetrofit.create(LoginApi.class)
|
||||
.newCodeLogin(mobile, code)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse> getUserLoginObservable(String mobile, String password) {
|
||||
return mRetrofit.create(LoginApi.class)
|
||||
.userLogin(mobile, password, DeviceSNManager.getDeviceSN())
|
||||
@@ -416,6 +424,13 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<CodeBean>> getActivationCodeControl() {
|
||||
return mRetrofit.create(UserApi.class)
|
||||
.getActivationCode(getToken(), DeviceSNManager.getDeviceSN())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<PayInfo>> getPayQrcodeControl(String orderSn) {
|
||||
return mRetrofit.create(UserApi.class)
|
||||
.payQrcode(getToken(), DeviceSNManager.getDeviceSN(), orderSn)
|
||||
|
||||
@@ -7,10 +7,14 @@ public class UrlAddress {
|
||||
/*发送登录验证码*/
|
||||
public final static String LOGIN_GET_CODE = "login/get-code";
|
||||
/*验证码登录*/
|
||||
@Deprecated
|
||||
public final static String CODE_LOGIN = "login/code-login";
|
||||
/*账号密码登录*/
|
||||
public final static String USER_LOGIN = "login/user-login";
|
||||
|
||||
public final static String NEW_CODE_LOGIN = "login/new-login";
|
||||
|
||||
|
||||
/*用户会员信息(用于判断是否有VIP)*/
|
||||
public static final String USER_INFO = "user/info";
|
||||
/*套餐可选列表*/
|
||||
@@ -19,6 +23,8 @@ public class UrlAddress {
|
||||
public static final String BUY = "user/buy";
|
||||
/*激活码激活*/
|
||||
public static final String activation_code = "activation/code";
|
||||
/*获取激活码(激活成功后才有)*/
|
||||
public static final String get_activation_code = "activation/get-code";
|
||||
/*发起支付*/
|
||||
public static final String PAY_QRCODE = "pay/qrcode";
|
||||
/*续费购买(已经是VIP过期或没过期)*/
|
||||
|
||||
@@ -32,4 +32,11 @@ public interface LoginApi {
|
||||
@Query("password") String password,
|
||||
@Field("sn") String sn
|
||||
);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(UrlAddress.NEW_CODE_LOGIN)
|
||||
Observable<BaseResponse<LoginInfo>> newCodeLogin(
|
||||
@Field("mobile") String mobile,
|
||||
@Field("code") String code
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.xwad.os.network.api;
|
||||
|
||||
import com.xwad.os.bean.BaseResponse;
|
||||
import com.xwad.os.bean.CodeBean;
|
||||
import com.xwad.os.bean.OrderInfo;
|
||||
import com.xwad.os.bean.PayInfo;
|
||||
import com.xwad.os.bean.UserInfo;
|
||||
@@ -45,6 +46,12 @@ public interface UserApi {
|
||||
@Field("code") String code
|
||||
);
|
||||
|
||||
@GET(UrlAddress.get_activation_code)
|
||||
Observable<BaseResponse<CodeBean>> getActivationCode(
|
||||
@Header("token") String token,
|
||||
@Query("sn") String sn
|
||||
);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(UrlAddress.PAY_QRCODE)
|
||||
Observable<BaseResponse<PayInfo>> payQrcode(
|
||||
|
||||
@@ -9,10 +9,12 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.blankj.utilcode.util.NetworkUtils;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xwad.os.activity.NoticeActivity;
|
||||
import com.xwad.os.alarm.AlarmUtils;
|
||||
import com.xwad.os.base.rx.BaseRxService;
|
||||
import com.xwad.os.bean.AlarmClockData;
|
||||
import com.xwad.os.config.CommonConfig;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
@@ -20,6 +22,8 @@ import java.util.HashMap;
|
||||
public class MainService extends BaseRxService implements MainSContact.MainSView, NetworkUtils.OnNetworkStatusChangedListener {
|
||||
private static final String TAG = "MainService";
|
||||
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
public MainSPresenter mPresenter;
|
||||
|
||||
public MainService() {
|
||||
@@ -53,7 +57,7 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
|
||||
mPresenter.attachView(this);
|
||||
mPresenter.setLifecycle(getLifecycleSubject());
|
||||
mPresenter.getCloudLessonSettings();
|
||||
// registerAlarmReceiver();
|
||||
registerReceivers();
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
startJxwLauncher();
|
||||
}
|
||||
@@ -83,10 +87,18 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
|
||||
// }
|
||||
}
|
||||
|
||||
private void registerReceivers() {
|
||||
// registerAlarmReceiver();
|
||||
registerJxwRegisterRefreshReceiver();
|
||||
}
|
||||
|
||||
private void unregisterReceiver() {
|
||||
// if (alarmReceiver != null) {
|
||||
// unregisterReceiver(alarmReceiver);
|
||||
// }
|
||||
if (null != mJxwRegisterReceiver) {
|
||||
unregisterReceiver(mJxwRegisterReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
public static final String ALARMWAKEUP = "ALARM_WAKEUP";
|
||||
@@ -155,4 +167,28 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
|
||||
|
||||
}
|
||||
|
||||
public static final String JXW_REGISTER_SUCCESS = "com.zzj.regist_success";
|
||||
|
||||
private JxwRegisterReceiver mJxwRegisterReceiver;
|
||||
|
||||
private void registerJxwRegisterRefreshReceiver() {
|
||||
if (mJxwRegisterReceiver == null) {
|
||||
mJxwRegisterReceiver = new JxwRegisterReceiver();
|
||||
}
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(JXW_REGISTER_SUCCESS);
|
||||
registerReceiver(mJxwRegisterReceiver, filter);
|
||||
}
|
||||
|
||||
public class JxwRegisterReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
Log.e("JxwRegisterReceiver", "onReceive: " + action);
|
||||
if (JXW_REGISTER_SUCCESS.equals(action)) {
|
||||
mMMKV.encode(JXW_REGISTER_SUCCESS, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.xwad.os.utils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xwad.os.config.CommonConfig;
|
||||
import com.xwad.os.service.main.MainService;
|
||||
|
||||
public class ActivationUtil {
|
||||
/*写入1为激活*/
|
||||
@@ -15,6 +19,8 @@ public class ActivationUtil {
|
||||
/*默认过期时间*/
|
||||
public static final int DEFAULT_EXPIRE_TIME = -1;
|
||||
|
||||
private static final String TAG = "ActivationUtil";
|
||||
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
@@ -110,4 +116,24 @@ public class ActivationUtil {
|
||||
return mMMKV.decodeInt(CommonConfig.ACCOUNT_LOGIN_STATU, 0) == 1;
|
||||
}
|
||||
|
||||
public void startJxwLauncher() {
|
||||
String code = mMMKV.decodeString(CommonConfig.ACTIVATIONBEAN_CODE_KEY, "");
|
||||
boolean regist_success = mMMKV.decodeBool(MainService.JXW_REGISTER_SUCCESS, false);
|
||||
if (!regist_success) {
|
||||
Intent intent = new Intent("UIUI_ACTIVATION");
|
||||
ComponentName componentName = new ComponentName("com.jxw.launcher", "com.jxw.engine.platsign.MainActivity");
|
||||
intent.setComponent(componentName);
|
||||
intent.putExtra("uiui_activation_code", code);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
try {
|
||||
mContext.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Log.e("getEBagCode", "startActivity: " + e.getMessage());
|
||||
}
|
||||
} else {
|
||||
Log.e("getEBagCode", "onNext: com.zzj.regist_success is true");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public class QhbzDialog extends Dialog {
|
||||
super.onCreate(bundle);
|
||||
setContentView(R.layout.dialog_qhbz);
|
||||
WindowManager windowManager = getWindow().getWindowManager();
|
||||
getWindow().setBackgroundDrawableResource(R.drawable.bg_shape_ffffff_40);
|
||||
// getWindow().setBackgroundDrawableResource(R.drawable.bg_shape_ffffff_40);
|
||||
Display defaultDisplay = windowManager.getDefaultDisplay();
|
||||
WindowManager.LayoutParams attributes = getWindow().getAttributes();
|
||||
defaultDisplay.getSize(new Point());
|
||||
|
||||
Reference in New Issue
Block a user