version:1.9.4
fix: update:作业页面完善
@@ -16,8 +16,8 @@ android {
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 29
|
||||
|
||||
versionCode 83
|
||||
versionName "1.9.1"
|
||||
versionCode 85
|
||||
versionName "1.9.4"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
@@ -153,6 +153,7 @@ dependencies {
|
||||
implementation project(path: ':niceimageview')
|
||||
implementation project(path: ':FlycoTabLayoutZ_Lib')
|
||||
implementation project(path: ':verification-view')
|
||||
implementation project(path: ':PhotoPreview')
|
||||
|
||||
|
||||
//保持1.3.1 更新会报错
|
||||
@@ -235,6 +236,8 @@ dependencies {
|
||||
implementation 'com.github.getActivity:Toaster:12.6'
|
||||
//图片选择
|
||||
implementation 'io.github.lucksiege:pictureselector:v3.11.1'
|
||||
// implementation 'com.github.wanglu1209:PhotoViewer:0.50'
|
||||
// implementation 'com.github.wanggaowan:PhotoPreview:2.5.5'
|
||||
}
|
||||
|
||||
preBuild {
|
||||
|
||||
@@ -117,6 +117,11 @@
|
||||
android:excludeFromRecents="true"
|
||||
android:screenOrientation="userLandscape"
|
||||
android:theme="@style/DialogCloseOnTouchOutside" />
|
||||
<activity
|
||||
android:name=".activity.homework.UpdateActivity"
|
||||
android:excludeFromRecents="true"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/DialogCloseOnTouchOutside" />
|
||||
<activity
|
||||
android:name=".activity.PasswordActivity"
|
||||
android:excludeFromRecents="true"
|
||||
@@ -174,9 +179,10 @@
|
||||
android:screenOrientation="userLandscape" />
|
||||
<activity
|
||||
android:name=".activity.homework.HomeworkActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="userLandscape" />
|
||||
|
||||
android:launchMode="singleTask" />
|
||||
<activity
|
||||
android:name=".activity.homework.HomeworkDetailsActivity"
|
||||
android:launchMode="singleTask" />
|
||||
|
||||
<receiver
|
||||
android:name=".receiver.BootReceiver"
|
||||
|
||||
@@ -95,7 +95,7 @@ public class EditActivity extends BaseMvvmActivity<EditViewModel, ActivityEditBi
|
||||
Toaster.show("不能为空");
|
||||
return;
|
||||
}
|
||||
if (ActivationUtil.isActivation(EditActivity.this)) {
|
||||
if (ActivationUtil.isActivation()) {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("sn", RemoteManager.getInstance().getSerial());
|
||||
params.put(mTypeName, mViewDataBinding.editText.getText().toString());
|
||||
|
||||
@@ -34,7 +34,7 @@ public class EditViewModel extends BaseViewModel<ActivityEditBinding, ActivityEv
|
||||
public MutableLiveData<Boolean> mSuccessfulData = new MutableLiveData<>();
|
||||
|
||||
public void updateInfo(Map<String, String> params) {
|
||||
if (!ActivationUtil.isActivation(getCtx())) {
|
||||
if (!ActivationUtil.isActivation()) {
|
||||
return;
|
||||
}
|
||||
NetInterfaceManager.getInstance().getUpdateInfoObservable(params)
|
||||
|
||||
@@ -9,12 +9,12 @@ import androidx.fragment.app.FragmentManager;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.flyco.tablayout.SlidingTabLayout;
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.base.mvvm.BaseMvvmActivity;
|
||||
import com.uiui.zyos.bean.HomeworkBean;
|
||||
import com.uiui.zyos.databinding.ActivityHomeworkBinding;
|
||||
import com.uiui.zyos.fragment.content.ContentFragment;
|
||||
import com.uiui.zyos.utils.TimeUtils;
|
||||
import com.uiui.zyos.view.ScaleCircleNavigator;
|
||||
import com.uiui.zyos.view.viewpager.BaseFragmentPagerAdapter;
|
||||
|
||||
@@ -22,12 +22,13 @@ import net.lucode.hackware.magicindicator.ViewPagerHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class HomeworkActivity extends BaseMvvmActivity<HomeworkViewModel, ActivityHomeworkBinding> {
|
||||
private static final String TAG = "HomeworkActivity";
|
||||
|
||||
private String[] title = new String[]{"语文", "数学", "英语", "物理", "化学", "地理", "生物", "政治", "历史"};
|
||||
private String[] title = new String[]{"全部", "语文", "数学", "英语", "其他",};
|
||||
|
||||
private int defaultCurrent = 0;
|
||||
|
||||
@@ -37,15 +38,12 @@ public class HomeworkActivity extends BaseMvvmActivity<HomeworkViewModel, Activi
|
||||
|
||||
private ScaleCircleNavigator scaleCircleNavigator;
|
||||
|
||||
private ContentFragment mAllFragment;
|
||||
private ContentFragment mChineseFragment;
|
||||
private ContentFragment mMathFragment;
|
||||
private ContentFragment mEnglishFragment;
|
||||
private ContentFragment mPhysicsFragment;
|
||||
private ContentFragment mChemicalFragment;
|
||||
private ContentFragment mGeographyFragment;
|
||||
private ContentFragment mBiologyFragment;
|
||||
private ContentFragment mPoliticsFragment;
|
||||
private ContentFragment mHistoryFragment;
|
||||
private ContentFragment mOtherFragment;
|
||||
|
||||
|
||||
/**
|
||||
* 设置布局
|
||||
@@ -70,25 +68,17 @@ public class HomeworkActivity extends BaseMvvmActivity<HomeworkViewModel, Activi
|
||||
public void initView() {
|
||||
mFragmentManager = getSupportFragmentManager();
|
||||
mFragments = new ArrayList<>();
|
||||
|
||||
mAllFragment = ContentFragment.newInstance("全部");
|
||||
if (!mAllFragment.isAdded()) mFragments.add(mAllFragment);
|
||||
mChineseFragment = ContentFragment.newInstance("语文");
|
||||
if (!mChineseFragment.isAdded()) mFragments.add(mChineseFragment);
|
||||
mMathFragment = ContentFragment.newInstance("数学");
|
||||
if (!mMathFragment.isAdded()) mFragments.add(mMathFragment);
|
||||
mEnglishFragment = ContentFragment.newInstance("英语");
|
||||
if (!mEnglishFragment.isAdded()) mFragments.add(mEnglishFragment);
|
||||
mPhysicsFragment = ContentFragment.newInstance("物理");
|
||||
if (!mPhysicsFragment.isAdded()) mFragments.add(mPhysicsFragment);
|
||||
mChemicalFragment = ContentFragment.newInstance("化学");
|
||||
if (!mChemicalFragment.isAdded()) mFragments.add(mChemicalFragment);
|
||||
mGeographyFragment = ContentFragment.newInstance("地理");
|
||||
if (!mGeographyFragment.isAdded()) mFragments.add(mGeographyFragment);
|
||||
mBiologyFragment = ContentFragment.newInstance("生物");
|
||||
if (!mBiologyFragment.isAdded()) mFragments.add(mBiologyFragment);
|
||||
mPoliticsFragment = ContentFragment.newInstance("政治");
|
||||
if (!mPoliticsFragment.isAdded()) mFragments.add(mPoliticsFragment);
|
||||
mHistoryFragment = ContentFragment.newInstance("历史");
|
||||
if (!mHistoryFragment.isAdded()) mFragments.add(mHistoryFragment);
|
||||
mOtherFragment = ContentFragment.newInstance("其他");
|
||||
if (!mOtherFragment.isAdded()) mFragments.add(mOtherFragment);
|
||||
|
||||
|
||||
mBaseFragmentPagerAdapter = new BaseFragmentPagerAdapter(mFragmentManager, mFragments);
|
||||
mViewDataBinding.viewPager.setAdapter(mBaseFragmentPagerAdapter);
|
||||
@@ -133,6 +123,7 @@ public class HomeworkActivity extends BaseMvvmActivity<HomeworkViewModel, Activi
|
||||
mViewDataBinding.viewPager.setCurrentItem(defaultCurrent);
|
||||
mViewDataBinding.magicIndicator.onPageSelected(defaultCurrent);
|
||||
}
|
||||
mViewDataBinding.tvTime.setText(TimeUtils.getHomeworkNowTime());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,29 +131,31 @@ public class HomeworkActivity extends BaseMvvmActivity<HomeworkViewModel, Activi
|
||||
*/
|
||||
@Override
|
||||
public void initData() {
|
||||
mViewModel.mHomeworkBeanListData.observe(this, new Observer<List<HomeworkBean>>() {
|
||||
mViewModel.mHomeworkBeanListData.observe(this, new Observer<ArrayList<HomeworkBean>>() {
|
||||
@Override
|
||||
public void onChanged(List<HomeworkBean> homeWorkList) {
|
||||
public void onChanged(ArrayList<HomeworkBean> homeWorkList) {
|
||||
if (homeWorkList != null && homeWorkList.size() != 0) {
|
||||
List<HomeworkBean> chineseHomeWorkList = homeWorkList.stream().filter(homeWork -> "语文".equals(homeWork.getSubject().getName())).collect(Collectors.toList());
|
||||
mAllFragment.setHomeWorkList(homeWorkList);
|
||||
ArrayList<HomeworkBean> chineseHomeWorkList = (ArrayList<HomeworkBean>) homeWorkList.stream().filter(homeWork -> "语文".equals(homeWork.getSubject().getName())).collect(Collectors.toList());
|
||||
mChineseFragment.setHomeWorkList(chineseHomeWorkList);
|
||||
List<HomeworkBean> mathHomeWorkList = homeWorkList.stream().filter(homeWork -> "数学".equals(homeWork.getSubject().getName())).collect(Collectors.toList());
|
||||
ArrayList<HomeworkBean> mathHomeWorkList = (ArrayList<HomeworkBean>) homeWorkList.stream().filter(homeWork -> "数学".equals(homeWork.getSubject().getName())).collect(Collectors.toList());
|
||||
mMathFragment.setHomeWorkList(mathHomeWorkList);
|
||||
List<HomeworkBean> englishHomeWorkList = homeWorkList.stream().filter(homeWork -> "英语".equals(homeWork.getSubject().getName())).collect(Collectors.toList());
|
||||
ArrayList<HomeworkBean> englishHomeWorkList = (ArrayList<HomeworkBean>) homeWorkList.stream().filter(homeWork -> "英语".equals(homeWork.getSubject().getName())).collect(Collectors.toList());
|
||||
mEnglishFragment.setHomeWorkList(englishHomeWorkList);
|
||||
List<HomeworkBean> physicsHomeWorkList = homeWorkList.stream().filter(homeWork -> "物理".equals(homeWork.getSubject().getName())).collect(Collectors.toList());
|
||||
mPhysicsFragment.setHomeWorkList(physicsHomeWorkList);
|
||||
List<HomeworkBean> chemicalHomeWorkList = homeWorkList.stream().filter(homeWork -> "化学".equals(homeWork.getSubject().getName())).collect(Collectors.toList());
|
||||
mChemicalFragment.setHomeWorkList(chemicalHomeWorkList);
|
||||
List<HomeworkBean> geographyHomeWorkList = homeWorkList.stream().filter(homeWork -> "地理".equals(homeWork.getSubject().getName())).collect(Collectors.toList());
|
||||
mGeographyFragment.setHomeWorkList(geographyHomeWorkList);
|
||||
List<HomeworkBean> biologyHomeWorkList = homeWorkList.stream().filter(homeWork -> "生物".equals(homeWork.getSubject().getName())).collect(Collectors.toList());
|
||||
mBiologyFragment.setHomeWorkList(biologyHomeWorkList);
|
||||
List<HomeworkBean> politicsHomeWorkList = homeWorkList.stream().filter(homeWork -> "政治".equals(homeWork.getSubject().getName())).collect(Collectors.toList());
|
||||
mPoliticsFragment.setHomeWorkList(politicsHomeWorkList);
|
||||
List<HomeworkBean> historyHomeWorkList = homeWorkList.stream().filter(homeWork -> "历史".equals(homeWork.getSubject().getName())).collect(Collectors.toList());
|
||||
mHistoryFragment.setHomeWorkList(historyHomeWorkList);
|
||||
|
||||
ArrayList<HomeworkBean> physicsHomeWorkList = (ArrayList<HomeworkBean>) homeWorkList.stream().filter(new Predicate<HomeworkBean>() {
|
||||
@Override
|
||||
public boolean test(HomeworkBean homeworkBean) {
|
||||
return "物理".equals(homeworkBean.getSubject().getName())
|
||||
|| "化学".equals(homeworkBean.getSubject().getName())
|
||||
|| "地理".equals(homeworkBean.getSubject().getName())
|
||||
|| "生物".equals(homeworkBean.getSubject().getName())
|
||||
|| "政治".equals(homeworkBean.getSubject().getName())
|
||||
|| "历史".equals(homeworkBean.getSubject().getName())
|
||||
|| "其他".equals(homeworkBean.getSubject().getName())
|
||||
;
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
mOtherFragment.setHomeWorkList(physicsHomeWorkList);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.uiui.zyos.activity.homework;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.arialyy.annotations.Download;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.task.DownloadTask;
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.adapter.HomeworkDetailPicAdapter;
|
||||
import com.uiui.zyos.base.mvvm.BaseMvvmActivity;
|
||||
import com.uiui.zyos.bean.HomeworkBean;
|
||||
import com.uiui.zyos.databinding.ActivityHomeworkDetailsBinding;
|
||||
import com.uiui.zyos.utils.TimeUtils;
|
||||
|
||||
public class HomeworkDetailsActivity extends BaseMvvmActivity<HomeworkDetailsViewModel, ActivityHomeworkDetailsBinding> {
|
||||
private static final String TAG = "HomeworkDetailsActivity";
|
||||
|
||||
private HomeworkDetailPicAdapter mHomeworkPicAdapter;
|
||||
private int mId = -1;
|
||||
|
||||
@Download.onTaskComplete
|
||||
void taskComplete(DownloadTask task) {
|
||||
//在这里处理任务完成的状态
|
||||
Log.e(TAG, "taskComplete: " + task.getFilePath());
|
||||
Log.e(TAG, "taskComplete: " + task.getDownloadEntity().getUrl());
|
||||
mHomeworkPicAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_homework_details;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDataBinding() {
|
||||
mViewModel.setCtx(this);
|
||||
mViewModel.setVDBinding(mViewDataBinding);
|
||||
mViewModel.setLifecycle(getLifecycleSubject());
|
||||
mViewDataBinding.setClick(new BtnClick());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
Aria.download(this).register();
|
||||
|
||||
Intent intent = getIntent();
|
||||
if (intent == null) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
mId = intent.getIntExtra("HomeworkBeanID", -1);
|
||||
if (mId == -1) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
mHomeworkPicAdapter = new HomeworkDetailPicAdapter();
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
|
||||
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
mViewDataBinding.rvPic.setLayoutManager(linearLayoutManager);
|
||||
mViewDataBinding.rvPic.setAdapter(mHomeworkPicAdapter);
|
||||
|
||||
mViewModel.mHomeworkBeanData.observe(this, new Observer<HomeworkBean>() {
|
||||
@Override
|
||||
public void onChanged(HomeworkBean homeworkBean) {
|
||||
mViewDataBinding.setHomeworkBean(homeworkBean);
|
||||
mViewDataBinding.tvTitle.setText(TimeUtils.getHomeworkTime3(homeworkBean.getCreated_at()) + homeworkBean.getSubject().getName() + "作业");
|
||||
switch (homeworkBean.getStatus()) {
|
||||
default:
|
||||
case 0:
|
||||
mViewDataBinding.tvStatu.setBackground(getDrawable(R.drawable.homework_unfinished_background));
|
||||
mViewDataBinding.tvStatu.setTextColor(getColor(R.color.black));
|
||||
mViewDataBinding.tvStatu.setText("未完成");
|
||||
break;
|
||||
case 1:
|
||||
mViewDataBinding.tvStatu.setBackground(getDrawable(R.drawable.homework_finish_background));
|
||||
mViewDataBinding.tvStatu.setTextColor(getColor(R.color.white));
|
||||
mViewDataBinding.tvStatu.setText("已完成");
|
||||
mViewDataBinding.tvStatu.setEnabled(false);
|
||||
break;
|
||||
}
|
||||
mHomeworkPicAdapter.setUrls(homeworkBean.getFile_url());
|
||||
}
|
||||
});
|
||||
|
||||
mViewModel.getHomeworkDetail(mId);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class BtnClick {
|
||||
public void exit(View v) {
|
||||
finish();
|
||||
}
|
||||
|
||||
public void empty(View v) {
|
||||
|
||||
}
|
||||
|
||||
public void updateHomework(View v) {
|
||||
// mViewModel.updateHomework(mId);
|
||||
Intent intent = new Intent(HomeworkDetailsActivity.this, UpdateActivity.class);
|
||||
intent.putExtra("HomeworkBeanID", mId);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.uiui.zyos.activity.homework;
|
||||
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.uiui.zyos.base.mvvm.BaseViewModel;
|
||||
import com.uiui.zyos.bean.BaseResponse;
|
||||
import com.uiui.zyos.bean.HomeworkBean;
|
||||
import com.uiui.zyos.databinding.ActivityHomeworkDetailsBinding;
|
||||
import com.uiui.zyos.network.NetInterfaceManager;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class HomeworkDetailsViewModel extends BaseViewModel<ActivityHomeworkDetailsBinding, ActivityEvent> {
|
||||
private static final String TAG = "HomeworkDetailsViewModel";
|
||||
|
||||
@Override
|
||||
public ActivityHomeworkDetailsBinding getVDBinding() {
|
||||
return binding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
|
||||
public MutableLiveData<HomeworkBean> mHomeworkBeanData = new MutableLiveData<>();
|
||||
|
||||
public void getHomeworkDetail(int id) {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getHomeworkDetailObservable(id)
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<HomeworkBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getHomeworkDetail", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<HomeworkBean> homeworkBeanBaseResponse) {
|
||||
Log.e("getHomeworkDetail", "onNext: " + homeworkBeanBaseResponse);
|
||||
if (homeworkBeanBaseResponse.code == 200) {
|
||||
mHomeworkBeanData.setValue(homeworkBeanBaseResponse.data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getHomeworkDetail", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getHomeworkDetail", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -13,8 +13,12 @@ import com.uiui.zyos.bean.HomeworkBean;
|
||||
import com.uiui.zyos.databinding.ActivityHomeworkBinding;
|
||||
import com.uiui.zyos.network.NetInterfaceManager;
|
||||
import com.uiui.zyos.utils.ActivationUtil;
|
||||
import com.uiui.zyos.utils.TimeUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
@@ -32,26 +36,33 @@ public class HomeworkViewModel extends BaseViewModel<ActivityHomeworkBinding, Ac
|
||||
|
||||
}
|
||||
|
||||
public MutableLiveData<List<HomeworkBean>> mHomeworkBeanListData = new MutableLiveData<>();
|
||||
public MutableLiveData<ArrayList<HomeworkBean>> mHomeworkBeanListData = new MutableLiveData<>();
|
||||
|
||||
public void getHomeWork(){
|
||||
boolean activation = ActivationUtil.isActivation(getCtx());
|
||||
public void getHomeWork() {
|
||||
boolean activation = ActivationUtil.isActivation();
|
||||
if (!activation) {
|
||||
return;
|
||||
}
|
||||
NetInterfaceManager.getInstance().getHomeworkObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<List<HomeworkBean>>>() {
|
||||
.subscribe(new Observer<BaseResponse<ArrayList<HomeworkBean>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getHomework", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<HomeworkBean>> listBaseResponse) {
|
||||
public void onNext(@NonNull BaseResponse<ArrayList<HomeworkBean>> listBaseResponse) {
|
||||
Log.e("getHomework", "onNext: " + listBaseResponse);
|
||||
List<HomeworkBean> homeworkBeans = listBaseResponse.data;
|
||||
mHomeworkBeanListData.setValue(homeworkBeans);
|
||||
ArrayList<HomeworkBean> homeworkBeans = listBaseResponse.data;
|
||||
|
||||
ArrayList<HomeworkBean> filter = (ArrayList<HomeworkBean>) homeworkBeans.stream().filter(new Predicate<HomeworkBean>() {
|
||||
@Override
|
||||
public boolean test(HomeworkBean homeworkBean) {
|
||||
return TimeUtils.isHomeworkToday(homeworkBean.getCreated_at());
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
mHomeworkBeanListData.setValue(filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.uiui.zyos.activity.homework;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.lifecycle.Observer;
|
||||
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.base.mvvm.BaseMvvmActivity;
|
||||
import com.uiui.zyos.databinding.ActivityHomeworkUpdateBinding;
|
||||
|
||||
public class UpdateActivity extends BaseMvvmActivity<UpdateViewModel, ActivityHomeworkUpdateBinding> {
|
||||
|
||||
private int mId = -1;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_homework_update;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDataBinding() {
|
||||
mViewModel.setCtx(this);
|
||||
mViewModel.setVDBinding(mViewDataBinding);
|
||||
mViewModel.setLifecycle(getLifecycleSubject());
|
||||
mViewDataBinding.setClick(new BtnClick());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
Intent intent = getIntent();
|
||||
if (intent == null) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
mId = intent.getIntExtra("HomeworkBeanID", -1);
|
||||
if (mId == -1) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
mViewModel.mBooleanMutableLiveData.observe(this, new Observer<Boolean>() {
|
||||
@Override
|
||||
public void onChanged(Boolean aBoolean) {
|
||||
if (aBoolean) {
|
||||
Toaster.show("已完成作业");
|
||||
finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public class BtnClick {
|
||||
public void exit(View view) {
|
||||
finish();
|
||||
}
|
||||
|
||||
public void updateHomework(View v) {
|
||||
mViewModel.updateHomework(mId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.uiui.zyos.activity.homework;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.uiui.zyos.base.mvvm.BaseViewModel;
|
||||
import com.uiui.zyos.bean.BaseResponse;
|
||||
import com.uiui.zyos.databinding.ActivityHomeworkUpdateBinding;
|
||||
import com.uiui.zyos.network.NetInterfaceManager;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class UpdateViewModel extends BaseViewModel<ActivityHomeworkUpdateBinding, ActivityEvent> {
|
||||
|
||||
@Override
|
||||
public ActivityHomeworkUpdateBinding getVDBinding() {
|
||||
return binding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
|
||||
public MutableLiveData<Boolean> mBooleanMutableLiveData = new MutableLiveData<>();
|
||||
|
||||
public void updateHomework(int id) {
|
||||
NetInterfaceManager.getInstance().getHomeworkUpdateObservable(id)
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("updateHomework", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse baseResponse) {
|
||||
Log.e("updateHomework", "onNext: " + baseResponse);
|
||||
if (baseResponse.code == 200) {
|
||||
mBooleanMutableLiveData.setValue(true);
|
||||
} else {
|
||||
Toaster.show(baseResponse.msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("updateHomework", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("updateHomework", "onComplete: ");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class MainViewModel extends BaseViewModel<ActivityMainBinding, ActivityEv
|
||||
|
||||
@Deprecated
|
||||
public void sendAPPUsage() {
|
||||
boolean activation = ActivationUtil.isActivation(getCtx());
|
||||
boolean activation = ActivationUtil.isActivation();
|
||||
if (!activation) {
|
||||
return;
|
||||
}
|
||||
@@ -130,7 +130,7 @@ public class MainViewModel extends BaseViewModel<ActivityMainBinding, ActivityEv
|
||||
|
||||
@Deprecated
|
||||
public void sendRunningInfo() {
|
||||
boolean activation = ActivationUtil.isActivation(getCtx());
|
||||
boolean activation = ActivationUtil.isActivation();
|
||||
if (!activation) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class PermissionActivity extends BaseMvvmActivity<PermissionViewModel, Ac
|
||||
// Permission.WRITE_SETTINGS,
|
||||
Permission.ACCESS_COARSE_LOCATION,
|
||||
Permission.ACCESS_FINE_LOCATION,
|
||||
Permission.ACCESS_BACKGROUND_LOCATION,
|
||||
// Permission.ACCESS_BACKGROUND_LOCATION,
|
||||
};
|
||||
|
||||
@Override
|
||||
|
||||
@@ -151,7 +151,7 @@ public class SelecteGradeActivity extends BaseMvvmActivity<SelecteGradeViewModel
|
||||
}
|
||||
|
||||
public void submit(View view) {
|
||||
if (ActivationUtil.isActivation(SelecteGradeActivity.this)) {
|
||||
if (ActivationUtil.isActivation()) {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("sn", RemoteManager.getInstance().getSerial());
|
||||
params.put("sn_grade", grade);
|
||||
|
||||
@@ -34,7 +34,7 @@ public class SelecteGradeViewModel extends BaseViewModel<ActivitySelecteGradeBin
|
||||
public MutableLiveData<Boolean> mSuccessfulData = new MutableLiveData<>();
|
||||
|
||||
public void updateInfo(Map<String, String> params) {
|
||||
if (!ActivationUtil.isActivation(getCtx())) {
|
||||
if (!ActivationUtil.isActivation()) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ public class UserActivity extends BaseMvvmActivity<UserViewModel, ActivityUserBi
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (ActivationUtil.isActivation(this)) {
|
||||
if (ActivationUtil.isActivation()) {
|
||||
mViewModel.getUserAvatarInfo();
|
||||
} else {
|
||||
setLocalData();
|
||||
@@ -227,7 +227,7 @@ public class UserActivity extends BaseMvvmActivity<UserViewModel, ActivityUserBi
|
||||
Log.e("selectPicture", "onResult: " + avatarFilePath);
|
||||
GlideLoadUtils.getInstance().glideLoad(UserActivity.this, avatarFilePath, mViewDataBinding.nvAvatar, R.drawable.default_avatar);
|
||||
|
||||
if (ActivationUtil.isActivation(UserActivity.this)) {
|
||||
if (ActivationUtil.isActivation()) {
|
||||
File avatarFile;
|
||||
if (TextUtils.isEmpty(avatarFilePath)) {
|
||||
avatarFile = FileUtil.drawableToFile(UserActivity.this, R.drawable.default_avatar, "avatar");
|
||||
|
||||
@@ -110,7 +110,7 @@ public class UserViewModel extends BaseViewModel<ActivityUserBinding, ActivityEv
|
||||
public MutableLiveData<Boolean> mSuccessfulData = new MutableLiveData<>();
|
||||
|
||||
public void updateInfo(Map<String, String> params, MultipartBody.Part multipartBody) {
|
||||
if (!ActivationUtil.isActivation(getCtx())) {
|
||||
if (!ActivationUtil.isActivation()) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -99,9 +99,7 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.AppHolder> {
|
||||
break;
|
||||
default:
|
||||
int settingOtherAppInstaller = Settings.Global.getInt(mContext.getContentResolver(), CommonConfig.SETTING_OTHER_APPINSTALLER_KEY, 1);
|
||||
if (settingOtherAppInstaller == 0
|
||||
&& !ApkUtils.isSystemApp(mContext, desktopIcon.getPackageName()
|
||||
)) {
|
||||
if (settingOtherAppInstaller == 0 && !ApkUtils.isSystemApp(mContext, desktopIcon.getPackageName())) {
|
||||
Toaster.show("已禁止应用打开");
|
||||
} else {
|
||||
OpenApkUtils.getInstance().openApp(desktopIcon.getPackageName(), desktopIcon.getClassName());
|
||||
|
||||
@@ -94,18 +94,18 @@ public class FileAdapter extends RecyclerView.Adapter<FileAdapter.AppHolder> {
|
||||
case AppManager.SERVICE_NAME:
|
||||
mContext.startActivity(new Intent(mContext, ServiceActivity.class));
|
||||
break;
|
||||
case "com.uiui.zyappstore":
|
||||
OpenApkUtils.getInstance().openApp(desktopIcon.getPackageName(), desktopIcon.getClassName());
|
||||
break;
|
||||
default:
|
||||
int settingOtherAppInstaller = Settings.Global.getInt(mContext.getContentResolver(), CommonConfig.SETTING_OTHER_APPINSTALLER_KEY, 1);
|
||||
if (settingOtherAppInstaller == 0
|
||||
&& !ApkUtils.isSystemApp(mContext, desktopIcon.getPackageName()
|
||||
)) {
|
||||
if (settingOtherAppInstaller == 0 && !ApkUtils.isSystemApp(mContext, desktopIcon.getPackageName())) {
|
||||
Toaster.show("已禁止应用打开");
|
||||
} else {
|
||||
OpenApkUtils.getInstance().openApp(desktopIcon.getPackageName(), desktopIcon.getClassName());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
121
app/src/main/java/com/uiui/zyos/adapter/HomeworkAdapter.java
Normal file
@@ -0,0 +1,121 @@
|
||||
package com.uiui.zyos.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.activity.homework.HomeworkDetailsActivity;
|
||||
import com.uiui.zyos.bean.HomeworkBean;
|
||||
import com.uiui.zyos.utils.ScreenUtils;
|
||||
import com.uiui.zyos.utils.TimeUtils;
|
||||
import com.uiui.zyos.view.HorizontalItemDecoration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class HomeworkAdapter extends RecyclerView.Adapter<HomeworkAdapter.Holder> {
|
||||
private static final String TAG = "HomeworkAdapter";
|
||||
|
||||
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, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||
HomeworkBean homeworkBean = mHomeworkList.get(position);
|
||||
holder.tv_title.setText(homeworkBean.getSubject().getName() + "作业");
|
||||
// switch (homeworkBean.getFile_type()) {
|
||||
// case 2:
|
||||
// holder.tv_type.setText("图片");
|
||||
// break;
|
||||
// case 3:
|
||||
// holder.tv_type.setText("视频");
|
||||
// break;
|
||||
// case 4:
|
||||
// holder.tv_type.setText("文档");
|
||||
// break;
|
||||
// default:
|
||||
// holder.tv_type.setText("文字");
|
||||
// }
|
||||
switch (homeworkBean.getStatus()) {
|
||||
default:
|
||||
case 0:
|
||||
holder.iv_statu.setImageDrawable(mContext.getDrawable(R.drawable.icon_hw_statu_unfinished));
|
||||
break;
|
||||
case 1:
|
||||
holder.iv_statu.setImageDrawable(mContext.getDrawable(R.drawable.icon_hw_statu_finish));
|
||||
break;
|
||||
}
|
||||
holder.tv_type.setText(homeworkBean.getContent());
|
||||
holder.tv_time.setText(TimeUtils.getHomeworkTime(homeworkBean.getCreated_at()));
|
||||
|
||||
List<String> urls = homeworkBean.getFile_url();
|
||||
if (urls != null && !urls.isEmpty()) {
|
||||
urls.removeIf(TextUtils::isEmpty);
|
||||
HomeworkPicAdapter homeworkPicAdapter = new HomeworkPicAdapter();
|
||||
homeworkPicAdapter.setUrls(urls);
|
||||
homeworkPicAdapter.setId(homeworkBean.getId());
|
||||
holder.rv_pic.setVisibility(View.VISIBLE);
|
||||
holder.rv_pic.setAdapter(homeworkPicAdapter);
|
||||
} else {
|
||||
holder.rv_pic.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(mContext, HomeworkDetailsActivity.class);
|
||||
intent.putExtra("HomeworkBeanID", homeworkBean.getId());
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mHomeworkList == null ? 0 : mHomeworkList.size();
|
||||
}
|
||||
|
||||
static class Holder extends RecyclerView.ViewHolder {
|
||||
ConstraintLayout root;
|
||||
RecyclerView rv_pic;
|
||||
TextView tv_title, tv_type, tv_time;
|
||||
ImageView iv_statu;
|
||||
|
||||
Holder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
rv_pic = itemView.findViewById(R.id.rv_pic);
|
||||
tv_title = itemView.findViewById(R.id.tv_title);
|
||||
tv_type = itemView.findViewById(R.id.tv_type);
|
||||
tv_time = itemView.findViewById(R.id.tv_time);
|
||||
iv_statu = itemView.findViewById(R.id.iv_statu);
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(root.getContext());
|
||||
linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
||||
rv_pic.setLayoutManager(linearLayoutManager);
|
||||
rv_pic.addItemDecoration(new HorizontalItemDecoration(ScreenUtils.dp2px(root.getContext().getResources(), 8), root.getContext()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
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 androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.Priority;
|
||||
import com.bumptech.glide.load.DecodeFormat;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.bean.HomeworkBean;
|
||||
import com.uiui.zyos.utils.FileUtil;
|
||||
import com.uiui.zyos.utils.GlideLoadUtils;
|
||||
import com.uiui.zyos.utils.OpenFileUtil;
|
||||
import com.wgw.photo.preview.PhotoPreview;
|
||||
import com.wgw.photo.preview.interfaces.ImageLoader;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class HomeworkDetailPicAdapter extends RecyclerView.Adapter<HomeworkDetailPicAdapter.Holder> {
|
||||
private static final String TAG = "HomeworkPicAdapter";
|
||||
|
||||
private Context mContext;
|
||||
private List<String> mUrls;
|
||||
|
||||
public void setUrls(List<String> urls) {
|
||||
mUrls = urls;
|
||||
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_detail_pic, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||
String url = mUrls.get(position);
|
||||
GlideLoadUtils.getInstance().glideLoadSetSize(mContext, url, holder.nv_pic, R.mipmap.ic_launcher);
|
||||
File file = new File(FileUtil.getDownLoadPath(mContext) + FileUtil.getFileNamefromURL(url));
|
||||
if (file.exists()) {
|
||||
holder.iv_download.setVisibility(View.GONE);
|
||||
holder.nv_pic.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// OpenFileUtil.openFile(mContext, file);
|
||||
PhotoPreview.with((FragmentActivity) mContext)
|
||||
.sources(mUrls)
|
||||
.defaultShowPosition(position)
|
||||
.imageLoader(new ImageLoader() {
|
||||
@Override
|
||||
public void onLoadImage(int position, @Nullable Object source, @NonNull ImageView imageView) {
|
||||
RequestOptions requestOptions = new RequestOptions()
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
|
||||
.priority(Priority.HIGH)
|
||||
.format(DecodeFormat.PREFER_RGB_565);
|
||||
Glide.with(imageView.getContext())
|
||||
.setDefaultRequestOptions(requestOptions)
|
||||
.load((String) source)
|
||||
.into(imageView);
|
||||
// GlideLoadUtils.getInstance().glideLoad(imageView.getContext(), (String)source, imageView, R.drawable.icon_no_homework);
|
||||
}
|
||||
})
|
||||
.build()
|
||||
.show(holder.nv_pic); // 指定缩略图
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
holder.iv_download.setVisibility(View.VISIBLE);
|
||||
holder.iv_download.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
FileUtil.ariaDownloadUrl(mContext, url);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mUrls == null ? 0 : mUrls.size();
|
||||
}
|
||||
|
||||
static class Holder extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView nv_pic;
|
||||
ImageView iv_download;
|
||||
|
||||
Holder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
nv_pic = itemView.findViewById(R.id.nv_pic);
|
||||
iv_download = itemView.findViewById(R.id.iv_download);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
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 androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.Priority;
|
||||
import com.bumptech.glide.load.DecodeFormat;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.bean.HomeworkBean;
|
||||
import com.uiui.zyos.utils.FileUtil;
|
||||
import com.uiui.zyos.utils.GlideLoadUtils;
|
||||
import com.uiui.zyos.utils.OpenFileUtil;
|
||||
import com.wgw.photo.preview.PhotoPreview;
|
||||
import com.wgw.photo.preview.interfaces.ImageLoader;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class HomeworkDetailPicAdapter2 extends RecyclerView.Adapter<HomeworkDetailPicAdapter2.Holder> {
|
||||
private static final String TAG = "HomeworkPicAdapter";
|
||||
|
||||
private Context mContext;
|
||||
private HomeworkBean mHomeworkBean;
|
||||
|
||||
public void setHomeworkBean(HomeworkBean homeworkBean) {
|
||||
mHomeworkBean = homeworkBean;
|
||||
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_detail_pic, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||
List<String> urls = mHomeworkBean.getFile_url();
|
||||
String url = urls.get(position);
|
||||
File file = new File(FileUtil.getDownLoadPath(mContext) + FileUtil.getFileNamefromURL(url));
|
||||
if (file.exists()) {
|
||||
GlideLoadUtils.getInstance().glideLoadSetSize(mContext, file, holder.nv_pic, R.mipmap.ic_launcher);
|
||||
holder.iv_download.setVisibility(View.GONE);
|
||||
if (mHomeworkBean.getFile_type() == 3) {
|
||||
holder.iv_play.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.iv_play.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
holder.nv_pic.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (mHomeworkBean.getFile_type() == 3) {
|
||||
OpenFileUtil.openFile(mContext, file);
|
||||
} else {
|
||||
PhotoPreview.with((FragmentActivity) mContext)
|
||||
.sources(urls)
|
||||
.imageLoader(new ImageLoader() {
|
||||
@Override
|
||||
public void onLoadImage(int position, @Nullable Object source, @NonNull ImageView imageView) {
|
||||
RequestOptions requestOptions = new RequestOptions()
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
|
||||
.priority(Priority.HIGH)
|
||||
.format(DecodeFormat.PREFER_RGB_565);
|
||||
Glide.with(imageView.getContext())
|
||||
.setDefaultRequestOptions(requestOptions)
|
||||
.load((String) source)
|
||||
.into(imageView);
|
||||
//GlideLoadUtils.getInstance().glideLoad(imageView.getContext(), (String)source, imageView, R.drawable.icon_no_homework);
|
||||
}
|
||||
})
|
||||
.build()
|
||||
.show(holder.nv_pic); // 指定缩略图
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
GlideLoadUtils.getInstance().glideLoadSetSize(mContext, url, holder.nv_pic, R.mipmap.ic_launcher);
|
||||
if (mHomeworkBean.getFile_type() == 3) {
|
||||
holder.iv_download.setVisibility(View.VISIBLE);
|
||||
holder.iv_download.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
FileUtil.ariaDownloadUrl(mContext, url);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
FileUtil.ariaDownloadUrl(mContext, url);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mHomeworkBean == null ? 0 : mHomeworkBean.getFile_url().size();
|
||||
}
|
||||
|
||||
static class Holder extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView nv_pic;
|
||||
ImageView iv_download;
|
||||
ImageView iv_play;
|
||||
|
||||
Holder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
nv_pic = itemView.findViewById(R.id.nv_pic);
|
||||
iv_download = itemView.findViewById(R.id.iv_download);
|
||||
iv_play = itemView.findViewById(R.id.iv_play);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.uiui.zyos.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.arialyy.annotations.Download;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.task.DownloadTask;
|
||||
import com.shehuan.niv.NiceImageView;
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.activity.homework.HomeworkDetailsActivity;
|
||||
import com.uiui.zyos.utils.FileUtil;
|
||||
import com.uiui.zyos.utils.GlideLoadUtils;
|
||||
import com.uiui.zyos.utils.OpenFileUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class HomeworkPicAdapter extends RecyclerView.Adapter<HomeworkPicAdapter.Holder> {
|
||||
private static final String TAG = "HomeworkPicAdapter";
|
||||
|
||||
private Context mContext;
|
||||
private List<String> mUrls;
|
||||
private int mId = -1;
|
||||
|
||||
public void setUrls(List<String> urls) {
|
||||
mUrls = urls;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
mId = id;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new Holder(LayoutInflater.from(mContext).inflate(R.layout.item_homework_pic, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||
String url = mUrls.get(position);
|
||||
File file = new File(FileUtil.getDownLoadPath(mContext) + FileUtil.getFileNamefromURL(url));
|
||||
if (file.exists()) {
|
||||
GlideLoadUtils.getInstance().glideLoad(mContext, file, holder.nv_pic, R.drawable.icon_no_homework);
|
||||
} else {
|
||||
GlideLoadUtils.getInstance().glideLoad(mContext, url, holder.nv_pic, R.drawable.icon_no_homework);
|
||||
}
|
||||
holder.cl_root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(mContext, HomeworkDetailsActivity.class);
|
||||
intent.putExtra("HomeworkBeanID", mId);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mUrls == null ? 0 : mUrls.size();
|
||||
}
|
||||
|
||||
static class Holder extends RecyclerView.ViewHolder {
|
||||
ConstraintLayout cl_root;
|
||||
NiceImageView nv_pic;
|
||||
|
||||
Holder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
cl_root = itemView.findViewById(R.id.cl_root);
|
||||
nv_pic = itemView.findViewById(R.id.nv_pic);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
package com.uiui.zyos.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
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.arialyy.annotations.Download;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.task.DownloadTask;
|
||||
import com.shehuan.niv.NiceImageView;
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.bean.HomeworkBean;
|
||||
import com.uiui.zyos.utils.FileUtil;
|
||||
import com.uiui.zyos.utils.GlideLoadUtils;
|
||||
import com.uiui.zyos.utils.OpenFileUtil;
|
||||
import com.uiui.zyos.utils.TimeUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class NewHomeworkAdapter extends RecyclerView.Adapter<NewHomeworkAdapter.Holder> {
|
||||
private static final String TAG = "NewHomeworkAdapter";
|
||||
|
||||
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) {
|
||||
Aria.download(this).register();
|
||||
|
||||
HomeworkBean homeworkBean = mHomeworkList.get(position);
|
||||
GlideLoadUtils.getInstance().glideLoad(mContext, homeworkBean.getFile_url(), holder.iv_cover, R.drawable.icon_homework_sample);
|
||||
holder.tv_title.setText(homeworkBean.getTitle());
|
||||
holder.tv_content.setText(homeworkBean.getContent());
|
||||
switch (homeworkBean.getFile_type()) {
|
||||
case 2:
|
||||
holder.tv_type.setText("图片");
|
||||
break;
|
||||
case 3:
|
||||
holder.tv_type.setText("视频");
|
||||
break;
|
||||
case 4:
|
||||
holder.tv_type.setText("文档");
|
||||
break;
|
||||
default:
|
||||
holder.tv_type.setText("文字");
|
||||
}
|
||||
holder.tv_time.setText(TimeUtils.getHomeworkTime(homeworkBean.getCreated_at()));
|
||||
|
||||
String mFileUrl = homeworkBean.getFile_url();
|
||||
File file = new File(FileUtil.getDownLoadPath(mContext) + FileUtil.getFileNamefromURL(mFileUrl));
|
||||
if (file.exists()) {
|
||||
holder.iv_download.setVisibility(View.GONE);
|
||||
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
OpenFileUtil.openFile(mContext, file);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
holder.iv_download.setVisibility(View.VISIBLE);
|
||||
holder.iv_download.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
FileUtil.ariaDownloadTestPaper(mContext, mFileUrl, homeworkBean);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mHomeworkList == null ? 0 : mHomeworkList.size();
|
||||
}
|
||||
|
||||
class Holder extends RecyclerView.ViewHolder {
|
||||
ConstraintLayout root;
|
||||
NiceImageView iv_cover;
|
||||
ImageView iv_download;
|
||||
TextView tv_title, tv_content, tv_type, tv_time;
|
||||
|
||||
public Holder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
iv_cover = itemView.findViewById(R.id.iv_cover);
|
||||
iv_download = itemView.findViewById(R.id.iv_download);
|
||||
tv_title = itemView.findViewById(R.id.tv_title);
|
||||
tv_content = itemView.findViewById(R.id.tv_content);
|
||||
tv_type = itemView.findViewById(R.id.tv_type);
|
||||
tv_time = itemView.findViewById(R.id.tv_time);
|
||||
}
|
||||
}
|
||||
|
||||
@Download.onTaskComplete
|
||||
void taskComplete(DownloadTask task) {
|
||||
//在这里处理任务完成的状态
|
||||
Log.e(TAG, "taskComplete: " + task.getFilePath());
|
||||
Log.e(TAG, "taskComplete: " + task.getDownloadEntity().getUrl());
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.uiui.zyos.base;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Debug;
|
||||
@@ -30,10 +32,22 @@ import com.uiui.zyos.utils.SystemUtils;
|
||||
public class BaseApplication extends Application {
|
||||
private static final String TAG = "BaseApplication";
|
||||
|
||||
|
||||
/**
|
||||
* ViewModel中因为经常旋转导致弱引用为空
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static Context context;
|
||||
|
||||
public static Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
Log.e(TAG, "onCreate: ");
|
||||
context = getApplicationContext();
|
||||
if (!BuildConfig.DEBUG) {
|
||||
// catchException();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package com.uiui.zyos.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class HomeworkBean implements Serializable {
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class HomeworkBean implements Serializable, Parcelable {
|
||||
private static final long serialVersionUID = 4974017718666880157L;
|
||||
|
||||
int id;
|
||||
@@ -11,7 +15,7 @@ public class HomeworkBean implements Serializable {
|
||||
String sn;
|
||||
String title;
|
||||
String content;
|
||||
String file_url;
|
||||
List<String> file_url;
|
||||
String file_name;
|
||||
int file_type;
|
||||
int work_type;
|
||||
@@ -20,6 +24,34 @@ public class HomeworkBean implements Serializable {
|
||||
String updated_at;
|
||||
HomeworkSubject subject;
|
||||
|
||||
protected HomeworkBean(Parcel in) {
|
||||
id = in.readInt();
|
||||
subject_id = in.readInt();
|
||||
status = in.readInt();
|
||||
sn = in.readStringNoHelper();
|
||||
title = in.readStringNoHelper();
|
||||
content = in.readStringNoHelper();
|
||||
file_url = in.createStringArrayList();
|
||||
file_name = in.readStringNoHelper();
|
||||
file_type = in.readInt();
|
||||
work_type = in.readInt();
|
||||
end_time = in.readStringNoHelper();
|
||||
created_at = in.readStringNoHelper();
|
||||
updated_at = in.readStringNoHelper();
|
||||
}
|
||||
|
||||
public static final Creator<HomeworkBean> CREATOR = new Creator<HomeworkBean>() {
|
||||
@Override
|
||||
public HomeworkBean createFromParcel(Parcel in) {
|
||||
return new HomeworkBean(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HomeworkBean[] newArray(int size) {
|
||||
return new HomeworkBean[size];
|
||||
}
|
||||
};
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -68,11 +100,11 @@ public class HomeworkBean implements Serializable {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getFile_url() {
|
||||
public List<String> getFile_url() {
|
||||
return file_url;
|
||||
}
|
||||
|
||||
public void setFile_url(String file_url) {
|
||||
public void setFile_url(List<String> file_url) {
|
||||
this.file_url = file_url;
|
||||
}
|
||||
|
||||
@@ -131,4 +163,26 @@ public class HomeworkBean implements Serializable {
|
||||
public void setSubject(HomeworkSubject subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeInt(id);
|
||||
parcel.writeInt(subject_id);
|
||||
parcel.writeInt(status);
|
||||
parcel.writeString(sn);
|
||||
parcel.writeString(title);
|
||||
parcel.writeString(content);
|
||||
parcel.writeStringList(file_url);
|
||||
parcel.writeString(file_name);
|
||||
parcel.writeInt(file_type);
|
||||
parcel.writeInt(work_type);
|
||||
parcel.writeString(end_time);
|
||||
parcel.writeString(created_at);
|
||||
parcel.writeString(updated_at);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.uiui.zyos.base.mvvm.BaseViewModel;
|
||||
import com.uiui.zyos.bean.DesktopIcon;
|
||||
import com.uiui.zyos.databinding.FragmentAppBinding;
|
||||
import com.uiui.zyos.manager.AppManager;
|
||||
import com.uiui.zyos.utils.ApkUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -29,10 +30,10 @@ public class AppViewModel extends BaseViewModel<FragmentAppBinding, FragmentEven
|
||||
ArrayList<DesktopIcon> desktopIcons = AppManager.getInstance().getFilterAppList();
|
||||
|
||||
DesktopIcon appstoreDesktopIcon = new DesktopIcon();
|
||||
appstoreDesktopIcon.setLable("应用市场");
|
||||
appstoreDesktopIcon.setLable(ApkUtils.getAppName(getCtx(), "com.uiui.zyappstore"));
|
||||
appstoreDesktopIcon.setPackageName(AppManager.APPSTORE_PACKAGE_NAME);
|
||||
appstoreDesktopIcon.setClassName(AppManager.APPSTORE_CLASS_NAME);
|
||||
appstoreDesktopIcon.setIcon(getCtx().getDrawable(R.drawable.com_android_appstore));
|
||||
appstoreDesktopIcon.setIcon(ApkUtils.getAppDrawable(getCtx(), "com.uiui.zyappstore"));
|
||||
desktopIcons.add(desktopIcons.size(), appstoreDesktopIcon);
|
||||
|
||||
DesktopIcon updateDesktopIcon = new DesktopIcon();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.uiui.zyos.fragment.content;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
@@ -11,17 +12,22 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import com.arialyy.annotations.Download;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.task.DownloadTask;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.adapter.NewHomeworkAdapter;
|
||||
import com.uiui.zyos.adapter.HomeworkAdapter;
|
||||
import com.uiui.zyos.base.mvvm.fragment.BaseMvvmFragment;
|
||||
import com.uiui.zyos.bean.HomeworkBean;
|
||||
import com.uiui.zyos.config.CommonConfig;
|
||||
import com.uiui.zyos.databinding.FragmentContentBinding;
|
||||
import com.uiui.zyos.utils.ScreenUtils;
|
||||
import com.uiui.zyos.view.EquallyDividedItemDecoration;
|
||||
import com.uiui.zyos.view.RecyclerViewSpacesItemDecoration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@@ -36,7 +42,21 @@ public class ContentFragment extends BaseMvvmFragment<ContentViewModel, Fragment
|
||||
|
||||
private FragmentActivity mContext;
|
||||
|
||||
private NewHomeworkAdapter mHomeworkAdapter;
|
||||
private HomeworkAdapter mHomeworkAdapter;
|
||||
|
||||
private ArrayList<HomeworkBean> mHomeworkBeanList;
|
||||
|
||||
private static final String HOME_WORK_LIST_NAME = "home_work_list_name";
|
||||
|
||||
public void setHomeWorkList(ArrayList<HomeworkBean> homeWorkList) {
|
||||
Log.e(TAG, "setHomeWorkList: ");
|
||||
Bundle args = getArguments();
|
||||
args.putSerializable(HOME_WORK_LIST_NAME, homeWorkList);
|
||||
setArguments(args);
|
||||
mHomeworkBeanList = homeWorkList;
|
||||
setAdapterData();
|
||||
|
||||
}
|
||||
|
||||
|
||||
// TODO: Rename parameter arguments, choose names that match
|
||||
@@ -59,6 +79,7 @@ public class ContentFragment extends BaseMvvmFragment<ContentViewModel, Fragment
|
||||
*/
|
||||
// TODO: Rename and change types and number of parameters
|
||||
public static ContentFragment newInstance(String subject) {
|
||||
Log.e(TAG, "newInstance: ");
|
||||
ContentFragment fragment = new ContentFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(SUBJECT_NAME, subject);
|
||||
@@ -66,11 +87,23 @@ public class ContentFragment extends BaseMvvmFragment<ContentViewModel, Fragment
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Download.onTaskComplete
|
||||
void taskComplete(DownloadTask task) {
|
||||
//在这里处理任务完成的状态
|
||||
Log.e(TAG, "taskComplete: " + task.getFilePath());
|
||||
Log.e(TAG, "taskComplete: " + task.getDownloadEntity().getUrl());
|
||||
mHomeworkAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Log.e(TAG, "onCreate: ");
|
||||
if (getArguments() != null) {
|
||||
mSubject = getArguments().getString(SUBJECT_NAME);
|
||||
Bundle args = getArguments();
|
||||
mSubject = args.getString(SUBJECT_NAME);
|
||||
mHomeworkBeanList = args.getParcelableArrayList(HOME_WORK_LIST_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +114,7 @@ public class ContentFragment extends BaseMvvmFragment<ContentViewModel, Fragment
|
||||
|
||||
@Override
|
||||
protected void initDataBinding() {
|
||||
Log.e(TAG, "initDataBinding: ");
|
||||
mContext = getActivity();
|
||||
mViewModel.setCtx(getCtx());
|
||||
mViewModel.setLifecycle(getLifecycleSubject());
|
||||
@@ -90,44 +124,54 @@ public class ContentFragment extends BaseMvvmFragment<ContentViewModel, Fragment
|
||||
|
||||
@Override
|
||||
protected void initView(Bundle bundle) {
|
||||
mHomeworkAdapter = new NewHomeworkAdapter();
|
||||
Log.e(TAG, "initView: ");
|
||||
|
||||
HashMap<String, Integer> stringIntegerHashMap = new HashMap<>();
|
||||
WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
wm.getDefaultDisplay().getRealMetrics(dm);
|
||||
float density = dm.density; // 屏幕密度(0.75 / 1.0 / 1.5)
|
||||
stringIntegerHashMap.put(RecyclerViewSpacesItemDecoration.TOP_DECORATION, (int) (density * 10));//top间距
|
||||
stringIntegerHashMap.put(RecyclerViewSpacesItemDecoration.BOTTOM_DECORATION, (int) (density * 10));//底部间距
|
||||
stringIntegerHashMap.put(RecyclerViewSpacesItemDecoration.LEFT_DECORATION, (int) (density * 10));//左间距
|
||||
stringIntegerHashMap.put(RecyclerViewSpacesItemDecoration.RIGHT_DECORATION, (int) (density * 10));//右间距
|
||||
mViewDataBinding.recyclerView.addItemDecoration(new RecyclerViewSpacesItemDecoration(stringIntegerHashMap));
|
||||
mViewDataBinding.recyclerView.setLayoutManager(new GridLayoutManager(mContext, 2));
|
||||
Aria.download(this).register();
|
||||
mHomeworkAdapter = new HomeworkAdapter();
|
||||
int orientation = mContext.getResources().getConfiguration().orientation;
|
||||
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
mViewDataBinding.recyclerView.addItemDecoration(new EquallyDividedItemDecoration(1, ScreenUtils.dp2px(getResources(), 4)));
|
||||
mViewDataBinding.recyclerView.setLayoutManager(new GridLayoutManager(mContext, 1));
|
||||
} else if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
mViewDataBinding.recyclerView.addItemDecoration(new EquallyDividedItemDecoration(2, ScreenUtils.dp2px(getResources(), 4)));
|
||||
mViewDataBinding.recyclerView.setLayoutManager(new GridLayoutManager(mContext, 2));
|
||||
}
|
||||
mViewDataBinding.recyclerView.setAdapter(mHomeworkAdapter);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData(Bundle savedInstanceState) {
|
||||
|
||||
Log.e(TAG, "initData: ");
|
||||
if (getArguments() != null) {
|
||||
Bundle args = getArguments();
|
||||
mHomeworkBeanList = args.getParcelableArrayList(HOME_WORK_LIST_NAME);
|
||||
setAdapterData();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void fetchData() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void setHomeWorkList(List<HomeworkBean> homeWorkList) {
|
||||
if (homeWorkList == null || homeWorkList.size() == 0) {
|
||||
private void setAdapterData() {
|
||||
Log.e(TAG, "setAdapterData: ");
|
||||
if (mViewDataBinding == null) {
|
||||
return;
|
||||
}
|
||||
if (mHomeworkBeanList == null || mHomeworkBeanList.isEmpty()) {
|
||||
mViewDataBinding.ivNodata.setVisibility(View.VISIBLE);
|
||||
mViewDataBinding.recyclerView.setVisibility(View.GONE);
|
||||
} else {
|
||||
mViewDataBinding.ivNodata.setVisibility(View.GONE);
|
||||
mViewDataBinding.recyclerView.setVisibility(View.VISIBLE);
|
||||
mHomeworkAdapter.setHomeworkList(homeWorkList);
|
||||
}
|
||||
if (mHomeworkAdapter != null) {
|
||||
mHomeworkAdapter.setHomeworkList(mHomeworkBeanList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void fetchData() {
|
||||
Log.e(TAG, "fetchData: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -139,6 +183,7 @@ public class ContentFragment extends BaseMvvmFragment<ContentViewModel, Fragment
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
Log.e(TAG, "onDestroyView: ");
|
||||
}
|
||||
|
||||
public class BtnClick {
|
||||
|
||||
@@ -19,6 +19,9 @@ import androidx.lifecycle.Observer;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.arialyy.annotations.Download;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.task.DownloadTask;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.uiui.zyos.R;
|
||||
@@ -27,7 +30,7 @@ import com.uiui.zyos.activity.homework.HomeworkActivity;
|
||||
import com.uiui.zyos.activity.more.MoreAppActivity;
|
||||
import com.uiui.zyos.activity.user.UserActivity;
|
||||
import com.uiui.zyos.adapter.AppAdapter;
|
||||
import com.uiui.zyos.adapter.NewHomeworkAdapter;
|
||||
import com.uiui.zyos.adapter.HomeworkAdapter;
|
||||
import com.uiui.zyos.base.mvvm.fragment.BaseMvvmFragment;
|
||||
import com.uiui.zyos.bean.BaseResponse;
|
||||
import com.uiui.zyos.bean.DesktopIcon;
|
||||
@@ -40,8 +43,10 @@ import com.uiui.zyos.databinding.FragmentUserBinding;
|
||||
import com.uiui.zyos.jxw.JxwPackageConfig;
|
||||
import com.uiui.zyos.utils.ApkUtils;
|
||||
import com.uiui.zyos.utils.OpenApkUtils;
|
||||
import com.uiui.zyos.utils.ScreenUtils;
|
||||
import com.uiui.zyos.utils.TimeUtils;
|
||||
import com.uiui.zyos.utils.Utils;
|
||||
import com.uiui.zyos.view.EquallyDividedItemDecoration;
|
||||
import com.uiui.zyos.view.RecyclerViewSpacesItemDecoration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -61,7 +66,7 @@ public class UserFragment extends BaseMvvmFragment<UserViewModel, FragmentUserBi
|
||||
private FragmentActivity mContext;
|
||||
|
||||
private AppAdapter mAppAdapter;
|
||||
private NewHomeworkAdapter mHomeworkAdapter;
|
||||
private HomeworkAdapter mHomeworkAdapter;
|
||||
|
||||
// TODO: Rename parameter arguments, choose names that match
|
||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||
@@ -95,6 +100,14 @@ public class UserFragment extends BaseMvvmFragment<UserViewModel, FragmentUserBi
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Download.onTaskComplete
|
||||
void taskComplete(DownloadTask task) {
|
||||
//在这里处理任务完成的状态
|
||||
Log.e(TAG, "taskComplete: " + task.getFilePath());
|
||||
Log.e(TAG, "taskComplete: " + task.getDownloadEntity().getUrl());
|
||||
mHomeworkAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -121,6 +134,8 @@ public class UserFragment extends BaseMvvmFragment<UserViewModel, FragmentUserBi
|
||||
|
||||
@Override
|
||||
protected void initView(Bundle bundle) {
|
||||
Aria.download(this).register();
|
||||
|
||||
Log.e(TAG, "initView: ");
|
||||
mViewDataBinding.tvNotification.requestFocus();
|
||||
registerOwnReceiver();
|
||||
@@ -163,9 +178,10 @@ public class UserFragment extends BaseMvvmFragment<UserViewModel, FragmentUserBi
|
||||
mAppAdapter = new AppAdapter();
|
||||
mViewDataBinding.rvApp.setAdapter(mAppAdapter);
|
||||
|
||||
mHomeworkAdapter = new NewHomeworkAdapter();
|
||||
mHomeworkAdapter = new HomeworkAdapter();
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mContext);
|
||||
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
mViewDataBinding.rvHomework.addItemDecoration(new EquallyDividedItemDecoration(1, ScreenUtils.dp2px(getResources(), 4)));
|
||||
mViewDataBinding.rvHomework.setLayoutManager(linearLayoutManager);
|
||||
mViewDataBinding.rvHomework.setAdapter(mHomeworkAdapter);
|
||||
}
|
||||
@@ -193,9 +209,7 @@ public class UserFragment extends BaseMvvmFragment<UserViewModel, FragmentUserBi
|
||||
} else {
|
||||
mViewDataBinding.tvGrade.setText(grade);
|
||||
}
|
||||
mViewDataBinding.tvPercent.setText(snInfo.getStudy_time_ranking() + "%");
|
||||
mViewDataBinding.tvDuration.setText(String.format(getString(R.string.today_study_time), TimeUtils.formatTime(snInfo.getStudy_time())));
|
||||
|
||||
mViewDataBinding.tvPercent.setText(TimeUtils.secondsToHourMin(snInfo.getStudy_time()));
|
||||
mViewDataBinding.ivActivation.setVisibility(View.GONE);
|
||||
mViewDataBinding.clStudyTime.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
@@ -255,7 +269,7 @@ public class UserFragment extends BaseMvvmFragment<UserViewModel, FragmentUserBi
|
||||
@Override
|
||||
public void onChanged(Long time) {
|
||||
Log.e(TAG, "setAppUsedStatistics: " + time);
|
||||
String useTime = TimeUtils.formatTime(time);
|
||||
// String useTime = TimeUtils.formatTime(time);
|
||||
// tv_duration.setText(String.format(getString(R.string.today_study_time), useTime));
|
||||
}
|
||||
});
|
||||
@@ -523,5 +537,9 @@ public class UserFragment extends BaseMvvmFragment<UserViewModel, FragmentUserBi
|
||||
startActivity(new Intent(mContext, HomeworkActivity.class));
|
||||
}
|
||||
|
||||
public void refreshHomework(View view) {
|
||||
mViewModel.getHomework();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.uiui.zyos.manager.RemoteManager;
|
||||
import com.uiui.zyos.network.NetInterfaceManager;
|
||||
import com.uiui.zyos.network.UrlAddress;
|
||||
import com.uiui.zyos.utils.ActivationUtil;
|
||||
import com.uiui.zyos.utils.ApkUtils;
|
||||
import com.uiui.zyos.utils.CXAESUtil;
|
||||
import com.uiui.zyos.utils.Utils;
|
||||
|
||||
@@ -59,7 +60,7 @@ public class UserViewModel extends BaseViewModel<FragmentUserBinding, FragmentEv
|
||||
public MutableLiveData<BaseResponse<SnInfo>> mSnInfoData = new MutableLiveData<>();
|
||||
|
||||
public void getSnInfo() {
|
||||
boolean activation = ActivationUtil.isActivation(getCtx());
|
||||
boolean activation = ActivationUtil.isActivation();
|
||||
if (!activation) {
|
||||
return;
|
||||
}
|
||||
@@ -96,7 +97,7 @@ public class UserViewModel extends BaseViewModel<FragmentUserBinding, FragmentEv
|
||||
public MutableLiveData<StudyStatBean> mStudyStatBeanData = new MutableLiveData<>();
|
||||
|
||||
public void getStudyStat() {
|
||||
boolean activation = ActivationUtil.isActivation(getCtx());
|
||||
boolean activation = ActivationUtil.isActivation();
|
||||
if (!activation) {
|
||||
return;
|
||||
}
|
||||
@@ -147,10 +148,10 @@ public class UserViewModel extends BaseViewModel<FragmentUserBinding, FragmentEv
|
||||
ArrayList<DesktopIcon> desktopIcons = AppManager.getInstance().getFilterAppList();
|
||||
|
||||
DesktopIcon appstoreDesktopIcon = new DesktopIcon();
|
||||
appstoreDesktopIcon.setLable("应用市场");
|
||||
appstoreDesktopIcon.setLable(ApkUtils.getAppName(getCtx(), "com.uiui.zyappstore"));
|
||||
appstoreDesktopIcon.setPackageName(AppManager.APPSTORE_PACKAGE_NAME);
|
||||
appstoreDesktopIcon.setPackageName(AppManager.APPSTORE_CLASS_NAME);
|
||||
appstoreDesktopIcon.setIcon(getCtx().getDrawable(R.drawable.com_android_appstore));
|
||||
appstoreDesktopIcon.setClassName(AppManager.APPSTORE_CLASS_NAME);
|
||||
appstoreDesktopIcon.setIcon(ApkUtils.getAppDrawable(getCtx(), "com.uiui.zyappstore"));
|
||||
desktopIcons.add(desktopIcons.size(), appstoreDesktopIcon);
|
||||
|
||||
DesktopIcon updateDesktopIcon = new DesktopIcon();
|
||||
@@ -200,20 +201,20 @@ public class UserViewModel extends BaseViewModel<FragmentUserBinding, FragmentEv
|
||||
public MutableLiveData<List<HomeworkBean>> mHomeworkBeanListData = new MutableLiveData<>();
|
||||
|
||||
public void getHomework() {
|
||||
boolean activation = ActivationUtil.isActivation(getCtx());
|
||||
boolean activation = ActivationUtil.isActivation();
|
||||
if (!activation) {
|
||||
return;
|
||||
}
|
||||
NetInterfaceManager.getInstance().getHomeworkObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<List<HomeworkBean>>>() {
|
||||
.subscribe(new Observer<BaseResponse<ArrayList<HomeworkBean>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getHomework", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<HomeworkBean>> listBaseResponse) {
|
||||
public void onNext(@NonNull BaseResponse<ArrayList<HomeworkBean>> listBaseResponse) {
|
||||
Log.e("getHomework", "onNext: " + listBaseResponse);
|
||||
List<HomeworkBean> homeworkBeans = listBaseResponse.data;
|
||||
mHomeworkBeanListData.setValue(homeworkBeans);
|
||||
@@ -234,7 +235,7 @@ public class UserViewModel extends BaseViewModel<FragmentUserBinding, FragmentEv
|
||||
public MutableLiveData<PhraseContent> mPhraseData = new MutableLiveData<>();
|
||||
|
||||
public void getPhrase() {
|
||||
boolean activation = ActivationUtil.isActivation(getCtx());
|
||||
boolean activation = ActivationUtil.isActivation();
|
||||
if (!activation) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class InfoFragment extends BaseMvvmFragment<InfoViewModel, FragmentInfoBi
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
||||
if (b) {
|
||||
if (ActivationUtil.isActivation(mContext)) {
|
||||
if (ActivationUtil.isActivation()) {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("sn", RemoteManager.getInstance().getSerial());
|
||||
params.put("sex", "1");
|
||||
@@ -75,7 +75,7 @@ public class InfoFragment extends BaseMvvmFragment<InfoViewModel, FragmentInfoBi
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
||||
if (b) {
|
||||
if (ActivationUtil.isActivation(mContext)) {
|
||||
if (ActivationUtil.isActivation()) {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("sn", RemoteManager.getInstance().getSerial());
|
||||
params.put("sex", "2");
|
||||
@@ -123,7 +123,7 @@ public class InfoFragment extends BaseMvvmFragment<InfoViewModel, FragmentInfoBi
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (ActivationUtil.isActivation(mContext)) {
|
||||
if (ActivationUtil.isActivation()) {
|
||||
mViewModel.getSnInfo();
|
||||
} else {
|
||||
getLocalData();
|
||||
|
||||
@@ -37,7 +37,7 @@ public class InfoViewModel extends BaseViewModel<FragmentInfoBinding, FragmentEv
|
||||
public MutableLiveData<SnInfo> mSnInfoData = new MutableLiveData<>();
|
||||
|
||||
public void getSnInfo() {
|
||||
if (!ActivationUtil.isActivation(getCtx())) {
|
||||
if (!ActivationUtil.isActivation()) {
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public class InfoViewModel extends BaseViewModel<FragmentInfoBinding, FragmentEv
|
||||
public MutableLiveData<Boolean> mSuccessfulData = new MutableLiveData<>();
|
||||
|
||||
public void updateInfo(Map<String, String> params) {
|
||||
if (!ActivationUtil.isActivation(getCtx())) {
|
||||
if (!ActivationUtil.isActivation()) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public class AmapManager {
|
||||
}
|
||||
|
||||
public void startLocation() {
|
||||
boolean activation = ActivationUtil.isActivation(mContext);
|
||||
boolean activation = ActivationUtil.isActivation();
|
||||
if (!activation) {
|
||||
return;
|
||||
}
|
||||
@@ -139,7 +139,7 @@ public class AmapManager {
|
||||
};
|
||||
|
||||
private void updateAddress(AMapLocation aMapLocation) {
|
||||
boolean activation = ActivationUtil.isActivation(mContext);
|
||||
boolean activation = ActivationUtil.isActivation();
|
||||
if (!activation) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ 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.HomeworkUpdateApi;
|
||||
import com.uiui.zyos.network.api.PhraseApi;
|
||||
import com.uiui.zyos.network.api.RunNewApp;
|
||||
import com.uiui.zyos.network.api.SNInfoApi;
|
||||
@@ -50,6 +51,7 @@ import com.uiui.zyos.utils.OpenApkUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -333,7 +335,7 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<List<HomeworkBean>>> getHomeworkObservable() {
|
||||
public Observable<BaseResponse<ArrayList<HomeworkBean>>> getHomeworkObservable() {
|
||||
return mRetrofit.create(GetHomeworkApi.class)
|
||||
.getHomeworks(RemoteManager.getInstance().getSerial())
|
||||
.subscribeOn(Schedulers.io())
|
||||
@@ -347,6 +349,13 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse> getHomeworkUpdateObservable(int id) {
|
||||
return mRetrofit.create(HomeworkUpdateApi.class)
|
||||
.updateHomework(RemoteManager.getInstance().getSerial(), id)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<PhraseContent>> getPhraseObservable() {
|
||||
return mRetrofit.create(PhraseApi.class)
|
||||
.getPhrase(RemoteManager.getInstance().getSerial())
|
||||
@@ -354,6 +363,8 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* execution
|
||||
|
||||
@@ -31,6 +31,9 @@ public class UrlAddress {
|
||||
public static final String GET_HOMEWORK = "homework/index";
|
||||
/*家庭作业详情*/
|
||||
public static final String GET_HOMEWORK_DETAIL = "homework/show";
|
||||
/*家庭作业详标记完成*/
|
||||
public static final String GET_HOMEWORK_UPDATE = "homework/update";
|
||||
|
||||
/*获取桌面短语*/
|
||||
public static final String GET_PHRASES = "other/phrase";
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.uiui.zyos.bean.BaseResponse;
|
||||
import com.uiui.zyos.bean.HomeworkBean;
|
||||
import com.uiui.zyos.network.UrlAddress;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.GET;
|
||||
@@ -12,7 +12,7 @@ import retrofit2.http.Query;
|
||||
|
||||
public interface GetHomeworkApi {
|
||||
@GET(UrlAddress.GET_HOMEWORK)
|
||||
Observable<BaseResponse<List<HomeworkBean>>> getHomeworks(
|
||||
Observable<BaseResponse<ArrayList<HomeworkBean>>> getHomeworks(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.uiui.zyos.network.api;
|
||||
|
||||
import com.uiui.zyos.bean.BaseResponse;
|
||||
import com.uiui.zyos.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface HomeworkUpdateApi {
|
||||
@FormUrlEncoded
|
||||
@POST(UrlAddress.GET_HOMEWORK_UPDATE)
|
||||
Observable<BaseResponse> updateHomework(
|
||||
@Field("sn") String sn,
|
||||
@Field("id") int id
|
||||
);
|
||||
|
||||
}
|
||||
@@ -113,7 +113,7 @@ public class SocketService extends Service implements NetworkUtils.OnNetworkStat
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
registerScreenLockReceiver();
|
||||
|
||||
if (ActivationUtil.isActivation(SocketService.this)) {
|
||||
if (ActivationUtil.isActivation()) {
|
||||
//初始化websocket
|
||||
initSocketClient();
|
||||
startLoop();
|
||||
@@ -258,7 +258,7 @@ public class SocketService extends Service implements NetworkUtils.OnNetworkStat
|
||||
public void accept(Long s) throws Exception {
|
||||
Log.d(TAG, "startLoop accept: " + s);
|
||||
Log.i(TAG, "心跳包检测websocket连接状态");
|
||||
if (!ActivationUtil.isActivation(SocketService.this)) {
|
||||
if (!ActivationUtil.isActivation()) {
|
||||
dispose();
|
||||
}
|
||||
//每隔一定的时间,对长连接进行一次心跳检测
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.uiui.zyos.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.uiui.zyos.base.BaseApplication;
|
||||
import com.uiui.zyos.config.CommonConfig;
|
||||
|
||||
public class ActivationUtil {
|
||||
@@ -19,72 +19,65 @@ public class ActivationUtil {
|
||||
/**
|
||||
* 获取激活状态
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public static int getActivationStateCode(Context context) {
|
||||
int activation = Settings.Global.getInt(context.getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, INACTIVATED_KEY);
|
||||
public static int getActivationStateCode() {
|
||||
int activation = Settings.Global.getInt(BaseApplication.getContext().getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, INACTIVATED_KEY);
|
||||
return activation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否激活
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public static boolean isActivation(Context context) {
|
||||
return getActivationStateCode(context) == ACTIVATED_KEY;
|
||||
public static boolean isActivation() {
|
||||
return getActivationStateCode() == ACTIVATED_KEY;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置激活状态
|
||||
*
|
||||
* @param context
|
||||
* @param code
|
||||
*/
|
||||
public static void setActivation(Context context, int code) {
|
||||
Settings.Global.putInt(context.getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, code);
|
||||
public static void setActivation(int code) {
|
||||
Settings.Global.putInt(BaseApplication.getContext().getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置激活码类型
|
||||
*
|
||||
* @param context
|
||||
* @param code
|
||||
*/
|
||||
public static void setActivationCodeType(Context context, int code) {
|
||||
Settings.Global.putInt(context.getContentResolver(), CommonConfig.UIUI_CODE_TYPE_KEY, code);
|
||||
public static void setActivationCodeType(int code) {
|
||||
Settings.Global.putInt(BaseApplication.getContext().getContentResolver(), CommonConfig.UIUI_CODE_TYPE_KEY, code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取激活码类型
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public static int getActivationCodeType(Context context) {
|
||||
return Settings.Global.getInt(context.getContentResolver(), CommonConfig.UIUI_CODE_TYPE_KEY, DEFAULT_CODE_TYPE);
|
||||
public static int getActivationCodeType() {
|
||||
return Settings.Global.getInt(BaseApplication.getContext().getContentResolver(), CommonConfig.UIUI_CODE_TYPE_KEY, DEFAULT_CODE_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置过期时间
|
||||
*
|
||||
* @param context
|
||||
* @param expireTime
|
||||
*/
|
||||
public static void setActivationExpireTime(Context context, long expireTime) {
|
||||
Settings.Global.putLong(context.getContentResolver(), CommonConfig.UIUI_EXPIRE_TIME_KEY, expireTime);
|
||||
public static void setActivationExpireTime(long expireTime) {
|
||||
Settings.Global.putLong(BaseApplication.getContext().getContentResolver(), CommonConfig.UIUI_EXPIRE_TIME_KEY, expireTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取过期时间
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public static long getActivationExpireTime(Context context) {
|
||||
return Settings.Global.getLong(context.getContentResolver(), CommonConfig.UIUI_EXPIRE_TIME_KEY, DEFAULT_EXPIRE_TIME);
|
||||
public static long getActivationExpireTime() {
|
||||
return Settings.Global.getLong(BaseApplication.getContext().getContentResolver(), CommonConfig.UIUI_EXPIRE_TIME_KEY, DEFAULT_EXPIRE_TIME);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -53,7 +53,6 @@ public class ApkUtils {
|
||||
this.add("com.uiui.zy");
|
||||
this.add("com.uiui.zyos");
|
||||
this.add("com.uiui.zybrowser");
|
||||
this.add("com.uiui.zyappstore");
|
||||
this.add("org.chromium.browser");
|
||||
this.add("com.sprd.sprdnote");
|
||||
this.add("com.android.deskclock");
|
||||
@@ -122,6 +121,7 @@ public class ApkUtils {
|
||||
// this.add("com.android.calendar");
|
||||
this.add("com.mediatek.camera");
|
||||
this.add("com.uiui.zybrowser");
|
||||
this.add("com.uiui.zyappstore");
|
||||
}};
|
||||
private static HashSet<String> allHintPackage = new HashSet<String>() {{
|
||||
this.add("com.android.uiuios");
|
||||
|
||||
@@ -179,7 +179,7 @@ public class AppUsedTimeUtils {
|
||||
}
|
||||
|
||||
public void sendRunningApp(RunningAppCallback runningAppCallback) {
|
||||
boolean activation = ActivationUtil.isActivation(mContext);
|
||||
boolean activation = ActivationUtil.isActivation();
|
||||
if (!activation) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -281,4 +281,18 @@ public class FileUtil {
|
||||
.create(); //启动下载}
|
||||
}
|
||||
}
|
||||
|
||||
public static void ariaDownloadUrl(Context context, String url) {
|
||||
String fileName = getFileNamefromURL(url);
|
||||
File file = new File(getDownLoadPath(context) + fileName);
|
||||
if (file.exists() && !file.isDirectory()) {
|
||||
Log.e(TAG, "ariaDownload: " + "file exists");
|
||||
} else {
|
||||
Aria.download(context)
|
||||
.load(url) //读取下载地址
|
||||
.setFilePath(getDownLoadPath(context) + fileName)
|
||||
.ignoreFilePathOccupy()
|
||||
.create(); //启动下载}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,23 @@ package com.uiui.zyos.utils;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.SimpleTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Glide 加载 简单判空封装 防止异步加载数据时调用Glide 抛出异常
|
||||
@@ -51,6 +61,70 @@ public class GlideLoadUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public void glideLoad(Context context, File file, ImageView imageView, int default_image) {
|
||||
if (context != null) {
|
||||
Glide.with(context).load(file).centerCrop().error(default_image).into(imageView);
|
||||
} else {
|
||||
Log.i(TAG, "Picture loading failed,context is null");
|
||||
}
|
||||
}
|
||||
|
||||
public void glideLoadSetSize(Context context, String url, ImageView imageView, int default_image) {
|
||||
if (context != null) {
|
||||
Glide.with(context).load(url).centerCrop().error(default_image).into(new SimpleTarget<Drawable>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
||||
imageView.setImageDrawable(resource);
|
||||
// 获取图片的原始尺寸
|
||||
BitmapDrawable drawable = (BitmapDrawable) resource;
|
||||
Bitmap bitmap = drawable.getBitmap();
|
||||
int height = bitmap.getHeight();
|
||||
int width = bitmap.getWidth();
|
||||
int imageViewWidth = imageView.getWidth();
|
||||
int imageViewHeight = (int) ((double)height/width*imageViewWidth);
|
||||
// 设置ImageView的高度
|
||||
ViewGroup.LayoutParams params = imageView.getLayoutParams();
|
||||
params.height = imageViewHeight;
|
||||
imageView.setLayoutParams(params);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Log.i(TAG, "Picture loading failed,context is null");
|
||||
}
|
||||
}
|
||||
|
||||
public void glideLoadSetSize(Context context, File file, ImageView imageView, int default_image) {
|
||||
if (context != null) {
|
||||
Glide.with(context).load(file).centerCrop().error(default_image).into(new SimpleTarget<Drawable>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
||||
imageView.setImageDrawable(resource);
|
||||
// 获取图片的原始尺寸
|
||||
BitmapDrawable drawable = (BitmapDrawable) resource;
|
||||
Bitmap bitmap = drawable.getBitmap();
|
||||
int height = bitmap.getHeight();
|
||||
int width = bitmap.getWidth();
|
||||
int imageViewWidth = imageView.getWidth();
|
||||
int imageViewHeight = (int) ((double)height/width*imageViewWidth);
|
||||
// 设置ImageView的高度
|
||||
ViewGroup.LayoutParams params = imageView.getLayoutParams();
|
||||
params.height = imageViewHeight;
|
||||
imageView.setLayoutParams(params);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Log.i(TAG, "Picture loading failed,context is null");
|
||||
}
|
||||
}
|
||||
|
||||
public void glideLoadCenterInside(Context context, String url, ImageView imageView, int default_image) {
|
||||
if (context != null) {
|
||||
Glide.with(context).load(url).centerInside().error(default_image).into(imageView);
|
||||
} else {
|
||||
Log.i(TAG, "Picture loading failed,context is null");
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
|
||||
public void glideLoad(Activity activity, String url, ImageView imageView, int default_image) {
|
||||
if (!activity.isDestroyed()) {
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@@ -216,7 +215,7 @@ public class OpenApkUtils {
|
||||
}};
|
||||
|
||||
private void sendRuningApp(String packageName) {
|
||||
boolean activation = ActivationUtil.isActivation(mContext);
|
||||
boolean activation = ActivationUtil.isActivation();
|
||||
if (!activation) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -16,11 +16,17 @@ import androidx.core.content.FileProvider;
|
||||
|
||||
import com.uiui.zyos.BuildConfig;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.net.URLConnection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
public class OpenFileUtil {
|
||||
private static final String TAG = "OpenFileUtil";
|
||||
|
||||
public static void openFile(Context context, String filePath) {
|
||||
File file = new File(filePath);
|
||||
@@ -63,6 +69,20 @@ public class OpenFileUtil {
|
||||
type = map.get(end);
|
||||
}
|
||||
}
|
||||
Log.e(TAG, "getMimeTypeFromFile: " + type);
|
||||
Log.e(TAG, "getMimeType: " + getMimeType(file.getAbsolutePath()));
|
||||
return type;
|
||||
}
|
||||
|
||||
private static String getMimeType(String filePath) {
|
||||
String type = "*/*";
|
||||
try {
|
||||
FileInputStream inputFile = new FileInputStream(filePath);
|
||||
type = URLConnection.guessContentTypeFromStream(new BufferedInputStream(inputFile));
|
||||
return type;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -75,6 +95,7 @@ public class OpenFileUtil {
|
||||
*/
|
||||
public static HashMap<String, String> getMimeMap() {
|
||||
if (mapSimple.size() == 0) {
|
||||
mapSimple.put("", "*/*");
|
||||
mapSimple.put(".3gp", "video/3gpp");
|
||||
mapSimple.put(".apk", "application/vnd.android.package-archive");
|
||||
mapSimple.put(".asf", "video/x-ms-asf");
|
||||
@@ -142,7 +163,6 @@ public class OpenFileUtil {
|
||||
mapSimple.put(".xlsx", "application/vnd.ms-excel");
|
||||
mapSimple.put(".z", "application/x-compress");
|
||||
mapSimple.put(".zip", "application/zip");
|
||||
mapSimple.put("", "*/*");
|
||||
}
|
||||
return mapSimple;
|
||||
}
|
||||
|
||||
@@ -67,6 +67,60 @@ public class TimeUtils {
|
||||
return sdf.format(date);
|
||||
}
|
||||
|
||||
public static String getHomeworkTime2(String timeString) {
|
||||
SimpleDateFormat old = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date date = new Date();
|
||||
try {
|
||||
date = old.parse(timeString);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
|
||||
return sdf.format(date);
|
||||
}
|
||||
|
||||
public static String getHomeworkTime3(String timeString) {
|
||||
SimpleDateFormat old = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date date = new Date();
|
||||
try {
|
||||
date = old.parse(timeString);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("MM月dd日");
|
||||
return sdf.format(date);
|
||||
}
|
||||
|
||||
public static String getHomeworkNowTime() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
Log.e(TAG, "getHomeworkNowTime: " + calendar.getTimeInMillis());
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("MM月dd日");
|
||||
return sdf.format(new Date(calendar.getTimeInMillis()));
|
||||
}
|
||||
|
||||
public static boolean isHomeworkToday(String timeString) {
|
||||
if (TextUtils.isEmpty(timeString)) {
|
||||
return true;
|
||||
}
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
Log.e(TAG, "getHomeworkNowTime: " + calendar.getTimeInMillis());
|
||||
SimpleDateFormat old = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date date = new Date();
|
||||
try {
|
||||
date = old.parse(timeString);
|
||||
return date.getTime() >= calendar.getTimeInMillis();
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String formatTime(Long s) {
|
||||
if (s == 0) {
|
||||
return "0分钟";
|
||||
@@ -101,6 +155,12 @@ public class TimeUtils {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String secondsToHourMin(long seconds) {
|
||||
long hour = seconds / 3600; // 1 hour = 3600 seconds
|
||||
long remainingSeconds = seconds % 3600; // remaining seconds not including hours
|
||||
long min = (long) Math.ceil((double) remainingSeconds / 60); // 1 min = 60 seconds
|
||||
return String.format("%d小时%d分", hour, min);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否在管控时间内
|
||||
|
||||
@@ -298,7 +298,6 @@ public class Utils {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取手机的MAC地址
|
||||
*
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.uiui.zyos.view;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class EquallyDividedItemDecoration extends RecyclerView.ItemDecoration {
|
||||
private static final String TAG = EquallyDividedItemDecoration.class.getSimpleName();
|
||||
|
||||
private int mSpanCount;// 横条目数量
|
||||
private int mHalfRowSpacing;// 行间距的一半
|
||||
private int mHalfColumnSpacing;// 列间距的一半
|
||||
|
||||
public EquallyDividedItemDecoration(int spanCount, int halfRowSpacing) {
|
||||
mSpanCount = spanCount;
|
||||
mHalfRowSpacing = halfRowSpacing;
|
||||
mHalfColumnSpacing = halfRowSpacing;
|
||||
}
|
||||
|
||||
public EquallyDividedItemDecoration(int spanCount, int halfRowSpacing, int halfColumnSpacing) {
|
||||
mSpanCount = spanCount;
|
||||
mHalfRowSpacing = halfRowSpacing;
|
||||
mHalfColumnSpacing = halfColumnSpacing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent,
|
||||
@NonNull RecyclerView.State state) {
|
||||
super.getItemOffsets(outRect, view, parent, state);
|
||||
int position = parent.getChildAdapterPosition(view); // 获取view 在adapter中的位置。
|
||||
Log.d(TAG, "getItemOffsets: position = " + position);
|
||||
|
||||
int itemCount = parent.getAdapter().getItemCount();// item全部数量
|
||||
Log.d(TAG, "getItemOffsets: itemCount = " + itemCount);
|
||||
|
||||
int column = position % mSpanCount; // view 所在的列
|
||||
Log.d(TAG, "getItemOffsets: column = " + column);
|
||||
|
||||
if (column == 0) {
|
||||
outRect.left = 2 * mHalfRowSpacing;
|
||||
outRect.right = mHalfRowSpacing;
|
||||
} else if (column == mSpanCount - 1) {
|
||||
outRect.left = mHalfRowSpacing;
|
||||
outRect.right = 2 * mHalfRowSpacing;
|
||||
} else {
|
||||
outRect.left = mHalfRowSpacing;
|
||||
outRect.right = mHalfRowSpacing;
|
||||
}
|
||||
|
||||
int row = (position / mSpanCount);// 所在行
|
||||
Log.d(TAG, "getItemOffsets: row = " + row);
|
||||
int maxRow = (int) Math.ceil((double) itemCount / mSpanCount);// 一共多少行
|
||||
Log.d(TAG, "getItemOffsets: maxRow = " + maxRow);
|
||||
|
||||
if (row == 0) {
|
||||
outRect.top = 2 * mHalfColumnSpacing;
|
||||
outRect.bottom = mHalfColumnSpacing;
|
||||
} else if (row == maxRow - 1) {
|
||||
outRect.top = mHalfColumnSpacing;
|
||||
outRect.bottom = 2 * mHalfColumnSpacing;
|
||||
} else {
|
||||
outRect.top = mHalfColumnSpacing;
|
||||
outRect.bottom = mHalfColumnSpacing;
|
||||
}
|
||||
|
||||
Log.d(TAG, "getItemOffsets: outRect.left = " + outRect.left);
|
||||
Log.d(TAG, "getItemOffsets: outRect.right = " + outRect.right);
|
||||
Log.d(TAG, "getItemOffsets: outRect.top = " + outRect.top);
|
||||
Log.d(TAG, "getItemOffsets: outRect.bottom = " + outRect.bottom);
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 7.0 KiB |
BIN
app/src/main/res/drawable-hdpi/com_android_calculator2.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
app/src/main/res/drawable-hdpi/com_android_dialer.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
app/src/main/res/drawable-hdpi/com_android_mms_ui.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 6.5 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_homework_detail_back.png
Normal file
|
After Width: | Height: | Size: 627 B |
BIN
app/src/main/res/drawable-hdpi/icon_homework_pull.png
Normal file
|
After Width: | Height: | Size: 328 B |
BIN
app/src/main/res/drawable-hdpi/icon_homework_refresh.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_hw_statu_finish.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_hw_statu_unfinished.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_no_homework.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 40 KiB |
6
app/src/main/res/drawable/finish_text_selector.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="true" android:color="@color/default_blue" />
|
||||
<item android:state_checked="false" android:color="@color/black" />
|
||||
<item android:color="@color/black" />
|
||||
</selector>
|
||||
25
app/src/main/res/drawable/homework_details_background.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<!-- 填充的颜色:这里设置背景透明 -->
|
||||
<solid android:color="#FFFFFF" />
|
||||
<!-- 边框的颜色 :不能和窗口背景色一样 -->
|
||||
|
||||
<!-- 设置按钮的四个角为弧形 -->
|
||||
<!-- android:radius 弧形的半径 -->
|
||||
<corners
|
||||
android:bottomLeftRadius="@dimen/dp_8"
|
||||
android:bottomRightRadius="@dimen/dp_8"
|
||||
android:topLeftRadius="@dimen/dp_8"
|
||||
android:topRightRadius="@dimen/dp_8" />
|
||||
|
||||
|
||||
<!-- padding:Button里面的文字与Button边界的间隔 -->
|
||||
<!-- <padding-->
|
||||
<!-- android:bottom="@dimen/dp_8"-->
|
||||
<!-- android:left="@dimen/dp_8"-->
|
||||
<!-- android:right="@dimen/dp_8"-->
|
||||
<!-- android:top="@dimen/dp_8" />-->
|
||||
|
||||
</shape>
|
||||
25
app/src/main/res/drawable/homework_finish_background.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<!-- 填充的颜色:这里设置背景透明 -->
|
||||
<solid android:color="#8282EB" />
|
||||
<!-- 边框的颜色 :不能和窗口背景色一样 -->
|
||||
|
||||
<!-- 设置按钮的四个角为弧形 -->
|
||||
<!-- android:radius 弧形的半径 -->
|
||||
<corners
|
||||
android:bottomLeftRadius="@dimen/dp_16"
|
||||
android:bottomRightRadius="@dimen/dp_16"
|
||||
android:topLeftRadius="@dimen/dp_16"
|
||||
android:topRightRadius="@dimen/dp_16" />
|
||||
|
||||
|
||||
<!-- padding:Button里面的文字与Button边界的间隔 -->
|
||||
<padding
|
||||
android:bottom="@dimen/dp_4"
|
||||
android:left="@dimen/dp_8"
|
||||
android:right="@dimen/dp_8"
|
||||
android:top="@dimen/dp_4" />
|
||||
|
||||
</shape>
|
||||
25
app/src/main/res/drawable/homework_unfinished_background.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<!-- 填充的颜色:这里设置背景透明 -->
|
||||
<solid android:color="#DCDCDC" />
|
||||
<!-- 边框的颜色 :不能和窗口背景色一样 -->
|
||||
|
||||
<!-- 设置按钮的四个角为弧形 -->
|
||||
<!-- android:radius 弧形的半径 -->
|
||||
<corners
|
||||
android:bottomLeftRadius="@dimen/dp_16"
|
||||
android:bottomRightRadius="@dimen/dp_16"
|
||||
android:topLeftRadius="@dimen/dp_16"
|
||||
android:topRightRadius="@dimen/dp_16" />
|
||||
|
||||
|
||||
<!-- padding:Button里面的文字与Button边界的间隔 -->
|
||||
<padding
|
||||
android:bottom="@dimen/dp_4"
|
||||
android:left="@dimen/dp_8"
|
||||
android:right="@dimen/dp_8"
|
||||
android:top="@dimen/dp_4" />
|
||||
|
||||
</shape>
|
||||
25
app/src/main/res/drawable/update_finish_background.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<!-- 填充的颜色:这里设置背景透明 -->
|
||||
<solid android:color="#8282EB" />
|
||||
<!-- 边框的颜色 :不能和窗口背景色一样 -->
|
||||
|
||||
<!-- 设置按钮的四个角为弧形 -->
|
||||
<!-- android:radius 弧形的半径 -->
|
||||
<corners
|
||||
android:bottomLeftRadius="@dimen/dp_16"
|
||||
android:bottomRightRadius="@dimen/dp_16"
|
||||
android:topLeftRadius="@dimen/dp_16"
|
||||
android:topRightRadius="@dimen/dp_16" />
|
||||
|
||||
|
||||
<!-- padding:Button里面的文字与Button边界的间隔 -->
|
||||
<padding
|
||||
android:bottom="@dimen/dp_4"
|
||||
android:left="@dimen/dp_16"
|
||||
android:right="@dimen/dp_16"
|
||||
android:top="@dimen/dp_4" />
|
||||
|
||||
</shape>
|
||||
@@ -13,9 +13,9 @@
|
||||
android:topLeftRadius="@dimen/dp_8"
|
||||
android:topRightRadius="@dimen/dp_8" />
|
||||
|
||||
<!-- <padding-->
|
||||
<!-- android:bottom="@dimen/dp_8"-->
|
||||
<!-- android:left="@dimen/dp_8"-->
|
||||
<!-- android:right="@dimen/dp_8"-->
|
||||
<!-- android:top="@dimen/dp_8" />-->
|
||||
<padding
|
||||
android:bottom="@dimen/dp_4"
|
||||
android:left="@dimen/dp_4"
|
||||
android:right="@dimen/dp_4"
|
||||
android:top="@dimen/dp_4" />
|
||||
</shape>
|
||||
@@ -383,7 +383,7 @@
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:background="@drawable/bt_dialer_selector"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/dp_4"
|
||||
android:padding="@dimen/dp_8"
|
||||
android:src="@drawable/icon_dialer_cancel"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@@ -402,7 +402,7 @@
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:background="@drawable/bt_dialer_selector"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/dp_4"
|
||||
android:padding="@dimen/dp_8"
|
||||
android:src="@drawable/icon_dialer_confirm"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
134
app/src/main/res/layout-land/activity_homework.xml
Normal file
@@ -0,0 +1,134 @@
|
||||
<?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.homework.HomeworkActivity">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="com.uiui.zyos.activity.homework.HomeworkActivity.BtnClick" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#8282EB">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/bannerLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_back"
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:onClick="@{click::exit}"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/bt_back"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="我的作业"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_4"
|
||||
android:gravity="center_horizontal"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_11"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/imageView24"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView24"
|
||||
android:layout_width="@dimen/dp_12"
|
||||
android:layout_height="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_homework_pull"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.flyco.tablayout.SlidingTabLayout
|
||||
android:id="@+id/main_sliding_tab_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_marginStart="@dimen/dp_32"
|
||||
android:layout_marginEnd="@dimen/dp_32"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/bannerLayout"
|
||||
app:tl_indicator_color="@color/white"
|
||||
app:tl_indicator_margin_left="2dp"
|
||||
app:tl_indicator_margin_right="2dp"
|
||||
app:tl_indicator_style="NORMAL"
|
||||
app:tl_indicator_width_equal_title="true"
|
||||
app:tl_tab_space_equal="true"
|
||||
app:tl_textBold="SELECT"
|
||||
app:tl_textSelectColor="@color/white"
|
||||
app:tl_textSelectSize="@dimen/sp_11"
|
||||
app:tl_textUnSelectColor="@color/gray"
|
||||
app:tl_textUnSelectSize="@dimen/sp_9" />
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/viewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/dp_60"
|
||||
android:layout_marginEnd="@dimen/dp_60"
|
||||
app:layout_constraintBottom_toTopOf="@id/magicIndicator"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/main_sliding_tab_layout" />
|
||||
|
||||
<net.lucode.hackware.magicindicator.MagicIndicator
|
||||
android:id="@+id/magicIndicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
143
app/src/main/res/layout-land/activity_homework_details.xml
Normal file
@@ -0,0 +1,143 @@
|
||||
<?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.homework.HomeworkDetailsActivity">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="com.uiui.zyos.activity.homework.HomeworkDetailsActivity.BtnClick" />
|
||||
|
||||
<variable
|
||||
name="homeworkBean"
|
||||
type="com.uiui.zyos.bean.HomeworkBean" />
|
||||
|
||||
<import type="android.text.TextUtils" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:onClick="@{click::exit}">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
android:onClick="@{click::empty}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_homework_detail_back"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="标题" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_statu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:background="@drawable/homework_finish_background"
|
||||
android:maxLines="1"
|
||||
android:onClick="@{click::updateHomework}"
|
||||
android:singleLine="true"
|
||||
android:text="已完成"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout10">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<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:text="@{homeworkBean.content}"
|
||||
android:textColor="@color/text_hint_color"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_content">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_pic"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_100"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_100"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
@@ -348,7 +348,7 @@
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:background="@drawable/bt_dialer_selector"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/dp_4"
|
||||
android:padding="@dimen/dp_8"
|
||||
android:src="@drawable/icon_dialer_cancel"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@@ -367,7 +367,7 @@
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:background="@drawable/bt_dialer_selector"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/dp_4"
|
||||
android:padding="@dimen/dp_8"
|
||||
android:src="@drawable/icon_dialer_confirm"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -194,7 +194,7 @@
|
||||
android:id="@+id/cl_study_time"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="visible"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView17"
|
||||
@@ -206,8 +206,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/percent_color"
|
||||
android:textSize="@dimen/sp_20"
|
||||
android:text="100%"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@@ -219,7 +218,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:text="今日学习时间"
|
||||
android:text="今日学习时长"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintEnd_toEndOf="@+id/tv_percent"
|
||||
@@ -452,14 +451,13 @@
|
||||
android:id="@+id/cl_homework"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:onClick="@{click::openHomework}"
|
||||
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"
|
||||
@@ -467,34 +465,21 @@
|
||||
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"
|
||||
<ImageView
|
||||
android:id="@+id/imageView14"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:adjustViewBounds="true"
|
||||
android:onClick="@{click::refreshHomework}"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_homework_refresh"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_date3">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView14"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/user_more"
|
||||
android:onClick="@{click::openHomework}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<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"
|
||||
@@ -504,7 +489,6 @@
|
||||
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"
|
||||
@@ -512,11 +496,11 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView23"
|
||||
android:layout_width="@dimen/dp_64"
|
||||
android:layout_width="@dimen/dp_84"
|
||||
android:layout_height="@dimen/dp_64"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/no_homework"
|
||||
android:src="@drawable/icon_no_homework"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
88
app/src/main/res/layout-land/item_homework.xml
Normal file
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android: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="wrap_content"
|
||||
android:background="@drawable/item_homework_background"
|
||||
android:padding="@dimen/dp_4"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout11"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:text="暂时没有作业"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_10"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxEms="8"
|
||||
android:maxLines="1"
|
||||
android:text="2024-09-12 17:57:42"
|
||||
android:textColor="@color/gray_text"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="文字"
|
||||
android:textColor="@color/gray_text"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout11" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_pic"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_44"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_type" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_statu"
|
||||
android:layout_width="@dimen/dp_48"
|
||||
android:layout_height="@dimen/dp_48"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_hw_statu_unfinished"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
29
app/src/main/res/layout-land/item_homework_pic.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_root"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.shehuan.niv.NiceImageView
|
||||
android:id="@+id/nv_pic"
|
||||
android:layout_width="@dimen/dp_44"
|
||||
android:layout_height="@dimen/dp_44"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
app:corner_radius="@dimen/dp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -382,7 +382,7 @@
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:background="@drawable/bt_dialer_selector"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/dp_4"
|
||||
android:padding="@dimen/dp_8"
|
||||
android:src="@drawable/icon_dialer_cancel"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@@ -401,7 +401,7 @@
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:background="@drawable/bt_dialer_selector"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/dp_4"
|
||||
android:padding="@dimen/dp_8"
|
||||
android:src="@drawable/icon_dialer_confirm"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -348,7 +348,7 @@
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:background="@drawable/bt_dialer_selector"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/dp_4"
|
||||
android:padding="@dimen/dp_8"
|
||||
android:src="@drawable/icon_dialer_cancel"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@@ -367,7 +367,7 @@
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:background="@drawable/bt_dialer_selector"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/dp_4"
|
||||
android:padding="@dimen/dp_8"
|
||||
android:src="@drawable/icon_dialer_confirm"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -190,9 +190,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:text="100%"
|
||||
android:textColor="@color/percent_color"
|
||||
android:textSize="@dimen/sp_20"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@@ -437,6 +436,7 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_homework"
|
||||
android:layout_width="match_parent"
|
||||
android:onClick="@{click::openHomework}"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible">
|
||||
|
||||
@@ -444,8 +444,6 @@
|
||||
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"
|
||||
@@ -453,34 +451,21 @@
|
||||
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"
|
||||
<ImageView
|
||||
android:id="@+id/imageView14"
|
||||
android:layout_width="@dimen/dp_14"
|
||||
android:layout_height="@dimen/dp_14"
|
||||
android:adjustViewBounds="true"
|
||||
android:onClick="@{click::refreshHomework}"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_homework_refresh"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_date3">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView14"
|
||||
android:layout_width="@dimen/dp_14"
|
||||
android:layout_height="@dimen/dp_14"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:onClick="@{click::openHomework}"
|
||||
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>
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<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"
|
||||
@@ -490,7 +475,6 @@
|
||||
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"
|
||||
@@ -498,11 +482,11 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView23"
|
||||
android:layout_width="@dimen/dp_64"
|
||||
android:layout_width="@dimen/dp_84"
|
||||
android:layout_height="@dimen/dp_64"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/no_homework"
|
||||
android:src="@drawable/icon_no_homework"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
@@ -382,7 +382,7 @@
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:background="@drawable/bt_dialer_selector"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/dp_4"
|
||||
android:padding="@dimen/dp_8"
|
||||
android:src="@drawable/icon_dialer_cancel"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@@ -401,7 +401,7 @@
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:background="@drawable/bt_dialer_selector"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/dp_4"
|
||||
android:padding="@dimen/dp_8"
|
||||
android:src="@drawable/icon_dialer_confirm"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -47,6 +47,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="我的作业"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_14"
|
||||
@@ -56,14 +58,40 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_4"
|
||||
android:gravity="center_horizontal"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_11"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/imageView24"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView24"
|
||||
android:layout_width="@dimen/dp_12"
|
||||
android:layout_height="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_homework_pull"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.flyco.tablayout.SlidingTabLayout
|
||||
android:id="@+id/main_sliding_tab_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_12"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -84,7 +112,11 @@
|
||||
android:id="@+id/viewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/dp_20"
|
||||
android:layout_marginEnd="@dimen/dp_20"
|
||||
app:layout_constraintBottom_toTopOf="@id/magicIndicator"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/main_sliding_tab_layout" />
|
||||
|
||||
<net.lucode.hackware.magicindicator.MagicIndicator
|
||||
|
||||
143
app/src/main/res/layout/activity_homework_details.xml
Normal file
@@ -0,0 +1,143 @@
|
||||
<?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.homework.HomeworkDetailsActivity">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="com.uiui.zyos.activity.homework.HomeworkDetailsActivity.BtnClick" />
|
||||
|
||||
<variable
|
||||
name="homeworkBean"
|
||||
type="com.uiui.zyos.bean.HomeworkBean" />
|
||||
|
||||
<import type="android.text.TextUtils" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:onClick="@{click::exit}">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
android:onClick="@{click::empty}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_homework_detail_back"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="标题" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_statu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:background="@drawable/homework_finish_background"
|
||||
android:maxLines="1"
|
||||
android:onClick="@{click::updateHomework}"
|
||||
android:singleLine="true"
|
||||
android:text="已完成"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout10">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<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:text="@{homeworkBean.content}"
|
||||
android:textColor="@color/text_hint_color"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_content">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_pic"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
102
app/src/main/res/layout/activity_homework_update.xml
Normal file
@@ -0,0 +1,102 @@
|
||||
<?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.homework.UpdateActivity">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="com.uiui.zyos.activity.homework.UpdateActivity.BtnClick" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="@dimen/dp_330"
|
||||
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:id="@+id/imageView"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:adjustViewBounds="true"
|
||||
android:onClick="@{click::exit}"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_close"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_64"
|
||||
android:layout_height="@dimen/dp_64"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_32"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_hw_statu_finish" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:text="你确定已经完成作业了吗?"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_16" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/linearLayout3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_32"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/positive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_32"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/update_finish_background"
|
||||
android:gravity="center"
|
||||
android:onClick="@{click::updateHomework}"
|
||||
android:singleLine="true"
|
||||
android:text="已完成"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_16"
|
||||
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.0" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
@@ -348,7 +348,7 @@
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:background="@drawable/bt_dialer_selector"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/dp_4"
|
||||
android:padding="@dimen/dp_8"
|
||||
android:src="@drawable/icon_dialer_cancel"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@@ -367,7 +367,7 @@
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:background="@drawable/bt_dialer_selector"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/dp_4"
|
||||
android:padding="@dimen/dp_8"
|
||||
android:src="@drawable/icon_dialer_confirm"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
android:adjustViewBounds="true"
|
||||
android:onClick="@{click::edit}"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/user_edit_avatar"
|
||||
android:src="@drawable/icon_user_edit"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="@dimen/dp_200"
|
||||
android:layout_width="@dimen/dp_300"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/background_add"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -17,7 +17,7 @@
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:text="@string/privacy_agreement_title"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_12"
|
||||
@@ -29,10 +29,10 @@
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:layout_marginBottom="@dimen/dp_8"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:layout_marginBottom="@dimen/dp_12"
|
||||
app:layout_constraintBottom_toTopOf="@+id/linearLayout5"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
@@ -25,14 +25,14 @@
|
||||
android:id="@+id/iv_nodata"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone">
|
||||
android:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_width="@dimen/dp_132"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/no_homework"
|
||||
android:src="@drawable/icon_no_homework"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
@@ -194,7 +194,7 @@
|
||||
android:id="@+id/cl_study_time"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="visible"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView17"
|
||||
@@ -205,9 +205,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:text="100%"
|
||||
android:textColor="@color/percent_color"
|
||||
android:textSize="@dimen/sp_20"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@@ -219,7 +218,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:text="今日学习时间"
|
||||
android:text="今日学习时长"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintEnd_toEndOf="@+id/tv_percent"
|
||||
@@ -452,14 +451,13 @@
|
||||
android:id="@+id/cl_homework"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:onClick="@{click::openHomework}"
|
||||
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"
|
||||
@@ -467,34 +465,21 @@
|
||||
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"
|
||||
<ImageView
|
||||
android:id="@+id/imageView14"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:adjustViewBounds="true"
|
||||
android:onClick="@{click::refreshHomework}"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_homework_refresh"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_date3">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView14"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:onClick="@{click::openHomework}"
|
||||
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>
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<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"
|
||||
@@ -504,7 +489,6 @@
|
||||
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"
|
||||
@@ -512,11 +496,11 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView23"
|
||||
android:layout_width="@dimen/dp_64"
|
||||
android:layout_width="@dimen/dp_84"
|
||||
android:layout_height="@dimen/dp_64"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/no_homework"
|
||||
android:src="@drawable/icon_no_homework"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
89
app/src/main/res/layout/item_homework.xml
Normal file
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android: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="wrap_content"
|
||||
android:background="@drawable/item_homework_background"
|
||||
android:padding="@dimen/dp_8"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout11"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:text="暂时没有作业"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_10"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxEms="8"
|
||||
android:maxLines="1"
|
||||
android:text="2024-09-12 17:57:42"
|
||||
android:textColor="@color/gray_text"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="文字"
|
||||
android:textColor="@color/gray_text"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout11" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_pic"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_type" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_statu"
|
||||
android:layout_width="@dimen/dp_48"
|
||||
android:layout_height="@dimen/dp_48"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:layout_marginBottom="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_hw_statu_unfinished"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
55
app/src/main/res/layout/item_homework_detail_pic.xml
Normal file
@@ -0,0 +1,55 @@
|
||||
<?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:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/nv_pic"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_download"
|
||||
android:layout_width="@dimen/dp_48"
|
||||
android:layout_height="@dimen/dp_48"
|
||||
android:adjustViewBounds="true"
|
||||
android:padding="@dimen/dp_8"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/status_download"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_play"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:adjustViewBounds="true"
|
||||
android:padding="@dimen/dp_8"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/play"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,106 +0,0 @@
|
||||
<?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_marginStart="@dimen/dp_4"
|
||||
android:layout_marginTop="@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/iv_cover"
|
||||
android:layout_width="@dimen/dp_48"
|
||||
android:layout_height="@dimen/dp_48"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_homework_sample"
|
||||
app:corner_radius="@dimen/dp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_download"
|
||||
android:layout_width="@dimen/dp_48"
|
||||
android:layout_height="@dimen/dp_48"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
android:padding="@dimen/dp_8"
|
||||
android:src="@drawable/status_download"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_time"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_cover"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
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_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/title_gray"
|
||||
android:textSize="@dimen/sp_7" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:maxEms="8"
|
||||
android:maxLines="1"
|
||||
android:text="2024-09-12 17:57:42"
|
||||
android:textColor="@color/title_gray"
|
||||
android:textSize="@dimen/sp_7"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.275" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
30
app/src/main/res/layout/item_homework_pic.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_root"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.shehuan.niv.NiceImageView
|
||||
android:id="@+id/nv_pic"
|
||||
android:layout_width="@dimen/dp_60"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
app:corner_radius="@dimen/dp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
<color name="noti_color">#f4bea3</color>
|
||||
<color name="title_gray">#858585</color>
|
||||
<color name="gray_text">#969696</color>
|
||||
|
||||
<color name="color_icon_background">#1AFFFFFF</color>
|
||||
|
||||
@@ -44,4 +45,5 @@
|
||||
|
||||
<color name="default_radio_color">#EFEFEF</color>
|
||||
|
||||
<color name="user_name_color">#80000000</color>
|
||||
</resources>
|
||||
|
||||