version:1.2.6
fix: update:同步最新代码
This commit is contained in:
@@ -17,8 +17,8 @@ android {
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 29
|
||||
|
||||
versionCode 26
|
||||
versionName "1.2.5"
|
||||
versionCode 27
|
||||
versionName "1.2.6"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
@@ -253,7 +253,20 @@
|
||||
<activity
|
||||
android:name=".eula.LicenseActivity"
|
||||
android:exported="false" />
|
||||
|
||||
<activity
|
||||
android:name=".activity.download.DownloadActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden|locale"
|
||||
android:exported="true"
|
||||
android:launchMode="standard"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:theme="@style/ActivityTheme2" />
|
||||
<activity
|
||||
android:name=".activity.app.OtherAppActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden|locale"
|
||||
android:exported="true"
|
||||
android:launchMode="standard"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:theme="@style/ActivityTheme2" />
|
||||
|
||||
<receiver
|
||||
android:name=".receiver.BootReceiver"
|
||||
@@ -335,6 +348,11 @@
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
|
||||
<service
|
||||
android:name=".service.RemoteService"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
|
||||
<receiver
|
||||
android:name=".receiver.InstallResultReceiver"
|
||||
android:enabled="true"
|
||||
|
||||
16
app/src/main/aidl/com/xwad/os/IGetInfoInterface.aidl
Normal file
16
app/src/main/aidl/com/xwad/os/IGetInfoInterface.aidl
Normal file
@@ -0,0 +1,16 @@
|
||||
// IGetInfoInterface.aidl
|
||||
package com.xwad.os;
|
||||
|
||||
// Declare any non-default types here with import statements
|
||||
|
||||
interface IGetInfoInterface {
|
||||
/**
|
||||
* Demonstrates some basic types that you can use as parameters
|
||||
* and return values in AIDL.
|
||||
*/
|
||||
void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat,
|
||||
double aDouble, String aString);
|
||||
|
||||
//获取sn
|
||||
String getSerial();
|
||||
}
|
||||
@@ -124,74 +124,20 @@ public class ExitActivity extends BaseDataBindingActivity {
|
||||
String password = mMMKV.decodeString(CommonConfig.LOCK_SCREEN_PASSWORD, CommonConfig.DEFAULT_PASSWORD);
|
||||
if ((!TextUtils.isEmpty(content) && !TextUtils.isEmpty(password))) {
|
||||
if (password.equals(content)) {
|
||||
// Utils.exitDesktop(this);
|
||||
exitDesktop();
|
||||
Utils.exitDesktop(this);
|
||||
} else {
|
||||
setEmpty();
|
||||
mBinding.tvHint.setText("密码错误");
|
||||
}
|
||||
} else if (CommonConfig.DEFAULT_PASSWORD.equals(content)) {
|
||||
// Utils.exitDesktop(this);
|
||||
exitDesktop();
|
||||
Utils.exitDesktop(this);
|
||||
} else {
|
||||
setEmpty();
|
||||
mBinding.tvHint.setText("密码错误");
|
||||
}
|
||||
}
|
||||
|
||||
private List<ComponentName> getAllLauncherApps() {
|
||||
PackageManager packageManager = getPackageManager();
|
||||
|
||||
// 构建用于查询桌面应用的Intent
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
intent.addCategory(Intent.CATEGORY_HOME);
|
||||
|
||||
// 查询所有可以处理该Intent的Activity
|
||||
List<ResolveInfo> resolveInfoList = packageManager.queryIntentActivities(intent, PackageManager.MATCH_ALL);
|
||||
|
||||
List<ComponentName> launcherPackageList = resolveInfoList.stream().filter(new Predicate<ResolveInfo>() {
|
||||
@Override
|
||||
public boolean test(ResolveInfo resolveInfo) {
|
||||
return !BuildConfig.APPLICATION_ID.equals(resolveInfo.activityInfo.packageName)
|
||||
|| !"com.jxw.launcher".equals(resolveInfo.activityInfo.packageName)
|
||||
|| !"com.handuan.os".equals(resolveInfo.activityInfo.packageName);
|
||||
}
|
||||
}).map(new Function<ResolveInfo, ComponentName>() {
|
||||
@Override
|
||||
public ComponentName apply(ResolveInfo resolveInfo) {
|
||||
return resolveInfo.getComponentInfo().getComponentName();
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return launcherPackageList;
|
||||
}
|
||||
|
||||
private void exitDesktop() {
|
||||
List<ComponentName> componentNames = getAllLauncherApps();
|
||||
Log.e(TAG, "exitDesktop: " + componentNames);
|
||||
if (componentNames != null && componentNames.size() != 0) {
|
||||
ComponentName componentName = componentNames.get(0);
|
||||
Intent intent = new Intent();
|
||||
intent.setComponent(componentName);
|
||||
try {
|
||||
startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "exitDesktop: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
startActivity(new Intent(Settings.ACTION_HOME_SETTINGS));
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
finishAndRemoveTask();
|
||||
} else {
|
||||
finishAffinity();
|
||||
}
|
||||
android.os.Process.killProcess(android.os.Process.myPid());
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
private void setEmpty() {
|
||||
private void setEmpty() {
|
||||
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -94,7 +94,7 @@ public class ActivationActivity extends BaseMvvmActivity<ActivationViewModel, Ac
|
||||
if (optional.isPresent()) {
|
||||
VipInfo vipInfo = optional.get();
|
||||
mViewDataBinding.tvPrice.setText("¥" + vipInfo.getPrice());
|
||||
mViewDataBinding.tvVipName.setText(vipInfo.getName());
|
||||
mViewDataBinding.tvVipName.setText("¥" + vipInfo.getOrigin_price());
|
||||
mViewDataBinding.tvVipPrice.setText("¥" + vipInfo.getPrice());
|
||||
mViewModel.getPayInfo(vipInfo.getId());
|
||||
}
|
||||
@@ -156,7 +156,7 @@ public class ActivationActivity extends BaseMvvmActivity<ActivationViewModel, Ac
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (pollingDisposable != null && pollingDisposable.isDisposed()) {
|
||||
if (pollingDisposable != null && !pollingDisposable.isDisposed()) {
|
||||
pollingDisposable.dispose();
|
||||
pollingDisposable = null;
|
||||
}
|
||||
|
||||
136
app/src/main/java/com/xwad/os/activity/app/OtherAppActivity.java
Normal file
136
app/src/main/java/com/xwad/os/activity/app/OtherAppActivity.java
Normal file
@@ -0,0 +1,136 @@
|
||||
package com.xwad.os.activity.app;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.xwad.os.R;
|
||||
import com.xwad.os.adapter.AppInfoAdapter;
|
||||
import com.xwad.os.base.mvvm.BaseMvvmActivity;
|
||||
import com.xwad.os.bean.AppInfo;
|
||||
import com.xwad.os.databinding.ActivityOtherAppBinding;
|
||||
import com.xwad.os.utils.ActivationUtil;
|
||||
import com.xwad.os.utils.ApkUtils;
|
||||
import com.xwad.os.utils.FileUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class OtherAppActivity extends BaseMvvmActivity<OtherAppViewModel, ActivityOtherAppBinding> {
|
||||
private static final String TAG = "DownloadActivity";
|
||||
|
||||
private AppInfoAdapter mAppInfoAdapter;
|
||||
private List<AppInfo> mAppInfos;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_other_app;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDataBinding() {
|
||||
mViewModel.setCtx(this);
|
||||
mViewModel.setLifecycle(getLifecycleSubject());
|
||||
mViewModel.setVDBinding(mViewDataBinding);
|
||||
mViewDataBinding.setClick(new BtnClick());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
mAppInfoAdapter = new AppInfoAdapter();
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 4);
|
||||
mViewDataBinding.rvContent.setLayoutManager(gridLayoutManager);
|
||||
mViewDataBinding.rvContent.setAdapter(mAppInfoAdapter);
|
||||
|
||||
registerAppChangedReceiver();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
mViewModel.mListMutableLiveData.observe(this, new Observer<List<AppInfo>>() {
|
||||
@Override
|
||||
public void onChanged(List<AppInfo> appInfos) {
|
||||
mAppInfos = appInfos;
|
||||
mAppInfoAdapter.setAppInfos(appInfos);
|
||||
if (appInfos == null || appInfos.isEmpty()) {
|
||||
mViewDataBinding.clContent.setVisibility(View.GONE);
|
||||
mViewDataBinding.llNodata.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mViewDataBinding.clContent.setVisibility(View.VISIBLE);
|
||||
mViewDataBinding.llNodata.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
mViewModel.getAdminApp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mAppChangedReceiver != null) {
|
||||
unregisterReceiver(mAppChangedReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
private AppChangedReceiver mAppChangedReceiver;
|
||||
|
||||
private void registerAppChangedReceiver() {
|
||||
if (mAppChangedReceiver == null) {
|
||||
mAppChangedReceiver = new AppChangedReceiver();
|
||||
}
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||
filter.addAction(Intent.ACTION_PACKAGE_ADDED);
|
||||
filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
|
||||
filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
|
||||
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
|
||||
filter.addDataScheme("package");
|
||||
registerReceiver(mAppChangedReceiver, filter);
|
||||
}
|
||||
|
||||
class AppChangedReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
Log.e("AppChangedReceiver", "onReceive: " + action);
|
||||
if (TextUtils.isEmpty(action)) {
|
||||
return;
|
||||
}
|
||||
mAppInfoAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public class BtnClick {
|
||||
public void exit(View view) {
|
||||
finish();
|
||||
}
|
||||
|
||||
public void downloadApp(View view) {
|
||||
if (mAppInfos == null || mAppInfos.isEmpty()) {
|
||||
Toaster.show("没有要下载的应用");
|
||||
} else {
|
||||
if (ActivationUtil.getInstance().isActivation()) {
|
||||
mAppInfos.forEach(new Consumer<AppInfo>() {
|
||||
@Override
|
||||
public void accept(AppInfo appInfo) {
|
||||
if (appInfo.getIs_must_components_down() == 1) {
|
||||
if (!ApkUtils.isAvailable(OtherAppActivity.this, appInfo.getApp_package())) {
|
||||
FileUtils.ariaDownload(OtherAppActivity.this, appInfo.getApp_url(), appInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.xwad.os.activity.app;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.xwad.os.base.mvvm.BaseViewModel;
|
||||
import com.xwad.os.bean.AppInfo;
|
||||
import com.xwad.os.bean.BaseResponse;
|
||||
import com.xwad.os.databinding.ActivityOtherAppBinding;
|
||||
import com.xwad.os.network.NetInterfaceManager;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class OtherAppViewModel extends BaseViewModel<ActivityOtherAppBinding, ActivityEvent> {
|
||||
|
||||
@Override
|
||||
public ActivityOtherAppBinding getVDBinding() {
|
||||
return binding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
|
||||
public MutableLiveData<List<AppInfo>> mListMutableLiveData = new MutableLiveData<>();
|
||||
|
||||
public void getAdminApp() {
|
||||
NetInterfaceManager.getInstance().get365AdminAppObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<List<AppInfo>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getAdminApp", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<AppInfo>> listBaseResponse) {
|
||||
Log.e("getAdminApp", "onNext: " + listBaseResponse);
|
||||
if (listBaseResponse.code == 200) {
|
||||
List<AppInfo> appInfoList = listBaseResponse.data;
|
||||
List<AppInfo> forceAppInfoList = appInfoList.stream()
|
||||
.filter(new Predicate<AppInfo>() {
|
||||
@Override
|
||||
public boolean test(AppInfo appInfo) {
|
||||
return appInfo.getIs_must_components() == 0;
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
mListMutableLiveData.setValue(forceAppInfoList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getAdminApp", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAdminApp", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.xwad.os.activity.download;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.graphics.Color;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.xwad.os.R;
|
||||
import com.xwad.os.activity.app.OtherAppActivity;
|
||||
import com.xwad.os.adapter.AppInfoAdapter;
|
||||
import com.xwad.os.base.mvvm.BaseMvvmActivity;
|
||||
import com.xwad.os.bean.AppInfo;
|
||||
import com.xwad.os.databinding.ActivityDownloadBinding;
|
||||
import com.xwad.os.utils.ActivationUtil;
|
||||
import com.xwad.os.utils.ApkUtils;
|
||||
import com.xwad.os.utils.FileUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class DownloadActivity extends BaseMvvmActivity<DownloadViewModel, ActivityDownloadBinding> {
|
||||
private static final String TAG = "DownloadActivity";
|
||||
|
||||
private AppInfoAdapter mAppInfoAdapter;
|
||||
private List<AppInfo> mAppInfos;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_download;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDataBinding() {
|
||||
mViewModel.setCtx(this);
|
||||
mViewModel.setLifecycle(getLifecycleSubject());
|
||||
mViewModel.setVDBinding(mViewDataBinding);
|
||||
mViewDataBinding.setClick(new BtnClick());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
mAppInfoAdapter = new AppInfoAdapter();
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 4);
|
||||
mViewDataBinding.rvContent.setLayoutManager(gridLayoutManager);
|
||||
mViewDataBinding.rvContent.setAdapter(mAppInfoAdapter);
|
||||
|
||||
SpannableString spannableString = new SpannableString(getResources().getString(R.string.bibeizujian_permission));
|
||||
spannableString.setSpan(new ForegroundColorSpan(Color.RED), 21, 35, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
mViewDataBinding.tvPermission.setText(spannableString);
|
||||
|
||||
registerAppChangedReceiver();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
mViewModel.mListMutableLiveData.observe(this, new Observer<List<AppInfo>>() {
|
||||
@Override
|
||||
public void onChanged(List<AppInfo> appInfos) {
|
||||
mAppInfos = appInfos;
|
||||
mAppInfoAdapter.setAppInfos(appInfos);
|
||||
if (appInfos == null || appInfos.isEmpty()) {
|
||||
mViewDataBinding.clContent.setVisibility(View.GONE);
|
||||
mViewDataBinding.llNodata.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mViewDataBinding.clContent.setVisibility(View.VISIBLE);
|
||||
mViewDataBinding.llNodata.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
mViewModel.getAdminApp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mAppChangedReceiver != null) {
|
||||
unregisterReceiver(mAppChangedReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
private AppChangedReceiver mAppChangedReceiver;
|
||||
|
||||
private void registerAppChangedReceiver() {
|
||||
if (mAppChangedReceiver == null) {
|
||||
mAppChangedReceiver = new AppChangedReceiver();
|
||||
}
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||
filter.addAction(Intent.ACTION_PACKAGE_ADDED);
|
||||
filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
|
||||
filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
|
||||
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
|
||||
filter.addDataScheme("package");
|
||||
registerReceiver(mAppChangedReceiver, filter);
|
||||
}
|
||||
|
||||
class AppChangedReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
Log.e("AppChangedReceiver", "onReceive: " + action);
|
||||
if (TextUtils.isEmpty(action)) {
|
||||
return;
|
||||
}
|
||||
mAppInfoAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public class BtnClick {
|
||||
public void exit(View view) {
|
||||
finish();
|
||||
}
|
||||
|
||||
public void openOtherApp(View view) {
|
||||
startActivity(new Intent(DownloadActivity.this, OtherAppActivity.class));
|
||||
}
|
||||
|
||||
public void downloadApp(View view) {
|
||||
if (mAppInfos == null || mAppInfos.isEmpty()) {
|
||||
Toaster.show("没有要下载的应用");
|
||||
} else {
|
||||
if (ActivationUtil.getInstance().isActivation()) {
|
||||
mAppInfos.forEach(new Consumer<AppInfo>() {
|
||||
@Override
|
||||
public void accept(AppInfo appInfo) {
|
||||
if (appInfo.getIs_must_components_down() == 1) {
|
||||
if (ApkUtils.isUpdate(DownloadActivity.this, appInfo)) {
|
||||
FileUtils.ariaDownload(DownloadActivity.this, appInfo.getApp_url(), appInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.xwad.os.activity.download;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
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.AppInfo;
|
||||
import com.xwad.os.bean.BaseResponse;
|
||||
import com.xwad.os.config.CommonConfig;
|
||||
import com.xwad.os.databinding.ActivityDownloadBinding;
|
||||
import com.xwad.os.network.NetInterfaceManager;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class DownloadViewModel extends BaseViewModel<ActivityDownloadBinding, ActivityEvent> {
|
||||
|
||||
MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
@Override
|
||||
public ActivityDownloadBinding getVDBinding() {
|
||||
return binding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public MutableLiveData<List<AppInfo>> mListMutableLiveData = new MutableLiveData<>();
|
||||
|
||||
public void getAdminApp() {
|
||||
NetInterfaceManager.getInstance().get365AdminAppObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<List<AppInfo>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getAdminApp", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<AppInfo>> listBaseResponse) {
|
||||
Log.e("getAdminApp", "onNext: " + listBaseResponse);
|
||||
if (listBaseResponse.code == 200) {
|
||||
List<AppInfo> appInfoList = listBaseResponse.data;
|
||||
List<AppInfo> forceAppInfoList = appInfoList.stream()
|
||||
.sorted(new Comparator<AppInfo>() {
|
||||
@Override
|
||||
public int compare(AppInfo o1, AppInfo o2) {
|
||||
if ("com.jxw.launcher".equals(o1.getApp_package()) && !"com.jxw.launcher".equals(o2.getApp_package())) {
|
||||
return -1;
|
||||
} else if (!"com.jxw.launcher".equals(o1.getApp_package()) && "com.jxw.launcher".equals(o2.getApp_package())) {
|
||||
return 1;
|
||||
} else {
|
||||
return o1.getApp_package().compareTo(o2.getApp_package()); // 非目标包名按字母排序
|
||||
}
|
||||
}
|
||||
})
|
||||
.filter(new Predicate<AppInfo>() {
|
||||
@Override
|
||||
public boolean test(AppInfo appInfo) {
|
||||
return appInfo.getIs_must_components() == 1;
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
mListMutableLiveData.setValue(forceAppInfoList);
|
||||
Set<String> packageSets = appInfoList.stream()
|
||||
.filter(new Predicate<AppInfo>() {
|
||||
@Override
|
||||
public boolean test(AppInfo appInfo) {
|
||||
return appInfo.getIs_must_components() == 1;
|
||||
}
|
||||
})
|
||||
.map(new Function<AppInfo, String>() {
|
||||
@Override
|
||||
public String apply(AppInfo appInfo) {
|
||||
return appInfo.getApp_package();
|
||||
}
|
||||
})
|
||||
.collect(Collectors.toSet());
|
||||
mMMKV.encode(CommonConfig.ESSENTIAL_COMPONENT_APPLICATIONS, packageSets);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getAdminApp", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAdminApp", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -175,12 +175,12 @@ public class HomeViewModel extends BaseViewModel<ActivityHomeBinding, ActivityEv
|
||||
.subscribe(new Observer<BaseResponse<AppUpdateInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("checkUpdateUiUiOS", "onSubscribe: ");
|
||||
Log.e("checkUpdate", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<AppUpdateInfo> appUpdateInfoBaseResponse) {
|
||||
Log.e("checkUpdateUiUiOS", "onNext: " + appUpdateInfoBaseResponse);
|
||||
Log.e("checkUpdate", "onNext: " + appUpdateInfoBaseResponse);
|
||||
if (appUpdateInfoBaseResponse.code == 200) {
|
||||
AppUpdateInfo appUpdateInfo = appUpdateInfoBaseResponse.data;
|
||||
mAppUpdateInfoUiUiOSData.setValue(appUpdateInfo);
|
||||
@@ -191,13 +191,13 @@ public class HomeViewModel extends BaseViewModel<ActivityHomeBinding, ActivityEv
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("checkUpdateUiUiOS", "onError: ");
|
||||
Log.e("checkUpdate", "onError: ");
|
||||
Toaster.show("网络连接失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("checkUpdateUiUiOS", "onComplete: ");
|
||||
Log.e("checkUpdate", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.view.View;
|
||||
import androidx.lifecycle.Observer;
|
||||
|
||||
import com.xwad.os.R;
|
||||
import com.xwad.os.activity.download.DownloadActivity;
|
||||
import com.xwad.os.activity.home.HomeActivity;
|
||||
import com.xwad.os.base.mvvm.BaseMvvmActivity;
|
||||
import com.xwad.os.databinding.ActivityLoginSuccessfulBinding;
|
||||
@@ -39,6 +40,12 @@ public class LoginSuccessfulActivity extends BaseMvvmActivity<LoginSuccessfulVie
|
||||
Utils.triggerRebirth(LoginSuccessfulActivity.this);
|
||||
}
|
||||
});
|
||||
mViewModel.mCompleteLiveData.observe(this, new Observer<Boolean>() {
|
||||
@Override
|
||||
public void onChanged(Boolean aBoolean) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,7 +64,9 @@ public class LoginSuccessfulActivity extends BaseMvvmActivity<LoginSuccessfulVie
|
||||
|
||||
public class BtnClick {
|
||||
public void toHome(View view) {
|
||||
mViewModel.getAppInfo();
|
||||
// mViewModel.getAppInfo();
|
||||
mViewModel.getAdminAppDownload();
|
||||
startActivity(new Intent(LoginSuccessfulActivity.this, DownloadActivity.class));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,13 @@ import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
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.AppInfo;
|
||||
import com.xwad.os.bean.BaseResponse;
|
||||
import com.xwad.os.config.CommonConfig;
|
||||
import com.xwad.os.databinding.ActivityLoginSuccessfulBinding;
|
||||
import com.xwad.os.jxw.JxwPackageConfig;
|
||||
import com.xwad.os.network.NetInterfaceManager;
|
||||
@@ -16,7 +19,11 @@ import com.xwad.os.utils.FileUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
@@ -27,11 +34,63 @@ import io.reactivex.rxjava3.functions.Function3;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
|
||||
public class LoginSuccessfulViewModel extends BaseViewModel<ActivityLoginSuccessfulBinding, ActivityEvent> {
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
|
||||
public MutableLiveData<Boolean> mCompleteLiveData = new MutableLiveData<>();
|
||||
|
||||
public void getAdminAppDownload() {
|
||||
NetInterfaceManager.getInstance().getAdminAppObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<List<AppInfo>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getAdminAppDownload", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<AppInfo>> listBaseResponse) {
|
||||
Log.e("getAdminAppDownload", "onNext: " + listBaseResponse);
|
||||
if (listBaseResponse.code == 200) {
|
||||
List<AppInfo> appInfoList = listBaseResponse.data;
|
||||
Set<String> packageSets = appInfoList.stream()
|
||||
.filter(new Predicate<AppInfo>() {
|
||||
@Override
|
||||
public boolean test(AppInfo appInfo) {
|
||||
return appInfo.getIs_must_components() == 1;
|
||||
}
|
||||
})
|
||||
.map(new Function<AppInfo, String>() {
|
||||
@Override
|
||||
public String apply(AppInfo appInfo) {
|
||||
return appInfo.getApp_package();
|
||||
}
|
||||
})
|
||||
.collect(Collectors.toSet());
|
||||
mMMKV.encode(CommonConfig.ESSENTIAL_COMPONENT_APPLICATIONS, packageSets);
|
||||
|
||||
}
|
||||
mCompleteLiveData.setValue(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getAdminAppDownload", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAdminAppDownload", "onComplete: ");
|
||||
mCompleteLiveData.setValue(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public MutableLiveData<Boolean> mBooleanMutableLiveData = new MutableLiveData<>();
|
||||
|
||||
public void getAppInfo() {
|
||||
|
||||
@@ -67,7 +67,7 @@ public class UpdateActivity extends BaseMvvmActivity<UpdateViewModel, ActivityUp
|
||||
DownloadEntity entity = Aria.download(this).getFirstDownloadEntity(mAppInfoData.getApp_url());
|
||||
if (null != entity) {
|
||||
if (entity.isComplete()) {
|
||||
ApkUtils.installApp(UpdateActivity.this, entity.getFilePath());
|
||||
ApkUtils.installApkFile(UpdateActivity.this, entity.getFilePath());
|
||||
} else {
|
||||
if (entity.getState() == STATE_RUNNING) {
|
||||
Toaster.show("文件正在下载中");
|
||||
|
||||
@@ -198,7 +198,11 @@ public class UserActivity extends BaseMvvmActivity<UserViewModel, ActivityUserBi
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if (ActivationUtil.getInstance().isLogin()) {
|
||||
mViewModel.getUserAvatarInfo();
|
||||
} else {
|
||||
setLocalData();
|
||||
}
|
||||
}
|
||||
|
||||
final static int DEBUGCOUNTS = 8;//点击次数
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.hjq.toast.Toaster;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xwad.os.BuildConfig;
|
||||
import com.xwad.os.R;
|
||||
import com.xwad.os.activity.ExitActivity;
|
||||
import com.xwad.os.activity.ManualActivity;
|
||||
import com.xwad.os.activity.PasswordActivity;
|
||||
import com.xwad.os.activity.activation.ActivationActivity;
|
||||
@@ -32,7 +31,6 @@ import com.xwad.os.manager.AppManager;
|
||||
import com.xwad.os.utils.ActivationUtil;
|
||||
import com.xwad.os.utils.ApkUtils;
|
||||
import com.xwad.os.utils.OpenApkUtils;
|
||||
import com.xwad.os.utils.Utils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
111
app/src/main/java/com/xwad/os/adapter/AppInfoAdapter.java
Normal file
111
app/src/main/java/com/xwad/os/adapter/AppInfoAdapter.java
Normal file
@@ -0,0 +1,111 @@
|
||||
package com.xwad.os.adapter;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xwad.os.R;
|
||||
import com.xwad.os.bean.AppInfo;
|
||||
import com.xwad.os.config.CommonConfig;
|
||||
import com.xwad.os.utils.ActivationUtil;
|
||||
import com.xwad.os.utils.ApkUtils;
|
||||
import com.xwad.os.utils.GlideLoadUtils;
|
||||
import com.xwad.os.utils.OpenApkUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import me.jessyan.autosize.AutoSizeCompat;
|
||||
|
||||
public class AppInfoAdapter extends RecyclerView.Adapter<AppInfoAdapter.Holder> {
|
||||
private static final String TAG = "AppInfoAdapter";
|
||||
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
private FragmentActivity mContext;
|
||||
|
||||
private List<AppInfo> mAppInfos;
|
||||
|
||||
public void setAppInfos(List<AppInfo> appInfos) {
|
||||
mAppInfos = appInfos;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = (FragmentActivity) parent.getContext();
|
||||
AutoSizeCompat.autoConvertDensityOfGlobal(mContext.getResources());
|
||||
return new AppInfoAdapter.Holder(LayoutInflater.from(mContext).inflate(R.layout.item_app_info, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||
AutoSizeCompat.autoConvertDensityOfGlobal(mContext.getResources());
|
||||
AppInfo appInfo = mAppInfos.get(position);
|
||||
GlideLoadUtils.getInstance().glideLoad(mContext, appInfo.getApp_img(), holder.iv_app_icon, R.drawable.icon_bbx_app);
|
||||
if (!TextUtils.isEmpty(appInfo.getApp_name())) {
|
||||
holder.tv_app_name.setText(appInfo.getApp_name());
|
||||
} else {
|
||||
holder.tv_app_name.setText("未知应用");
|
||||
}
|
||||
if (ApkUtils.isAvailable(mContext, appInfo.getApp_package())) {
|
||||
holder.iv_download.setVisibility(View.GONE);
|
||||
if (ApkUtils.isUpdate(mContext, appInfo)) {
|
||||
holder.iv_update.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.iv_update.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
holder.iv_download.setVisibility(View.VISIBLE);
|
||||
holder.iv_update.setVisibility(View.GONE);
|
||||
}
|
||||
holder.rl_root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (ApkUtils.isAvailable(mContext, appInfo.getApp_package())) {
|
||||
if (ApkUtils.isUpdate(mContext, appInfo)) {
|
||||
OpenApkUtils.getInstance().showDownloadDialog(mContext, appInfo, "\"" + appInfo.getApp_name() + "\"\n更新后可继续使用!");
|
||||
} else {
|
||||
ApkUtils.openPackage(mContext, appInfo.getApp_package());
|
||||
}
|
||||
} else {
|
||||
if (ActivationUtil.getInstance().isActivation()) {
|
||||
OpenApkUtils.getInstance().showDownloadDialog(mContext, appInfo, "未安装\"" + appInfo.getApp_name() + "\"\n下载后可继续使用!");
|
||||
} else {
|
||||
Toaster.show("请先激活设备");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mAppInfos == null ? 0 : mAppInfos.size();
|
||||
}
|
||||
|
||||
public class Holder extends RecyclerView.ViewHolder {
|
||||
ConstraintLayout rl_root;
|
||||
ImageView iv_app_icon, iv_download, iv_update;
|
||||
TextView tv_app_name;
|
||||
|
||||
public Holder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
rl_root = itemView.findViewById(R.id.rl_root);
|
||||
iv_app_icon = itemView.findViewById(R.id.iv_app_icon);
|
||||
iv_download = itemView.findViewById(R.id.iv_download);
|
||||
iv_update = itemView.findViewById(R.id.iv_update);
|
||||
tv_app_name = itemView.findViewById(R.id.tv_app_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,8 @@ public class AppInfo implements Serializable {
|
||||
private String use_type;
|
||||
private int is_autodown;
|
||||
private String third_url;
|
||||
private int is_must_components;
|
||||
private int is_must_components_down;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
@@ -209,6 +211,22 @@ public class AppInfo implements Serializable {
|
||||
this.third_url = third_url;
|
||||
}
|
||||
|
||||
public int getIs_must_components() {
|
||||
return is_must_components;
|
||||
}
|
||||
|
||||
public void setIs_must_components(int is_must_components) {
|
||||
this.is_must_components = is_must_components;
|
||||
}
|
||||
|
||||
public int getIs_must_components_down() {
|
||||
return is_must_components_down;
|
||||
}
|
||||
|
||||
public void setIs_must_components_down(int is_must_components_down) {
|
||||
this.is_must_components_down = is_must_components_down;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
@@ -1,10 +1,23 @@
|
||||
package com.xwad.os.config;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class CommonConfig {
|
||||
public static final String MMKV_ID = "InterProcessKV";
|
||||
|
||||
public static final String CLOUD_LESSON_SETTINGS_KEY = "cloud_lesson_settings_key";
|
||||
public static final String DISALLOWED_RUNNING_APP_KEY = "disallowed_running_app";
|
||||
public static final String ESSENTIAL_COMPONENT_APPLICATIONS = "essential_component_applications";
|
||||
public static final Set<String> ESSENTIAL_APPLICATIONS_SETS = new HashSet<String>() {{
|
||||
this.add("com.jxw.jpkc");
|
||||
this.add("com.jxw.zncd");
|
||||
this.add("com.jxw.question");
|
||||
this.add("com.jxw.launcher");
|
||||
this.add("com.jxw.tbdd");
|
||||
this.add("com.jxw.download");
|
||||
this.add("com.jxw.tbfd");
|
||||
}};
|
||||
|
||||
public static final String ALIYUN_PUSH_ID = "aliyun_push_id_key";
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@ import com.hjq.toast.Toaster;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xwad.os.R;
|
||||
import com.xwad.os.activity.ExitActivity;
|
||||
import com.xwad.os.activity.activation.ActivationActivity;
|
||||
import com.xwad.os.activity.download.DownloadActivity;
|
||||
import com.xwad.os.activity.login.LoginActivity;
|
||||
import com.xwad.os.activity.user.UserActivity;
|
||||
import com.xwad.os.base.mvvm.fragment.BaseMvvmFragment;
|
||||
import com.xwad.os.bean.SnInfo;
|
||||
@@ -25,9 +28,10 @@ import com.xwad.os.databinding.FragmentMineBinding;
|
||||
import com.xwad.os.jxw.StudyRecordMng;
|
||||
import com.xwad.os.jxw.ToastUtil;
|
||||
import com.xwad.os.jxw.event.UpdateColorEvent;
|
||||
import com.xwad.os.utils.ActivationUtil;
|
||||
import com.xwad.os.utils.OpenApkUtils;
|
||||
import com.xwad.os.utils.Utils;
|
||||
import com.xwad.os.view.jxw.view.dialog.QhbzDialog;
|
||||
import com.xwad.os.view.jxw.widget.DefaultAppsDialog;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
@@ -386,24 +390,41 @@ public class MineFragment extends BaseMvvmFragment<MineViewModel, FragmentMineBi
|
||||
}
|
||||
|
||||
public void exit(View view) {
|
||||
int toAndroid = mMMKV.decodeInt(CommonConfig.UIUI_RETURN_ANDROID_KEY, 0);
|
||||
if (toAndroid == 1) {
|
||||
startActivity(new Intent(mContext, ExitActivity.class));
|
||||
if (ActivationUtil.getInstance().isLogin()) {
|
||||
int toAndroid = mMMKV.decodeInt(CommonConfig.UIUI_RETURN_ANDROID_KEY, 0);
|
||||
if (toAndroid == 1) {
|
||||
startActivity(new Intent(mContext, ExitActivity.class));
|
||||
} else {
|
||||
Toaster.show("小程序已设置禁止退出");
|
||||
}
|
||||
} else {
|
||||
Toaster.show("小程序已设置禁止退出");
|
||||
Utils.exitDesktop(mContext);
|
||||
}
|
||||
// OpenApkUtils.getInstance().openJxwApp(mContext, "com.hihonor.android.launcher,com.hihonor.android.launcher.unihome.UniHomeLauncher,,,退出桌面");
|
||||
}
|
||||
|
||||
public void openAppsDialog(View view) {
|
||||
DefaultAppsDialog appsDialog = new DefaultAppsDialog(getActivity());
|
||||
appsDialog.show();
|
||||
appsDialog.setOnCallback(new DefaultAppsDialog.Callback() {
|
||||
@Override
|
||||
public void onCallback() {
|
||||
if (!ActivationUtil.getInstance().isLogin()) {
|
||||
Toaster.show("请先登录");
|
||||
startActivity(new Intent(mContext, LoginActivity.class));
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
if (!ActivationUtil.getInstance().isActivation()) {
|
||||
Toaster.show("请先激活后使用");
|
||||
startActivity(new Intent(mContext, ActivationActivity.class));
|
||||
return;
|
||||
}
|
||||
|
||||
startActivity(new Intent(mContext, DownloadActivity.class));
|
||||
// DefaultAppsDialog appsDialog = new DefaultAppsDialog(getActivity());
|
||||
// appsDialog.show();
|
||||
// appsDialog.setOnCallback(new DefaultAppsDialog.Callback() {
|
||||
// @Override
|
||||
// public void onCallback() {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
public void register(View view) {
|
||||
|
||||
@@ -29,7 +29,6 @@ import com.arialyy.aria.core.task.DownloadTask;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xwad.os.R;
|
||||
import com.xwad.os.activity.ExitActivity;
|
||||
import com.xwad.os.activity.homework.HomeworkActivity;
|
||||
import com.xwad.os.activity.more.MoreAppActivity;
|
||||
import com.xwad.os.activity.user.UserActivity;
|
||||
@@ -48,7 +47,6 @@ import com.xwad.os.jxw.JxwPackageConfig;
|
||||
import com.xwad.os.jxw.SPUtils;
|
||||
import com.xwad.os.utils.OpenApkUtils;
|
||||
import com.xwad.os.utils.TimeUtils;
|
||||
import com.xwad.os.utils.Utils;
|
||||
import com.xwad.os.view.RecyclerViewSpacesItemDecoration;
|
||||
import com.xwad.os.view.VerticalDecorationWithoutFirst;
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.hjq.toast.Toaster;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xwad.os.R;
|
||||
import com.xwad.os.activity.activation.ActivationActivity;
|
||||
import com.xwad.os.activity.download.DownloadActivity;
|
||||
import com.xwad.os.activity.login.LoginActivity;
|
||||
import com.xwad.os.base.mvvm.fragment.BaseMvvmFragment;
|
||||
import com.xwad.os.bean.UserInfo;
|
||||
@@ -28,11 +29,8 @@ import com.xwad.os.fragment.dialog.login.account.AccountLoginDialogFragment;
|
||||
import com.xwad.os.fragment.dialog.login.code.CodeLoginDialogFragment;
|
||||
import com.xwad.os.fragment.dialog.login.statu.LoginStatuDialogFragment;
|
||||
import com.xwad.os.fragment.dialog.viplist.VipListDialogFragment;
|
||||
import com.xwad.os.jxw.JxwPackageConfig;
|
||||
import com.xwad.os.utils.ActivationUtil;
|
||||
import com.xwad.os.utils.ApkUtils;
|
||||
import com.xwad.os.utils.OpenApkUtils;
|
||||
import com.xwad.os.view.jxw.widget.DefaultAppsDialog;
|
||||
|
||||
|
||||
public class AccountFragment extends BaseMvvmFragment<AccountViewModel, FragmentAccountBinding> {
|
||||
@@ -87,15 +85,16 @@ public class AccountFragment extends BaseMvvmFragment<AccountViewModel, Fragment
|
||||
if (vipLevel != null && !TextUtils.isEmpty(vipLevel.getName())) {
|
||||
mViewDataBinding.tvVipName.setText(vipLevel.getName());
|
||||
}
|
||||
if (!ApkUtils.isAvailable(getCtx(), JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME)) {
|
||||
mViewModel.getAppInfo(JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME);
|
||||
}
|
||||
if (!ApkUtils.isAvailable(getCtx(), "com.jxw.download")) {
|
||||
mViewModel.getAppInfo("com.jxw.download");
|
||||
}
|
||||
if (!ApkUtils.isAvailable(getCtx(), "com.study.flashplayer")) {
|
||||
mViewModel.getAppInfo("com.study.flashplayer");
|
||||
}
|
||||
// if (!ApkUtils.isAvailable(getCtx(), JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME)) {
|
||||
// mViewModel.getAppInfo(JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME);
|
||||
// }
|
||||
// if (!ApkUtils.isAvailable(getCtx(), "com.jxw.download")) {
|
||||
// mViewModel.getAppInfo("com.jxw.download");
|
||||
// }
|
||||
// if (!ApkUtils.isAvailable(getCtx(), "com.study.flashplayer")) {
|
||||
// mViewModel.getAppInfo("com.study.flashplayer");
|
||||
// }
|
||||
// mViewModel.getAdminAppDownload();
|
||||
mViewModel.getActivation();
|
||||
} else {
|
||||
mViewDataBinding.tvVipName.setText("学王365AI旗舰版");
|
||||
@@ -104,6 +103,8 @@ public class AccountFragment extends BaseMvvmFragment<AccountViewModel, Fragment
|
||||
}
|
||||
});
|
||||
mViewModel.getUserInfo();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -139,8 +140,9 @@ public class AccountFragment extends BaseMvvmFragment<AccountViewModel, Fragment
|
||||
if (intent != null && result.getResultCode() == Activity.RESULT_OK) {
|
||||
mViewModel.getUserInfo();
|
||||
|
||||
DefaultAppsDialog appsDialog = new DefaultAppsDialog(getActivity());
|
||||
appsDialog.show();
|
||||
startActivity(new Intent(mContext, DownloadActivity.class));
|
||||
// DefaultAppsDialog appsDialog = new DefaultAppsDialog(getActivity());
|
||||
// appsDialog.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,14 @@ import com.xwad.os.config.CommonConfig;
|
||||
import com.xwad.os.databinding.FragmentAccountBinding;
|
||||
import com.xwad.os.network.NetInterfaceManager;
|
||||
import com.xwad.os.utils.ActivationUtil;
|
||||
import com.xwad.os.utils.ApkUtils;
|
||||
import com.xwad.os.utils.FileUtils;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
@@ -107,6 +113,7 @@ public class AccountViewModel extends BaseViewModel<FragmentAccountBinding, Frag
|
||||
|
||||
public void getAppInfo(String pkg) {
|
||||
NetInterfaceManager.getInstance().getAdminAppObservable(pkg)
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<AppInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
@@ -135,4 +142,63 @@ public class AccountViewModel extends BaseViewModel<FragmentAccountBinding, Frag
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getAdminAppDownload() {
|
||||
NetInterfaceManager.getInstance().getAdminAppObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<List<AppInfo>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getAdminAppDownload", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<AppInfo>> listBaseResponse) {
|
||||
Log.e("getAdminAppDownload", "onNext: " + listBaseResponse);
|
||||
if (listBaseResponse.code == 200) {
|
||||
List<AppInfo> appInfoList = listBaseResponse.data;
|
||||
appInfoList.stream()
|
||||
.sorted(new Comparator<AppInfo>() {
|
||||
@Override
|
||||
public int compare(AppInfo o1, AppInfo o2) {
|
||||
if ("com.jxw.launcher".equals(o1.getApp_package()) && !"com.jxw.launcher".equals(o2.getApp_package())) {
|
||||
return -1;
|
||||
} else if (!"com.jxw.launcher".equals(o1.getApp_package()) && "com.jxw.launcher".equals(o2.getApp_package())) {
|
||||
return 1;
|
||||
} else {
|
||||
return o1.getApp_package().compareTo(o2.getApp_package()); // 非目标包名按字母排序
|
||||
}
|
||||
}
|
||||
})
|
||||
.filter(new Predicate<AppInfo>() {
|
||||
@Override
|
||||
public boolean test(AppInfo appInfo) {
|
||||
return appInfo.getIs_must_components() == 1;
|
||||
}
|
||||
})
|
||||
.forEach(new Consumer<AppInfo>() {
|
||||
@Override
|
||||
public void accept(AppInfo appInfo) {
|
||||
if (appInfo.getIs_must_components_down() == 1) {
|
||||
if (!ApkUtils.isAvailable(getCtx(), appInfo.getApp_package())) {
|
||||
FileUtils.ariaDownload(getCtx(), appInfo.getApp_url(), appInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getAdminAppDownload", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAdminAppDownload", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,6 +132,11 @@ public class InfoFragment extends BaseMvvmFragment<InfoViewModel, FragmentInfoBi
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (ActivationUtil.getInstance().isLogin()) {
|
||||
mViewModel.getSnInfo();
|
||||
} else {
|
||||
getLocalData();
|
||||
}
|
||||
}
|
||||
|
||||
private void getLocalData() {
|
||||
|
||||
@@ -848,12 +848,12 @@ public class ControlManager {
|
||||
|
||||
public void setTopNotify(int status) {
|
||||
Log.e(TAG, "setTopNotify: " + status);
|
||||
// AdminManager.getInstance().setStatusBarExpandPanelDisabled(status);
|
||||
mMMKV.encode(CommonConfig.ShowStatusBarExpandPanel, status);
|
||||
}
|
||||
|
||||
public void setBottomBar(int status) {
|
||||
Log.e(TAG, "setBottomBar: " + status);
|
||||
// AdminManager.getInstance().setNavigationBarDisabled(status);
|
||||
mMMKV.encode(CommonConfig.ShowNavigationBar, status);
|
||||
}
|
||||
|
||||
public void setAppNotify(int status) {
|
||||
|
||||
@@ -24,7 +24,6 @@ public class DeviceSNManager {
|
||||
/**
|
||||
* 获取设备SN,如果不存在则创建新的
|
||||
*/
|
||||
@Deprecated
|
||||
public static String getDeviceSN() {
|
||||
String existingSN = mMMKV.decodeString(SN_KEY, "");
|
||||
|
||||
|
||||
@@ -465,6 +465,13 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<List<AppInfo>>> getTestAppObservable() {
|
||||
return getAppApi()
|
||||
.getTestApp(DeviceSNManager.getDeviceSN())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse> getPhoneCodeObservable(String mobile) {
|
||||
return mRetrofit.create(LoginApi.class)
|
||||
.getCode(mobile)
|
||||
@@ -537,28 +544,35 @@ public class NetInterfaceManager {
|
||||
|
||||
public Observable<BaseResponse<ScreenPassword>> getLockScreenPwdObservable() {
|
||||
return getSnInfoApi()
|
||||
.getLockScreenPwd(Utils.getSerial())
|
||||
.getLockScreenPwd(DeviceSNManager.getDeviceSN())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse> getUpdateLockScreenObservable() {
|
||||
return mRetrofit.create(SnInfoApi.class)
|
||||
.updateLockScreen(Utils.getSerial())
|
||||
.updateLockScreen(DeviceSNManager.getDeviceSN())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<List<AppInfo>>> getAdminAppObservable() {
|
||||
return mRetrofit.create(AppApi.class)
|
||||
.getAdminApp(Utils.getSerial())
|
||||
.getAdminApp(DeviceSNManager.getDeviceSN())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<List<AppInfo>>> get365AdminAppObservable() {
|
||||
return mRetrofit.create(AppApi.class)
|
||||
.getAdminApp(DeviceSNManager.getDeviceSN(), "11", BuildConfig.APPLICATION_ID)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<List<AppIcon>>> getAppIconObservable() {
|
||||
return mRetrofit.create(GetAppIconApi.class)
|
||||
.getAppIcon(Utils.getSerial())
|
||||
.getAppIcon(DeviceSNManager.getDeviceSN())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
@@ -1075,7 +1089,7 @@ public class NetInterfaceManager {
|
||||
Log.e(TAG, "updateAdminInfo: software = " + software);
|
||||
}
|
||||
getSnInfoApi().sendAdminSn(
|
||||
Utils.getSerial(),
|
||||
DeviceSNManager.getDeviceSN(),
|
||||
"",
|
||||
machine,
|
||||
hardware,
|
||||
@@ -1241,7 +1255,7 @@ public class NetInterfaceManager {
|
||||
public ObservableSource<BaseResponse> apply(String s) throws Throwable {
|
||||
Log.e("SendAppInstallInfo", "apply: " + s);
|
||||
return getAppApi()
|
||||
.installorRemove(Utils.getSerial(), s);
|
||||
.installorRemove(DeviceSNManager.getDeviceSN(), s);
|
||||
}
|
||||
}).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@@ -1298,7 +1312,7 @@ public class NetInterfaceManager {
|
||||
MultipartBody.Part body = MultipartBody.Part.createFormData("file", file.getName(), fileBody);
|
||||
Map<String, RequestBody> params = new HashMap<>();
|
||||
params.put("package", NetInterfaceManager.convertToRequestBody(packageInfo.packageName));
|
||||
Call<BaseResponse> call = getUploadAppImgApi().uploadAppImg(Utils.getSerial(), params, body);
|
||||
Call<BaseResponse> call = getUploadAppImgApi().uploadAppImg(DeviceSNManager.getDeviceSN(), params, body);
|
||||
call.enqueue(new RetryCallback<BaseResponse>(call, 1, 30 * 1000) {
|
||||
@Override
|
||||
public void onRequestResponse(Call call, retrofit2.Response response) {
|
||||
@@ -1334,7 +1348,7 @@ public class NetInterfaceManager {
|
||||
public void screenshot() {
|
||||
// String path = mContext.getExternalFilesDir("db").getAbsolutePath();
|
||||
String path = ContextCompat.getExternalFilesDirs(mContext, Environment.DIRECTORY_DOWNLOADS)[0].getAbsolutePath();
|
||||
String filePath = path + File.separator + Utils.getSerial() + ".png";
|
||||
String filePath = path + File.separator + DeviceSNManager.getDeviceSN() + ".png";
|
||||
getScreenshot(filePath).concatMap(new Function<Integer, ObservableSource<BaseResponse>>() {
|
||||
@Override
|
||||
public ObservableSource<BaseResponse> apply(Integer integer) throws Exception {
|
||||
@@ -1406,7 +1420,7 @@ public class NetInterfaceManager {
|
||||
|
||||
private Observable<BaseResponse> getSendFile(String path, MultipartBody.Part body) {
|
||||
return getUploadScreenshotControl()
|
||||
.getControlScreenshot(Utils.getSerial(), body)
|
||||
.getControlScreenshot(DeviceSNManager.getDeviceSN(), body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
@@ -39,6 +39,8 @@ public class UrlAddress {
|
||||
public final static String APP_FORCE_INSTALL = "app/force-install";
|
||||
/*根据包名获取更新*/
|
||||
public final static String GET_NEWEST_APPUPDATE = "app/newestAppUpdate";
|
||||
/*获取灰度更新*/
|
||||
public static final String GET_TEST_APP_INFO = "app/getTestAppInfo";
|
||||
/*发送卸载或者安装信息*/
|
||||
public final static String SEND_INSTALLEDORREMOVED = "app/addAppInstall";
|
||||
|
||||
|
||||
@@ -14,6 +14,18 @@ import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface AppApi {
|
||||
@GET(UrlAddress.GET_ADMIN_APP)
|
||||
Observable<BaseResponse<List<AppInfo>>> getAdminApp(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
|
||||
@GET(UrlAddress.GET_ADMIN_APP)
|
||||
Observable<BaseResponse<List<AppInfo>>> getAdminApp(
|
||||
@Query("sn") String sn,
|
||||
@Query("class_id") String class_id,
|
||||
@Query("desktop_package") String desktop_package
|
||||
);
|
||||
|
||||
@GET(UrlAddress.APP_FORCE_INSTALL)
|
||||
Observable<BaseResponse<AppInfo>> getAdminApp(
|
||||
@Query("desktop_app_package") String desktop_app_package,
|
||||
@@ -27,15 +39,15 @@ public interface AppApi {
|
||||
@Query("type") int type
|
||||
);
|
||||
|
||||
@GET(UrlAddress.GET_TEST_APP_INFO)
|
||||
Observable<BaseResponse<List<AppInfo>>> getTestApp(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(UrlAddress.SEND_INSTALLEDORREMOVED)
|
||||
Observable<BaseResponse> installorRemove(
|
||||
@Field("sn") String sn,
|
||||
@Field("app") String jsonString
|
||||
);
|
||||
|
||||
@GET(UrlAddress.GET_ADMIN_APP)
|
||||
Observable<BaseResponse<List<AppInfo>>> getAdminApp(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
@@ -29,12 +28,12 @@ import com.xwad.os.disklrucache.CacheHelper;
|
||||
import com.xwad.os.fragment.user.UserFragment;
|
||||
import com.xwad.os.gson.GsonUtils;
|
||||
import com.xwad.os.manager.ControlManager;
|
||||
import com.xwad.os.manager.DeviceSNManager;
|
||||
import com.xwad.os.network.NetInterfaceManager;
|
||||
import com.xwad.os.network.RetryCallback;
|
||||
import com.xwad.os.service.ManagerService;
|
||||
import com.xwad.os.service.main.MainService;
|
||||
import com.xwad.os.utils.ApkUtils;
|
||||
import com.xwad.os.utils.BitmapUtils;
|
||||
import com.xwad.os.utils.FileUtils;
|
||||
import com.xwad.os.utils.JgyUtils;
|
||||
import com.xwad.os.utils.ServiceAliveUtils;
|
||||
@@ -818,9 +817,9 @@ public class PushManager {
|
||||
//设置一个file文件
|
||||
MultipartBody.Part body = MultipartBody.Part.createFormData("file", file.getName(), fileBody);
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("sn", Utils.getSerial(mContext));
|
||||
params.put("sn", DeviceSNManager.getDeviceSN());
|
||||
params.put("createtime", String.valueOf(time));
|
||||
Call<BaseResponse> call = NetInterfaceManager.getInstance().getUploadScreenshotControl().uploadScreenshotCall(Utils.getSerial(mContext), body);
|
||||
Call<BaseResponse> call = NetInterfaceManager.getInstance().getUploadScreenshotControl().uploadScreenshotCall(DeviceSNManager.getDeviceSN(), body);
|
||||
call.enqueue(new RetryCallback<BaseResponse>(call, 10, 30 * 1000) {
|
||||
@Override
|
||||
public void onRequestResponse(Call call, Response response) {
|
||||
|
||||
@@ -204,7 +204,7 @@ public class DownloadService extends Service {
|
||||
@Download.onTaskComplete
|
||||
void taskComplete(DownloadTask task) {
|
||||
Log.e(TAG, "taskComplete: " + task.getFilePath());
|
||||
ApkUtils.installApp(DownloadService.this, task.getFilePath());
|
||||
ApkUtils.installApkFile(DownloadService.this, task.getFilePath());
|
||||
String jsonString = task.getExtendField();
|
||||
Log.e(TAG, "taskComplete: " + "下载完成:" + jsonString);
|
||||
AriaDownloadInfo ariaDownloadInfo = getAriaDownloadInfo(jsonString);
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.xwad.os.R;
|
||||
import com.xwad.os.bean.BaseResponse;
|
||||
import com.xwad.os.config.CommonConfig;
|
||||
import com.xwad.os.gson.GsonUtils;
|
||||
import com.xwad.os.manager.DeviceSNManager;
|
||||
import com.xwad.os.network.NetInterfaceManager;
|
||||
import com.xwad.os.receiver.ApkInstallReceiver;
|
||||
import com.xwad.os.receiver.BootReceiver;
|
||||
@@ -275,7 +276,7 @@ public class ManagerService extends Service implements NetworkUtils.OnNetworkSta
|
||||
private void getScreenLockState() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getSnInfoApi()
|
||||
.getScreenshot(Utils.getSerial())
|
||||
.getScreenshot(DeviceSNManager.getDeviceSN())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
|
||||
52
app/src/main/java/com/xwad/os/service/RemoteService.java
Normal file
52
app/src/main/java/com/xwad/os/service/RemoteService.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package com.xwad.os.service;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xwad.os.IGetInfoInterface;
|
||||
import com.xwad.os.config.CommonConfig;
|
||||
import com.xwad.os.manager.DeviceSNManager;
|
||||
import com.xwad.os.utils.Utils;
|
||||
|
||||
public class RemoteService extends Service {
|
||||
private static final String TAG = "RemoteService";
|
||||
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
public RemoteService() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
Log.e(TAG, "onBind: ");
|
||||
return mBinde;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
Log.e(TAG, "onCreate: ");
|
||||
super.onCreate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
Log.e(TAG, "onStartCommand: ");
|
||||
return super.onStartCommand(intent, flags, startId);
|
||||
}
|
||||
|
||||
private IBinder mBinde = new IGetInfoInterface.Stub() {
|
||||
@Override
|
||||
public void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat, double aDouble, String aString) throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSerial() throws RemoteException {
|
||||
return DeviceSNManager.getDeviceSN();
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -54,6 +54,8 @@ public class MainSContact {
|
||||
void getTestApp();
|
||||
/*获取管理员应用*/
|
||||
void getAdminApp();
|
||||
|
||||
void getAdminAppDownload();
|
||||
/*获取id管控*/
|
||||
void getAppInside();
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.xwad.os.service.main;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
@@ -14,7 +17,7 @@ import com.xwad.os.bean.BaseResponse;
|
||||
import com.xwad.os.bean.UserInfo;
|
||||
import com.xwad.os.config.CommonConfig;
|
||||
import com.xwad.os.gson.GsonUtils;
|
||||
import com.xwad.os.jxw.JxwPackageConfig;
|
||||
import com.xwad.os.manager.DeviceSNManager;
|
||||
import com.xwad.os.network.NetInterfaceManager;
|
||||
import com.xwad.os.service.ManagerService;
|
||||
import com.xwad.os.utils.ActivationUtil;
|
||||
@@ -23,8 +26,12 @@ import com.xwad.os.utils.FileUtils;
|
||||
import com.xwad.os.utils.ServiceAliveUtils;
|
||||
import com.xwad.os.utils.Utils;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
@@ -114,15 +121,16 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
UserInfo userInfo = userInfoBaseResponse.data;
|
||||
int vip_level_id = userInfo.getVip_level_id();
|
||||
if (vip_level_id != 0) {
|
||||
if (!ApkUtils.isAvailable(mContext, JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME)) {
|
||||
getAppInfo(JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME);
|
||||
}
|
||||
if (!ApkUtils.isAvailable(mContext, "com.jxw.download")) {
|
||||
getAppInfo("com.jxw.download");
|
||||
}
|
||||
if (!ApkUtils.isAvailable(mContext, "com.study.flashplayer")) {
|
||||
getAppInfo("com.study.flashplayer");
|
||||
}
|
||||
// if (!ApkUtils.isAvailable(mContext, JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME)) {
|
||||
// getAppInfo(JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME);
|
||||
// }
|
||||
// if (!ApkUtils.isAvailable(mContext, "com.jxw.download")) {
|
||||
// getAppInfo("com.jxw.download");
|
||||
// }
|
||||
// if (!ApkUtils.isAvailable(mContext, "com.study.flashplayer")) {
|
||||
// getAppInfo("com.study.flashplayer");
|
||||
// }
|
||||
getAdminAppDownload();
|
||||
}
|
||||
|
||||
} else if (userInfoBaseResponse.code == 401) {
|
||||
@@ -224,7 +232,7 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
public void getScreenLock() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getSnInfoApi()
|
||||
.getScreenshot(Utils.getSerial())
|
||||
.getScreenshot(DeviceSNManager.getDeviceSN())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
@@ -282,12 +290,68 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void getTestApp() {
|
||||
NetInterfaceManager.getInstance().getTestAppObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<List<AppInfo>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getTestApp", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<AppInfo>> listBaseResponse) {
|
||||
Log.e("getTestApp", "onNext: " + listBaseResponse);
|
||||
if (listBaseResponse.code == 200) {
|
||||
List<AppInfo> appInfos = listBaseResponse.data;
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
appInfos.forEach(new Consumer<AppInfo>() {
|
||||
@Override
|
||||
public void accept(AppInfo appInfo) {
|
||||
String packages = appInfo.getApp_package();
|
||||
long app_version_code = appInfo.getApp_version_code();
|
||||
PackageInfo packageInfo = null;
|
||||
try {
|
||||
packageInfo = pm.getPackageInfo(packages, 0);
|
||||
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (packageInfo != null) {
|
||||
long appVersionCode;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
appVersionCode = packageInfo.getLongVersionCode();
|
||||
} else {
|
||||
appVersionCode = packageInfo.versionCode;
|
||||
}
|
||||
if (app_version_code > appVersionCode) {
|
||||
FileUtils.ariaDownload(mContext, appInfo.getApp_url(), appInfo);
|
||||
} else {
|
||||
Log.e("getTestApp", "intallApk: " + packages + " is up to date");
|
||||
}
|
||||
} else {
|
||||
FileUtils.ariaDownload(mContext, appInfo.getApp_url(), appInfo);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getTestApp", "onError: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getTestApp", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAdminApp() {
|
||||
NetInterfaceManager.getInstance().getAdminAppObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<List<AppInfo>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
@@ -319,6 +383,82 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAdminAppDownload() {
|
||||
NetInterfaceManager.getInstance().getAdminAppObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<List<AppInfo>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getAdminAppDownload", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<AppInfo>> listBaseResponse) {
|
||||
Log.e("getAdminAppDownload", "onNext: " + listBaseResponse);
|
||||
if (listBaseResponse.code == 200) {
|
||||
List<AppInfo> appInfoList = listBaseResponse.data;
|
||||
appInfoList.stream()
|
||||
.sorted(new Comparator<AppInfo>() {
|
||||
@Override
|
||||
public int compare(AppInfo o1, AppInfo o2) {
|
||||
if ("com.jxw.launcher".equals(o1.getApp_package()) && !"com.jxw.launcher".equals(o2.getApp_package())) {
|
||||
return -1;
|
||||
} else if (!"com.jxw.launcher".equals(o1.getApp_package()) && "com.jxw.launcher".equals(o2.getApp_package())) {
|
||||
return 1;
|
||||
} else {
|
||||
return o1.getApp_package().compareTo(o2.getApp_package()); // 非目标包名按字母排序
|
||||
}
|
||||
}
|
||||
})
|
||||
.filter(new Predicate<AppInfo>() {
|
||||
@Override
|
||||
public boolean test(AppInfo appInfo) {
|
||||
return appInfo.getIs_must_components() == 1;
|
||||
}
|
||||
})
|
||||
.forEach(new Consumer<AppInfo>() {
|
||||
@Override
|
||||
public void accept(AppInfo appInfo) {
|
||||
if (appInfo.getIs_must_components_down() == 1) {
|
||||
if (!ApkUtils.isAvailable(mContext, appInfo.getApp_package())) {
|
||||
// FileUtils.ariaDownload(mContext, appInfo.getApp_url(), appInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Set<String> packageSets = appInfoList.stream()
|
||||
.filter(new Predicate<AppInfo>() {
|
||||
@Override
|
||||
public boolean test(AppInfo appInfo) {
|
||||
return appInfo.getIs_must_components() == 1;
|
||||
}
|
||||
})
|
||||
.map(new Function<AppInfo, String>() {
|
||||
@Override
|
||||
public String apply(AppInfo appInfo) {
|
||||
return appInfo.getApp_package();
|
||||
}
|
||||
})
|
||||
.collect(Collectors.toSet());
|
||||
mMMKV.encode(CommonConfig.ESSENTIAL_COMPONENT_APPLICATIONS, packageSets);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getAdminAppDownload", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAdminAppDownload", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppInside() {
|
||||
|
||||
|
||||
@@ -96,7 +96,9 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
|
||||
mPresenter.updateDeviceInfo();
|
||||
mPresenter.getAppIcon();
|
||||
mPresenter.getScreenLock();
|
||||
mPresenter.getTestApp();
|
||||
mPresenter.getAdminApp();
|
||||
mPresenter.getAdminAppDownload();
|
||||
mPresenter.getSystemSettings();
|
||||
mPresenter.getLockScreenPwd();
|
||||
|
||||
|
||||
@@ -597,6 +597,7 @@ public class ApkUtils {
|
||||
* @param context 上下文
|
||||
* @param filePath apk文件路径
|
||||
*/
|
||||
@Deprecated
|
||||
public static void installApp(Context context, String filePath) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
installAppatPie(context, filePath);
|
||||
@@ -853,9 +854,9 @@ public class ApkUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isUpdate(Context context, AppInfo appUpdateInfo) {
|
||||
String packageName = appUpdateInfo.getApp_package();
|
||||
long versionCode = appUpdateInfo.getApp_version_code();
|
||||
public static boolean isUpdate(Context context, AppInfo appInfo) {
|
||||
String packageName = appInfo.getApp_package();
|
||||
long versionCode = appInfo.getApp_version_code();
|
||||
return isUpdate(context, packageName, versionCode);
|
||||
}
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ public class FileUtils {
|
||||
String fileMd5 = com.blankj.utilcode.util.FileUtils.getFileMD5ToString(file);
|
||||
Log.e("ariaDownload", "fileMD5 = " + fileMd5);
|
||||
if (fileMd5.equalsIgnoreCase(app_md5)) {
|
||||
ApkUtils.installApp(context, file.getAbsolutePath());
|
||||
ApkUtils.installApkFile(context, file.getAbsolutePath());
|
||||
} else {
|
||||
file.delete();
|
||||
Aria.download(context)
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.hjq.toast.Toaster;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xwad.os.R;
|
||||
import com.xwad.os.activity.activation.ActivationActivity;
|
||||
import com.xwad.os.activity.download.DownloadActivity;
|
||||
import com.xwad.os.activity.login.LoginActivity;
|
||||
import com.xwad.os.bean.AppInfo;
|
||||
import com.xwad.os.bean.BaseResponse;
|
||||
@@ -689,16 +690,6 @@ public class OpenApkUtils {
|
||||
}
|
||||
|
||||
public void openJxwAppWithParam(Activity activity, String paramStr, boolean checkInstall) {
|
||||
if (checkInstall) {
|
||||
if (!ApkUtils.isAvailable(activity, "com.jxw.launcher") || !ApkUtils.isAvailable(activity, "com.jxw.download")) {
|
||||
DefaultAppsDialog appsDialog = new DefaultAppsDialog(activity);
|
||||
appsDialog.show();
|
||||
Toaster.show("请先安装必备组件");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// if (!BuildConfig.DEBUG){
|
||||
if (!ActivationUtil.getInstance().isLogin()) {
|
||||
Toaster.show("请先登录");
|
||||
activity.startActivity(new Intent(activity, LoginActivity.class));
|
||||
@@ -711,15 +702,39 @@ public class OpenApkUtils {
|
||||
return;
|
||||
}
|
||||
|
||||
if (checkInstall) {
|
||||
if (!checkEssentialAppAllInstall()) {
|
||||
activity.startActivity(new Intent(activity, DownloadActivity.class));
|
||||
// DefaultAppsDialog appsDialog = new DefaultAppsDialog(activity);
|
||||
// appsDialog.show();
|
||||
Toaster.show("请先安装必备组件");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(paramStr)) {
|
||||
Log.e(TAG, "context为空或参数字符串为空");
|
||||
return;
|
||||
}
|
||||
// }
|
||||
|
||||
openJxwApp(activity, paramStr);
|
||||
}
|
||||
|
||||
private boolean checkEssentialAppAllInstall() {
|
||||
Set<String> essentialAppSets = mMMKV.decodeStringSet(CommonConfig.ESSENTIAL_COMPONENT_APPLICATIONS, CommonConfig.ESSENTIAL_APPLICATIONS_SETS);
|
||||
Log.e(TAG, "checkEssentialAppAllInstall: " + essentialAppSets);
|
||||
boolean allTrue = essentialAppSets.stream().allMatch(new Predicate<String>() {
|
||||
@Override
|
||||
public boolean test(String s) {
|
||||
boolean install = ApkUtils.isAvailable(mContext, s);
|
||||
Log.e(TAG, "checkEssentialAppAllInstall: " + s + " " + install);
|
||||
return install;
|
||||
}
|
||||
});
|
||||
Log.e(TAG, "checkEssentialAppAllInstall: " + allTrue);
|
||||
return allTrue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数字符串打开对应页面
|
||||
*
|
||||
@@ -864,6 +879,48 @@ public class OpenApkUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public void showDownloadDialog(Activity context, AppInfo appInfo, String conetnt) {
|
||||
Dialog dialog = new Dialog(context, R.style.ActionSheet);
|
||||
Window window = dialog.getWindow();
|
||||
View inflate = ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.download_dialog, null);
|
||||
TextView textView = inflate.findViewById(R.id.download_cancel);
|
||||
TextView textView2 = inflate.findViewById(R.id.tag_title);
|
||||
if (!TextUtils.isEmpty(appInfo.getApp_name())) {
|
||||
textView2.setText(conetnt);
|
||||
}
|
||||
TextView textView3 = inflate.findViewById(R.id.download_ok);
|
||||
textView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
textView3.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
FileUtils.ariaDownload(mContext, appInfo.getApp_url(), appInfo);
|
||||
Intent intent = new Intent(mContext, DownloadService.class);
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// mContext.startForegroundService(intent);
|
||||
// } else {
|
||||
mContext.startService(intent);
|
||||
// }
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
WindowManager.LayoutParams attributes = window.getAttributes();
|
||||
attributes.x = 0;
|
||||
attributes.y = 0;
|
||||
attributes.gravity = Gravity.CENTER;
|
||||
dialog.onWindowAttributesChanged(attributes);
|
||||
dialog.setCanceledOnTouchOutside(true);
|
||||
dialog.setContentView(inflate);
|
||||
window.setDimAmount(0.6f);
|
||||
dialog.show();
|
||||
window.setAttributes(attributes);
|
||||
}
|
||||
|
||||
|
||||
public void showDownloadDialog(Activity context, String pkg, String appName) {
|
||||
Dialog dialog = new Dialog(context, R.style.ActionSheet);
|
||||
Window window = dialog.getWindow();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.xwad.os.utils;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
@@ -10,6 +11,7 @@ import android.content.ContextWrapper;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
@@ -44,6 +46,7 @@ import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.qrcode.QRCodeWriter;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xwad.os.BuildConfig;
|
||||
import com.xwad.os.R;
|
||||
import com.xwad.os.config.CommonConfig;
|
||||
import com.xwad.os.network.NetInterfaceManager;
|
||||
@@ -66,7 +69,10 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static android.content.Context.WIFI_SERVICE;
|
||||
|
||||
@@ -101,6 +107,8 @@ public class Utils {
|
||||
// }
|
||||
// return serial;
|
||||
// }
|
||||
|
||||
|
||||
public static String getAndroiodScreenProperty(Context context) {
|
||||
Log.e("getAndroiodScreenProperty", "heightPixels:" + context.getResources().getDisplayMetrics().heightPixels);
|
||||
Log.e("getAndroiodScreenProperty", "widthPixels:" + context.getResources().getDisplayMetrics().widthPixels);
|
||||
@@ -474,39 +482,57 @@ public class Utils {
|
||||
return powerManager.isInteractive();
|
||||
}
|
||||
|
||||
// public static void exitDesktop(Activity context) {
|
||||
// if ("HONOR".equalsIgnoreCase(Build.BRAND)) {
|
||||
//// AdminManager.getInstance().exitDesktop();
|
||||
//// AdminManager.getInstance().setDefaultDesktop("com.hihonor.android.launcher");
|
||||
// } else {
|
||||
// if ("U807".equals(BuildConfig.platform) && ApkUtils.isAvailable(context, "com.uiuipad.os")) {
|
||||
// AdminManager.getInstance().setDefaultLauncher("com.uiuipad.os");
|
||||
// } else {
|
||||
// AdminManager.getInstance().setDefaultLauncher(ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME);
|
||||
// }
|
||||
//
|
||||
// if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
|
||||
// if ("U807".equals(BuildConfig.platform) && ApkUtils.isAvailable(context, "com.uiuipad.os")) {
|
||||
//
|
||||
// if (!ApkUtils.openPackage(context, "com.uiuipad.os", "com.uiuipad.os.Launcher")) {
|
||||
// ApkUtils.gotoLauncher(context);
|
||||
// }
|
||||
// } else {
|
||||
//
|
||||
// if (!ApkUtils.openPackage(context, ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME, ApkUtils.ANDROID_LAUNCHER3_Quickstep_CLASS_NAME)) {
|
||||
// ApkUtils.gotoLauncher(context);
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
//
|
||||
// if (!ApkUtils.openPackage(context, ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME, ApkUtils.ANDROID_LAUNCHER3_CLASS_NAME)) {
|
||||
// ApkUtils.gotoLauncher(context);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// context.finish();
|
||||
// System.exit(0);
|
||||
// }
|
||||
public static void exitDesktop(Activity activity) {
|
||||
activity.startActivity(new Intent(Settings.ACTION_HOME_SETTINGS));
|
||||
|
||||
List<ComponentName> componentNames = getAllLauncherApps(activity);
|
||||
Log.e(TAG, "exitDesktop: " + componentNames);
|
||||
if (componentNames != null && componentNames.size() != 0) {
|
||||
ComponentName componentName = componentNames.get(0);
|
||||
Intent intent = new Intent();
|
||||
intent.setComponent(componentName);
|
||||
try {
|
||||
activity.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "exitDesktop: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
activity.finishAndRemoveTask();
|
||||
} else {
|
||||
activity.finishAffinity();
|
||||
}
|
||||
android.os.Process.killProcess(android.os.Process.myPid());
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
private static List<ComponentName> getAllLauncherApps(Context context) {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
|
||||
// 构建用于查询桌面应用的Intent
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
intent.addCategory(Intent.CATEGORY_HOME);
|
||||
|
||||
// 查询所有可以处理该Intent的Activity
|
||||
List<ResolveInfo> resolveInfoList = packageManager.queryIntentActivities(intent, PackageManager.MATCH_ALL);
|
||||
|
||||
List<ComponentName> launcherPackageList = resolveInfoList.stream().filter(new Predicate<ResolveInfo>() {
|
||||
@Override
|
||||
public boolean test(ResolveInfo resolveInfo) {
|
||||
return !BuildConfig.APPLICATION_ID.equals(resolveInfo.activityInfo.packageName)
|
||||
|| !"com.jxw.launcher".equals(resolveInfo.activityInfo.packageName)
|
||||
|| !"com.handuan.os".equals(resolveInfo.activityInfo.packageName);
|
||||
}
|
||||
}).map(new Function<ResolveInfo, ComponentName>() {
|
||||
@Override
|
||||
public ComponentName apply(ResolveInfo resolveInfo) {
|
||||
return resolveInfo.getComponentInfo().getComponentName();
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return launcherPackageList;
|
||||
}
|
||||
|
||||
public static void triggerRebirth(Context context) {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
|
||||
BIN
app/src/main/res/drawable-hdpi/icon_back1.png
Normal file
BIN
app/src/main/res/drawable-hdpi/icon_back1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_btk.png
Normal file
BIN
app/src/main/res/drawable-hdpi/icon_btk.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_qdy.webp
Normal file
BIN
app/src/main/res/drawable-hdpi/icon_qdy.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_qst.png
Normal file
BIN
app/src/main/res/drawable-hdpi/icon_qst.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
9
app/src/main/res/drawable/ic_download_all.xml
Normal file
9
app/src/main/res/drawable/ic_download_all.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="50dp"
|
||||
android:height="50dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M512,22C241.38,22 22,241.38 22,512s219.38,490 490,490 490,-219.38 490,-490S782.62,22 512,22zM710.12,563.35l-173.9,173.91c-0.78,1 -1.61,1.97 -2.53,2.88 -5.99,5.99 -13.84,8.95 -21.69,8.91 -7.84,0.05 -15.7,-2.92 -21.69,-8.91 -0.92,-0.92 -1.76,-1.88 -2.53,-2.88l-173.9,-173.9c-11.88,-11.88 -11.88,-31.14 0,-43.02 11.88,-11.88 31.14,-11.88 43.03,0L481.58,645L481.58,305.37c0,-16.8 13.62,-30.42 30.42,-30.42 16.8,0 30.42,13.62 30.42,30.42L542.42,645L667.1,520.33c11.88,-11.88 31.14,-11.88 43.03,0 11.88,11.88 11.88,31.14 -0.01,43.02z"
|
||||
android:fillColor="#2c2c2c" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/ic_update.xml
Normal file
9
app/src/main/res/drawable/ic_update.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="50dp"
|
||||
android:height="50dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M501.97,124.24c208.59,0 377.71,169.11 377.71,377.74 0,208.59 -169.11,377.71 -377.71,377.71 -208.62,0 -377.74,-169.11 -377.74,-377.71 0,-208.62 169.11,-377.74 377.74,-377.74zM359.45,546.79c-9.04,-28.79 -51.5,-22.29 -51.5,7.89v105.41l0.21,3.31a26.35,26.35 0,0 0,26.17 23.04l3.31,-0.21a26.35,26.35 0,0 0,23.01 -26.14v-13.73l4.28,4.1a202.09,202.09 0,0 0,329.79 -87.88,26.35 26.35,0 0,0 -50.27,-15.81 149.38,149.38 0,0 1,-285 0zM501.97,299.91a202.09,202.09 0,0 0,-192.78 141.43,26.35 26.35,0 1,0 50.3,15.81 149.38,149.38 0,0 1,284.97 0c9.04,28.76 51.5,22.29 51.5,-7.89v-105.41l-0.21,-3.31a26.35,26.35 0,0 0,-26.14 -23.04l-3.31,0.18a26.35,26.35 0,0 0,-23.04 26.17v13.7l-4.25,-4.1a201.82,201.82 0,0 0,-137.04 -53.55z"
|
||||
android:fillColor="#3c77fc" />
|
||||
</vector>
|
||||
@@ -119,7 +119,8 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_price"
|
||||
@@ -139,27 +140,83 @@
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
<LinearLayout
|
||||
android:layout_width="160dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="请在15分钟内完成支付,超时二维码将失效"
|
||||
android:textColor="#9bb2cc"
|
||||
android:textSize="8sp"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="商品价格"
|
||||
android:textColor="@color/activation_text_color"
|
||||
android:textSize="9sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_vip_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:textColor="#000000"
|
||||
android:textSize="11sp"
|
||||
tools:text="¥980.00" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="160dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="限时优惠价格"
|
||||
android:textColor="@color/activation_text_color"
|
||||
android:textSize="9sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_vip_price"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="14sp"
|
||||
tools:text="¥980.00" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_qrcode"
|
||||
@@ -218,12 +275,14 @@
|
||||
android:layout_marginEnd="4dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_alipay" />
|
||||
android:src="@drawable/icon_alipay"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="4dp"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
@@ -238,75 +297,19 @@
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="160dp"
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="请在15分钟内完成支付,超时二维码将失效"
|
||||
android:textColor="#9bb2cc"
|
||||
android:textSize="8sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="商品名称"
|
||||
android:textColor="@color/activation_text_color"
|
||||
android:textSize="9sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_vip_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="软件终端许可证-AI旗舰版"
|
||||
android:textColor="#000000"
|
||||
android:textSize="9sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="160dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="商品价格"
|
||||
android:textColor="@color/activation_text_color"
|
||||
android:textSize="9sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_vip_price"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="¥980.00"
|
||||
android:textColor="#000000"
|
||||
android:textSize="9sp" />
|
||||
|
||||
</LinearLayout>
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
@@ -585,9 +588,9 @@
|
||||
android:layout_marginEnd="32dp"
|
||||
android:background="@drawable/edit_text_background"
|
||||
android:gravity="center"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:inputType="text"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
205
app/src/main/res/layout/activity_download.xml
Normal file
205
app/src/main/res/layout/activity_download.xml
Normal file
@@ -0,0 +1,205 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".activity.download.DownloadActivity">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="com.xwad.os.activity.download.DownloadActivity.BtnClick" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#d4dfff"
|
||||
android:tag="layout/activity_home_0">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/x160"
|
||||
android:background="@drawable/icon_btk"
|
||||
android:tag="layout/book_layout_title_bar_0"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_back"
|
||||
android:layout_width="@dimen/y100"
|
||||
android:layout_height="@dimen/x100"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="@dimen/y60"
|
||||
android:duplicateParentState="true"
|
||||
android:onClick="@{click::exit}"
|
||||
android:src="@drawable/icon_back1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:paddingBottom="@dimen/x5"
|
||||
android:singleLine="true"
|
||||
android:tag="binding_1"
|
||||
android:text="必备组件下载"
|
||||
android:textColor="@color/res_text_color1"
|
||||
android:textSize="@dimen/x50"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/img_download"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/y60"
|
||||
android:duplicateParentState="true"
|
||||
android:maxLines="1"
|
||||
android:onClick="@{click::openOtherApp}"
|
||||
android:singleLine="true"
|
||||
android:text="其他应用下载"
|
||||
android:textColor="@color/res_text_color1"
|
||||
android:textSize="@dimen/x40"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title_bar">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_content"
|
||||
style="@style/recycler_view_style"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toTopOf="@+id/linearLayout7"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout7"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginEnd="80dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toTopOf="@+id/download_ok">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:duplicateParentState="true"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="注意事项:"
|
||||
android:textColor="@color/res_text_color1"
|
||||
android:textSize="@dimen/x30"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_permission"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="4dp"
|
||||
android:duplicateParentState="true"
|
||||
android:text="@string/bibeizujian_permission"
|
||||
android:textColor="@color/res_text_color1"
|
||||
android:textSize="@dimen/x28"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:duplicateParentState="true"
|
||||
android:text="2、“许可证校验”为正版验证程序,部分设备因系统限制,如未自动激活请重启APP或重启设备,若始终不能自动激活请联系客服索要许可证代码手动激活;"
|
||||
android:textColor="@color/res_text_color1"
|
||||
android:textSize="@dimen/x28"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:duplicateParentState="true"
|
||||
android:text="3、其他应用列表请点击右上角下载安装,也可在学习界面点击相应功能按钮按需安装。"
|
||||
android:textColor="@color/res_text_color1"
|
||||
android:textSize="@dimen/x28"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/download_ok"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="28dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:background="@drawable/download_ok_bg"
|
||||
android:gravity="center"
|
||||
android:onClick="@{click::downloadApp}"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:text="点击一键下载必备组件"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_nodata"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title_bar">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/y589"
|
||||
android:layout_height="@dimen/x524"
|
||||
android:src="@drawable/icon_qst" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/x43"
|
||||
android:text="@string/no_content_available_the_moment"
|
||||
android:textColor="@color/res_text_color1"
|
||||
android:textSize="@dimen/x36" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
107
app/src/main/res/layout/activity_other_app.xml
Normal file
107
app/src/main/res/layout/activity_other_app.xml
Normal file
@@ -0,0 +1,107 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".activity.app.OtherAppActivity">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="com.xwad.os.activity.app.OtherAppActivity.BtnClick" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#d4dfff"
|
||||
android:tag="layout/activity_home_0">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/x160"
|
||||
android:background="@drawable/icon_btk"
|
||||
android:tag="layout/book_layout_title_bar_0"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_back"
|
||||
android:layout_width="@dimen/y100"
|
||||
android:layout_height="@dimen/x100"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="@dimen/y60"
|
||||
android:duplicateParentState="true"
|
||||
android:onClick="@{click::exit}"
|
||||
android:src="@drawable/icon_back1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:paddingBottom="@dimen/x5"
|
||||
android:singleLine="true"
|
||||
android:tag="binding_1"
|
||||
android:text="其他应用下载"
|
||||
android:textColor="@color/res_text_color1"
|
||||
android:textSize="@dimen/x50"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title_bar">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_content"
|
||||
style="@style/recycler_view_style"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_nodata"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title_bar">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/y589"
|
||||
android:layout_height="@dimen/x524"
|
||||
android:src="@drawable/icon_qst" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/x43"
|
||||
android:text="@string/no_content_available_the_moment"
|
||||
android:textColor="@color/res_text_color1"
|
||||
android:textSize="@dimen/x36" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
35
app/src/main/res/layout/book_layout_title_bar.xml
Normal file
35
app/src/main/res/layout/book_layout_title_bar.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:binding="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/x160"
|
||||
android:background="@drawable/icon_btk"
|
||||
android:tag="layout/book_layout_title_bar_0">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_back"
|
||||
android:layout_width="@dimen/y100"
|
||||
android:layout_height="@dimen/x100"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="@dimen/y60"
|
||||
android:duplicateParentState="true"
|
||||
android:src="@drawable/icon_back1"
|
||||
binding:layout_constraintBottom_toBottomOf="parent"
|
||||
binding:layout_constraintLeft_toLeftOf="parent"
|
||||
binding:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="false"
|
||||
android:paddingBottom="@dimen/x5"
|
||||
android:tag="binding_1"
|
||||
android:text="学王365必备组件下载"
|
||||
android:textColor="@color/res_text_color1"
|
||||
android:textSize="@dimen/x50"
|
||||
binding:layout_constraintBottom_toBottomOf="parent"
|
||||
binding:layout_constraintLeft_toLeftOf="parent"
|
||||
binding:layout_constraintRight_toRightOf="parent"
|
||||
binding:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -23,7 +23,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginTop="3dp"
|
||||
android:text="必备组件"
|
||||
android:text="组件安装"
|
||||
android:textColor="#333333"
|
||||
android:textSize="12sp" />
|
||||
|
||||
|
||||
@@ -763,7 +763,7 @@
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="2dp"
|
||||
android:singleLine="true"
|
||||
android:text="必备组件"
|
||||
android:text="组件安装"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/mine_app_name_size"
|
||||
app:layout_constraintEnd_toEndOf="@+id/app_icon11"
|
||||
|
||||
57
app/src/main/res/layout/item_app_info.xml
Normal file
57
app/src/main/res/layout/item_app_info.xml
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/rl_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="69dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_app_icon"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_download"
|
||||
android:layout_width="14dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ic_download_all"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_app_icon"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_app_icon" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_update"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ic_update"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_app_icon"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_app_icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_app_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="#333333"
|
||||
android:textSize="9sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_app_icon"
|
||||
tools:text="当前壁纸" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/rl_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="69dp">
|
||||
@@ -31,7 +32,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="当前壁纸"
|
||||
tools:text="当前壁纸"
|
||||
android:textColor="#333333"
|
||||
android:textSize="9sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<color name="default_title_indicator_text_color">#bbffffff</color>
|
||||
<color name="default_underline_indicator_selected_color">#ff33b5e5</color>
|
||||
|
||||
<color name="res_text_color1">#333333</color>
|
||||
|
||||
|
||||
</resources>
|
||||
@@ -836,4 +836,8 @@
|
||||
<string name="wifi_set">设\t置</string>
|
||||
<string name="yxp_pag_baoxiang">pag/exp_baoxiang_ywc.pag</string>
|
||||
<string name="yxp_pag_liwuhe">pag/exp_liwuhe_ywc.pag</string>
|
||||
|
||||
<!--download-->
|
||||
<string name="no_content_available_the_moment">暂无内容,请先去下载吧!</string>
|
||||
|
||||
</resources>
|
||||
@@ -70,5 +70,6 @@
|
||||
|
||||
<string name="sample_device_admin">为学王365提供管控功能,请激活后使用</string>
|
||||
<string name="sample_device_admin_description">开启我吧</string>
|
||||
<string name="bibeizujian_permission">1、必备组件维持系统基本运行,请优先安装,并【允许】所有权限弹窗请求;</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -137,4 +137,24 @@
|
||||
<item name="android:windowSoftInputMode">stateVisible|adjustPan</item>
|
||||
</style>
|
||||
|
||||
<style name="recycler_view_style" parent="">
|
||||
<item name="android:scrollbars">none</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">match_parent</item>
|
||||
<item name="android:layout_weight">1</item>
|
||||
<item name="android:overScrollMode">never</item>
|
||||
</style>
|
||||
|
||||
<style name="BaseTheme" parent="@style/Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="android:windowFullscreen">true</item>
|
||||
<item name="android:windowTranslucentStatus">true</item>
|
||||
<item name="android:windowTranslucentNavigation">false</item>
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<style name="ActivityTheme2" parent="@style/BaseTheme">
|
||||
<item name="android:windowBackground">@drawable/icon_qdy</item>
|
||||
<item name="android:windowIsTranslucent">false</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user