version:1.0.1
fix: update:去掉推送,增加退出和返回桌面,使用csdk获取sn
This commit is contained in:
@@ -16,8 +16,8 @@ android {
|
|||||||
minSdkVersion 24
|
minSdkVersion 24
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
|
|
||||||
versionCode 1
|
versionCode 2
|
||||||
versionName "1.0.0"
|
versionName "1.0.1"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
@@ -113,7 +113,7 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// implementation fileTree(dir: 'libs', include: ['*.jar'])
|
// implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
implementation files('libs/CSDK_TBY11_AiYouDu_250312.jar')
|
||||||
compileOnly files('libs/framework.jar')
|
compileOnly files('libs/framework.jar')
|
||||||
implementation project(path: ':niceimageview')
|
implementation project(path: ':niceimageview')
|
||||||
implementation project(path: ':FlycoTabLayoutZ_Lib')
|
implementation project(path: ':FlycoTabLayoutZ_Lib')
|
||||||
@@ -132,6 +132,7 @@ dependencies {
|
|||||||
// Java language implementation
|
// Java language implementation
|
||||||
implementation "androidx.fragment:fragment:1.4.1"
|
implementation "androidx.fragment:fragment:1.4.1"
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||||
|
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||||
@@ -174,7 +175,7 @@ dependencies {
|
|||||||
//bugly
|
//bugly
|
||||||
implementation 'com.tencent.bugly:crashreport:4.1.9.2'
|
implementation 'com.tencent.bugly:crashreport:4.1.9.2'
|
||||||
//阿里云推送
|
//阿里云推送
|
||||||
implementation 'com.aliyun.ams:alicloud-android-push:3.8.0'
|
// implementation 'com.aliyun.ams:alicloud-android-push:3.8.0'
|
||||||
//高德地图定位
|
//高德地图定位
|
||||||
implementation 'com.amap.api:location:5.1.0'
|
implementation 'com.amap.api:location:5.1.0'
|
||||||
//状态栏透明
|
//状态栏透明
|
||||||
|
|||||||
BIN
app/libs/CSDK_TBY11_AiYouDu_250312.jar
Normal file
BIN
app/libs/CSDK_TBY11_AiYouDu_250312.jar
Normal file
Binary file not shown.
@@ -21,6 +21,7 @@ interface IGetInfoInterface {
|
|||||||
String getActivationCode();
|
String getActivationCode();
|
||||||
//设置为默认桌面
|
//设置为默认桌面
|
||||||
void setDefaultLauncher(String pkg);
|
void setDefaultLauncher(String pkg);
|
||||||
|
void setCustomLauncher(String pkg, String className);
|
||||||
//退出桌面
|
//退出桌面
|
||||||
void exitDesktop();
|
void exitDesktop();
|
||||||
//能否退出桌面
|
//能否退出桌面
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.xuexispace.ai.config.CommonConfig;
|
|||||||
import com.xuexispace.ai.databinding.ActivityEditBinding;
|
import com.xuexispace.ai.databinding.ActivityEditBinding;
|
||||||
import com.xuexispace.ai.manager.RemoteManager;
|
import com.xuexispace.ai.manager.RemoteManager;
|
||||||
import com.xuexispace.ai.utils.ActivationUtil;
|
import com.xuexispace.ai.utils.ActivationUtil;
|
||||||
|
import com.xuexispace.ai.utils.LenovoCsdkUtil;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -100,9 +101,9 @@ public class EditActivity extends BaseMvvmActivity<EditViewModel, ActivityEditBi
|
|||||||
Toaster.show("不能为空");
|
Toaster.show("不能为空");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ActivationUtil.isActivation()) {
|
if (ActivationUtil.getInstance().isActivation()) {
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>();
|
||||||
params.put("sn", RemoteManager.getInstance().getSerial());
|
params.put("sn", LenovoCsdkUtil.getInstance().getSerial());
|
||||||
params.put(mTypeName, mViewDataBinding.editText.getText().toString());
|
params.put(mTypeName, mViewDataBinding.editText.getText().toString());
|
||||||
mViewModel.updateInfo(params);
|
mViewModel.updateInfo(params);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class EditViewModel extends BaseViewModel<ActivityEditBinding, ActivityEv
|
|||||||
public MutableLiveData<Boolean> mSuccessfulData = new MutableLiveData<>();
|
public MutableLiveData<Boolean> mSuccessfulData = new MutableLiveData<>();
|
||||||
|
|
||||||
public void updateInfo(Map<String, String> params) {
|
public void updateInfo(Map<String, String> params) {
|
||||||
if (!ActivationUtil.isActivation()) {
|
if (!ActivationUtil.getInstance().isActivation()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
NetInterfaceManager.getInstance().getUpdateInfoObservable(params)
|
NetInterfaceManager.getInstance().getUpdateInfoObservable(params)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class HomeworkViewModel extends BaseViewModel<ActivityHomeworkBinding, Ac
|
|||||||
public MutableLiveData<ArrayList<HomeworkBean>> mHomeworkBeanListData = new MutableLiveData<>();
|
public MutableLiveData<ArrayList<HomeworkBean>> mHomeworkBeanListData = new MutableLiveData<>();
|
||||||
|
|
||||||
public void getHomeWork() {
|
public void getHomeWork() {
|
||||||
boolean activation = ActivationUtil.isActivation();
|
boolean activation = ActivationUtil.getInstance().isActivation();
|
||||||
if (!activation) {
|
if (!activation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,14 @@ import com.xuexispace.ai.config.CommonConfig;
|
|||||||
import com.xuexispace.ai.databinding.ActivityMainBinding;
|
import com.xuexispace.ai.databinding.ActivityMainBinding;
|
||||||
import com.xuexispace.ai.dialog.PermissionsDialog;
|
import com.xuexispace.ai.dialog.PermissionsDialog;
|
||||||
import com.xuexispace.ai.dialog.PrivacyPolicyDialog;
|
import com.xuexispace.ai.dialog.PrivacyPolicyDialog;
|
||||||
|
import com.xuexispace.ai.fragment.biology.BiologyFragment;
|
||||||
|
import com.xuexispace.ai.fragment.chemical.ChemicalFragment;
|
||||||
|
import com.xuexispace.ai.fragment.chinese.ChineseFragment;
|
||||||
|
import com.xuexispace.ai.fragment.complex.ComplexFragment;
|
||||||
|
import com.xuexispace.ai.fragment.english.EnglishFragment;
|
||||||
|
import com.xuexispace.ai.fragment.math.MathFragment;
|
||||||
|
import com.xuexispace.ai.fragment.physics.PhysicsFragment;
|
||||||
|
import com.xuexispace.ai.fragment.precision.PrecisionFragment;
|
||||||
import com.xuexispace.ai.fragment.subject.SubjectFragment;
|
import com.xuexispace.ai.fragment.subject.SubjectFragment;
|
||||||
import com.xuexispace.ai.fragment.user.UserFragment;
|
import com.xuexispace.ai.fragment.user.UserFragment;
|
||||||
import com.xuexispace.ai.jxw.JxwPackageConfig;
|
import com.xuexispace.ai.jxw.JxwPackageConfig;
|
||||||
@@ -46,6 +54,7 @@ import com.xuexispace.ai.manager.AmapManager;
|
|||||||
import com.xuexispace.ai.manager.RemoteManager;
|
import com.xuexispace.ai.manager.RemoteManager;
|
||||||
import com.xuexispace.ai.service.SocketService;
|
import com.xuexispace.ai.service.SocketService;
|
||||||
import com.xuexispace.ai.utils.ApkUtils;
|
import com.xuexispace.ai.utils.ApkUtils;
|
||||||
|
import com.xuexispace.ai.utils.LenovoCsdkUtil;
|
||||||
import com.xuexispace.ai.utils.OpenApkUtils;
|
import com.xuexispace.ai.utils.OpenApkUtils;
|
||||||
import com.xuexispace.ai.utils.Utils;
|
import com.xuexispace.ai.utils.Utils;
|
||||||
import com.xuexispace.ai.view.ScaleCircleNavigator;
|
import com.xuexispace.ai.view.ScaleCircleNavigator;
|
||||||
@@ -59,6 +68,25 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
|||||||
|
|
||||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||||
|
|
||||||
|
private String[] mAllTitle = new String[]{"精准学", "语文", "数学", "英语", "物理", "化学", "生物", "综合"};
|
||||||
|
|
||||||
|
private PrecisionFragment mPrecisionFragment;
|
||||||
|
private ChineseFragment mChineseFragment;
|
||||||
|
private MathFragment mMathFragment;
|
||||||
|
private EnglishFragment mEnglishFragment;
|
||||||
|
|
||||||
|
private PhysicsFragment mPhysicsFragment;
|
||||||
|
private ChemicalFragment mChemicalFragment;
|
||||||
|
private BiologyFragment mBiologyFragment;
|
||||||
|
private ComplexFragment mComplexFragment;
|
||||||
|
|
||||||
|
|
||||||
|
private List<Fragment> mFragments;
|
||||||
|
private FragmentManager mFragmentManager;
|
||||||
|
private BaseFragmentPagerAdapter mBaseFragmentPagerAdapter;
|
||||||
|
private ViewPager.OnPageChangeListener mListener;
|
||||||
|
private int defaultCurrent = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRemoteConnected() {
|
public void onRemoteConnected() {
|
||||||
Log.e(TAG, "onConnected: ");
|
Log.e(TAG, "onConnected: ");
|
||||||
@@ -81,7 +109,7 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initView() {
|
public void initView() {
|
||||||
Log.e(TAG, "initView: ");
|
Log.e(TAG, "initView: getSerial = " + LenovoCsdkUtil.getInstance().getSerial());
|
||||||
|
|
||||||
// mViewDataBinding.ivIcon2.setImageDrawable(ApkUtils.getAppDrawable(MainActivity.this, "com.uiui.zy", R.drawable.com_uiui_sn));
|
// mViewDataBinding.ivIcon2.setImageDrawable(ApkUtils.getAppDrawable(MainActivity.this, "com.uiui.zy", R.drawable.com_uiui_sn));
|
||||||
mViewDataBinding.tvAppname2.setText(ApkUtils.getAppName(MainActivity.this, "com.uiui.zy", "设备守护"));
|
mViewDataBinding.tvAppname2.setText(ApkUtils.getAppName(MainActivity.this, "com.uiui.zy", "设备守护"));
|
||||||
@@ -99,8 +127,6 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
|||||||
|
|
||||||
Utils.getAndroiodScreenProperty(this);
|
Utils.getAndroiodScreenProperty(this);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Intent intent = new Intent(MainActivity.this, SocketService.class);
|
Intent intent = new Intent(MainActivity.this, SocketService.class);
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
startForegroundService(intent);
|
startForegroundService(intent);
|
||||||
@@ -124,6 +150,41 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
|||||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
|
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long time = System.currentTimeMillis();
|
||||||
|
Log.e(TAG, "SubjectFragment: start " + time);
|
||||||
|
mFragments = new ArrayList<>();
|
||||||
|
|
||||||
|
mPrecisionFragment = new PrecisionFragment();
|
||||||
|
mChineseFragment = new ChineseFragment();
|
||||||
|
mMathFragment = new MathFragment();
|
||||||
|
mEnglishFragment = new EnglishFragment();
|
||||||
|
mPhysicsFragment = new PhysicsFragment();
|
||||||
|
mChemicalFragment = new ChemicalFragment();
|
||||||
|
mBiologyFragment = new BiologyFragment();
|
||||||
|
mComplexFragment = new ComplexFragment();
|
||||||
|
|
||||||
|
mFragments.add(mPrecisionFragment);
|
||||||
|
mFragments.add(mChineseFragment);
|
||||||
|
mFragments.add(mMathFragment);
|
||||||
|
mFragments.add(mEnglishFragment);
|
||||||
|
mFragments.add(mPhysicsFragment);
|
||||||
|
mFragments.add(mChemicalFragment);
|
||||||
|
mFragments.add(mBiologyFragment);
|
||||||
|
mFragments.add(mComplexFragment);
|
||||||
|
Log.e(TAG, "SubjectFragment: end = " + (System.currentTimeMillis() - time));
|
||||||
|
|
||||||
|
long time2 = System.currentTimeMillis();
|
||||||
|
Log.e(TAG, "initView: start " + time2);
|
||||||
|
mFragmentManager = getSupportFragmentManager();
|
||||||
|
mBaseFragmentPagerAdapter = new BaseFragmentPagerAdapter(mFragmentManager, mFragments);
|
||||||
|
mViewDataBinding.viewPager.setAdapter(mBaseFragmentPagerAdapter);
|
||||||
|
mViewDataBinding.viewPager.setOnPageChangeListener(mListener);
|
||||||
|
mViewDataBinding.mainSlidingTabLayout.setViewPager(mViewDataBinding.viewPager, mAllTitle);
|
||||||
|
|
||||||
|
Log.e(TAG, "initView: end = " + (System.currentTimeMillis() - time2));
|
||||||
|
mViewDataBinding.viewPager.setOffscreenPageLimit(10);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -196,16 +257,24 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
|
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == KeyEvent.ACTION_DOWN) {
|
||||||
return false;
|
lazyExit();
|
||||||
} else if (KeyEvent.KEYCODE_HOME == keyCode) {
|
return true;
|
||||||
Log.e(TAG, "onKeyDown: keyCode = " + keyCode);
|
|
||||||
//写要执行的动作或者任务
|
|
||||||
android.os.Process.killProcess(android.os.Process.myPid());
|
|
||||||
}
|
}
|
||||||
return super.onKeyDown(keyCode, event);
|
return super.onKeyDown(keyCode, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private long mPreClickTime;
|
||||||
|
|
||||||
|
private void lazyExit() {
|
||||||
|
if (System.currentTimeMillis() - mPreClickTime > 3000) {
|
||||||
|
Toaster.showShort("再按一次,退出");
|
||||||
|
mPreClickTime = System.currentTimeMillis();
|
||||||
|
} else {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onNewIntent(Intent intent) {
|
protected void onNewIntent(Intent intent) {
|
||||||
super.onNewIntent(intent);
|
super.onNewIntent(intent);
|
||||||
@@ -660,6 +729,10 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class BtnClick {
|
public class BtnClick {
|
||||||
|
public void exit(View view) {
|
||||||
|
lazyExit();
|
||||||
|
}
|
||||||
|
|
||||||
public void openRobot(View view) {
|
public void openRobot(View view) {
|
||||||
OpenApkUtils.getInstance().openAppWithoutArgs(JxwPackageConfig.JXW_VOICE_PACKAGE_NAME, JxwPackageConfig.JXW_VOICE_CLASS_NAME);
|
OpenApkUtils.getInstance().openAppWithoutArgs(JxwPackageConfig.JXW_VOICE_PACKAGE_NAME, JxwPackageConfig.JXW_VOICE_CLASS_NAME);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ import com.xuexispace.ai.bean.SnInfo;
|
|||||||
import com.xuexispace.ai.bean.SystemSettings;
|
import com.xuexispace.ai.bean.SystemSettings;
|
||||||
import com.xuexispace.ai.config.CommonConfig;
|
import com.xuexispace.ai.config.CommonConfig;
|
||||||
import com.xuexispace.ai.databinding.ActivityMainBinding;
|
import com.xuexispace.ai.databinding.ActivityMainBinding;
|
||||||
import com.xuexispace.ai.manager.RemoteManager;
|
|
||||||
import com.xuexispace.ai.network.NetInterfaceManager;
|
import com.xuexispace.ai.network.NetInterfaceManager;
|
||||||
import com.xuexispace.ai.utils.ActivationUtil;
|
import com.xuexispace.ai.utils.ActivationUtil;
|
||||||
import com.xuexispace.ai.utils.ApkUtils;
|
import com.xuexispace.ai.utils.ApkUtils;
|
||||||
import com.xuexispace.ai.utils.AppUsedTimeUtils;
|
import com.xuexispace.ai.utils.AppUsedTimeUtils;
|
||||||
|
import com.xuexispace.ai.utils.LenovoCsdkUtil;
|
||||||
import com.xuexispace.ai.utils.Utils;
|
import com.xuexispace.ai.utils.Utils;
|
||||||
|
|
||||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||||
@@ -51,7 +51,7 @@ public class MainViewModel extends BaseViewModel<ActivityMainBinding, ActivityEv
|
|||||||
public MutableLiveData<String> mGradleData = new MutableLiveData<>();
|
public MutableLiveData<String> mGradleData = new MutableLiveData<>();
|
||||||
|
|
||||||
public void getSnInfo() {
|
public void getSnInfo() {
|
||||||
NetInterfaceManager.getInstance().getsnInfoControl()
|
NetInterfaceManager.getInstance().getSnInfoControl()
|
||||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||||
.subscribe(new Observer<BaseResponse<SnInfo>>() {
|
.subscribe(new Observer<BaseResponse<SnInfo>>() {
|
||||||
@Override
|
@Override
|
||||||
@@ -158,7 +158,7 @@ public class MainViewModel extends BaseViewModel<ActivityMainBinding, ActivityEv
|
|||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void sendAPPUsage() {
|
public void sendAPPUsage() {
|
||||||
boolean activation = ActivationUtil.isActivation();
|
boolean activation = ActivationUtil.getInstance().isActivation();
|
||||||
if (!activation) {
|
if (!activation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -174,7 +174,7 @@ public class MainViewModel extends BaseViewModel<ActivityMainBinding, ActivityEv
|
|||||||
Log.e(TAG, "onRestart: " + packagename);
|
Log.e(TAG, "onRestart: " + packagename);
|
||||||
NetInterfaceManager.getInstance()
|
NetInterfaceManager.getInstance()
|
||||||
.getAppUsageRecordControl()
|
.getAppUsageRecordControl()
|
||||||
.sendappUsageRecord(RemoteManager.getInstance().getSerial(),
|
.sendappUsageRecord(LenovoCsdkUtil.getInstance().getSerial(),
|
||||||
ApkUtils.getAppNameByPackage(getCtx(), packagename),
|
ApkUtils.getAppNameByPackage(getCtx(), packagename),
|
||||||
packagename,
|
packagename,
|
||||||
AppUsedTimeUtils.getInstance().getStartTime() / 1000,
|
AppUsedTimeUtils.getInstance().getStartTime() / 1000,
|
||||||
@@ -211,7 +211,7 @@ public class MainViewModel extends BaseViewModel<ActivityMainBinding, ActivityEv
|
|||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void sendRunningInfo() {
|
public void sendRunningInfo() {
|
||||||
boolean activation = ActivationUtil.isActivation();
|
boolean activation = ActivationUtil.getInstance().isActivation();
|
||||||
if (!activation) {
|
if (!activation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.xuexispace.ai.config.CommonConfig;
|
|||||||
import com.xuexispace.ai.databinding.ActivitySelecteGradeBinding;
|
import com.xuexispace.ai.databinding.ActivitySelecteGradeBinding;
|
||||||
import com.xuexispace.ai.manager.RemoteManager;
|
import com.xuexispace.ai.manager.RemoteManager;
|
||||||
import com.xuexispace.ai.utils.ActivationUtil;
|
import com.xuexispace.ai.utils.ActivationUtil;
|
||||||
|
import com.xuexispace.ai.utils.LenovoCsdkUtil;
|
||||||
import com.xuexispace.ai.utils.Utils;
|
import com.xuexispace.ai.utils.Utils;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -166,9 +167,9 @@ public class SelecteGradeActivity extends BaseMvvmActivity<SelecteGradeViewModel
|
|||||||
|
|
||||||
public void submit(View view) {
|
public void submit(View view) {
|
||||||
mMMKV.encode(CommonConfig.UIUI_USER_GRADE_KEY, grade);
|
mMMKV.encode(CommonConfig.UIUI_USER_GRADE_KEY, grade);
|
||||||
if (ActivationUtil.isActivation()) {
|
if (ActivationUtil.getInstance().isActivation()) {
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>();
|
||||||
params.put("sn", RemoteManager.getInstance().getSerial());
|
params.put("sn", LenovoCsdkUtil.getInstance().getSerial());
|
||||||
params.put("sn_grade", grade);
|
params.put("sn_grade", grade);
|
||||||
mViewModel.updateInfo(params);
|
mViewModel.updateInfo(params);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class SelecteGradeViewModel extends BaseViewModel<ActivitySelecteGradeBin
|
|||||||
public MutableLiveData<Boolean> mSuccessfulData = new MutableLiveData<>();
|
public MutableLiveData<Boolean> mSuccessfulData = new MutableLiveData<>();
|
||||||
|
|
||||||
public void updateInfo(Map<String, String> params) {
|
public void updateInfo(Map<String, String> params) {
|
||||||
if (!ActivationUtil.isActivation()) {
|
if (!ActivationUtil.getInstance().isActivation()) {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import com.xuexispace.ai.utils.ActivationUtil;
|
|||||||
import com.xuexispace.ai.utils.ApkUtils;
|
import com.xuexispace.ai.utils.ApkUtils;
|
||||||
import com.xuexispace.ai.utils.FileUtil;
|
import com.xuexispace.ai.utils.FileUtil;
|
||||||
import com.xuexispace.ai.utils.GlideLoadUtils;
|
import com.xuexispace.ai.utils.GlideLoadUtils;
|
||||||
|
import com.xuexispace.ai.utils.LenovoCsdkUtil;
|
||||||
import com.xuexispace.ai.utils.Utils;
|
import com.xuexispace.ai.utils.Utils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -122,7 +123,7 @@ public class UserActivity extends BaseMvvmActivity<UserViewModel, ActivityUserBi
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mViewModel.getAppUpdateInfoData().observe(this, new Observer<AppUpdateInfo>() {
|
mViewModel.mAppUpdateInfoData.observe(this, new Observer<AppUpdateInfo>() {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(AppUpdateInfo appUpdateInfo) {
|
public void onChanged(AppUpdateInfo appUpdateInfo) {
|
||||||
if (appUpdateInfo == null) {
|
if (appUpdateInfo == null) {
|
||||||
@@ -152,7 +153,7 @@ public class UserActivity extends BaseMvvmActivity<UserViewModel, ActivityUserBi
|
|||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (ActivationUtil.isActivation()) {
|
if (ActivationUtil.getInstance().isActivation()) {
|
||||||
mViewModel.getUserAvatarInfo();
|
mViewModel.getUserAvatarInfo();
|
||||||
} else {
|
} else {
|
||||||
setLocalData();
|
setLocalData();
|
||||||
@@ -231,7 +232,7 @@ public class UserActivity extends BaseMvvmActivity<UserViewModel, ActivityUserBi
|
|||||||
Log.e("selectPicture", "onResult: " + avatarFilePath);
|
Log.e("selectPicture", "onResult: " + avatarFilePath);
|
||||||
GlideLoadUtils.getInstance().glideLoad(UserActivity.this, avatarFilePath, mViewDataBinding.nvAvatar, R.drawable.default_avatar);
|
GlideLoadUtils.getInstance().glideLoad(UserActivity.this, avatarFilePath, mViewDataBinding.nvAvatar, R.drawable.default_avatar);
|
||||||
|
|
||||||
if (ActivationUtil.isActivation()) {
|
if (ActivationUtil.getInstance().isActivation()) {
|
||||||
File avatarFile;
|
File avatarFile;
|
||||||
if (TextUtils.isEmpty(avatarFilePath)) {
|
if (TextUtils.isEmpty(avatarFilePath)) {
|
||||||
avatarFile = FileUtil.drawableToFile(UserActivity.this, R.drawable.default_avatar, "avatar");
|
avatarFile = FileUtil.drawableToFile(UserActivity.this, R.drawable.default_avatar, "avatar");
|
||||||
@@ -244,7 +245,7 @@ public class UserActivity extends BaseMvvmActivity<UserViewModel, ActivityUserBi
|
|||||||
RequestBody requestBody = RequestBody.Companion.create(avatarFile, mediaType);
|
RequestBody requestBody = RequestBody.Companion.create(avatarFile, mediaType);
|
||||||
MultipartBody.Part body = MultipartBody.Part.createFormData("avatar", avatarFile.getName(), requestBody);
|
MultipartBody.Part body = MultipartBody.Part.createFormData("avatar", avatarFile.getName(), requestBody);
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>();
|
||||||
params.put("sn", RemoteManager.getInstance().getSerial());
|
params.put("sn", LenovoCsdkUtil.getInstance().getSerial());
|
||||||
mViewModel.updateInfo(params, body);
|
mViewModel.updateInfo(params, body);
|
||||||
} else {
|
} else {
|
||||||
mMMKV.encode(CommonConfig.UIUI_USER_AVATAR_KEY, avatarFilePath);
|
mMMKV.encode(CommonConfig.UIUI_USER_AVATAR_KEY, avatarFilePath);
|
||||||
|
|||||||
@@ -67,11 +67,7 @@ public class UserViewModel extends BaseViewModel<ActivityUserBinding, ActivityEv
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private MutableLiveData<AppUpdateInfo> mAppUpdateInfoData = new MutableLiveData<>();
|
public MutableLiveData<AppUpdateInfo> mAppUpdateInfoData = new MutableLiveData<>();
|
||||||
|
|
||||||
public MutableLiveData<AppUpdateInfo> getAppUpdateInfoData() {
|
|
||||||
return mAppUpdateInfoData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void checkUpdate() {
|
public void checkUpdate() {
|
||||||
NetInterfaceManager.getInstance().getCheckUpdateObservable(BuildConfig.APPLICATION_ID)
|
NetInterfaceManager.getInstance().getCheckUpdateObservable(BuildConfig.APPLICATION_ID)
|
||||||
@@ -109,7 +105,7 @@ public class UserViewModel extends BaseViewModel<ActivityUserBinding, ActivityEv
|
|||||||
public MutableLiveData<Boolean> mSuccessfulData = new MutableLiveData<>();
|
public MutableLiveData<Boolean> mSuccessfulData = new MutableLiveData<>();
|
||||||
|
|
||||||
public void updateInfo(Map<String, String> params, MultipartBody.Part multipartBody) {
|
public void updateInfo(Map<String, String> params, MultipartBody.Part multipartBody) {
|
||||||
if (!ActivationUtil.isActivation()) {
|
if (!ActivationUtil.getInstance().isActivation()) {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import android.os.Handler;
|
|||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.alibaba.sdk.android.push.CloudPushService;
|
|
||||||
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
|
|
||||||
import com.arialyy.aria.core.Aria;
|
import com.arialyy.aria.core.Aria;
|
||||||
import com.hjq.toast.Toaster;
|
import com.hjq.toast.Toaster;
|
||||||
import com.tencent.bugly.crashreport.CrashReport;
|
import com.tencent.bugly.crashreport.CrashReport;
|
||||||
@@ -24,14 +22,15 @@ import com.xuexispace.ai.manager.RemoteManager;
|
|||||||
import com.xuexispace.ai.network.NetInterfaceManager;
|
import com.xuexispace.ai.network.NetInterfaceManager;
|
||||||
import com.xuexispace.ai.push.PushManager;
|
import com.xuexispace.ai.push.PushManager;
|
||||||
import com.xuexispace.ai.receiver.APKinstallReceiver;
|
import com.xuexispace.ai.receiver.APKinstallReceiver;
|
||||||
|
import com.xuexispace.ai.utils.ActivationUtil;
|
||||||
import com.xuexispace.ai.utils.AppUsedTimeUtils;
|
import com.xuexispace.ai.utils.AppUsedTimeUtils;
|
||||||
|
import com.xuexispace.ai.utils.LenovoCsdkUtil;
|
||||||
import com.xuexispace.ai.utils.OpenApkUtils;
|
import com.xuexispace.ai.utils.OpenApkUtils;
|
||||||
import com.xuexispace.ai.utils.SystemUtils;
|
import com.xuexispace.ai.utils.SystemUtils;
|
||||||
|
|
||||||
public class BaseApplication extends Application {
|
public class BaseApplication extends Application {
|
||||||
private static final String TAG = "BaseApplication";
|
private static final String TAG = "BaseApplication";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ViewModel中因为经常旋转导致弱引用为空
|
* ViewModel中因为经常旋转导致弱引用为空
|
||||||
*/
|
*/
|
||||||
@@ -62,24 +61,25 @@ public class BaseApplication extends Application {
|
|||||||
private void init() {
|
private void init() {
|
||||||
Log.e(TAG, "init: ");
|
Log.e(TAG, "init: ");
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
|
catchException();
|
||||||
}
|
}
|
||||||
if (SystemUtils.isMainProcessName(this, android.os.Process.myPid())) {
|
if (SystemUtils.isMainProcessName(this, android.os.Process.myPid())) {
|
||||||
String rootDir = MMKV.initialize(this);
|
String rootDir = MMKV.initialize(this);
|
||||||
Log.e(TAG, "mmkv root: " + rootDir);
|
Log.e(TAG, "mmkv root: " + rootDir);
|
||||||
|
|
||||||
|
ActivationUtil.init(this);
|
||||||
|
LenovoCsdkUtil.init(this);
|
||||||
|
|
||||||
|
CrashReport.initCrashReport(getApplicationContext(), "d1cd982951", false);
|
||||||
|
CrashReport.setDeviceId(BaseApplication.this, LenovoCsdkUtil.getInstance().getSerial());
|
||||||
|
|
||||||
// 初始化 Toast 框架
|
// 初始化 Toast 框架
|
||||||
Toaster.init(this);
|
Toaster.init(this);
|
||||||
AmapManager.init(this);
|
AmapManager.init(this);
|
||||||
AppManager.init(this);
|
AppManager.init(this);
|
||||||
PushManager.init(this);
|
PushManager.init(this);
|
||||||
RemoteManager.init(this);
|
RemoteManager.init(this);
|
||||||
RemoteManager.setListener(new RemoteManager.ConnectedListener() {
|
|
||||||
@Override
|
|
||||||
public void onRemoteConnected() {
|
|
||||||
CrashReport.setDeviceId(BaseApplication.this, RemoteManager.getInstance().getSerial());
|
|
||||||
RemoteManager.getInstance().aliyunPushInit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
AlarmUtils.init(this);
|
AlarmUtils.init(this);
|
||||||
AppUsedTimeUtils.init(this);
|
AppUsedTimeUtils.init(this);
|
||||||
OpenApkUtils.init(this);
|
OpenApkUtils.init(this);
|
||||||
@@ -87,42 +87,32 @@ public class BaseApplication extends Application {
|
|||||||
NetInterfaceManager.init(this);
|
NetInterfaceManager.init(this);
|
||||||
// startService(new Intent(this, MainService.class));
|
// startService(new Intent(this, MainService.class));
|
||||||
registAppReceive();
|
registAppReceive();
|
||||||
new Handler().postDelayed(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
slowInit();
|
|
||||||
}
|
|
||||||
}, 1234);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void slowInit() {
|
|
||||||
Log.e(TAG, "slowInit: ");
|
|
||||||
Aria.init(this);
|
Aria.init(this);
|
||||||
// Aria.get(this).getDownloadConfig().setMaxTaskNum(1);
|
// Aria.get(this).getDownloadConfig().setMaxTaskNum(1);
|
||||||
// Aria.get(this).getDownloadConfig().setConvertSpeed(true);
|
// Aria.get(this).getDownloadConfig().setConvertSpeed(true);
|
||||||
CrashReport.initCrashReport(getApplicationContext(), "d1cd982951", false);
|
|
||||||
|
|
||||||
aliyunPushInit();
|
// aliyunPushInit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void aliyunPushInit() {
|
// public void aliyunPushInit() {
|
||||||
PushServiceFactory.init(this);
|
// PushServiceFactory.init(this);
|
||||||
final CloudPushService pushService = PushServiceFactory.getCloudPushService();
|
// final CloudPushService pushService = PushServiceFactory.getCloudPushService();
|
||||||
pushService.setLogLevel(CloudPushService.LOG_DEBUG);
|
// pushService.setLogLevel(CloudPushService.LOG_DEBUG);
|
||||||
// pushService.register(this, new CommonCallback() {
|
//// pushService.register(this, new CommonCallback() {
|
||||||
// @Override
|
//// @Override
|
||||||
// public void onSuccess(String response) {
|
//// public void onSuccess(String response) {
|
||||||
// Log.e("AliyunPush", "init cloudchannel success");
|
//// Log.e("AliyunPush", "init cloudchannel success");
|
||||||
// Log.e("AliyunPush", "init cloudchannel success " + pushService.getDeviceId());
|
//// Log.e("AliyunPush", "init cloudchannel success " + pushService.getDeviceId());
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
//// @Override
|
||||||
|
//// public void onFailed(String errorCode, String errorMessage) {
|
||||||
|
//// Log.e("AliyunPush", "init cloudchannel failed -- errorcode:" + errorCode + " -- errorMessage:" + errorMessage);
|
||||||
|
//// }
|
||||||
|
//// });
|
||||||
// }
|
// }
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onFailed(String errorCode, String errorMessage) {
|
|
||||||
// Log.e("AliyunPush", "init cloudchannel failed -- errorcode:" + errorCode + " -- errorMessage:" + errorMessage);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
|
|
||||||
private APKinstallReceiver apKinstallReceiver;
|
private APKinstallReceiver apKinstallReceiver;
|
||||||
|
|
||||||
|
|||||||
@@ -37,9 +37,7 @@ public class SubjectFragment extends BaseDataBindingFragment<FragmentSubjectBind
|
|||||||
|
|
||||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||||
|
|
||||||
private String[] mAllTitle = new String[]{
|
private String[] mAllTitle = new String[]{"精准学", "语文", "数学", "英语", "物理", "化学", "生物", "综合"};
|
||||||
// "AR自主学",
|
|
||||||
"精准学", "语文", "数学", "英语", "物理", "化学", "生物", "综合"};
|
|
||||||
|
|
||||||
private String[] mTitleWithoutScience = new String[]{"精准学", "语文", "数学", "英语"};
|
private String[] mTitleWithoutScience = new String[]{"精准学", "语文", "数学", "英语"};
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import com.xuexispace.ai.network.UrlAddress;
|
|||||||
import com.xuexispace.ai.utils.ActivationUtil;
|
import com.xuexispace.ai.utils.ActivationUtil;
|
||||||
import com.xuexispace.ai.utils.ApkUtils;
|
import com.xuexispace.ai.utils.ApkUtils;
|
||||||
import com.xuexispace.ai.utils.CXAESUtil;
|
import com.xuexispace.ai.utils.CXAESUtil;
|
||||||
|
import com.xuexispace.ai.utils.LenovoCsdkUtil;
|
||||||
import com.xuexispace.ai.utils.TimeUtils;
|
import com.xuexispace.ai.utils.TimeUtils;
|
||||||
import com.xuexispace.ai.utils.Utils;
|
import com.xuexispace.ai.utils.Utils;
|
||||||
|
|
||||||
@@ -61,7 +62,7 @@ public class UserViewModel extends BaseViewModel<FragmentUserBinding, FragmentEv
|
|||||||
public MutableLiveData<BaseResponse<SnInfo>> mSnInfoData = new MutableLiveData<>();
|
public MutableLiveData<BaseResponse<SnInfo>> mSnInfoData = new MutableLiveData<>();
|
||||||
|
|
||||||
public void getSnInfo() {
|
public void getSnInfo() {
|
||||||
boolean activation = ActivationUtil.isActivation();
|
boolean activation = ActivationUtil.getInstance().isActivation();
|
||||||
if (!activation) {
|
if (!activation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -98,7 +99,7 @@ public class UserViewModel extends BaseViewModel<FragmentUserBinding, FragmentEv
|
|||||||
public MutableLiveData<StudyStatBean> mStudyStatBeanData = new MutableLiveData<>();
|
public MutableLiveData<StudyStatBean> mStudyStatBeanData = new MutableLiveData<>();
|
||||||
|
|
||||||
public void getStudyStat() {
|
public void getStudyStat() {
|
||||||
boolean activation = ActivationUtil.isActivation();
|
boolean activation = ActivationUtil.getInstance().isActivation();
|
||||||
if (!activation) {
|
if (!activation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -137,7 +138,7 @@ public class UserViewModel extends BaseViewModel<FragmentUserBinding, FragmentEv
|
|||||||
public MutableLiveData<Bitmap> mQrCodeData = new MutableLiveData<>();
|
public MutableLiveData<Bitmap> mQrCodeData = new MutableLiveData<>();
|
||||||
|
|
||||||
public void getQrCode() {
|
public void getQrCode() {
|
||||||
String encryptString = CXAESUtil.encrypt(CommonConfig.AES_KEY, RemoteManager.getInstance().getSerial());
|
String encryptString = CXAESUtil.encrypt(CommonConfig.AES_KEY, LenovoCsdkUtil.getInstance().getSerial());
|
||||||
Log.e("getQRCode", "setImageAndText: " + encryptString);
|
Log.e("getQRCode", "setImageAndText: " + encryptString);
|
||||||
Bitmap bitmap = Utils.createQRImage(encryptString, 400, 400);
|
Bitmap bitmap = Utils.createQRImage(encryptString, 400, 400);
|
||||||
mQrCodeData.setValue(bitmap);
|
mQrCodeData.setValue(bitmap);
|
||||||
@@ -202,7 +203,7 @@ public class UserViewModel extends BaseViewModel<FragmentUserBinding, FragmentEv
|
|||||||
public MutableLiveData<List<HomeworkBean>> mHomeworkBeanListData = new MutableLiveData<>();
|
public MutableLiveData<List<HomeworkBean>> mHomeworkBeanListData = new MutableLiveData<>();
|
||||||
|
|
||||||
public void getHomework() {
|
public void getHomework() {
|
||||||
boolean activation = ActivationUtil.isActivation();
|
boolean activation = ActivationUtil.getInstance().isActivation();
|
||||||
if (!activation) {
|
if (!activation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -246,7 +247,7 @@ public class UserViewModel extends BaseViewModel<FragmentUserBinding, FragmentEv
|
|||||||
public MutableLiveData<PhraseContent> mPhraseData = new MutableLiveData<>();
|
public MutableLiveData<PhraseContent> mPhraseData = new MutableLiveData<>();
|
||||||
|
|
||||||
public void getPhrase() {
|
public void getPhrase() {
|
||||||
boolean activation = ActivationUtil.isActivation();
|
boolean activation = ActivationUtil.getInstance().isActivation();
|
||||||
if (!activation) {
|
if (!activation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.xuexispace.ai.activity.service.ServiceActivity;
|
|||||||
import com.xuexispace.ai.base.mvvm.fragment.BaseMvvmFragment;
|
import com.xuexispace.ai.base.mvvm.fragment.BaseMvvmFragment;
|
||||||
import com.xuexispace.ai.databinding.FragmentDeviceBinding;
|
import com.xuexispace.ai.databinding.FragmentDeviceBinding;
|
||||||
import com.xuexispace.ai.manager.RemoteManager;
|
import com.xuexispace.ai.manager.RemoteManager;
|
||||||
|
import com.xuexispace.ai.utils.LenovoCsdkUtil;
|
||||||
|
|
||||||
public class DeviceFragment extends BaseMvvmFragment<DeviceViewModel, FragmentDeviceBinding> {
|
public class DeviceFragment extends BaseMvvmFragment<DeviceViewModel, FragmentDeviceBinding> {
|
||||||
|
|
||||||
@@ -40,7 +41,7 @@ public class DeviceFragment extends BaseMvvmFragment<DeviceViewModel, FragmentDe
|
|||||||
protected void initView(Bundle bundle) {
|
protected void initView(Bundle bundle) {
|
||||||
mViewDataBinding.tvModel.setText(Build.MODEL);
|
mViewDataBinding.tvModel.setText(Build.MODEL);
|
||||||
mViewDataBinding.tvVersion.setText(BuildConfig.VERSION_NAME);
|
mViewDataBinding.tvVersion.setText(BuildConfig.VERSION_NAME);
|
||||||
mViewDataBinding.tvMac.setText(RemoteManager.getInstance().getSerial());
|
mViewDataBinding.tvMac.setText(LenovoCsdkUtil.getInstance().getSerial());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import com.xuexispace.ai.config.CommonConfig;
|
|||||||
import com.xuexispace.ai.databinding.FragmentInfoBinding;
|
import com.xuexispace.ai.databinding.FragmentInfoBinding;
|
||||||
import com.xuexispace.ai.manager.RemoteManager;
|
import com.xuexispace.ai.manager.RemoteManager;
|
||||||
import com.xuexispace.ai.utils.ActivationUtil;
|
import com.xuexispace.ai.utils.ActivationUtil;
|
||||||
|
import com.xuexispace.ai.utils.LenovoCsdkUtil;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -60,9 +61,9 @@ public class InfoFragment extends BaseMvvmFragment<InfoViewModel, FragmentInfoBi
|
|||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
||||||
if (b) {
|
if (b) {
|
||||||
if (ActivationUtil.isActivation()) {
|
if (ActivationUtil.getInstance().isActivation()) {
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>();
|
||||||
params.put("sn", RemoteManager.getInstance().getSerial());
|
params.put("sn", LenovoCsdkUtil.getInstance().getSerial());
|
||||||
params.put("sex", "1");
|
params.put("sex", "1");
|
||||||
mViewModel.updateInfo(params);
|
mViewModel.updateInfo(params);
|
||||||
} else {
|
} else {
|
||||||
@@ -75,9 +76,9 @@ public class InfoFragment extends BaseMvvmFragment<InfoViewModel, FragmentInfoBi
|
|||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
||||||
if (b) {
|
if (b) {
|
||||||
if (ActivationUtil.isActivation()) {
|
if (ActivationUtil.getInstance().isActivation()) {
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>();
|
||||||
params.put("sn", RemoteManager.getInstance().getSerial());
|
params.put("sn", LenovoCsdkUtil.getInstance().getSerial());
|
||||||
params.put("sex", "2");
|
params.put("sex", "2");
|
||||||
mViewModel.updateInfo(params);
|
mViewModel.updateInfo(params);
|
||||||
} else {
|
} else {
|
||||||
@@ -123,7 +124,7 @@ public class InfoFragment extends BaseMvvmFragment<InfoViewModel, FragmentInfoBi
|
|||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (ActivationUtil.isActivation()) {
|
if (ActivationUtil.getInstance().isActivation()) {
|
||||||
mViewModel.getSnInfo();
|
mViewModel.getSnInfo();
|
||||||
} else {
|
} else {
|
||||||
getLocalData();
|
getLocalData();
|
||||||
|
|||||||
@@ -35,11 +35,11 @@ public class InfoViewModel extends BaseViewModel<FragmentInfoBinding, FragmentEv
|
|||||||
public MutableLiveData<SnInfo> mSnInfoData = new MutableLiveData<>();
|
public MutableLiveData<SnInfo> mSnInfoData = new MutableLiveData<>();
|
||||||
|
|
||||||
public void getSnInfo() {
|
public void getSnInfo() {
|
||||||
if (!ActivationUtil.isActivation()) {
|
if (!ActivationUtil.getInstance().isActivation()) {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
NetInterfaceManager.getInstance().getsnInfoControl()
|
NetInterfaceManager.getInstance().getSnInfoControl()
|
||||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||||
.subscribe(new Observer<BaseResponse<SnInfo>>() {
|
.subscribe(new Observer<BaseResponse<SnInfo>>() {
|
||||||
@Override
|
@Override
|
||||||
@@ -70,7 +70,7 @@ public class InfoViewModel extends BaseViewModel<FragmentInfoBinding, FragmentEv
|
|||||||
public MutableLiveData<Boolean> mSuccessfulData = new MutableLiveData<>();
|
public MutableLiveData<Boolean> mSuccessfulData = new MutableLiveData<>();
|
||||||
|
|
||||||
public void updateInfo(Map<String, String> params) {
|
public void updateInfo(Map<String, String> params) {
|
||||||
if (!ActivationUtil.isActivation()) {
|
if (!ActivationUtil.getInstance().isActivation()) {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public class AmapManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void startLocation() {
|
public void startLocation() {
|
||||||
boolean activation = ActivationUtil.isActivation();
|
boolean activation = ActivationUtil.getInstance().isActivation();
|
||||||
if (!activation) {
|
if (!activation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,7 @@ public class AmapManager {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private void updateAddress(AMapLocation aMapLocation) {
|
private void updateAddress(AMapLocation aMapLocation) {
|
||||||
boolean activation = ActivationUtil.isActivation();
|
boolean activation = ActivationUtil.getInstance().isActivation();
|
||||||
if (!activation) {
|
if (!activation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,6 @@ import android.provider.Settings;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.alibaba.sdk.android.push.CloudPushService;
|
|
||||||
import com.alibaba.sdk.android.push.CommonCallback;
|
|
||||||
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
|
|
||||||
import com.tencent.bugly.crashreport.CrashReport;
|
import com.tencent.bugly.crashreport.CrashReport;
|
||||||
import com.tencent.mmkv.MMKV;
|
import com.tencent.mmkv.MMKV;
|
||||||
import com.uiui.zy.IGetInfoInterface;
|
import com.uiui.zy.IGetInfoInterface;
|
||||||
@@ -65,8 +62,7 @@ public class RemoteManager {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.e(TAG, "onServiceConnected: " + getSerial());
|
// aliyunPushInit();
|
||||||
aliyunPushInit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -123,67 +119,67 @@ public class RemoteManager {
|
|||||||
mListeners.remove(listener);
|
mListeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void aliyunPushInit() {
|
// public void aliyunPushInit() {
|
||||||
String sn = getSerial();
|
// String sn = getSerial();
|
||||||
if (TextUtils.isEmpty(sn)) {
|
// if (TextUtils.isEmpty(sn)) {
|
||||||
Log.e(TAG, "aliyunPushInit: empty");
|
// Log.e(TAG, "aliyunPushInit: empty");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
PushServiceFactory.init(mContext);
|
// PushServiceFactory.init(mContext);
|
||||||
CloudPushService pushService = PushServiceFactory.getCloudPushService();
|
// CloudPushService pushService = PushServiceFactory.getCloudPushService();
|
||||||
pushService.register(mContext, new CommonCallback() {
|
// pushService.register(mContext, new CommonCallback() {
|
||||||
@Override
|
// @Override
|
||||||
public void onSuccess(String response) {
|
// public void onSuccess(String response) {
|
||||||
Log.e("AliyunPush", "init cloudchannel success");
|
// Log.e("AliyunPush", "init cloudchannel success");
|
||||||
Log.e("AliyunPush", "init cloudchannel success " + pushService.getDeviceId());
|
// Log.e("AliyunPush", "init cloudchannel success " + pushService.getDeviceId());
|
||||||
pushService.bindAccount(sn, new CommonCallback() {
|
// pushService.bindAccount(sn, new CommonCallback() {
|
||||||
@Override
|
// @Override
|
||||||
public void onSuccess(String s) {
|
// public void onSuccess(String s) {
|
||||||
Log.e("AliyunPush", "bind account " + sn + " success\n");
|
// Log.e("AliyunPush", "bind account " + sn + " success\n");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void onFailed(String errorCode, String errorMsg) {
|
// public void onFailed(String errorCode, String errorMsg) {
|
||||||
Log.e("AliyunPush", "bind account " + sn + " failed." +
|
// Log.e("AliyunPush", "bind account " + sn + " failed." +
|
||||||
"errorCode: " + errorCode + ", errorMsg:" + errorMsg);
|
// "errorCode: " + errorCode + ", errorMsg:" + errorMsg);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
pushService.addAlias(sn, new CommonCallback() {
|
// pushService.addAlias(sn, new CommonCallback() {
|
||||||
@Override
|
// @Override
|
||||||
public void onSuccess(String s) {
|
// public void onSuccess(String s) {
|
||||||
Log.e("AliyunPush", "add alias " + sn + " success\n");
|
// Log.e("AliyunPush", "add alias " + sn + " success\n");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void onFailed(String errorCode, String errorMsg) {
|
// public void onFailed(String errorCode, String errorMsg) {
|
||||||
Log.e("AliyunPush", "add alias " + sn + " failed." +
|
// Log.e("AliyunPush", "add alias " + sn + " failed." +
|
||||||
"errorCode: " + errorCode + ", errorMsg:" + errorMsg + "\n");
|
// "errorCode: " + errorCode + ", errorMsg:" + errorMsg + "\n");
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void onFailed(String errorCode, String errorMessage) {
|
// public void onFailed(String errorCode, String errorMessage) {
|
||||||
Log.e("AliyunPush", "init cloudchannel failed -- errorcode:" + errorCode + " -- errorMessage:" + errorMessage);
|
// Log.e("AliyunPush", "init cloudchannel failed -- errorcode:" + errorCode + " -- errorMessage:" + errorMessage);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return 获取sn
|
* @return 获取sn
|
||||||
*/
|
*/
|
||||||
public String getSerial() {
|
// public String getSerial() {
|
||||||
if (mIGetInfoInterface != null) {
|
// if (mIGetInfoInterface != null) {
|
||||||
try {
|
// try {
|
||||||
return mIGetInfoInterface.getSerial();
|
// return mIGetInfoInterface.getSerial();
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
Log.e(TAG, "getSerial: " + e.getMessage());
|
// Log.e(TAG, "getSerial: " + e.getMessage());
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
bindInfoService();
|
// bindInfoService();
|
||||||
}
|
// }
|
||||||
return mMMKV.decodeString(SN_KEY, "");
|
// return mMMKV.decodeString(SN_KEY, "");
|
||||||
}
|
// }
|
||||||
|
|
||||||
public String getAppUsedStatistics() {
|
public String getAppUsedStatistics() {
|
||||||
Log.e(TAG, "getAppUsedStatistics: " );
|
Log.e(TAG, "getAppUsedStatistics: " );
|
||||||
|
|||||||
@@ -27,16 +27,16 @@ import com.xuexispace.ai.bean.UserAvatarInfo;
|
|||||||
import com.xuexispace.ai.config.CommonConfig;
|
import com.xuexispace.ai.config.CommonConfig;
|
||||||
import com.xuexispace.ai.disklrucache.CacheHelper;
|
import com.xuexispace.ai.disklrucache.CacheHelper;
|
||||||
import com.xuexispace.ai.gson.GsonUtils;
|
import com.xuexispace.ai.gson.GsonUtils;
|
||||||
import com.xuexispace.ai.manager.RemoteManager;
|
|
||||||
import com.xuexispace.ai.network.api.AlarmClockApi;
|
import com.xuexispace.ai.network.api.AlarmClockApi;
|
||||||
import com.xuexispace.ai.network.api.AppUsageRecordApi;
|
import com.xuexispace.ai.network.api.AppUsageRecordApi;
|
||||||
import com.xuexispace.ai.network.api.GetFilesApi;
|
import com.xuexispace.ai.network.api.FilesApi;
|
||||||
import com.xuexispace.ai.network.api.HomeworkApi;
|
import com.xuexispace.ai.network.api.HomeworkApi;
|
||||||
import com.xuexispace.ai.network.api.PhraseApi;
|
import com.xuexispace.ai.network.api.PhraseApi;
|
||||||
import com.xuexispace.ai.network.api.SnInfoApi;
|
import com.xuexispace.ai.network.api.SnInfoApi;
|
||||||
import com.xuexispace.ai.network.api.SettingApi;
|
import com.xuexispace.ai.network.api.SettingApi;
|
||||||
import com.xuexispace.ai.network.api.uiuios.CheckUpdateApi;
|
import com.xuexispace.ai.network.api.uiuios.CheckUpdateApi;
|
||||||
import com.xuexispace.ai.network.interceptor.RepeatRequestInterceptor;
|
import com.xuexispace.ai.network.interceptor.RepeatRequestInterceptor;
|
||||||
|
import com.xuexispace.ai.utils.LenovoCsdkUtil;
|
||||||
import com.xuexispace.ai.utils.OpenApkUtils;
|
import com.xuexispace.ai.utils.OpenApkUtils;
|
||||||
import com.xuexispace.ai.utils.Utils;
|
import com.xuexispace.ai.utils.Utils;
|
||||||
|
|
||||||
@@ -220,16 +220,16 @@ public class NetInterfaceManager {
|
|||||||
*
|
*
|
||||||
* */
|
* */
|
||||||
|
|
||||||
public Observable<BaseResponse<SnInfo>> getsnInfoControl() {
|
public Observable<BaseResponse<SnInfo>> getSnInfoControl() {
|
||||||
return mRetrofit.create(SnInfoApi.class)
|
return mRetrofit.create(SnInfoApi.class)
|
||||||
.getsninfo(RemoteManager.getInstance().getSerial())
|
.getSninfo(LenovoCsdkUtil.getInstance().getSerial())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Observable<BaseResponse<UserAvatarInfo>> getUserAvatarInfoControl() {
|
public Observable<BaseResponse<UserAvatarInfo>> getUserAvatarInfoControl() {
|
||||||
return mRetrofit.create(SnInfoApi.class)
|
return mRetrofit.create(SnInfoApi.class)
|
||||||
.getUserAvatarInfo(RemoteManager.getInstance().getSerial())
|
.getUserAvatarInfo(LenovoCsdkUtil.getInstance().getSerial())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
@@ -254,21 +254,21 @@ public class NetInterfaceManager {
|
|||||||
|
|
||||||
public Observable<BaseResponse> getRunningAppObservable(String json) {
|
public Observable<BaseResponse> getRunningAppObservable(String json) {
|
||||||
return mRetrofit.create(AppUsageRecordApi.class)
|
return mRetrofit.create(AppUsageRecordApi.class)
|
||||||
.sendRunningInfo(RemoteManager.getInstance().getSerial(), json)
|
.sendRunningInfo(LenovoCsdkUtil.getInstance().getSerial(), json)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Observable<BaseResponse<LessonSetting>> getCloudLessonObservable() {
|
public Observable<BaseResponse<LessonSetting>> getCloudLessonObservable() {
|
||||||
return mRetrofit.create(SettingApi.class)
|
return mRetrofit.create(SettingApi.class)
|
||||||
.getCloudLessonSetting(RemoteManager.getInstance().getSerial())
|
.getCloudLessonSetting(LenovoCsdkUtil.getInstance().getSerial())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Observable<BaseResponse<LessonApp>> getCloudLessonAppObservable() {
|
public Observable<BaseResponse<LessonApp>> getCloudLessonAppObservable() {
|
||||||
return mRetrofit.create(SettingApi.class)
|
return mRetrofit.create(SettingApi.class)
|
||||||
.getCloudLessonApp(RemoteManager.getInstance().getSerial())
|
.getCloudLessonApp(LenovoCsdkUtil.getInstance().getSerial())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
@@ -276,34 +276,34 @@ public class NetInterfaceManager {
|
|||||||
public Observable<BaseResponse<List<AlarmClockData>>> getAlarmClockObservable() {
|
public Observable<BaseResponse<List<AlarmClockData>>> getAlarmClockObservable() {
|
||||||
return mRetrofit
|
return mRetrofit
|
||||||
.create(AlarmClockApi.class)
|
.create(AlarmClockApi.class)
|
||||||
.getAlarmClock(RemoteManager.getInstance().getSerial())
|
.getAlarmClock(LenovoCsdkUtil.getInstance().getSerial())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Observable<BaseResponse> getUpdateAlarmObservable(int id) {
|
public Observable<BaseResponse> getUpdateAlarmObservable(int id) {
|
||||||
return mRetrofit.create(AlarmClockApi.class)
|
return mRetrofit.create(AlarmClockApi.class)
|
||||||
.updateAlarm(RemoteManager.getInstance().getSerial(), id)
|
.updateAlarm(LenovoCsdkUtil.getInstance().getSerial(), id)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Observable<BaseResponse<StudyStatBean>> getStudyStatObservable() {
|
public Observable<BaseResponse<StudyStatBean>> getStudyStatObservable() {
|
||||||
return mRetrofit.create(SnInfoApi.class)
|
return mRetrofit.create(SnInfoApi.class)
|
||||||
.getStudyStat(RemoteManager.getInstance().getSerial())
|
.getStudyStat(LenovoCsdkUtil.getInstance().getSerial())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Observable<BaseResponse> getUpdateAddressObservable(String address, double longitude, double latitude) {
|
public Observable<BaseResponse> getUpdateAddressObservable(String address, double longitude, double latitude) {
|
||||||
return mRetrofit.create(SnInfoApi.class)
|
return mRetrofit.create(SnInfoApi.class)
|
||||||
.updateAddress(RemoteManager.getInstance().getSerial(), address, longitude, latitude)
|
.updateAddress(LenovoCsdkUtil.getInstance().getSerial(), address, longitude, latitude)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Observable<BaseResponse<GuideBean>> getFilesObservable(int type) {
|
public Observable<BaseResponse<GuideBean>> getFilesObservable(int type) {
|
||||||
return mRetrofit.create(GetFilesApi.class)
|
return mRetrofit.create(FilesApi.class)
|
||||||
.getFiles(type)
|
.getFiles(type)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
@@ -311,35 +311,35 @@ public class NetInterfaceManager {
|
|||||||
|
|
||||||
public Observable<BaseResponse<ArrayList<HomeworkBean>>> getHomeworkObservable() {
|
public Observable<BaseResponse<ArrayList<HomeworkBean>>> getHomeworkObservable() {
|
||||||
return mRetrofit.create(HomeworkApi.class)
|
return mRetrofit.create(HomeworkApi.class)
|
||||||
.getHomeworks(RemoteManager.getInstance().getSerial())
|
.getHomeworks(LenovoCsdkUtil.getInstance().getSerial())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Observable<BaseResponse<HomeworkBean>> getHomeworkDetailObservable(int id) {
|
public Observable<BaseResponse<HomeworkBean>> getHomeworkDetailObservable(int id) {
|
||||||
return mRetrofit.create(HomeworkApi.class)
|
return mRetrofit.create(HomeworkApi.class)
|
||||||
.getHomeworkDetail(RemoteManager.getInstance().getSerial(), id)
|
.getHomeworkDetail(LenovoCsdkUtil.getInstance().getSerial(), id)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Observable<BaseResponse> getHomeworkUpdateObservable(int id) {
|
public Observable<BaseResponse> getHomeworkUpdateObservable(int id) {
|
||||||
return mRetrofit.create(HomeworkApi.class)
|
return mRetrofit.create(HomeworkApi.class)
|
||||||
.updateHomework(RemoteManager.getInstance().getSerial(), id)
|
.updateHomework(LenovoCsdkUtil.getInstance().getSerial(), id)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Observable<BaseResponse<PhraseContent>> getPhraseObservable() {
|
public Observable<BaseResponse<PhraseContent>> getPhraseObservable() {
|
||||||
return mRetrofit.create(PhraseApi.class)
|
return mRetrofit.create(PhraseApi.class)
|
||||||
.getPhrase(RemoteManager.getInstance().getSerial())
|
.getPhrase(LenovoCsdkUtil.getInstance().getSerial())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Observable<BaseResponse<SystemSettings>> getsettingControl() {
|
public Observable<BaseResponse<SystemSettings>> getsettingControl() {
|
||||||
return mRetrofit.create(SettingApi.class)
|
return mRetrofit.create(SettingApi.class)
|
||||||
.getSetting(RemoteManager.getInstance().getSerial())
|
.getSetting(LenovoCsdkUtil.getInstance().getSerial())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
@@ -388,24 +388,24 @@ public class NetInterfaceManager {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
public void getSnInfo(BehaviorSubject<ActivityEvent> lifecycle, ObserverCallback callback) {
|
public void getSnInfo(BehaviorSubject<ActivityEvent> lifecycle, ObserverCallback callback) {
|
||||||
getsnInfoControl()
|
getSnInfoControl()
|
||||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||||
.subscribe(getSnInfoObserver(callback));
|
.subscribe(getSnInfoObserver(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getSnInfoFragment(BehaviorSubject<FragmentEvent> lifecycle, ObserverCallback callback) {
|
public void getSnInfoFragment(BehaviorSubject<FragmentEvent> lifecycle, ObserverCallback callback) {
|
||||||
getsnInfoControl()
|
getSnInfoControl()
|
||||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, FragmentEvent.DESTROY))
|
.compose(RxLifecycle.bindUntilEvent(lifecycle, FragmentEvent.DESTROY))
|
||||||
.subscribe(getSnInfoObserver(callback));
|
.subscribe(getSnInfoObserver(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getSnInfo(ObserverCallback callback) {
|
public void getSnInfo(ObserverCallback callback) {
|
||||||
getsnInfoControl()
|
getSnInfoControl()
|
||||||
.subscribe(getSnInfoObserver(callback));
|
.subscribe(getSnInfoObserver(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getSnInfo() {
|
public void getSnInfo() {
|
||||||
getsnInfoControl()
|
getSnInfoControl()
|
||||||
.subscribe(getSnInfoObserver(null));
|
.subscribe(getSnInfoObserver(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import io.reactivex.rxjava3.core.Observable;
|
|||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
import retrofit2.http.Query;
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
public interface GetFilesApi {
|
public interface FilesApi {
|
||||||
@GET(UrlAddress.GET_FILES)
|
@GET(UrlAddress.GET_FILES)
|
||||||
Observable<BaseResponse<GuideBean>> getFiles(
|
Observable<BaseResponse<GuideBean>> getFiles(
|
||||||
@Query("type") int type
|
@Query("type") int type
|
||||||
@@ -20,7 +20,7 @@ import retrofit2.http.Query;
|
|||||||
|
|
||||||
public interface SnInfoApi {
|
public interface SnInfoApi {
|
||||||
@GET(UrlAddress.SNINFO)
|
@GET(UrlAddress.SNINFO)
|
||||||
Observable<BaseResponse<SnInfo>> getsninfo(
|
Observable<BaseResponse<SnInfo>> getSninfo(
|
||||||
@Query("sn") String sn
|
@Query("sn") String sn
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,99 +0,0 @@
|
|||||||
package com.xuexispace.ai.push.alipush;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.alibaba.sdk.android.push.AliyunMessageIntentService;
|
|
||||||
import com.alibaba.sdk.android.push.notification.CPushMessage;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by liyazhou on 17/8/22.
|
|
||||||
* 为避免推送广播被系统拦截的小概率事件,我们推荐用户通过IntentService处理消息互调,接入步骤:
|
|
||||||
* 1. 创建IntentService并继承AliyunMessageIntentService
|
|
||||||
* 2. 覆写相关方法,并在Manifest的注册该Service
|
|
||||||
* 3. 调用接口CloudPushService.setPushIntentService
|
|
||||||
* 详细用户可参考:https://help.aliyun.com/document_detail/30066.html#h2-2-messagereceiver-aliyunmessageintentservice
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class AliMessageIntentService extends AliyunMessageIntentService {
|
|
||||||
private static final String TAG = "AliyunMessageIntentService";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 推送通知的回调方法
|
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
* @param title
|
|
||||||
* @param summary
|
|
||||||
* @param extraMap
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void onNotification(Context context, String title, String summary, Map<String, String> extraMap) {
|
|
||||||
Log.i(TAG, "收到一条推送通知 : " + title + ", summary:" + summary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 推送消息的回调方法
|
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
* @param cPushMessage
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void onMessage(Context context, CPushMessage cPushMessage) {
|
|
||||||
Log.i(TAG, "收到一条推送消息 : " + cPushMessage.getTitle() + ", content:" + cPushMessage.getContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 从通知栏打开通知的扩展处理
|
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
* @param title
|
|
||||||
* @param summary
|
|
||||||
* @param extraMap
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void onNotificationOpened(Context context, String title, String summary, String extraMap) {
|
|
||||||
Log.i(TAG, "onNotificationOpened : " + " : " + title + " : " + summary + " : " + extraMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 无动作通知点击回调。当在后台或阿里云控制台指定的通知动作为无逻辑跳转时,通知点击回调为onNotificationClickedWithNoAction而不是onNotificationOpened
|
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
* @param title
|
|
||||||
* @param summary
|
|
||||||
* @param extraMap
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void onNotificationClickedWithNoAction(Context context, String title, String summary, String extraMap) {
|
|
||||||
Log.i(TAG, "onNotificationClickedWithNoAction : " + " : " + title + " : " + summary + " : " + extraMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通知删除回调
|
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
* @param messageId
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void onNotificationRemoved(Context context, String messageId) {
|
|
||||||
Log.i(TAG, "onNotificationRemoved : " + messageId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 应用处于前台时通知到达回调。注意:该方法仅对自定义样式通知有效,相关详情请参考https://help.aliyun.com/document_detail/30066.html#h3-3-4-basiccustompushnotification-api
|
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
* @param title
|
|
||||||
* @param summary
|
|
||||||
* @param extraMap
|
|
||||||
* @param openType
|
|
||||||
* @param openActivity
|
|
||||||
* @param openUrl
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void onNotificationReceivedInApp(Context context, String title, String summary, Map<String, String> extraMap, int openType, String openActivity, String openUrl) {
|
|
||||||
Log.i(TAG, "onNotificationReceivedInApp : " + " : " + title + " : " + summary + " " + extraMap + " : " + openType + " : " + openActivity + " : " + openUrl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
package com.xuexispace.ai.push.alipush;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.alibaba.sdk.android.push.MessageReceiver;
|
|
||||||
import com.alibaba.sdk.android.push.notification.CPushMessage;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonParser;
|
|
||||||
import com.xuexispace.ai.push.PushManager;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: 正纬
|
|
||||||
* @since: 15/4/9
|
|
||||||
* @version: 1.1
|
|
||||||
* @feature: 用于接收推送的通知和消息
|
|
||||||
*/
|
|
||||||
public class AliyunMessageReceiver extends MessageReceiver {
|
|
||||||
// 消息接收部分的LOG_TAG
|
|
||||||
public static final String TAG = "AliyunMessageReceiver";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 推送通知的回调方法
|
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
* @param title
|
|
||||||
* @param summary
|
|
||||||
* @param extraMap
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void onNotification(Context context, String title, String summary, Map<String, String> extraMap) {
|
|
||||||
// TODO 处理推送通知
|
|
||||||
if (null != extraMap) {
|
|
||||||
for (Map.Entry<String, String> entry : extraMap.entrySet()) {
|
|
||||||
Log.i(TAG, "@Get diy param : Key=" + entry.getKey() + " , Value=" + entry.getValue());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Log.i(TAG, "@收到通知 && 自定义消息为空");
|
|
||||||
}
|
|
||||||
Log.i(TAG, "收到一条推送通知 : " + title + ", summary:" + summary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 应用处于前台时通知到达回调。注意:该方法仅对自定义样式通知有效,相关详情请参考https://help.aliyun.com/document_detail/30066.html?spm=5176.product30047.6.620.wjcC87#h3-3-4-basiccustompushnotification-api
|
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
* @param title
|
|
||||||
* @param summary
|
|
||||||
* @param extraMap
|
|
||||||
* @param openType
|
|
||||||
* @param openActivity
|
|
||||||
* @param openUrl
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void onNotificationReceivedInApp(Context context, String title, String summary, Map<String, String> extraMap, int openType, String openActivity, String openUrl) {
|
|
||||||
Log.i(TAG, "onNotificationReceivedInApp : " + " : " + title + " : " + summary + " " + extraMap + " : " + openType + " : " + openActivity + " : " + openUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 推送消息的回调方法
|
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
* @param cPushMessage
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void onMessage(Context context, CPushMessage cPushMessage) {
|
|
||||||
Log.e(TAG, "收到一条推送消息 : " + cPushMessage.getTitle() + ", content:" + cPushMessage.getContent());
|
|
||||||
String title = cPushMessage.getTitle();
|
|
||||||
String content = cPushMessage.getContent();
|
|
||||||
JsonObject extrasJson = JsonParser.parseString(content).getAsJsonObject();
|
|
||||||
String extras = "";
|
|
||||||
if (extrasJson.get("extras") != null) {
|
|
||||||
extras = extrasJson.get("extras").toString();
|
|
||||||
}
|
|
||||||
PushManager.getInstance().setPushContent(title, extras);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 从通知栏打开通知的扩展处理
|
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
* @param title
|
|
||||||
* @param summary
|
|
||||||
* @param extraMap
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void onNotificationOpened(Context context, String title, String summary, String extraMap) {
|
|
||||||
Log.i(TAG, "onNotificationOpened : " + " : " + title + " : " + summary + " : " + extraMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通知删除回调
|
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
* @param messageId
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void onNotificationRemoved(Context context, String messageId) {
|
|
||||||
Log.i(TAG, "onNotificationRemoved : " + messageId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 无动作通知点击回调。当在后台或阿里云控制台指定的通知动作为无逻辑跳转时,通知点击回调为onNotificationClickedWithNoAction而不是onNotificationOpened
|
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
* @param title
|
|
||||||
* @param summary
|
|
||||||
* @param extraMap
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void onNotificationClickedWithNoAction(Context context, String title, String summary, String extraMap) {
|
|
||||||
Log.i(TAG, "onNotificationClickedWithNoAction : " + " : " + title + " : " + summary + " : " + extraMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -27,6 +27,7 @@ import com.xuexispace.ai.activity.main.MainActivity;
|
|||||||
import com.xuexispace.ai.config.CommonConfig;
|
import com.xuexispace.ai.config.CommonConfig;
|
||||||
import com.xuexispace.ai.manager.RemoteManager;
|
import com.xuexispace.ai.manager.RemoteManager;
|
||||||
import com.xuexispace.ai.utils.ActivationUtil;
|
import com.xuexispace.ai.utils.ActivationUtil;
|
||||||
|
import com.xuexispace.ai.utils.LenovoCsdkUtil;
|
||||||
import com.xuexispace.ai.utils.Utils;
|
import com.xuexispace.ai.utils.Utils;
|
||||||
import com.xuexispace.ai.websocket.JWebSocketClient;
|
import com.xuexispace.ai.websocket.JWebSocketClient;
|
||||||
|
|
||||||
@@ -111,11 +112,12 @@ public class SocketService extends Service implements NetworkUtils.OnNetworkStat
|
|||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
Log.e(TAG, "onCreate: ");
|
Log.e(TAG, "onCreate: ");
|
||||||
|
|
||||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||||
registerScreenLockReceiver();
|
registerScreenLockReceiver();
|
||||||
registerJxwRegisterRefreshReceiver();
|
registerJxwRegisterRefreshReceiver();
|
||||||
|
|
||||||
if (ActivationUtil.isActivation()) {
|
if (ActivationUtil.getInstance().isActivation()) {
|
||||||
//初始化websocket
|
//初始化websocket
|
||||||
initSocketClient();
|
initSocketClient();
|
||||||
startLoop();
|
startLoop();
|
||||||
@@ -265,7 +267,7 @@ public class SocketService extends Service implements NetworkUtils.OnNetworkStat
|
|||||||
Log.e("JxwRegisterReceiver", "onReceive: " + action);
|
Log.e("JxwRegisterReceiver", "onReceive: " + action);
|
||||||
if (JXW_REGISTER_SUCCESS.equals(action)) {
|
if (JXW_REGISTER_SUCCESS.equals(action)) {
|
||||||
mMMKV.encode(JXW_REGISTER_SUCCESS, true);
|
mMMKV.encode(JXW_REGISTER_SUCCESS, true);
|
||||||
mMMKV.encode(CommonConfig.UIUI_ACTIVATION_KEY, ActivationUtil.ACTIVATED_KEY);
|
mMMKV.encode(CommonConfig.UIUI_ACTIVATION_KEY, ActivationUtil.getInstance().ACTIVATED_KEY);
|
||||||
initSocketClient();
|
initSocketClient();
|
||||||
startLoop();
|
startLoop();
|
||||||
}
|
}
|
||||||
@@ -292,7 +294,7 @@ public class SocketService extends Service implements NetworkUtils.OnNetworkStat
|
|||||||
public void accept(Long s) throws Exception {
|
public void accept(Long s) throws Exception {
|
||||||
Log.d(TAG, "startLoop accept: " + s);
|
Log.d(TAG, "startLoop accept: " + s);
|
||||||
Log.i(TAG, "心跳包检测websocket连接状态");
|
Log.i(TAG, "心跳包检测websocket连接状态");
|
||||||
if (!ActivationUtil.isActivation()) {
|
if (!ActivationUtil.getInstance().isActivation()) {
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
//每隔一定的时间,对长连接进行一次心跳检测
|
//每隔一定的时间,对长连接进行一次心跳检测
|
||||||
@@ -320,7 +322,7 @@ public class SocketService extends Service implements NetworkUtils.OnNetworkStat
|
|||||||
* 初始化websocket连接
|
* 初始化websocket连接
|
||||||
*/
|
*/
|
||||||
private void initSocketClient() {
|
private void initSocketClient() {
|
||||||
URI uri = URI.create(BuildConfig.WEBSOCKET_URL + "?sn=" + RemoteManager.getInstance().getSerial());
|
URI uri = URI.create(BuildConfig.WEBSOCKET_URL + "?sn=" + LenovoCsdkUtil.getInstance().getSerial());
|
||||||
mJWebSocketClient = new JWebSocketClient(uri) {
|
mJWebSocketClient = new JWebSocketClient(uri) {
|
||||||
@Override
|
@Override
|
||||||
public void onMessage(String message) {
|
public void onMessage(String message) {
|
||||||
@@ -398,7 +400,7 @@ public class SocketService extends Service implements NetworkUtils.OnNetworkStat
|
|||||||
*/
|
*/
|
||||||
public void sendPingMsg() {
|
public void sendPingMsg() {
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
jsonObject.addProperty("sn", RemoteManager.getInstance().getSerial());
|
jsonObject.addProperty("sn", LenovoCsdkUtil.getInstance().getSerial());
|
||||||
jsonObject.addProperty("type", "ping");
|
jsonObject.addProperty("type", "ping");
|
||||||
if (null != mJWebSocketClient) {
|
if (null != mJWebSocketClient) {
|
||||||
Log.i(TAG, "sendPingMsg: 发送的消息:" + jsonObject.toString());
|
Log.i(TAG, "sendPingMsg: 发送的消息:" + jsonObject.toString());
|
||||||
@@ -408,7 +410,7 @@ public class SocketService extends Service implements NetworkUtils.OnNetworkStat
|
|||||||
|
|
||||||
public void sendMsgScreen() {
|
public void sendMsgScreen() {
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
jsonObject.addProperty("sn", RemoteManager.getInstance().getSerial());
|
jsonObject.addProperty("sn", LenovoCsdkUtil.getInstance().getSerial());
|
||||||
if (Utils.isScreenOn(SocketService.this)) {
|
if (Utils.isScreenOn(SocketService.this)) {
|
||||||
jsonObject.addProperty("type", "device_open_screen");
|
jsonObject.addProperty("type", "device_open_screen");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
package com.xuexispace.ai.utils;
|
package com.xuexispace.ai.utils;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
import com.tencent.mmkv.MMKV;
|
import com.tencent.mmkv.MMKV;
|
||||||
import com.xuexispace.ai.config.CommonConfig;
|
import com.xuexispace.ai.config.CommonConfig;
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public class ActivationUtil {
|
public class ActivationUtil {
|
||||||
|
|
||||||
private static MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
|
||||||
|
|
||||||
/*写入1为激活*/
|
/*写入1为激活*/
|
||||||
public static final int ACTIVATED_KEY = 1;
|
public static final int ACTIVATED_KEY = 1;
|
||||||
public static final int INACTIVATED_KEY = 0;
|
public static final int INACTIVATED_KEY = 0;
|
||||||
@@ -16,13 +15,38 @@ public class ActivationUtil {
|
|||||||
/*默认过期时间*/
|
/*默认过期时间*/
|
||||||
public static final int DEFAULT_EXPIRE_TIME = -1;
|
public static final int DEFAULT_EXPIRE_TIME = -1;
|
||||||
|
|
||||||
|
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||||
|
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
private static ActivationUtil sInstance;
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
private ActivationUtil(Context context) {
|
||||||
|
if (context == null) {
|
||||||
|
throw new RuntimeException("Context is NULL");
|
||||||
|
}
|
||||||
|
this.mContext = context.getApplicationContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init(Context context) {
|
||||||
|
if (sInstance == null) {
|
||||||
|
sInstance = new ActivationUtil(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ActivationUtil getInstance() {
|
||||||
|
if (sInstance == null) {
|
||||||
|
throw new IllegalStateException("You must be init ActivationUtil first");
|
||||||
|
}
|
||||||
|
return sInstance;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取激活状态
|
* 获取激活状态
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static int getActivationStateCode() {
|
public int getActivationStateCode() {
|
||||||
int activation = mMMKV.decodeInt(CommonConfig.UIUI_ACTIVATION_KEY, INACTIVATED_KEY);
|
int activation = mMMKV.decodeInt(CommonConfig.UIUI_ACTIVATION_KEY, INACTIVATED_KEY);
|
||||||
return activation;
|
return activation;
|
||||||
}
|
}
|
||||||
@@ -32,7 +56,7 @@ public class ActivationUtil {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean isActivation() {
|
public boolean isActivation() {
|
||||||
return getActivationStateCode() == ACTIVATED_KEY;
|
return getActivationStateCode() == ACTIVATED_KEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +65,7 @@ public class ActivationUtil {
|
|||||||
*
|
*
|
||||||
* @param code
|
* @param code
|
||||||
*/
|
*/
|
||||||
public static void setActivation(int code) {
|
public void setActivation(int code) {
|
||||||
mMMKV.encode(CommonConfig.UIUI_ACTIVATION_KEY, code);
|
mMMKV.encode(CommonConfig.UIUI_ACTIVATION_KEY, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +74,7 @@ public class ActivationUtil {
|
|||||||
*
|
*
|
||||||
* @param code
|
* @param code
|
||||||
*/
|
*/
|
||||||
public static void setActivationCodeType(int code) {
|
public void setActivationCodeType(int code) {
|
||||||
mMMKV.encode(CommonConfig.UIUI_CODE_TYPE_KEY, code);
|
mMMKV.encode(CommonConfig.UIUI_CODE_TYPE_KEY, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +83,7 @@ public class ActivationUtil {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static int getActivationCodeType() {
|
public int getActivationCodeType() {
|
||||||
return mMMKV.decodeInt(CommonConfig.UIUI_CODE_TYPE_KEY, DEFAULT_CODE_TYPE);
|
return mMMKV.decodeInt(CommonConfig.UIUI_CODE_TYPE_KEY, DEFAULT_CODE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +92,7 @@ public class ActivationUtil {
|
|||||||
*
|
*
|
||||||
* @param expireTime
|
* @param expireTime
|
||||||
*/
|
*/
|
||||||
public static void setActivationExpireTime(long expireTime) {
|
public void setActivationExpireTime(long expireTime) {
|
||||||
mMMKV.encode(CommonConfig.UIUI_EXPIRE_TIME_KEY, expireTime);
|
mMMKV.encode(CommonConfig.UIUI_EXPIRE_TIME_KEY, expireTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +101,7 @@ public class ActivationUtil {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static long getActivationExpireTime() {
|
public long getActivationExpireTime() {
|
||||||
return mMMKV.decodeLong(CommonConfig.UIUI_EXPIRE_TIME_KEY, DEFAULT_EXPIRE_TIME);
|
return mMMKV.decodeLong(CommonConfig.UIUI_EXPIRE_TIME_KEY, DEFAULT_EXPIRE_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ public class AppUsedTimeUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void sendRunningApp(RunningAppCallback runningAppCallback) {
|
public void sendRunningApp(RunningAppCallback runningAppCallback) {
|
||||||
boolean activation = ActivationUtil.isActivation();
|
boolean activation = ActivationUtil.getInstance().isActivation();
|
||||||
if (!activation) {
|
if (!activation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.xuexispace.ai.utils;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.csdk.CSDKManager;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.tencent.mmkv.MMKV;
|
||||||
|
import com.xuexispace.ai.BuildConfig;
|
||||||
|
import com.xuexispace.ai.config.CommonConfig;
|
||||||
|
|
||||||
|
public class LenovoCsdkUtil {
|
||||||
|
private static final String TAG = "LenovoCsdkUtil";
|
||||||
|
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
private static LenovoCsdkUtil sInstance;
|
||||||
|
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||||
|
private Context mContext;
|
||||||
|
private CSDKManager mCSDKManager;
|
||||||
|
|
||||||
|
|
||||||
|
private LenovoCsdkUtil(Context context) {
|
||||||
|
if (context == null) {
|
||||||
|
throw new RuntimeException("Context is NULL");
|
||||||
|
}
|
||||||
|
this.mContext = context;
|
||||||
|
this.mCSDKManager = new CSDKManager(context);
|
||||||
|
if (mCSDKManager.isLicenseKeyEnabled(BuildConfig.APPLICATION_ID)) {
|
||||||
|
Log.e(TAG, "LenovoCsdkUtil: devices activated");
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "LenovoCsdkUtil: devices not activated");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init(Context context) {
|
||||||
|
if (sInstance == null) {
|
||||||
|
Log.e(TAG, "init: ");
|
||||||
|
sInstance = new LenovoCsdkUtil(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LenovoCsdkUtil getInstance() {
|
||||||
|
if (sInstance == null) {
|
||||||
|
throw new IllegalStateException("You must be init LenovoCsdkUtil first");
|
||||||
|
}
|
||||||
|
return sInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* int: 1 MAC
|
||||||
|
* int: 2 SN
|
||||||
|
* int: 3 Model
|
||||||
|
* int: 4 IMEI
|
||||||
|
*/
|
||||||
|
public String getDeviceMac() {
|
||||||
|
String mac = mCSDKManager.getDeviceInfo(1);
|
||||||
|
return mac;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSerial() {
|
||||||
|
String sn = mCSDKManager.getDeviceInfo(2);
|
||||||
|
return sn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceModel() {
|
||||||
|
String model = mCSDKManager.getDeviceInfo(3);
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceIMEI() {
|
||||||
|
String imei = mCSDKManager.getDeviceInfo(4);
|
||||||
|
return imei;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -218,7 +218,7 @@ public class OpenApkUtils {
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
private void sendRuningApp(String packageName) {
|
private void sendRuningApp(String packageName) {
|
||||||
boolean activation = ActivationUtil.isActivation();
|
boolean activation = ActivationUtil.getInstance().isActivation();
|
||||||
if (!activation) {
|
if (!activation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 37 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 32 KiB |
@@ -20,16 +20,65 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<fragment
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/subjectFragment"
|
|
||||||
android:name="com.xuexispace.ai.fragment.subject.SubjectFragment"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/constraintLayout2"
|
app:layout_constraintBottom_toTopOf="@+id/constraintLayout2"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/constraintLayout15"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageView27"
|
||||||
|
android:layout_width="@dimen/dp_20"
|
||||||
|
android:layout_height="@dimen/dp_20"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:layout_marginStart="@dimen/dp_8"
|
||||||
|
android:onClick="@{click::exit}"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/icon_homework_back"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<com.flyco.tablayout.SlidingTabLayout
|
||||||
|
android:id="@+id/main_sliding_tab_layout"
|
||||||
|
android:layout_marginStart="@dimen/dp_8"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="@dimen/dp_24"
|
||||||
|
android:layout_marginTop="@dimen/dp_2"
|
||||||
|
android:visibility="visible"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/imageView27"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:tl_indicator_color="#FFFFFF"
|
||||||
|
app:tl_indicator_style="NORMAL"
|
||||||
|
app:tl_indicator_width_equal_title="true"
|
||||||
|
app:tl_tab_space_equal="false"
|
||||||
|
app:tl_textBold="SELECT"
|
||||||
|
app:tl_textSelectSize="@dimen/sp_13"
|
||||||
|
app:tl_textSize="@dimen/sp_11"
|
||||||
|
app:tl_textUnSelectSize="@dimen/sp_11" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<androidx.viewpager.widget.ViewPager
|
||||||
|
android:id="@+id/viewPager"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/constraintLayout15" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_robot"
|
android:id="@+id/iv_robot"
|
||||||
android:layout_width="@dimen/dp_40"
|
android:layout_width="@dimen/dp_40"
|
||||||
@@ -41,7 +90,7 @@
|
|||||||
android:src="@drawable/robot"
|
android:src="@drawable/robot"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/constraintLayout2"
|
app:layout_constraintBottom_toBottomOf="@+id/constraintLayout2"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/constraintLayout2"
|
app:layout_constraintEnd_toStartOf="@+id/constraintLayout2"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/magicIndicator" />
|
app:layout_constraintTop_toTopOf="@+id/constraintLayout2" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/constraintLayout2"
|
android:id="@+id/constraintLayout2"
|
||||||
|
|||||||
Reference in New Issue
Block a user