version:1.8.9
fix:优化英语界面报错 update:用户页显示作业分发
This commit is contained in:
@@ -115,7 +115,7 @@
|
||||
<activity
|
||||
android:name=".activity.NoticeActivity"
|
||||
android:excludeFromRecents="true"
|
||||
android:screenOrientation="portrait"
|
||||
android:screenOrientation="userLandscape"
|
||||
android:theme="@style/DialogCloseOnTouchOutside" />
|
||||
<activity
|
||||
android:name=".activity.PasswordActivity"
|
||||
@@ -140,15 +140,20 @@
|
||||
<activity
|
||||
android:name=".activity.ManualActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="userLandscape" />
|
||||
<activity
|
||||
android:name=".activity.AboutActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="userLandscape" />
|
||||
<activity
|
||||
android:name=".activity.ServiceActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/DialogCloseOnTouchOutside" />
|
||||
<activity
|
||||
android:name=".activity.update.UpdateActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="userLandscape"
|
||||
android:theme="@style/DialogCloseOnTouchOutside" />
|
||||
|
||||
<receiver
|
||||
android:name=".receiver.BootReceiver"
|
||||
@@ -214,6 +219,11 @@
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </service>-->
|
||||
|
||||
<service
|
||||
android:name=".service.DownloadService"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
|
||||
<receiver
|
||||
android:name=".receiver.APKinstallReceiver"
|
||||
android:enabled="true"
|
||||
@@ -228,6 +238,16 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.FileProvider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
|
||||
<!-- 消息接收监听器 (用户可自主扩展) -->
|
||||
<receiver
|
||||
android:name=".push.alipush.AliyunMessageReceiver"
|
||||
|
||||
@@ -21,8 +21,11 @@ import android.view.animation.TranslateAnimation;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
import com.hjq.permissions.OnPermissionCallback;
|
||||
import com.hjq.permissions.Permission;
|
||||
import com.hjq.permissions.XXPermissions;
|
||||
@@ -31,7 +34,9 @@ import com.tencent.mmkv.MMKV;
|
||||
import com.uiui.zyos.BuildConfig;
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.activity.ExitActivity;
|
||||
import com.uiui.zyos.activity.update.UpdateActivity;
|
||||
import com.uiui.zyos.base.mvvm.BaseMvvmActivity;
|
||||
import com.uiui.zyos.bean.AppUpdateInfo;
|
||||
import com.uiui.zyos.config.CommonConfig;
|
||||
import com.uiui.zyos.databinding.ActivityMainBinding;
|
||||
import com.uiui.zyos.dialog.PrivacyPolicyDialog;
|
||||
@@ -50,6 +55,8 @@ import com.uiui.zyos.view.viewpager.BaseFragmentPagerAdapter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.arialyy.aria.core.inf.IEntity.STATE_RUNNING;
|
||||
|
||||
public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBinding> implements RemoteManager.ConnectedListener {
|
||||
private static final String TAG = "MainActivity";
|
||||
|
||||
@@ -67,6 +74,8 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
||||
|
||||
private int defaultCurrent = 1;
|
||||
|
||||
private AppUpdateInfo mAppUpdateInfo;
|
||||
|
||||
@Override
|
||||
public void onRemoteConnected() {
|
||||
Log.e(TAG, "onConnected: ");
|
||||
@@ -204,6 +213,25 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mViewModel.getAppUpdateInfoData().observe(this, new Observer<AppUpdateInfo>() {
|
||||
@Override
|
||||
public void onChanged(AppUpdateInfo appUpdateInfo) {
|
||||
mAppUpdateInfo = appUpdateInfo;
|
||||
if (appUpdateInfo == null) {
|
||||
// Toaster.show("已是最新版本");
|
||||
} else {
|
||||
if (ApkUtils.isUpdate(MainActivity.this, appUpdateInfo)) {
|
||||
Intent intent = new Intent(MainActivity.this, UpdateActivity.class);
|
||||
intent.putExtra("appUpdateInfo", appUpdateInfo);
|
||||
startActivity(intent);
|
||||
Toaster.show("有新的版本需要更新");
|
||||
} else {
|
||||
// Toaster.show("已是最新版本");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
getStorgePermission();
|
||||
registmNewAppReceiver();
|
||||
registmUpdateAddressReceiver();
|
||||
}
|
||||
@@ -418,6 +446,42 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
||||
});
|
||||
}
|
||||
|
||||
private void getStorgePermission() {
|
||||
XXPermissions.with(this)
|
||||
// 申请单个权限
|
||||
.permission(Permission.WRITE_EXTERNAL_STORAGE)
|
||||
// 申请多个权限
|
||||
// .permission(Permission.Group.STORAGE)
|
||||
// 设置权限请求拦截器(局部设置)
|
||||
//.interceptor(new PermissionInterceptor())
|
||||
// 设置不触发错误检测机制(局部设置)
|
||||
//.unchecked()
|
||||
.request(new OnPermissionCallback() {
|
||||
@Override
|
||||
public void onGranted(@NonNull List<String> permissions, boolean allGranted) {
|
||||
Log.e(TAG, "onGranted: permissions = " + permissions + " allGranted = " + allGranted);
|
||||
if (!allGranted) {
|
||||
Toaster.show("获取部分权限成功,但部分权限未正常授予");
|
||||
return;
|
||||
}
|
||||
Log.e(TAG, "onGranted: 获取权限成功");
|
||||
mViewModel.checkUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDenied(@NonNull List<String> permissions, boolean doNotAskAgain) {
|
||||
Log.e(TAG, "onDenied: permissions = " + permissions + " doNotAskAgain = " + doNotAskAgain);
|
||||
if (doNotAskAgain) {
|
||||
Toaster.show("被永久拒绝授权,请手动授予权限");
|
||||
// 如果是被永久拒绝就跳转到应用权限系统设置页面
|
||||
XXPermissions.startPermissionActivity(MainActivity.this, permissions);
|
||||
} else {
|
||||
Log.e(TAG, "onGranted: 获取权限失败");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String[] mLocationPermission = new String[]{
|
||||
Permission.ACCESS_COARSE_LOCATION,
|
||||
Permission.ACCESS_FINE_LOCATION,
|
||||
|
||||
@@ -3,11 +3,15 @@ package com.uiui.zyos.activity.main;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.uiui.zyos.BuildConfig;
|
||||
import com.uiui.zyos.base.mvvm.BaseViewModel;
|
||||
import com.uiui.zyos.bean.AppUpdateInfo;
|
||||
import com.uiui.zyos.bean.BaseResponse;
|
||||
import com.uiui.zyos.databinding.ActivityMainBinding;
|
||||
import com.uiui.zyos.manager.RemoteManager;
|
||||
@@ -17,6 +21,7 @@ import com.uiui.zyos.utils.ApkUtils;
|
||||
import com.uiui.zyos.utils.AppUsedTimeUtils;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
@@ -35,6 +40,46 @@ public class MainViewModel extends BaseViewModel<ActivityMainBinding, ActivityEv
|
||||
|
||||
}
|
||||
|
||||
private MutableLiveData<AppUpdateInfo> mAppUpdateInfoData = new MutableLiveData<>();
|
||||
|
||||
public MutableLiveData<AppUpdateInfo> getAppUpdateInfoData() {
|
||||
return mAppUpdateInfoData;
|
||||
}
|
||||
|
||||
public void checkUpdate() {
|
||||
NetInterfaceManager.getInstance().getCheckUpdateObservable(BuildConfig.APPLICATION_ID)
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.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: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void sendAPPUsage() {
|
||||
boolean activation = ActivationUtil.isActivation(getCtx());
|
||||
if (!activation) {
|
||||
@@ -83,6 +128,7 @@ public class MainViewModel extends BaseViewModel<ActivityMainBinding, ActivityEv
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void sendRunningInfo() {
|
||||
boolean activation = ActivationUtil.isActivation(getCtx());
|
||||
if (!activation) {
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.uiui.zyos.activity.update;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.base.mvvm.BaseMvvmActivity;
|
||||
import com.uiui.zyos.bean.AppUpdateInfo;
|
||||
import com.uiui.zyos.databinding.ActivityUpdateBinding;
|
||||
import com.uiui.zyos.service.DownloadService;
|
||||
import com.uiui.zyos.utils.ApkUtils;
|
||||
|
||||
import static com.arialyy.aria.core.inf.IEntity.STATE_RUNNING;
|
||||
|
||||
public class UpdateActivity extends BaseMvvmActivity<UpdateViewModel, ActivityUpdateBinding> {
|
||||
|
||||
private AppUpdateInfo mAppInfoData;
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_update;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDataBinding() {
|
||||
mViewModel.setCtx(this);
|
||||
mViewModel.setLifecycle(getLifecycleSubject());
|
||||
mViewModel.setVDBinding(mViewDataBinding);
|
||||
mViewDataBinding.setClick(new BtnClick());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
Intent intent = getIntent();
|
||||
mAppInfoData = (AppUpdateInfo) intent.getSerializableExtra("appUpdateInfo");
|
||||
mViewDataBinding.setAppUpdateInfo(mAppInfoData);
|
||||
mViewDataBinding.setMsg("检测到新版本,是否更新");
|
||||
}
|
||||
|
||||
|
||||
public class BtnClick {
|
||||
public void empty(View view){
|
||||
|
||||
}
|
||||
|
||||
public void exit(View view) {
|
||||
finish();
|
||||
}
|
||||
|
||||
public void upgrade(View view) {
|
||||
startService(new Intent(UpdateActivity.this, DownloadService.class));
|
||||
if (mAppInfoData != null) {
|
||||
DownloadEntity entity = Aria.download(this).getFirstDownloadEntity(mAppInfoData.getApp_url());
|
||||
if (null != entity) {
|
||||
if (entity.isComplete()) {
|
||||
ApkUtils.installApkFile(UpdateActivity.this, entity.getFilePath());
|
||||
} else {
|
||||
if (entity.getState() == STATE_RUNNING) {
|
||||
Toaster.show("文件正在下载中");
|
||||
finish();
|
||||
} else {
|
||||
Aria.download(this).resumeAllTask();
|
||||
Toaster.show("正在下载");
|
||||
finish();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ApkUtils.checkAppUpdate(UpdateActivity.this, mAppInfoData);
|
||||
Toaster.show("正在下载更新");
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.uiui.zyos.activity.update;
|
||||
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.uiui.zyos.base.mvvm.BaseViewModel;
|
||||
import com.uiui.zyos.databinding.ActivityUpdateBinding;
|
||||
|
||||
public class UpdateViewModel extends BaseViewModel<ActivityUpdateBinding, ActivityEvent> {
|
||||
|
||||
@Override
|
||||
public ActivityUpdateBinding getVDBinding() {
|
||||
return binding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.uiui.zyos.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
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.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.shehuan.niv.NiceImageView;
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.bean.HomeworkBean;
|
||||
import com.uiui.zyos.utils.GlideLoadUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NewHomeworkAdapter extends RecyclerView.Adapter<NewHomeworkAdapter.Holder> {
|
||||
|
||||
private Context mContext;
|
||||
private List<HomeworkBean> mHomeworkList;
|
||||
|
||||
public void setHomeworkList(List<HomeworkBean> homeworkList) {
|
||||
mHomeworkList = homeworkList;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new Holder(LayoutInflater.from(mContext).inflate(R.layout.item_homework_new, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||
HomeworkBean homeworkBean = mHomeworkList.get(position);
|
||||
GlideLoadUtils.getInstance().glideLoad(mContext, homeworkBean.getFile_url(), holder.imageView, R.drawable.item_icon_homework);
|
||||
holder.tv_content.setText(homeworkBean.getTitle());
|
||||
holder.tv_type.setText(homeworkBean.getContent());
|
||||
holder.tv_time.setText(homeworkBean.getCreated_at());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mHomeworkList == null ? 0 : mHomeworkList.size();
|
||||
}
|
||||
|
||||
class Holder extends RecyclerView.ViewHolder {
|
||||
ConstraintLayout root;
|
||||
NiceImageView imageView;
|
||||
TextView tv_content, tv_type, tv_time;
|
||||
|
||||
public Holder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
imageView = itemView.findViewById(R.id.imageView);
|
||||
tv_content = itemView.findViewById(R.id.tv_content);
|
||||
tv_type = itemView.findViewById(R.id.tv_type);
|
||||
tv_time = itemView.findViewById(R.id.tv_time);
|
||||
}
|
||||
}
|
||||
}
|
||||
58
app/src/main/java/com/uiui/zyos/bean/AppBase.java
Normal file
58
app/src/main/java/com/uiui/zyos/bean/AppBase.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package com.uiui.zyos.bean;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class AppBase implements Serializable {
|
||||
private static final long serialVersionUID = -1084612101570534997L;
|
||||
|
||||
int id;
|
||||
String app_name;
|
||||
String app_package;
|
||||
// @SerializedName(value = "icon", alternate = "app_icon")
|
||||
String icon;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getApp_name() {
|
||||
return app_name;
|
||||
}
|
||||
|
||||
public void setApp_name(String app_name) {
|
||||
this.app_name = app_name;
|
||||
}
|
||||
|
||||
public String getApp_package() {
|
||||
return app_package;
|
||||
}
|
||||
|
||||
public void setApp_package(String app_package) {
|
||||
this.app_package = app_package;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
|
||||
}
|
||||
|
||||
}
|
||||
109
app/src/main/java/com/uiui/zyos/bean/AppUpdateInfo.java
Normal file
109
app/src/main/java/com/uiui/zyos/bean/AppUpdateInfo.java
Normal file
@@ -0,0 +1,109 @@
|
||||
package com.uiui.zyos.bean;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class AppUpdateInfo implements Serializable {
|
||||
private static final long serialVersionUID = -683006285701880863L;
|
||||
|
||||
int id;
|
||||
int app_id;
|
||||
String app_version_name;
|
||||
long app_version_code;
|
||||
long app_size;
|
||||
String app_desc;
|
||||
String app_md5;
|
||||
String app_url;
|
||||
String is_forcedown;
|
||||
AppBase app;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getApp_id() {
|
||||
return app_id;
|
||||
}
|
||||
|
||||
public void setApp_id(int app_id) {
|
||||
this.app_id = app_id;
|
||||
}
|
||||
|
||||
public String getApp_version_name() {
|
||||
return app_version_name;
|
||||
}
|
||||
|
||||
public void setApp_version_name(String app_version_name) {
|
||||
this.app_version_name = app_version_name;
|
||||
}
|
||||
|
||||
public long getApp_version_code() {
|
||||
return app_version_code;
|
||||
}
|
||||
|
||||
public void setApp_version_code(long app_version_code) {
|
||||
this.app_version_code = app_version_code;
|
||||
}
|
||||
|
||||
public long getApp_size() {
|
||||
return app_size;
|
||||
}
|
||||
|
||||
public void setApp_size(long app_size) {
|
||||
this.app_size = app_size;
|
||||
}
|
||||
|
||||
public String getApp_desc() {
|
||||
return app_desc;
|
||||
}
|
||||
|
||||
public void setApp_desc(String app_desc) {
|
||||
this.app_desc = app_desc;
|
||||
}
|
||||
|
||||
public String getApp_md5() {
|
||||
return app_md5;
|
||||
}
|
||||
|
||||
public void setApp_md5(String app_md5) {
|
||||
this.app_md5 = app_md5;
|
||||
}
|
||||
|
||||
public String getApp_url() {
|
||||
return app_url;
|
||||
}
|
||||
|
||||
public void setApp_url(String app_url) {
|
||||
this.app_url = app_url;
|
||||
}
|
||||
|
||||
public String getIs_forcedown() {
|
||||
return is_forcedown;
|
||||
}
|
||||
|
||||
public void setIs_forcedown(String is_forcedown) {
|
||||
this.is_forcedown = is_forcedown;
|
||||
}
|
||||
|
||||
public AppBase getApp() {
|
||||
return app;
|
||||
}
|
||||
|
||||
public void setApp(AppBase app) {
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
|
||||
}
|
||||
}
|
||||
140
app/src/main/java/com/uiui/zyos/bean/AriaDownloadInfo.java
Normal file
140
app/src/main/java/com/uiui/zyos/bean/AriaDownloadInfo.java
Normal file
@@ -0,0 +1,140 @@
|
||||
package com.uiui.zyos.bean;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class AriaDownloadInfo implements Serializable {
|
||||
private static final long serialVersionUID = -2835281454196323431L;
|
||||
|
||||
int appId;
|
||||
String appName;
|
||||
String appPackage;
|
||||
String appVersionName;
|
||||
long appVersionCode;
|
||||
String appUrl;
|
||||
String appIcon;
|
||||
long appSize;
|
||||
String appMd5;
|
||||
|
||||
public AriaDownloadInfo(int appId, String appName, String appPackage, String appVersionName, long appVersionCode, String appUrl, String appIcon, long appSize, String appMd5) {
|
||||
this.appId = appId;
|
||||
this.appName = appName;
|
||||
this.appPackage = appPackage;
|
||||
this.appVersionName = appVersionName;
|
||||
this.appVersionCode = appVersionCode;
|
||||
this.appUrl = appUrl;
|
||||
this.appIcon = appIcon;
|
||||
this.appSize = appSize;
|
||||
this.appMd5 = appMd5;
|
||||
}
|
||||
|
||||
public int getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(int appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getAppName() {
|
||||
return appName;
|
||||
}
|
||||
|
||||
public void setAppName(String appName) {
|
||||
this.appName = appName;
|
||||
}
|
||||
|
||||
public String getAppPackage() {
|
||||
return appPackage;
|
||||
}
|
||||
|
||||
public void setAppPackage(String appPackage) {
|
||||
this.appPackage = appPackage;
|
||||
}
|
||||
|
||||
public String getAppVersionName() {
|
||||
return appVersionName;
|
||||
}
|
||||
|
||||
public void setAppVersionName(String appVersionName) {
|
||||
this.appVersionName = appVersionName;
|
||||
}
|
||||
|
||||
public long getAppVersionCode() {
|
||||
return appVersionCode;
|
||||
}
|
||||
|
||||
public void setAppVersionCode(long appVersionCode) {
|
||||
this.appVersionCode = appVersionCode;
|
||||
}
|
||||
|
||||
public String getAppUrl() {
|
||||
return appUrl;
|
||||
}
|
||||
|
||||
public void setAppUrl(String appUrl) {
|
||||
this.appUrl = appUrl;
|
||||
}
|
||||
|
||||
public String getAppIcon() {
|
||||
return appIcon;
|
||||
}
|
||||
|
||||
public void setAppIcon(String appIcon) {
|
||||
this.appIcon = appIcon;
|
||||
}
|
||||
|
||||
public long getAppSize() {
|
||||
return appSize;
|
||||
}
|
||||
|
||||
public void setAppSize(long appSize) {
|
||||
this.appSize = appSize;
|
||||
}
|
||||
|
||||
public String getAppMd5() {
|
||||
return appMd5;
|
||||
}
|
||||
|
||||
public void setAppMd5(String appMd5) {
|
||||
this.appMd5 = appMd5;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
|
||||
}
|
||||
|
||||
public static AriaDownloadInfo toAriaDownloadInfo(AppUpdateInfo appUpdateInfo) {
|
||||
return new AriaDownloadInfo(
|
||||
appUpdateInfo.getApp_id(),
|
||||
appUpdateInfo.getApp().getApp_name(),
|
||||
appUpdateInfo.getApp().getApp_package(),
|
||||
appUpdateInfo.getApp_version_name(),
|
||||
appUpdateInfo.getApp_version_code(),
|
||||
appUpdateInfo.getApp_url(),
|
||||
appUpdateInfo.getApp().getIcon(),
|
||||
appUpdateInfo.getApp_size(),
|
||||
appUpdateInfo.getApp_md5()
|
||||
);
|
||||
}
|
||||
//
|
||||
// public static AriaDownloadInfo toAriaDownloadInfo(AppDetails appDetails) {
|
||||
// return new AriaDownloadInfo(
|
||||
// appDetails.getId(),
|
||||
// appDetails.getApp_name(),
|
||||
// appDetails.getApp_package(),
|
||||
// appDetails.getApp_version_name(),
|
||||
// appDetails.getApp_version_code(),
|
||||
// appDetails.getApp_url(),
|
||||
// appDetails.getApp_icon(),
|
||||
// appDetails.getApp_size(),
|
||||
// appDetails.getApp_md5()
|
||||
// );
|
||||
// }
|
||||
}
|
||||
134
app/src/main/java/com/uiui/zyos/bean/HomeworkBean.java
Normal file
134
app/src/main/java/com/uiui/zyos/bean/HomeworkBean.java
Normal file
@@ -0,0 +1,134 @@
|
||||
package com.uiui.zyos.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class HomeworkBean implements Serializable {
|
||||
private static final long serialVersionUID = 4974017718666880157L;
|
||||
|
||||
int id;
|
||||
int subject_id;
|
||||
int status;
|
||||
String sn;
|
||||
String title;
|
||||
String content;
|
||||
String file_url;
|
||||
String file_name;
|
||||
int file_type;
|
||||
int work_type;
|
||||
String end_time;
|
||||
String created_at;
|
||||
String updated_at;
|
||||
HomeworkSubject subject;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getSubject_id() {
|
||||
return subject_id;
|
||||
}
|
||||
|
||||
public void setSubject_id(int subject_id) {
|
||||
this.subject_id = subject_id;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getFile_url() {
|
||||
return file_url;
|
||||
}
|
||||
|
||||
public void setFile_url(String file_url) {
|
||||
this.file_url = file_url;
|
||||
}
|
||||
|
||||
public String getFile_name() {
|
||||
return file_name;
|
||||
}
|
||||
|
||||
public void setFile_name(String file_name) {
|
||||
this.file_name = file_name;
|
||||
}
|
||||
|
||||
public int getFile_type() {
|
||||
return file_type;
|
||||
}
|
||||
|
||||
public void setFile_type(int file_type) {
|
||||
this.file_type = file_type;
|
||||
}
|
||||
|
||||
public int getWork_type() {
|
||||
return work_type;
|
||||
}
|
||||
|
||||
public void setWork_type(int work_type) {
|
||||
this.work_type = work_type;
|
||||
}
|
||||
|
||||
public String getEnd_time() {
|
||||
return end_time;
|
||||
}
|
||||
|
||||
public void setEnd_time(String end_time) {
|
||||
this.end_time = end_time;
|
||||
}
|
||||
|
||||
public String getCreated_at() {
|
||||
return created_at;
|
||||
}
|
||||
|
||||
public void setCreated_at(String created_at) {
|
||||
this.created_at = created_at;
|
||||
}
|
||||
|
||||
public String getUpdated_at() {
|
||||
return updated_at;
|
||||
}
|
||||
|
||||
public void setUpdated_at(String updated_at) {
|
||||
this.updated_at = updated_at;
|
||||
}
|
||||
|
||||
public HomeworkSubject getSubject() {
|
||||
return subject;
|
||||
}
|
||||
|
||||
public void setSubject(HomeworkSubject subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
}
|
||||
26
app/src/main/java/com/uiui/zyos/bean/HomeworkSubject.java
Normal file
26
app/src/main/java/com/uiui/zyos/bean/HomeworkSubject.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.uiui.zyos.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class HomeworkSubject implements Serializable {
|
||||
private static final long serialVersionUID = 8454145003419075553L;
|
||||
|
||||
int id;
|
||||
String name;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ public class EnglishBasicsDialog extends AlertDialog {
|
||||
private ConstraintLayout cl_sentence;
|
||||
private ConstraintLayout cl_patterns;
|
||||
private ConstraintLayout cl_writing;
|
||||
|
||||
public EnglishBasicsDialog(@NonNull Context context) {
|
||||
super(context, R.style.CustomDialog);
|
||||
this.mContext = context;
|
||||
|
||||
@@ -73,7 +73,7 @@ public class EnglishFragment extends BaseDataBindingFragment<FragmentEnglishBind
|
||||
|
||||
@Override
|
||||
protected void initDataBinding() {
|
||||
|
||||
mContext = getActivity();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,7 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
@@ -25,9 +26,11 @@ import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.activity.ExitActivity;
|
||||
import com.uiui.zyos.activity.more.MoreAppActivity;
|
||||
import com.uiui.zyos.adapter.AppAdapter;
|
||||
import com.uiui.zyos.adapter.NewHomeworkAdapter;
|
||||
import com.uiui.zyos.base.mvvm.fragment.BaseMvvmFragment;
|
||||
import com.uiui.zyos.bean.BaseResponse;
|
||||
import com.uiui.zyos.bean.DesktopIcon;
|
||||
import com.uiui.zyos.bean.HomeworkBean;
|
||||
import com.uiui.zyos.bean.SnInfo;
|
||||
import com.uiui.zyos.bean.StudyStatBean;
|
||||
import com.uiui.zyos.config.CommonConfig;
|
||||
@@ -42,6 +45,7 @@ import com.uiui.zyos.view.RecyclerViewSpacesItemDecoration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
@@ -56,6 +60,7 @@ public class UserFragment extends BaseMvvmFragment<UserViewModel, FragmentUserBi
|
||||
private FragmentActivity mContext;
|
||||
|
||||
private AppAdapter mAppAdapter;
|
||||
private NewHomeworkAdapter mHomeworkAdapter;
|
||||
|
||||
// TODO: Rename parameter arguments, choose names that match
|
||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||
@@ -209,6 +214,12 @@ public class UserFragment extends BaseMvvmFragment<UserViewModel, FragmentUserBi
|
||||
mViewDataBinding.rvApp.addItemDecoration(new RecyclerViewSpacesItemDecoration(stringIntegerHashMap));
|
||||
mAppAdapter = new AppAdapter();
|
||||
mViewDataBinding.rvApp.setAdapter(mAppAdapter);
|
||||
|
||||
mHomeworkAdapter = new NewHomeworkAdapter();
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mContext);
|
||||
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
mViewDataBinding.rvHomework.setLayoutManager(linearLayoutManager);
|
||||
mViewDataBinding.rvHomework.setAdapter(mHomeworkAdapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -276,12 +287,14 @@ public class UserFragment extends BaseMvvmFragment<UserViewModel, FragmentUserBi
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mViewModel.mQrCodeData.observe(this, new Observer<Bitmap>() {
|
||||
@Override
|
||||
public void onChanged(Bitmap bitmap) {
|
||||
mViewDataBinding.ivDeviceQrcode.setImageBitmap(bitmap);
|
||||
}
|
||||
});
|
||||
|
||||
mViewModel.mDesktopListIconData.observe(this, new Observer<ArrayList<DesktopIcon>>() {
|
||||
@Override
|
||||
public void onChanged(ArrayList<DesktopIcon> desktopIcons) {
|
||||
@@ -297,6 +310,7 @@ public class UserFragment extends BaseMvvmFragment<UserViewModel, FragmentUserBi
|
||||
mViewModel.getAppUsedStatistics();
|
||||
}
|
||||
});
|
||||
|
||||
mViewModel.mAppUsedData.observe(this, new Observer<Long>() {
|
||||
@Override
|
||||
public void onChanged(Long time) {
|
||||
@@ -305,6 +319,22 @@ public class UserFragment extends BaseMvvmFragment<UserViewModel, FragmentUserBi
|
||||
// tv_duration.setText(String.format(getString(R.string.today_study_time), useTime));
|
||||
}
|
||||
});
|
||||
|
||||
mViewModel.mHomeworkBeanListData.observe(this, new Observer<List<HomeworkBean>>() {
|
||||
@Override
|
||||
public void onChanged(List<HomeworkBean> homeworkBeans) {
|
||||
mHomeworkAdapter.setHomeworkList(homeworkBeans);
|
||||
if (homeworkBeans==null||homeworkBeans.isEmpty()){
|
||||
mViewDataBinding.llNodata.setVisibility(View.VISIBLE);
|
||||
mViewDataBinding.rvHomework.setVisibility(View.GONE);
|
||||
}else {
|
||||
mViewDataBinding.llNodata.setVisibility(View.GONE);
|
||||
mViewDataBinding.rvHomework.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mViewModel.getHomework();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.uiui.zyos.base.mvvm.BaseViewModel;
|
||||
import com.uiui.zyos.bean.AppUsed;
|
||||
import com.uiui.zyos.bean.BaseResponse;
|
||||
import com.uiui.zyos.bean.DesktopIcon;
|
||||
import com.uiui.zyos.bean.HomeworkBean;
|
||||
import com.uiui.zyos.bean.SnInfo;
|
||||
import com.uiui.zyos.bean.StudyStatBean;
|
||||
import com.uiui.zyos.config.CommonConfig;
|
||||
@@ -190,4 +191,34 @@ public class UserViewModel extends BaseViewModel<FragmentUserBinding, FragmentEv
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MutableLiveData<List<HomeworkBean>> mHomeworkBeanListData = new MutableLiveData<>();
|
||||
|
||||
public void getHomework() {
|
||||
NetInterfaceManager.getInstance().getHomeworkObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<List<HomeworkBean>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getHomework", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<HomeworkBean>> listBaseResponse) {
|
||||
Log.e("getHomework", "onNext: " + listBaseResponse);
|
||||
List<HomeworkBean> homeworkBeans = listBaseResponse.data;
|
||||
mHomeworkBeanListData.setValue(homeworkBeans);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getHomework", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getHomework", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.uiui.zyos.network;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Environment;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -13,8 +14,10 @@ import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.trello.rxlifecycle4.android.FragmentEvent;
|
||||
import com.uiui.zyos.alarm.AlarmUtils;
|
||||
import com.uiui.zyos.bean.AlarmClockData;
|
||||
import com.uiui.zyos.bean.AppUpdateInfo;
|
||||
import com.uiui.zyos.bean.BaseResponse;
|
||||
import com.uiui.zyos.bean.GuideBean;
|
||||
import com.uiui.zyos.bean.HomeworkBean;
|
||||
import com.uiui.zyos.bean.LessonApp;
|
||||
import com.uiui.zyos.bean.LessonJson;
|
||||
import com.uiui.zyos.bean.LessonSetting;
|
||||
@@ -30,12 +33,15 @@ import com.uiui.zyos.network.api.AppUsageRecordApi;
|
||||
import com.uiui.zyos.network.api.CloudLessonApi;
|
||||
import com.uiui.zyos.network.api.CloudLessonAppApi;
|
||||
import com.uiui.zyos.network.api.GetFilesApi;
|
||||
import com.uiui.zyos.network.api.GetHomeworkApi;
|
||||
import com.uiui.zyos.network.api.HomeworkDetailApi;
|
||||
import com.uiui.zyos.network.api.RunNewApp;
|
||||
import com.uiui.zyos.network.api.SNInfoApi;
|
||||
import com.uiui.zyos.network.api.StudyStatApi;
|
||||
import com.uiui.zyos.network.api.UpdateAddressApi;
|
||||
import com.uiui.zyos.network.api.UpdateAlarmClockApi;
|
||||
import com.uiui.zyos.network.api.UserInfoControl;
|
||||
import com.uiui.zyos.network.api.uiuios.CheckUpdateApi;
|
||||
import com.uiui.zyos.network.interceptor.RepeatRequestInterceptor;
|
||||
import com.uiui.zyos.utils.OpenApkUtils;
|
||||
|
||||
@@ -70,13 +76,15 @@ public class NetInterfaceManager {
|
||||
private CacheHelper mCacheHelper;
|
||||
|
||||
private Retrofit mRetrofit;
|
||||
private OkHttpClient okHttpClient;
|
||||
private OkHttpClient mOkHttpClient;
|
||||
private Retrofit mUiuiosRetrofit;
|
||||
private OkHttpClient mUiuiosOkHttpClient;
|
||||
|
||||
private final ConcurrentHashMap<String, Long> requestIdsMap = new ConcurrentHashMap<>();
|
||||
//超时时间
|
||||
private static int timeOut = 30;
|
||||
private static final int TIME_OUT = 30;
|
||||
// 缓存文件最大限制大小20M
|
||||
private static long cacheSize = 1024 * 1024 * 64;
|
||||
private static final long CACHE_SIZE = 1024 * 1024 * 64;
|
||||
|
||||
public static final String HTTP_KEY = "YTM3YTAxNTJmMmZmNzkyM2E2YzIwZjlhZTc0NzNmMGI=";
|
||||
public static final String CUSTOM_REPEAT_REQ_PROTOCOL = "MY_CUSTOM_REPEAT_REQ_PROTOCOL";
|
||||
@@ -84,31 +92,55 @@ public class NetInterfaceManager {
|
||||
private NetInterfaceManager(Context context) {
|
||||
this.mContext = context;
|
||||
this.mCacheHelper = new CacheHelper(context);
|
||||
if (okHttpClient == null) {
|
||||
if (mOkHttpClient == null) {
|
||||
|
||||
//如果无法生存缓存文件目录,检测权限使用已经加上,检测手机是否把文件读写权限禁止了
|
||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||
builder.connectTimeout(timeOut, TimeUnit.SECONDS); // 设置连接超时时间
|
||||
builder.writeTimeout(timeOut, TimeUnit.SECONDS);// 设置写入超时时间
|
||||
builder.readTimeout(timeOut, TimeUnit.SECONDS);// 设置读取数据超时时间
|
||||
builder.connectTimeout(TIME_OUT, TimeUnit.SECONDS); // 设置连接超时时间
|
||||
builder.writeTimeout(TIME_OUT, TimeUnit.SECONDS);// 设置写入超时时间
|
||||
builder.readTimeout(TIME_OUT, TimeUnit.SECONDS);// 设置读取数据超时时间
|
||||
builder.retryOnConnectionFailure(true);// 设置进行连接失败重试
|
||||
builder.addInterceptor(new RepeatRequestInterceptor());
|
||||
|
||||
// 设置缓存文件路径
|
||||
String cacheDirectory = mContext.getExternalCacheDir().getAbsolutePath() + "/OkHttpCache";
|
||||
Cache cache = new Cache(new File(cacheDirectory), cacheSize);
|
||||
Cache cache = new Cache(new File(getCacheDir() + "/OkHttpCache"), CACHE_SIZE);
|
||||
builder.cache(cache);// 设置缓存
|
||||
okHttpClient = builder.build();
|
||||
mOkHttpClient = builder.build();
|
||||
}
|
||||
|
||||
if (mRetrofit == null) {
|
||||
mRetrofit = new Retrofit.Builder()
|
||||
.client(okHttpClient)
|
||||
.client(mOkHttpClient)
|
||||
.baseUrl(UrlAddress.ROOT_URL)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
|
||||
.build();
|
||||
}
|
||||
|
||||
if (mUiuiosOkHttpClient == null) {
|
||||
|
||||
//如果无法生存缓存文件目录,检测权限使用已经加上,检测手机是否把文件读写权限禁止了
|
||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||
builder.connectTimeout(TIME_OUT, TimeUnit.SECONDS); // 设置连接超时时间
|
||||
builder.writeTimeout(TIME_OUT, TimeUnit.SECONDS);// 设置写入超时时间
|
||||
builder.readTimeout(TIME_OUT, TimeUnit.SECONDS);// 设置读取数据超时时间
|
||||
builder.retryOnConnectionFailure(true);// 设置进行连接失败重试
|
||||
builder.addInterceptor(new RepeatRequestInterceptor());
|
||||
|
||||
// 设置缓存文件路径
|
||||
Cache cache = new Cache(new File(getCacheDir() + "/OkHttpCache"), CACHE_SIZE);
|
||||
builder.cache(cache);// 设置缓存
|
||||
mUiuiosOkHttpClient = builder.build();
|
||||
}
|
||||
|
||||
if (mUiuiosRetrofit == null) {
|
||||
mUiuiosRetrofit = new Retrofit.Builder()
|
||||
.client(mUiuiosOkHttpClient)
|
||||
.baseUrl(UrlAddress.UIUIOS_ROOT_URL)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,6 +163,23 @@ public class NetInterfaceManager {
|
||||
Log.e("OKhttp ", " 打印HTTP请求完成 Headers \n");
|
||||
}
|
||||
|
||||
private String getCacheDir() {
|
||||
String cachePath;
|
||||
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
|
||||
|| !Environment.isExternalStorageRemovable()) {
|
||||
if (mContext.getExternalCacheDir() != null) {
|
||||
cachePath = mContext.getExternalCacheDir().getPath();
|
||||
} else if (mContext.getExternalFilesDir("cache") != null) {
|
||||
cachePath = mContext.getExternalFilesDir("cache").getPath();
|
||||
} else {
|
||||
cachePath = mContext.getCacheDir().getPath();
|
||||
}
|
||||
} else {
|
||||
cachePath = mContext.getCacheDir().getPath();
|
||||
}
|
||||
return cachePath;
|
||||
}
|
||||
|
||||
public static void init(Context context) {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = new NetInterfaceManager(context);
|
||||
@@ -145,7 +194,20 @@ public class NetInterfaceManager {
|
||||
}
|
||||
|
||||
public OkHttpClient getOkHttpClient() {
|
||||
return okHttpClient;
|
||||
return mOkHttpClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查更新
|
||||
*
|
||||
* @param pkg
|
||||
* @return
|
||||
*/
|
||||
public Observable<BaseResponse<AppUpdateInfo>> getCheckUpdateObservable(String pkg) {
|
||||
return mUiuiosRetrofit.create(CheckUpdateApi.class)
|
||||
.checkUpdate(pkg)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -234,6 +296,20 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<List<HomeworkBean>>> getHomeworkObservable() {
|
||||
return mRetrofit.create(GetHomeworkApi.class)
|
||||
.getHomeworks(RemoteManager.getInstance().getSerial())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<HomeworkBean>> getHomeworkDetailObservable(int id) {
|
||||
return mRetrofit.create(HomeworkDetailApi.class)
|
||||
.getHomeworkDetail(RemoteManager.getInstance().getSerial(), id)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* execution
|
||||
|
||||
@@ -24,7 +24,17 @@ public class UrlAddress {
|
||||
/*获取文件*/
|
||||
public static final String GET_FILES = "file/getFiles";
|
||||
|
||||
/*家庭作业列表*/
|
||||
public static final String GET_HOMEWORK = "homework/index";
|
||||
/*家庭作业详情*/
|
||||
public static final String GET_HOMEWORK_DETAIL = "homework/show";
|
||||
|
||||
/*网课模式*/
|
||||
public final static String GET_CLOUD_LESSON = "Control/getCloudLessonSetting";
|
||||
public final static String GET_CLOUD_LESSON_APP = "Control/getCloudLessonApp";
|
||||
|
||||
|
||||
public static final String UIUIOS_ROOT_URL = "https://map.uiuios.com/android/";
|
||||
/*获取应用更新*/
|
||||
public static final String CHECK_UPDATE = "app/check-update";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.uiui.zyos.network.api;
|
||||
|
||||
import com.uiui.zyos.bean.BaseResponse;
|
||||
import com.uiui.zyos.bean.HomeworkBean;
|
||||
import com.uiui.zyos.network.UrlAddress;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface GetHomeworkApi {
|
||||
@GET(UrlAddress.GET_HOMEWORK)
|
||||
Observable<BaseResponse<List<HomeworkBean>>> getHomeworks(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.uiui.zyos.network.api;
|
||||
|
||||
import com.uiui.zyos.bean.BaseResponse;
|
||||
import com.uiui.zyos.bean.HomeworkBean;
|
||||
import com.uiui.zyos.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface HomeworkDetailApi {
|
||||
@GET(UrlAddress.GET_HOMEWORK_DETAIL)
|
||||
Observable<BaseResponse<HomeworkBean>> getHomeworkDetail(
|
||||
@Query("sn") String sn,
|
||||
@Query("id") int id
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.uiui.zyos.network.api.uiuios;
|
||||
|
||||
import com.uiui.zyos.bean.AppUpdateInfo;
|
||||
import com.uiui.zyos.bean.BaseResponse;
|
||||
import com.uiui.zyos.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface CheckUpdateApi {
|
||||
@GET(UrlAddress.CHECK_UPDATE)
|
||||
Observable<BaseResponse<AppUpdateInfo>> checkUpdate(
|
||||
@Query("app_package") String app_package
|
||||
);
|
||||
}
|
||||
@@ -1,13 +1,33 @@
|
||||
package com.uiui.zyos.service;
|
||||
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import com.arialyy.annotations.Download;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.task.DownloadTask;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.bean.AriaDownloadInfo;
|
||||
import com.uiui.zyos.utils.ApkUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
public class DownloadService extends Service {
|
||||
private static final String TAG = "DownloadService";
|
||||
@@ -23,13 +43,17 @@ public class DownloadService extends Service {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
Aria.init(this);
|
||||
Aria.download(this).register();
|
||||
|
||||
|
||||
mNotificationManagerCompat = NotificationManagerCompat.from(this);
|
||||
createNotificationChannel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
return super.onStartCommand(intent, flags, startId);
|
||||
Log.e(TAG, "onStartCommand: " + intent);
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -37,20 +61,172 @@ public class DownloadService extends Service {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
//在这里处理任务执行中的状态,如进度进度条的刷新
|
||||
private static final String CHANNEL_ID = "CHANNEL_ID";
|
||||
private static final String CHANNEL_NAME = "系统通知";
|
||||
private static final String CHANNEL_DESCRIPTION = "关怀桌面通知";
|
||||
|
||||
private static final String CHANNEL_DOWNLOAD = "DOWNLOAD_CHANNEL";
|
||||
private static final String CHANNEL_DOWNLOAD_NAME = "下载管理";
|
||||
private static final String CHANNEL_DOWNLOAD_DESCRIPTION = "下载管理通知";
|
||||
|
||||
private void createNotificationChannel() {
|
||||
// Create the NotificationChannel, but only on API 26+ because
|
||||
// the NotificationChannel class is new and not in the support library
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
CharSequence name = CHANNEL_NAME;
|
||||
String description = CHANNEL_DESCRIPTION;
|
||||
int importance = NotificationManager.IMPORTANCE_DEFAULT;
|
||||
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
|
||||
channel.setDescription(description);
|
||||
// Register the channel with the system; you can't change the importance
|
||||
// or other notification behaviors after this
|
||||
NotificationManager notificationManager = getSystemService(NotificationManager.class);
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
}
|
||||
|
||||
private NotificationManagerCompat mNotificationManagerCompat;
|
||||
private int NotificationID = 7890;
|
||||
|
||||
private void sendSimpleNotification() {
|
||||
Intent intent = new Intent(this, DownloadService.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "CHANNEL_ID")
|
||||
.setSmallIcon(R.mipmap.ic_launcher)
|
||||
.setContentTitle("关怀系统正在运行")
|
||||
// .setContentText("测试内容")
|
||||
.setAutoCancel(false)
|
||||
.setShowWhen(false)
|
||||
.setContentIntent(pendingIntent)
|
||||
.setOngoing(true)
|
||||
.setOnlyAlertOnce(true)
|
||||
.setPriority(NotificationCompat.PRIORITY_MAX);
|
||||
// notificationId is a unique int for each notification that you must define
|
||||
// mNotificationManagerCompat.notify(NotificationID, builder.build());
|
||||
startForeground(NotificationID, builder.build());
|
||||
}
|
||||
|
||||
private void sendDownloadRunning(AriaDownloadInfo ariaDownloadInfo, int progress) {
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_DOWNLOAD)
|
||||
.setSmallIcon(R.mipmap.ic_launcher)
|
||||
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))
|
||||
.setContentTitle(ariaDownloadInfo.getAppName())
|
||||
.setContentText("下载中:" + progress + "%")
|
||||
.setAutoCancel(true)
|
||||
.setShowWhen(true)
|
||||
.setOngoing(false)
|
||||
.setOnlyAlertOnce(true)
|
||||
.setProgress(100, progress, false)
|
||||
.setPriority(NotificationCompat.PRIORITY_HIGH);
|
||||
// notificationId is a unique int for each notification that you must define
|
||||
mNotificationManagerCompat.notify(ariaDownloadInfo.getAppId(), builder.build());
|
||||
}
|
||||
|
||||
private void sendDownloadComplete(AriaDownloadInfo ariaDownloadInfo, String path) {
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_DOWNLOAD)
|
||||
.setSmallIcon(R.mipmap.ic_launcher)
|
||||
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))
|
||||
.setContentTitle(ariaDownloadInfo.getAppName())
|
||||
.setContentText("下载完成")
|
||||
.setAutoCancel(true)
|
||||
.setShowWhen(true)
|
||||
.setOngoing(false)
|
||||
.setOnlyAlertOnce(true)
|
||||
.setPriority(NotificationCompat.PRIORITY_HIGH)
|
||||
.setContentIntent(createIntent(path));
|
||||
// notificationId is a unique int for each notification that you must define
|
||||
mNotificationManagerCompat.notify(ariaDownloadInfo.getAppId(), builder.build());
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置通知点击事件
|
||||
*
|
||||
* @return 点击事件
|
||||
*/
|
||||
private PendingIntent createIntent(String path) {
|
||||
File file = new File(path);
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
//注意第二个参数,要保持和manifest中android:authorities的值相同
|
||||
Uri uri = FileProvider.getUriForFile(DownloadService.this,
|
||||
getPackageName() + ".FileProvider", file);
|
||||
intent.setDataAndType(uri, "application/vnd.android.package-archive");
|
||||
} else {
|
||||
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
|
||||
}
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(DownloadService.this, 0, intent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
return pendingIntent;
|
||||
}
|
||||
|
||||
private void sendDownloadFail(AriaDownloadInfo ariaDownloadInfo) {
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_DOWNLOAD)
|
||||
.setSmallIcon(R.mipmap.ic_launcher)
|
||||
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))
|
||||
.setContentTitle(ariaDownloadInfo.getAppName())
|
||||
.setContentText("下载失败")
|
||||
.setAutoCancel(true)
|
||||
.setShowWhen(true)
|
||||
.setOngoing(false)
|
||||
.setOnlyAlertOnce(true)
|
||||
.setPriority(NotificationCompat.PRIORITY_HIGH);
|
||||
// notificationId is a unique int for each notification that you must define
|
||||
mNotificationManagerCompat.notify(ariaDownloadInfo.getAppId(), builder.build());
|
||||
}
|
||||
|
||||
@Download.onTaskRunning
|
||||
protected void running(DownloadTask task) {
|
||||
Log.e("aria", "正在下载:" + task.getPercent() + ":" + task.getExtendField());
|
||||
void running(DownloadTask task) {
|
||||
String jsonString = task.getExtendField();
|
||||
Log.e(TAG, "running: " + "正在下载:" + task.getPercent() + "% " + jsonString);
|
||||
AriaDownloadInfo ariaDownloadInfo = getAriaDownloadInfo(jsonString);
|
||||
if (ariaDownloadInfo != null) {
|
||||
Toaster.show("正在下载: " + ariaDownloadInfo.getAppName() + "\t" + task.getPercent() + "%");
|
||||
sendDownloadRunning(ariaDownloadInfo, task.getPercent());
|
||||
}
|
||||
}
|
||||
|
||||
@Download.onTaskComplete
|
||||
void taskComplete(DownloadTask task) {
|
||||
//在这里处理任务完成的状态
|
||||
Log.e(TAG, "taskComplete: " + task.getFilePath());
|
||||
ApkUtils.installApkFile(DownloadService.this, task.getFilePath());
|
||||
String jsonString = task.getExtendField();
|
||||
Log.e(TAG, "taskComplete: " + "下载完成:" + jsonString);
|
||||
AriaDownloadInfo ariaDownloadInfo = getAriaDownloadInfo(jsonString);
|
||||
if (ariaDownloadInfo != null) {
|
||||
Toaster.show("下载完成: " + "\t" + ariaDownloadInfo.getAppName());
|
||||
sendDownloadComplete(ariaDownloadInfo, task.getFilePath());
|
||||
}
|
||||
}
|
||||
|
||||
@Download.onTaskFail
|
||||
void taskFail(DownloadTask task, Exception e) {
|
||||
Log.e(TAG, "taskFail: ");
|
||||
String jsonString = task.getExtendField();
|
||||
Log.e(TAG, "taskFail: " + "下载失败:" + jsonString);
|
||||
AriaDownloadInfo ariaDownloadInfo = getAriaDownloadInfo(jsonString);
|
||||
if (ariaDownloadInfo != null) {
|
||||
Toaster.show("下载失败: " + "\t" + ariaDownloadInfo.getAppName());
|
||||
sendDownloadFail(ariaDownloadInfo);
|
||||
}
|
||||
}
|
||||
|
||||
private AriaDownloadInfo getAriaDownloadInfo(String jsonString) {
|
||||
if (!TextUtils.isEmpty(jsonString)) {
|
||||
Gson gson = new Gson();
|
||||
Type type = new TypeToken<AriaDownloadInfo>() {
|
||||
}.getType();
|
||||
AriaDownloadInfo ariaDownloadInfo = null;
|
||||
try {
|
||||
ariaDownloadInfo = gson.fromJson(jsonString, type);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "getAriaDownloadInfo: " + e.getMessage());
|
||||
}
|
||||
return ariaDownloadInfo;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ import io.reactivex.rxjava3.functions.Consumer;
|
||||
* 3.设备用户解除绑定后,断开websocket 等待5秒 再重新链接websocket 以刷新用户关联
|
||||
*/
|
||||
public class SocketService extends Service implements NetworkUtils.OnNetworkStatusChangedListener {
|
||||
private final static String TAG = "JWebSocketClientService";
|
||||
private static final String TAG = "JWebSocketClientService";
|
||||
|
||||
public JWebSocketClient mJWebSocketClient;
|
||||
// private SocketServiceBinder mBinder = new SocketServiceBinder();
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageInstaller;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Binder;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
@@ -16,8 +17,10 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import com.uiui.zyos.BuildConfig;
|
||||
import com.uiui.zyos.bean.AppUpdateInfo;
|
||||
import com.uiui.zyos.bean.DesktopIcon;
|
||||
import com.uiui.zyos.manager.RemoteManager;
|
||||
import com.uiui.zyos.receiver.InstallResultReceiver;
|
||||
@@ -633,4 +636,87 @@ public class ApkUtils {
|
||||
context.startActivity(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean isUpdate(Context context, AppUpdateInfo appUpdateInfo) {
|
||||
String packageName = appUpdateInfo.getApp().getApp_package();
|
||||
long versionCode = appUpdateInfo.getApp_version_code();
|
||||
return isUpdate(context, packageName, versionCode);
|
||||
}
|
||||
|
||||
public static boolean isUpdate(Context context, String packageName, long versionCode) {
|
||||
PackageInfo packageInfo = null;
|
||||
try {
|
||||
packageInfo = context.getPackageManager().getPackageInfo(packageName, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (packageInfo == null) {
|
||||
return true;
|
||||
} else {
|
||||
long appVersionCode;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
appVersionCode = packageInfo.getLongVersionCode();
|
||||
} else {
|
||||
appVersionCode = packageInfo.versionCode;
|
||||
}
|
||||
if (appVersionCode < versionCode) {
|
||||
return true;
|
||||
} else {
|
||||
Log.e(TAG, "checkUpdate: " + packageName + "\t已经是最新版");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void installApkFile(Context context, String path) {
|
||||
File apk = new File(path);
|
||||
installApkFile(context, apk);
|
||||
}
|
||||
|
||||
public static void checkAppUpdate(Context context, AppUpdateInfo appUpdateInfo) {
|
||||
String packageName = appUpdateInfo.getApp().getApp_package();
|
||||
long versionCode = appUpdateInfo.getApp_version_code();
|
||||
String url = appUpdateInfo.getApp_url();
|
||||
PackageInfo packageInfo = null;
|
||||
try {
|
||||
packageInfo = context.getPackageManager().getPackageInfo(packageName, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (packageInfo == null) {
|
||||
FileUtil.ariaDownload(context, url, appUpdateInfo);
|
||||
} else {
|
||||
long appVersionCode;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
appVersionCode = packageInfo.getLongVersionCode();
|
||||
} else {
|
||||
appVersionCode = packageInfo.versionCode;
|
||||
}
|
||||
if (appVersionCode < versionCode) {
|
||||
FileUtil.ariaDownload(context, url, appUpdateInfo);
|
||||
} else {
|
||||
Log.e(TAG, "checkUpdate: " + packageName + "\t已经是最新版");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void installApkFile(Context context, File file) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
//注意第二个参数,要保持和manifest中android:authorities的值相同
|
||||
Uri uri = FileProvider.getUriForFile(context,
|
||||
context.getPackageName() + ".FileProvider", file);
|
||||
intent.setDataAndType(uri, "application/vnd.android.package-archive");
|
||||
} else {
|
||||
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
|
||||
}
|
||||
try {
|
||||
context.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,33 @@
|
||||
package com.uiui.zyos.utils;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
import android.provider.MediaStore;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.uiui.zyos.bean.AppUpdateInfo;
|
||||
import com.uiui.zyos.bean.AriaDownloadInfo;
|
||||
import com.uiui.zyos.gson.GsonUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class FileUtil {
|
||||
private static final String TAG = "FileUtil";
|
||||
|
||||
public static String getFileType(String url) {
|
||||
if (url.indexOf("/") == -1) {
|
||||
return url.substring(url.indexOf("."), url.length());
|
||||
@@ -14,6 +37,10 @@ public class FileUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isLocalPath(String path) {
|
||||
return path.startsWith(File.separator);
|
||||
}
|
||||
|
||||
private static HashSet<String> videoFormat = new HashSet<String>() {{
|
||||
this.add(".mp4");
|
||||
this.add(".avi");
|
||||
@@ -51,4 +78,191 @@ public class FileUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static File uriToFile(Uri uri, Context context) {
|
||||
String path = null;
|
||||
if ("file".equals(uri.getScheme())) {
|
||||
path = uri.getEncodedPath();
|
||||
if (path != null) {
|
||||
path = Uri.decode(path);
|
||||
ContentResolver cr = context.getContentResolver();
|
||||
StringBuffer buff = new StringBuffer();
|
||||
buff.append("(").append(MediaStore.Images.ImageColumns.DATA).append("=").append("'" + path + "'").append(")");
|
||||
Cursor cur = cr.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new String[]{MediaStore.Images.ImageColumns._ID, MediaStore.Images.ImageColumns.DATA}, buff.toString(), null, null);
|
||||
int index = 0;
|
||||
int dataIdx = 0;
|
||||
for (cur.moveToFirst(); !cur.isAfterLast(); cur.moveToNext()) {
|
||||
index = cur.getColumnIndex(MediaStore.Images.ImageColumns._ID);
|
||||
index = cur.getInt(index);
|
||||
dataIdx = cur.getColumnIndex(MediaStore.Images.ImageColumns.DATA);
|
||||
path = cur.getString(dataIdx);
|
||||
}
|
||||
cur.close();
|
||||
if (index == 0) {
|
||||
} else {
|
||||
Uri u = Uri.parse("content://media/external/images/media/" + index);
|
||||
System.out.println("temp uri is :" + u);
|
||||
}
|
||||
}
|
||||
if (path != null) {
|
||||
return new File(path);
|
||||
}
|
||||
} else if ("content".equals(uri.getScheme())) {
|
||||
// 4.2.2以后
|
||||
String[] proj = {MediaStore.Images.Media.DATA};
|
||||
Cursor cursor = context.getContentResolver().query(uri, proj, null, null, null);
|
||||
if (cursor.moveToFirst()) {
|
||||
int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
|
||||
path = cursor.getString(columnIndex);
|
||||
}
|
||||
cursor.close();
|
||||
|
||||
return new File(path);
|
||||
} else {
|
||||
//Log.i(TAG, "Uri Scheme:" + uri.getScheme());
|
||||
return new File(uri.toString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* drawable转为file
|
||||
*
|
||||
* @param drawableId drawable的ID
|
||||
* @param fileName 转换后的文件名
|
||||
* @return
|
||||
*/
|
||||
public static File drawableToFile(Context context, int drawableId, String fileName) {
|
||||
// InputStream is = view.getContext().getResources().openRawResource(R.drawable.logo);
|
||||
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), drawableId);
|
||||
// Bitmap bitmap = BitmapFactory.decodeStream(is);
|
||||
String defaultPath = context.getFilesDir().getAbsolutePath() + "/defaultGoodInfo";
|
||||
File file = new File(defaultPath);
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
String defaultImgPath = defaultPath + "/" + fileName;
|
||||
file = new File(defaultImgPath);
|
||||
try {
|
||||
file.createNewFile();
|
||||
FileOutputStream fOut = new FileOutputStream(file);
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 20, fOut);
|
||||
// is.close();
|
||||
fOut.flush();
|
||||
fOut.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* bitmap
|
||||
*
|
||||
* @param bitmap bitmap
|
||||
* @param fileName 转换后的文件名
|
||||
* @return
|
||||
*/
|
||||
public static File bitmapToFile(Context context, Bitmap bitmap, String fileName) {
|
||||
String defaultPath = context.getFilesDir().getAbsolutePath() + "/defaultGoodInfo";
|
||||
File file = new File(defaultPath);
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
String defaultImgPath = defaultPath + "/" + fileName;
|
||||
file = new File(defaultImgPath);
|
||||
try {
|
||||
file.createNewFile();
|
||||
FileOutputStream fOut = new FileOutputStream(file);
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut);
|
||||
// is.close();
|
||||
fOut.flush();
|
||||
fOut.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
|
||||
public static String getFileNamefromURL(String url) {
|
||||
int position = url.lastIndexOf("/");
|
||||
return url.substring(position + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个文件的MD5值
|
||||
*
|
||||
* @param file 文件
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static String getFileMd5(File file) {
|
||||
if (!file.isFile()) {
|
||||
return "";
|
||||
}
|
||||
MessageDigest digest = null;
|
||||
FileInputStream in = null;
|
||||
byte buffer[] = new byte[1024];
|
||||
int len;
|
||||
try {
|
||||
digest = MessageDigest.getInstance("MD5");
|
||||
in = new FileInputStream(file);
|
||||
while ((len = in.read(buffer, 0, 1024)) != -1) {
|
||||
digest.update(buffer, 0, len);
|
||||
}
|
||||
in.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
BigInteger bigInt = new BigInteger(1, digest.digest());
|
||||
return bigInt.toString(32);
|
||||
}
|
||||
|
||||
public static String getDownLoadPath(Context context) {
|
||||
String path = ContextCompat.getExternalFilesDirs(context, Environment.DIRECTORY_DOWNLOADS)[0].getAbsolutePath();
|
||||
return path + File.separator;
|
||||
}
|
||||
|
||||
// public static void ariaDownload(Context context, String url, AppDetails appDetails) {
|
||||
// Log.e(TAG, "ariaDownload: " + appDetails);
|
||||
// AriaDownloadInfo ariaDownloadInfo = AriaDownloadInfo.toAriaDownloadInfo(appDetails);
|
||||
// ariaDownload(context, url, ariaDownloadInfo);
|
||||
// }
|
||||
|
||||
public static void ariaDownload(Context context, String url, AppUpdateInfo appUpdateInfo) {
|
||||
Log.e(TAG, "ariaDownload: " + appUpdateInfo);
|
||||
AriaDownloadInfo ariaDownloadInfo = AriaDownloadInfo.toAriaDownloadInfo(appUpdateInfo);
|
||||
ariaDownload(context, url, ariaDownloadInfo);
|
||||
}
|
||||
|
||||
public static void ariaDownload(Context context, String url, AriaDownloadInfo ariaDownloadInfo) {
|
||||
Log.e(TAG, "ariaDownload: " + ariaDownloadInfo);
|
||||
String fileName = getFileNamefromURL(url);
|
||||
String app_md5 = ariaDownloadInfo.getAppMd5();
|
||||
Log.e("ariaDownload", "app_md5 = " + app_md5);
|
||||
File file = new File(getDownLoadPath(context) + fileName);
|
||||
if (file.exists() && !file.isDirectory()) {
|
||||
String fileMd5 = com.blankj.utilcode.util.FileUtils.getFileMD5ToString(file);
|
||||
Log.e("ariaDownload", "fileMD5 = " + fileMd5);
|
||||
if (fileMd5.equalsIgnoreCase(app_md5)) {
|
||||
ApkUtils.installApkFile(context, file);
|
||||
} else {
|
||||
file.delete();
|
||||
Aria.download(context)
|
||||
.load(url) //读取下载地址
|
||||
.setFilePath(getDownLoadPath(context) + fileName)
|
||||
.ignoreFilePathOccupy()
|
||||
.setExtendField(GsonUtils.toJSONString(ariaDownloadInfo))
|
||||
.create(); //启动下载}
|
||||
}
|
||||
} else {
|
||||
Aria.download(context)
|
||||
.load(url) //读取下载地址
|
||||
.setFilePath(getDownLoadPath(context) + fileName)
|
||||
.ignoreFilePathOccupy()
|
||||
.setExtendField(GsonUtils.toJSONString(ariaDownloadInfo))
|
||||
.create(); //启动下载}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.uiui.zyos.config.CommonConfig;
|
||||
import com.uiui.zyos.jxw.JxwPackageConfig;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@@ -383,15 +384,29 @@ public class OpenApkUtils {
|
||||
if (packageInfo == null) {
|
||||
return false;
|
||||
}
|
||||
long appVersionCode;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
appVersionCode = packageInfo.getLongVersionCode();
|
||||
} else {
|
||||
appVersionCode = packageInfo.versionCode;
|
||||
}
|
||||
if (appVersionCode > 10) {
|
||||
return false;
|
||||
} else {
|
||||
// long appVersionCode;
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
// appVersionCode = packageInfo.getLongVersionCode();
|
||||
// } else {
|
||||
// appVersionCode = packageInfo.versionCode;
|
||||
// }
|
||||
// if (appVersionCode > 10) {
|
||||
// return false;
|
||||
// } else {
|
||||
// return true;
|
||||
// }
|
||||
String versionName = packageInfo.versionName;
|
||||
Log.e(TAG, "isNewAiApp: versionName = " + versionName);
|
||||
try {
|
||||
BigDecimal version = new BigDecimal("20240527");
|
||||
BigDecimal bigDecimal = new BigDecimal(versionName);
|
||||
if (bigDecimal.compareTo(version) > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "isNewAiApp: " + e.getMessage());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
BIN
app/src/main/res/drawable-hdpi/icon_close.png
Normal file
BIN
app/src/main/res/drawable-hdpi/icon_close.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/drawable-hdpi/no_homework.png
Normal file
BIN
app/src/main/res/drawable-hdpi/no_homework.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
9
app/src/main/res/drawable/dialog_background.xml
Normal file
9
app/src/main/res/drawable/dialog_background.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#ffffff" />
|
||||
<stroke
|
||||
android:width="0.8dp"
|
||||
android:color="#ffffff" />
|
||||
<!-- 圆角 -->
|
||||
<corners android:radius="12dp" />
|
||||
</shape>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 内部颜色 -->
|
||||
<solid android:color="#33000000" />
|
||||
<solid android:color="#ffffff" />
|
||||
<!-- 圆角的幅度 -->
|
||||
<corners
|
||||
android:bottomLeftRadius="@dimen/dp_8"
|
||||
|
||||
13
app/src/main/res/drawable/update_background.xml
Normal file
13
app/src/main/res/drawable/update_background.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 内部颜色 -->
|
||||
<solid android:color="@color/default_blue" />
|
||||
<!-- 圆角的幅度 -->
|
||||
<corners android:radius="32dp" />
|
||||
|
||||
<padding
|
||||
android:bottom="6dp"
|
||||
android:left="32dp"
|
||||
android:right="32dp"
|
||||
android:top="6dp" />
|
||||
</shape>
|
||||
13
app/src/main/res/drawable/update_cancel_background.xml
Normal file
13
app/src/main/res/drawable/update_cancel_background.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 内部颜色 -->
|
||||
<solid android:color="@color/lightGray" />
|
||||
<!-- 圆角的幅度 -->
|
||||
<corners android:radius="32dp" />
|
||||
|
||||
<padding
|
||||
android:bottom="6dp"
|
||||
android:left="32dp"
|
||||
android:right="32dp"
|
||||
android:top="6dp" />
|
||||
</shape>
|
||||
@@ -340,7 +340,7 @@
|
||||
android:id="@+id/cl_activation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible">
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_date1"
|
||||
@@ -530,6 +530,95 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_homework"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_date3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:text="2月14日 星期二"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_homework_more"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_date3"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_date3">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView14"
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/user_more"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_homework"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="@dimen/dp_8"
|
||||
android:fadeScrollbars="false"
|
||||
android:scrollbars="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_date3" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/ll_nodata"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="@dimen/dp_8"
|
||||
android:fadeScrollbars="false"
|
||||
android:scrollbars="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_date3">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView23"
|
||||
android:layout_width="@dimen/dp_64"
|
||||
android:layout_height="@dimen/dp_64"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/no_homework"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.418" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:text="暂无作业"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintEnd_toEndOf="@+id/imageView23"
|
||||
app:layout_constraintStart_toStartOf="@+id/imageView23"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView23" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -458,7 +458,7 @@
|
||||
android:id="@+id/cl_app"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible">
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_date2"
|
||||
@@ -532,6 +532,96 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_homework"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_date3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:text="2月14日 星期二"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_homework_more"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_date3"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_date3">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView14"
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/user_more"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_homework"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="@dimen/dp_8"
|
||||
android:fadeScrollbars="false"
|
||||
android:scrollbars="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_date3" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/ll_nodata"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="@dimen/dp_8"
|
||||
android:fadeScrollbars="false"
|
||||
android:scrollbars="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_date3">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView23"
|
||||
android:layout_width="@dimen/dp_64"
|
||||
android:layout_height="@dimen/dp_64"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/no_homework"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.418" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:text="暂无作业"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintEnd_toEndOf="@+id/imageView23"
|
||||
app:layout_constraintStart_toStartOf="@+id/imageView23"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView23" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
164
app/src/main/res/layout/activity_update.xml
Normal file
164
app/src/main/res/layout/activity_update.xml
Normal file
@@ -0,0 +1,164 @@
|
||||
<?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.update.UpdateActivity">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="appUpdateInfo"
|
||||
type="com.uiui.zyos.bean.AppUpdateInfo" />
|
||||
|
||||
<variable
|
||||
name="msg"
|
||||
type="String" />
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="com.uiui.zyos.activity.update.UpdateActivity.BtnClick" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="330dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/dialog_background"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:src="@drawable/icon_close"
|
||||
android:layout_height="24dp"
|
||||
android:adjustViewBounds="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:onClick="@{click::exit}"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:scaleType="centerCrop"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center_vertical"
|
||||
android:text="检查更新"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="visible" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toTopOf="@+id/linearLayout3"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linearLayout2">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:gravity="center"
|
||||
android:lineSpacingExtra="2dp"
|
||||
android:lineSpacingMultiplier="1.2"
|
||||
android:minHeight="50dp"
|
||||
android:minLines="2"
|
||||
android:text="@{msg}"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
tools:text="提示消息提示消息提示消息提示消息提示消息" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="16dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@{appUpdateInfo.app_version_name}"
|
||||
android:textColor="@color/contact_text_color"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/linearLayout3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="32dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/negtive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/update_cancel_background"
|
||||
android:gravity="center"
|
||||
android:onClick="@{click.exit}"
|
||||
android:singleLine="true"
|
||||
android:text="取消"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/positive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/update_background"
|
||||
android:gravity="center"
|
||||
android:onClick="@{click.upgrade}"
|
||||
android:singleLine="true"
|
||||
android:text="更新"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
@@ -115,41 +115,6 @@
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_speaker"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_bind_statu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_notification"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView15"
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/com_uiui_sn"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_bind"
|
||||
android:layout_width="@dimen/dp_50"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_device_unbind"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/imageView15"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView15"
|
||||
app:layout_constraintTop_toTopOf="@+id/imageView15" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
@@ -183,7 +148,33 @@
|
||||
android:id="@+id/cl_nodata"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible">
|
||||
android:visibility="gone">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_bind_statu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/iv_bind"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/tv_bind_background"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="绑定设备"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_9"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_activated2"
|
||||
@@ -219,13 +210,13 @@
|
||||
android:id="@+id/imageView12"
|
||||
android:layout_width="@dimen/dp_68"
|
||||
android:layout_height="@dimen/dp_82"
|
||||
android:layout_marginTop="@dimen/dp_32"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/user_trophy"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/cl_bind_statu" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
@@ -239,29 +230,23 @@
|
||||
app:layout_constraintStart_toStartOf="@+id/imageView12"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView12" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_activation"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bt_checkupdate_selector"
|
||||
android:paddingStart="@dimen/dp_8"
|
||||
android:paddingTop="@dimen/dp_4"
|
||||
android:paddingEnd="@dimen/dp_8"
|
||||
android:paddingBottom="@dimen/dp_4"
|
||||
android:text="点击激活学习系统"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_8"
|
||||
<ImageView
|
||||
android:id="@+id/iv_activation"
|
||||
android:layout_width="@dimen/dp_84"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:src="@drawable/icon_activition_bind"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView8" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_usedata"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone">
|
||||
android:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_activated"
|
||||
@@ -278,56 +263,65 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView17"
|
||||
android:layout_width="@dimen/dp_68"
|
||||
android:layout_height="@dimen/dp_82"
|
||||
android:layout_marginTop="@dimen/dp_32"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/user_trophy"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_percent"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:text="80%"
|
||||
android:textColor="@color/percent_color"
|
||||
android:textSize="@dimen/sp_25"
|
||||
app:layout_constraintEnd_toEndOf="@+id/imageView17"
|
||||
app:layout_constraintStart_toStartOf="@+id/imageView17"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView17" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:text="学习时长超过同用户"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_percent" />
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_duration"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView5"
|
||||
tools:text="@string/today_study_time" />
|
||||
<ImageView
|
||||
android:id="@+id/imageView17"
|
||||
android:layout_width="@dimen/dp_68"
|
||||
android:layout_height="@dimen/dp_82"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/user_trophy"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_percent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:text="80%"
|
||||
android:textColor="@color/percent_color"
|
||||
android:textSize="@dimen/sp_25"
|
||||
app:layout_constraintEnd_toEndOf="@+id/imageView17"
|
||||
app:layout_constraintStart_toStartOf="@+id/imageView17"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView17" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:text="学习时长超过同用户"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_percent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_duration"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView5"
|
||||
tools:text="@string/today_study_time" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -346,7 +340,7 @@
|
||||
android:id="@+id/cl_activation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible">
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_date1"
|
||||
@@ -488,8 +482,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView13"
|
||||
android:layout_width="@dimen/dp_12"
|
||||
android:layout_height="@dimen/dp_12"
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
@@ -505,6 +499,7 @@
|
||||
android:text="更多应用"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_10"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/imageView13"
|
||||
app:layout_constraintEnd_toStartOf="@+id/imageView13"
|
||||
app:layout_constraintTop_toTopOf="@+id/imageView13" />
|
||||
@@ -534,6 +529,96 @@
|
||||
app:layout_constraintTop_toTopOf="@+id/rv_app" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_homework"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_date3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:text="2月14日 星期二"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_homework_more"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_date3"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_date3">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView14"
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/user_more"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_homework"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="@dimen/dp_8"
|
||||
android:fadeScrollbars="false"
|
||||
android:scrollbars="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_date3" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/ll_nodata"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="@dimen/dp_8"
|
||||
android:fadeScrollbars="false"
|
||||
android:scrollbars="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_date3">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView23"
|
||||
android:layout_width="@dimen/dp_64"
|
||||
android:layout_height="@dimen/dp_64"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/no_homework"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.418" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:text="暂无作业"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintEnd_toEndOf="@+id/imageView23"
|
||||
app:layout_constraintStart_toStartOf="@+id/imageView23"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView23" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
79
app/src/main/res/layout/item_homework_new.xml
Normal file
79
app/src/main/res/layout/item_homework_new.xml
Normal file
@@ -0,0 +1,79 @@
|
||||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_60"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:layout_marginEnd="@dimen/dp_4"
|
||||
android:background="@drawable/item_homework_background"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.shehuan.niv.NiceImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="@dimen/dp_48"
|
||||
android:layout_height="@dimen/dp_48"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
app:corner_radius="@dimen/dp_8"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/item_icon_homework"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:text="暂时没有作业"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_9" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:text="暂时没有作业"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_9" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:text="暂时没有作业"
|
||||
android:textColor="@color/title_gray"
|
||||
android:textSize="@dimen/sp_7" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -39,4 +39,6 @@
|
||||
|
||||
<color name="search_box_color">#F3F3F3</color>
|
||||
<color name="text_hint_color">#646464</color>
|
||||
<color name="contact_text_color">#98999a</color>
|
||||
|
||||
</resources>
|
||||
|
||||
18
app/src/main/res/xml/file_paths.xml
Normal file
18
app/src/main/res/xml/file_paths.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths>
|
||||
<external-path
|
||||
name="external"
|
||||
path="." />
|
||||
<external-files-path
|
||||
name="external_files"
|
||||
path="." />
|
||||
<cache-path
|
||||
name="cache"
|
||||
path="." />
|
||||
<external-cache-path
|
||||
name="external_cache"
|
||||
path="." />
|
||||
<files-path
|
||||
name="files"
|
||||
path="." />
|
||||
</paths>
|
||||
Reference in New Issue
Block a user