version:1.0.9

fix:
update:更新资源,增加登录,增加检测更新,增加必备插件
This commit is contained in:
2025-12-19 10:32:21 +08:00
parent daebcee8b8
commit 7ce4158afd
26 changed files with 344 additions and 28 deletions

View File

@@ -16,8 +16,8 @@ android {
minSdkVersion 24
targetSdkVersion 29
versionCode 10
versionName "1.0.9"
versionCode 11
versionName "1.1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View File

@@ -218,8 +218,7 @@
android:theme="@style/DialogCloseOnTouchOutside" />
<activity
android:name=".activity.permission.PermissionActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait" />
android:launchMode="singleTask" />
<activity
android:name=".activity.user.UserActivity"
android:launchMode="singleTask"

View File

@@ -189,7 +189,7 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
@Override
public void onChanged(AppUpdateInfo appUpdateInfo) {
if (appUpdateInfo == null) {
Toaster.show("已是最新版本");
// Toaster.show("已是最新版本");
} else {
if (ApkUtils.isUpdate(HomeActivity.this, appUpdateInfo)) {
Intent intent = new Intent(HomeActivity.this, UpdateActivity.class);
@@ -197,7 +197,7 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
startActivity(intent);
Toaster.show("有新的版本需要更新");
} else {
Toaster.show("已是最新版本");
// Toaster.show("已是最新版本");
}
}
}

View File

@@ -160,7 +160,7 @@ public class UserActivity extends BaseMvvmActivity<UserViewModel, ActivityUserBi
@Override
public void onChanged(AppUpdateInfo appUpdateInfo) {
if (appUpdateInfo == null) {
Toaster.show("已是最新版本");
// Toaster.show("已是最新版本");
} else {
if (ApkUtils.isUpdate(UserActivity.this, appUpdateInfo)) {
Intent intent = new Intent(UserActivity.this, UpdateActivity.class);
@@ -168,7 +168,7 @@ public class UserActivity extends BaseMvvmActivity<UserViewModel, ActivityUserBi
startActivity(intent);
Toaster.show("有新的版本需要更新");
} else {
Toaster.show("已是最新版本");
// Toaster.show("已是最新版本");
}
}
}

View File

@@ -85,7 +85,7 @@ public class BaseApplication extends Application {
RemoteManager.init(this);
LenovoCsdkUtil.init(this);
CrashReport.initCrashReport(getApplicationContext(), "d1cd982951", false);
CrashReport.initCrashReport(getApplicationContext(), "4efcaad4c9", false);
CrashReport.setDeviceId(BaseApplication.this, DeviceSNManager.getDeviceSN());
// 初始化 Toast 框架

View File

@@ -8,6 +8,16 @@ public class ItemsBean implements Serializable {
private String tag;
private String text;
public ItemsBean() {
}
public ItemsBean(String icon, String learnStage, String tag, String text) {
this.icon = icon;
this.learnStage = learnStage;
this.tag = tag;
this.text = text;
}
public String getText() {
return this.text;
}

View File

@@ -348,7 +348,6 @@ public class ChineseFragment extends BaseMvvmFragment<ChineseViewModel, Fragment
AppsDialog appsDialog = new AppsDialog(getActivity(), type);
appsDialog.show();
appsDialog.setOnCallback(new AppsDialog.Callback() {
@Override
public void onCallback() {
getMyList();

View File

@@ -38,6 +38,8 @@ import com.xwad.os.jxw.event.UpdateColorEvent;
import com.xwad.os.utils.OpenApkUtils;
import com.xwad.os.view.jxw.view.dialog.QhbzDialog;
import com.xwad.os.view.jxw.view.dialog.RemoveAppDialog;
import com.xwad.os.view.jxw.widget.AppsDialog;
import com.xwad.os.view.jxw.widget.DefaultAppsDialog;
import com.xwad.os.view.jxw.widget.RecyclerMarginClickHelper;
import org.greenrobot.eventbus.EventBus;
@@ -381,5 +383,16 @@ public class MineFragment extends BaseMvvmFragment<MineViewModel, FragmentMineBi
startActivity(new Intent(mContext, ExitActivity.class));
// 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() {
}
});
}
}
}

View File

@@ -6,14 +6,21 @@ import android.os.Build;
import android.os.Bundle;
import android.view.View;
import androidx.lifecycle.Observer;
import com.hjq.toast.Toaster;
import com.xwad.os.BuildConfig;
import com.xwad.os.R;
import com.xwad.os.activity.home.HomeActivity;
import com.xwad.os.activity.permission.PermissionActivity;
import com.xwad.os.activity.service.ServiceActivity;
import com.xwad.os.activity.update.UpdateActivity;
import com.xwad.os.base.mvvm.fragment.BaseMvvmFragment;
import com.xwad.os.bean.AppUpdateInfo;
import com.xwad.os.databinding.FragmentDeviceBinding;
import com.xwad.os.manager.DeviceSNManager;
import com.xwad.os.manager.RemoteManager;
import com.xwad.os.utils.ApkUtils;
import com.xwad.os.utils.LenovoCsdkUtil;
public class DeviceFragment extends BaseMvvmFragment<DeviceViewModel, FragmentDeviceBinding> {
@@ -41,13 +48,30 @@ public class DeviceFragment extends BaseMvvmFragment<DeviceViewModel, FragmentDe
@Override
protected void initView(Bundle bundle) {
mViewDataBinding.tvModel.setText(Build.MODEL);
mViewDataBinding.tvVersion.setText(BuildConfig.VERSION_NAME);
mViewDataBinding.tvVersion.setText("(检查更新)" + BuildConfig.VERSION_NAME);
mViewDataBinding.tvMac.setText(DeviceSNManager.getDeviceSN());
}
@Override
protected void initData(Bundle savedInstanceState) {
mViewModel.mAppUpdateInfoData.observe(this, new Observer<AppUpdateInfo>() {
@Override
public void onChanged(AppUpdateInfo appUpdateInfo) {
if (appUpdateInfo == null) {
Toaster.show("已是最新版本");
} else {
if (ApkUtils.isUpdate(mContext, appUpdateInfo)) {
Intent intent = new Intent(mContext, UpdateActivity.class);
intent.putExtra("appUpdateInfo", appUpdateInfo);
startActivity(intent);
Toaster.show("有新的版本需要更新");
} else {
Toaster.show("已是最新版本");
}
}
}
});
mViewModel.checkUpdate();
}
@@ -64,5 +88,9 @@ public class DeviceFragment extends BaseMvvmFragment<DeviceViewModel, FragmentDe
public void checkPermission(View view) {
startActivity(new Intent(mContext, PermissionActivity.class));
}
public void checkUpdate(View view) {
mViewModel.checkUpdate();
}
}
}

View File

@@ -1,8 +1,23 @@
package com.xwad.os.fragment.usercenter.device;
import android.util.Log;
import androidx.lifecycle.MutableLiveData;
import com.hjq.toast.Toaster;
import com.trello.rxlifecycle4.RxLifecycle;
import com.trello.rxlifecycle4.android.ActivityEvent;
import com.trello.rxlifecycle4.android.FragmentEvent;
import com.xwad.os.BuildConfig;
import com.xwad.os.base.mvvm.BaseViewModel;
import com.xwad.os.bean.AppUpdateInfo;
import com.xwad.os.bean.BaseResponse;
import com.xwad.os.databinding.FragmentDeviceBinding;
import com.xwad.os.network.NetInterfaceManager;
import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.Observer;
import io.reactivex.rxjava3.disposables.Disposable;
public class DeviceViewModel extends BaseViewModel<FragmentDeviceBinding, FragmentEvent> {
@@ -15,4 +30,39 @@ public class DeviceViewModel extends BaseViewModel<FragmentDeviceBinding, Fragme
public void onDestroy() {
}
public MutableLiveData<AppUpdateInfo> mAppUpdateInfoData = new MutableLiveData<>();
public void checkUpdate() {
NetInterfaceManager.getInstance().getCheckUpdateObservable(BuildConfig.APPLICATION_ID)
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
.subscribe(new Observer<BaseResponse<AppUpdateInfo>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("checkUpdate", "onSubscribe: ");
}
@Override
public void onNext(@NonNull BaseResponse<AppUpdateInfo> appUpdateInfoBaseResponse) {
Log.e("checkUpdate", "onNext: " + appUpdateInfoBaseResponse);
if (appUpdateInfoBaseResponse.code == 200) {
AppUpdateInfo appUpdateInfo = appUpdateInfoBaseResponse.data;
mAppUpdateInfoData.setValue(appUpdateInfo);
} else {
mAppUpdateInfoData.setValue(null);
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("checkUpdate", "onError: ");
Toaster.show("网络连接失败");
}
@Override
public void onComplete() {
Log.e("checkUpdate", "onComplete: ");
}
});
}
}

View File

@@ -36,7 +36,7 @@ public class JiaoShuiDialog extends Dialog {
super.onCreate(bundle);
setContentView(R.layout.dialog_jiaoshui);
WindowManager windowManager = getWindow().getWindowManager();
getWindow().setBackgroundDrawableResource(17170445);
getWindow().setBackgroundDrawableResource(R.drawable.bg_shape_ffffff_40);
Display defaultDisplay = windowManager.getDefaultDisplay();
Window window = getWindow();
WindowManager.LayoutParams attributes = getWindow().getAttributes();
@@ -50,7 +50,7 @@ public class JiaoShuiDialog extends Dialog {
}
private void initView() {
this.pag = (PAGView) findViewById(R.id.pag);
this.pag = findViewById(R.id.pag);
this.pag.setComposition(PAGFile.Load(this.activity.getAssets(), "pag/shjs.pag"));
this.pag.setRepeatCount(1);
this.pag.play();

View File

@@ -12,6 +12,7 @@ import android.content.pm.PackageManager;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -797,7 +798,7 @@ public class OpenApkUtils {
public void showDownloadDialog(Activity context, String pkg, String appName) {
Dialog dialog = new Dialog(context, R.style.ActionSheet);
Window window = dialog.getWindow();
View inflate = ((LayoutInflater) context.getSystemService("layout_inflater")).inflate(R.layout.download_dialog, null);
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(appName)) {
@@ -826,7 +827,7 @@ public class OpenApkUtils {
WindowManager.LayoutParams attributes = window.getAttributes();
attributes.x = 0;
attributes.y = 0;
attributes.gravity = 17;
attributes.gravity = Gravity.CENTER;
dialog.onWindowAttributesChanged(attributes);
dialog.setCanceledOnTouchOutside(true);
dialog.setContentView(inflate);

View File

@@ -37,7 +37,7 @@ public class LockDialog extends Dialog {
super.onCreate(bundle);
setContentView(R.layout.dialog_lock);
WindowManager windowManager = getWindow().getWindowManager();
getWindow().setBackgroundDrawableResource(17170445);
getWindow().setBackgroundDrawableResource(R.drawable.bg_shape_ffffff_40);
Display defaultDisplay = windowManager.getDefaultDisplay();
WindowManager.LayoutParams attributes = getWindow().getAttributes();
Point point = new Point();

View File

@@ -55,7 +55,7 @@ public class QhbzDialog extends Dialog {
super.onCreate(bundle);
setContentView(R.layout.dialog_qhbz);
WindowManager windowManager = getWindow().getWindowManager();
getWindow().setBackgroundDrawableResource(17170445);
getWindow().setBackgroundDrawableResource(R.drawable.bg_shape_ffffff_40);
Display defaultDisplay = windowManager.getDefaultDisplay();
WindowManager.LayoutParams attributes = getWindow().getAttributes();
defaultDisplay.getSize(new Point());

View File

@@ -34,7 +34,7 @@ public class RemoveAppDialog extends Dialog {
super.onCreate(bundle);
setContentView(R.layout.dialog_removeapp);
WindowManager windowManager = getWindow().getWindowManager();
getWindow().setBackgroundDrawableResource(17170445);
getWindow().setBackgroundDrawableResource(R.drawable.bg_shape_ffffff_40);
Display defaultDisplay = windowManager.getDefaultDisplay();
WindowManager.LayoutParams attributes = getWindow().getAttributes();
Point point = new Point();

View File

@@ -68,7 +68,7 @@ public class AppsDialog extends Dialog {
super.onCreate(bundle);
setContentView(R.layout.dialog_yw_apps);
WindowManager windowManager = getWindow().getWindowManager();
getWindow().setBackgroundDrawableResource(17170445);
getWindow().setBackgroundDrawableResource(R.drawable.bg_shape_ffffff_40);
Display defaultDisplay = windowManager.getDefaultDisplay();
WindowManager.LayoutParams attributes = getWindow().getAttributes();
defaultDisplay.getSize(new Point());

View File

@@ -0,0 +1,119 @@
package com.xwad.os.view.jxw.widget;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Point;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Display;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xwad.os.R;
import com.xwad.os.bean.jxw.ItemsBean;
import com.xwad.os.utils.OpenApkUtils;
import java.util.ArrayList;
import java.util.List;
public class DefaultAppsDialog extends Dialog {
private Activity activity;
private AppAdapter appAdapter;
private List<ItemsBean> appList;
private Callback mCallback;
private RecyclerView rv_apps;
public interface Callback {
void onCallback();
}
public DefaultAppsDialog(Context context) {
super(context, R.style.ActionSheetDialogStyle);
appList = new ArrayList<>();
activity = (Activity) context;
}
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.dialog_default_apps);
WindowManager windowManager = getWindow().getWindowManager();
getWindow().setBackgroundDrawableResource(R.drawable.bg_shape_ffffff_40);
Display defaultDisplay = windowManager.getDefaultDisplay();
WindowManager.LayoutParams attributes = getWindow().getAttributes();
defaultDisplay.getSize(new Point());
getWindow().setAttributes(attributes);
setCanceledOnTouchOutside(true);
setCancelable(true);
getWindow().setDimAmount(0.3f);
initView();
}
private void initView() {
GridLayoutManager gridLayoutManager = new GridLayoutManager(activity, 2);
rv_apps = findViewById(R.id.rv_apps);
appAdapter = new AppAdapter(getDefaultApps());
rv_apps.setLayoutManager(gridLayoutManager);
rv_apps.setAdapter(appAdapter);
findViewById(R.id.ll_gb).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
}
});
}
public void setOnCallback(Callback callback) {
mCallback = callback;
}
public class AppAdapter extends BaseQuickAdapter<ItemsBean, BaseViewHolder> {
public AppAdapter(List<ItemsBean> list) {
super(R.layout.item_dialog_app, list);
}
@Override
public void convert(BaseViewHolder baseViewHolder, final ItemsBean itemsBean) {
RelativeLayout relativeLayout = baseViewHolder.getView(R.id.rl_root);
((ImageView) baseViewHolder.getView(R.id.iv_app_icon)).setImageResource(mContext.getResources().getIdentifier(itemsBean.getIcon(), "drawable", mContext.getPackageName()));
((TextView) baseViewHolder.getView(R.id.tv_app_name)).setText(itemsBean.getText());
relativeLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
jumpTag(itemsBean);
}
});
}
}
public void jumpTag(ItemsBean itemsBean) {
if (activity != null) {
Callback callback = mCallback;
if (callback != null) {
callback.onCallback();
}
// MyApp.getInstance().mBottomBtnOnClickListener.setContext(activity);
// MyApp.getInstance().mBottomBtnOnClickListener.onClick(viewTag);
OpenApkUtils.getInstance().openJxwApp(activity, itemsBean.getTag());
}
}
private List<ItemsBean> getDefaultApps() {
List<ItemsBean> itemsBeans = new ArrayList<>();
itemsBeans.add(new ItemsBean("icon_bbx_launcher", "", "com.jxw.launcher,,,,资源下载", "资源下载"));
itemsBeans.add(new ItemsBean("icon_bbx_player", "", "com.study.flashplayer,,,,播放器", "播放器"));
return itemsBeans;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<LinearLayout
android:layout_width="375dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/bg_shape_ffffff_40"
android:gravity="center_horizontal"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="41dp">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginTop="3dp"
android:text="必备插件"
android:textColor="#333333"
android:textSize="12sp" />
<LinearLayout
android:id="@+id/ll_gb"
android:layout_width="25dp"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:gravity="center">
<ImageView
android:layout_width="19dp"
android:layout_height="19dp"
android:layout_marginEnd="6dp"
android:background="@drawable/icon_x" />
</LinearLayout>
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_apps"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="12dp"
android:layout_marginTop="9dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="6dp" />
</LinearLayout>
</LinearLayout>

View File

@@ -83,6 +83,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:onClick="@{click::checkUpdate}"
android:layout_weight="1">
<TextView
@@ -145,7 +146,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="SN"
android:text="软终端序列号"
android:textColor="@color/black"
android:textSize="10sp"
app:layout_constraintBottom_toBottomOf="parent"

View File

@@ -72,7 +72,6 @@
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_toEndOf="@+id/head_image"
android:onClick="onClick"
android:orientation="vertical"
android:tag="@string/tag_args_xxgrzx"
app:layout_constraintBottom_toBottomOf="parent"
@@ -87,7 +86,7 @@
android:orientation="horizontal">
<TextView
android:layout_width="28dp"
android:layout_width="32dp"
android:layout_height="10dp"
android:text="昵称:"
android:textColor="#60ffffff"
@@ -111,7 +110,7 @@
android:orientation="horizontal">
<TextView
android:layout_width="28dp"
android:layout_width="32dp"
android:layout_height="10dp"
android:text="年级:"
android:textColor="#60ffffff"
@@ -133,7 +132,7 @@
android:orientation="horizontal">
<TextView
android:layout_width="28dp"
android:layout_width="32dp"
android:layout_height="10dp"
android:text="学力值:"
android:textColor="#60ffffff"
@@ -143,7 +142,7 @@
android:id="@+id/tv_wlz"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="0"
android:text="敬请期待"
android:textColor="@color/white"
android:textSize="9sp" />
</LinearLayout>
@@ -680,6 +679,48 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="@dimen/mine_icon_width"
android:layout_height="match_parent"
android:onClick="@{click::openAppsDialog}"
android:tag="@string/tag_args_new_settings">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/app_icon11"
android:layout_width="@dimen/mine_icon_height"
android:layout_height="@dimen/mine_icon_height"
android:layout_gravity="center_horizontal"
android:src="@drawable/icon_bbx_app"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/app_name11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="2dp"
android:singleLine="true"
android:text="必备插件"
android:textColor="@color/white"
android:textSize="@dimen/mine_app_name_size"
app:layout_constraintEnd_toEndOf="@+id/app_icon11"
app:layout_constraintStart_toStartOf="@+id/app_icon11"
app:layout_constraintTop_toBottomOf="@+id/app_icon11" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -3292,6 +3292,6 @@
<dimen name="y999">999px</dimen>
<dimen name="mine_icon_height">36dp</dimen>
<dimen name="mine_icon_width">44dp</dimen>
<dimen name="mine_icon_width">56dp</dimen>
<dimen name="mine_app_name_size">8sp</dimen>
</resources>

View File

@@ -8,7 +8,7 @@
<string name="notset">未设置</string>
<string name="device_unauthorized">设备未经授权</string>
<string name="default_nickname">小学王</string>
<string name="default_grade">年级</string>
<string name="default_grade">年级</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>