version:
fix: update:优化离线添加闹钟,优化离线添加联系人,dock栏自定义图标
This commit is contained in:
@@ -15,8 +15,8 @@ android {
|
|||||||
applicationId "com.xxpatx.os"
|
applicationId "com.xxpatx.os"
|
||||||
minSdkVersion 24
|
minSdkVersion 24
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 1017
|
versionCode 1019
|
||||||
versionName "1.1.6"
|
versionName "1.1.8"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
|||||||
@@ -154,6 +154,10 @@
|
|||||||
android:name=".activity.setting.SettingActivity"
|
android:name=".activity.setting.SettingActivity"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
|
<activity
|
||||||
|
android:name=".activity.dock.DockActivity"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.setting.TouchActivity"
|
android:name=".activity.setting.TouchActivity"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ public class AlarmAddActivity extends BaseMvvmActivity<AlarmAddViewModel, Activi
|
|||||||
alarmClockData.setIs_local(true);
|
alarmClockData.setIs_local(true);
|
||||||
Log.e(TAG, "checkContent: addAlarmClock = " + AlarmUtils.getInstance().addAlarmClock(alarmClockData));
|
Log.e(TAG, "checkContent: addAlarmClock = " + AlarmUtils.getInstance().addAlarmClock(alarmClockData));
|
||||||
Toaster.show("添加成功");
|
Toaster.show("添加成功");
|
||||||
Intent intent = new Intent(MainService.uploadAlarmClockReceiver.UPLOAD_ALARM_RECEIVER_ACTION);
|
Intent intent = new Intent(MainService.ALARM_RECEIVER_ACTION_ADD);
|
||||||
sendBroadcast(intent);
|
sendBroadcast(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,17 +60,14 @@ import okhttp3.RequestBody;
|
|||||||
public class AlarmEditActivity extends BaseMvvmActivity<AlarmEditViewModel, ActivityAlarmEditBinding> {
|
public class AlarmEditActivity extends BaseMvvmActivity<AlarmEditViewModel, ActivityAlarmEditBinding> {
|
||||||
private static final String TAG = "AlarmEditActivity";
|
private static final String TAG = "AlarmEditActivity";
|
||||||
|
|
||||||
private LoadingDialog mLoadingDialog;
|
|
||||||
private PopupWindow mMenuPopupWindow;
|
|
||||||
|
|
||||||
private TimePickerView pvTime;
|
private TimePickerView pvTime;
|
||||||
private String mPictrueFilePath;
|
|
||||||
|
private String mPictrueFilePath = "";
|
||||||
|
|
||||||
private Date mDate;
|
private Date mDate;
|
||||||
/*类型 1一次性 2每天 3周一到周五 4周六周日*/
|
/*类型 1一次性 2每天 3周一到周五 4周六周日*/
|
||||||
private int mDayType = 1;
|
private int mDayType = 1;
|
||||||
private int mClockType = 1;
|
|
||||||
private int mId;
|
|
||||||
private AlarmClockData mAlarmClockData;
|
private AlarmClockData mAlarmClockData;
|
||||||
|
|
||||||
|
|
||||||
@@ -137,60 +134,19 @@ public class AlarmEditActivity extends BaseMvvmActivity<AlarmEditViewModel, Acti
|
|||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mId = intent.getIntExtra("id", -1);
|
mAlarmClockData = (AlarmClockData) intent.getSerializableExtra("AlarmClockData");
|
||||||
if (mId == -1) {
|
if (mAlarmClockData == null) {
|
||||||
Toaster.show("获取闹钟信息失败");
|
Toaster.show("获取闹钟信息失败");
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
HashMap<Integer, AlarmClockData> clockDataHashMap = AlarmUtils.getInstance().getOldDataMap();
|
mViewDataBinding.setAlarmClockData(mAlarmClockData);
|
||||||
AlarmClockData alarmClockData = clockDataHashMap.get(mId);
|
setAlarmClockInfo();
|
||||||
if (alarmClockData == null || !alarmClockData.isIs_local()) {
|
|
||||||
NetInterfaceManager.getInstance().getAlarmClockByIdObservable(mId)
|
|
||||||
.compose(RxLifecycle.bindUntilEvent(getLifecycleSubject(), ActivityEvent.DESTROY))
|
|
||||||
.subscribe(new Observer<BaseResponse<AlarmClockData>>() {
|
|
||||||
@Override
|
|
||||||
public void onSubscribe(@NonNull Disposable d) {
|
|
||||||
Log.e("getAlarmClockById", "onSubscribe: ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void setAlarmClockInfo() {
|
||||||
public void onNext(@NonNull BaseResponse<AlarmClockData> alarmClockDatabaseResponse) {
|
Log.e(TAG, "setAlarmClockInfo: " + mAlarmClockData);
|
||||||
Log.e("getAlarmClockById", "onNext: " + alarmClockDatabaseResponse);
|
mDayType = mAlarmClockData.getType();
|
||||||
if (alarmClockDatabaseResponse.code == 200) {
|
|
||||||
AlarmClockData alarmClockData = alarmClockDatabaseResponse.data;
|
|
||||||
mAlarmClockData = alarmClockData;
|
|
||||||
setAlarmClockInfo(alarmClockData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(@NonNull Throwable e) {
|
|
||||||
Log.e("getAlarmClockById", "onError: " + e.getMessage());
|
|
||||||
HashMap<Integer, AlarmClockData> oldData = AlarmUtils.getInstance().getOldDataMap();
|
|
||||||
mAlarmClockData = oldData.get(mId);
|
|
||||||
setAlarmClockInfo(mAlarmClockData);
|
|
||||||
onComplete();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onComplete() {
|
|
||||||
Log.e("getAlarmClockById", "onComplete: ");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
mAlarmClockData = alarmClockData;
|
|
||||||
setAlarmClockInfo(mAlarmClockData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setAlarmClockInfo(AlarmClockData alarmClockData) {
|
|
||||||
if (alarmClockData == null) {
|
|
||||||
Toaster.show("闹钟信息为空");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Log.e(TAG, "setAlarmClockInfo: " + alarmClockData);
|
|
||||||
mDayType = alarmClockData.getType();
|
|
||||||
switch (mDayType) {
|
switch (mDayType) {
|
||||||
default:
|
default:
|
||||||
case AlarmUtils.ONCE:
|
case AlarmUtils.ONCE:
|
||||||
@@ -210,35 +166,22 @@ public class AlarmEditActivity extends BaseMvvmActivity<AlarmEditViewModel, Acti
|
|||||||
// tvType.setText("周六至周日");
|
// tvType.setText("周六至周日");
|
||||||
// break;
|
// break;
|
||||||
}
|
}
|
||||||
mClockType = alarmClockData.getClazz();
|
String time = mAlarmClockData.getTime();
|
||||||
switch (mClockType) {
|
|
||||||
case 1:
|
|
||||||
default:
|
|
||||||
mViewDataBinding.rbAll.setChecked(true);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
mViewDataBinding.rbLook.setChecked(true);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
mViewDataBinding.rbReserve.setChecked(true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
String time = alarmClockData.getTime();
|
|
||||||
Calendar date = getTime(time);
|
Calendar date = getTime(time);
|
||||||
Calendar now = Calendar.getInstance();
|
Calendar now = Calendar.getInstance();
|
||||||
date.set(now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, now.get(Calendar.DAY_OF_MONTH));
|
date.set(now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, now.get(Calendar.DAY_OF_MONTH));
|
||||||
Log.e(TAG, "setAlarmClockInfo: " + date.getTimeInMillis());
|
Log.e(TAG, "setAlarmClockInfo: " + date.getTimeInMillis());
|
||||||
pvTime.setDate(date);
|
pvTime.setDate(date);
|
||||||
String title = alarmClockData.getTitle();
|
String title = mAlarmClockData.getTitle();
|
||||||
mViewDataBinding.etActivation.setText(title);
|
mViewDataBinding.etActivation.setText(title);
|
||||||
String fileUrl = alarmClockData.getFile();
|
String fileUrl = mAlarmClockData.getFile();
|
||||||
mPictrueFilePath = fileUrl;
|
|
||||||
String fileName = Utils.getFileNamefromURL(fileUrl);
|
|
||||||
File file = new File(Utils.getDownLoadPath(AlarmEditActivity.this) + fileName);
|
|
||||||
if (TextUtils.isEmpty(fileUrl)) {
|
if (TextUtils.isEmpty(fileUrl)) {
|
||||||
mViewDataBinding.clPic.setVisibility(View.VISIBLE);
|
mViewDataBinding.clPic.setVisibility(View.VISIBLE);
|
||||||
mViewDataBinding.nvPic.setVisibility(View.GONE);
|
mViewDataBinding.nvPic.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
|
mPictrueFilePath = fileUrl;
|
||||||
|
String fileName = Utils.getFileNamefromURL(fileUrl);
|
||||||
|
File file = new File(Utils.getDownLoadPath(AlarmEditActivity.this) + fileName);
|
||||||
if (file.exists() && !file.isDirectory()) {
|
if (file.exists() && !file.isDirectory()) {
|
||||||
GlideLoadUtils.getInstance().glideLoad(this, file, mViewDataBinding.nvPic);
|
GlideLoadUtils.getInstance().glideLoad(this, file, mViewDataBinding.nvPic);
|
||||||
} else {
|
} else {
|
||||||
@@ -255,10 +198,10 @@ public class AlarmEditActivity extends BaseMvvmActivity<AlarmEditViewModel, Acti
|
|||||||
Toaster.show("请输入标题");
|
Toaster.show("请输入标题");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (TextUtils.isEmpty(mPictrueFilePath)) {
|
// if (TextUtils.isEmpty(mPictrueFilePath)) {
|
||||||
Toaster.show("请重新选择图片");
|
// Toaster.show("请重新选择图片");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
String timeStamp = getTime(mDate);
|
String timeStamp = getTime(mDate);
|
||||||
Log.e(TAG, "checkContent: " + timeStamp);
|
Log.e(TAG, "checkContent: " + timeStamp);
|
||||||
Log.e(TAG, "checkContent: " + mPictrueFilePath);
|
Log.e(TAG, "checkContent: " + mPictrueFilePath);
|
||||||
@@ -278,41 +221,29 @@ public class AlarmEditActivity extends BaseMvvmActivity<AlarmEditViewModel, Acti
|
|||||||
body = MultipartBody.Part.createFormData("file", picFile.getName(), requestBody);
|
body = MultipartBody.Part.createFormData("file", picFile.getName(), requestBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
mAlarmClockData.setId(mId);
|
mAlarmClockData.setId(mAlarmClockData.getId());
|
||||||
mAlarmClockData.setType(mDayType);
|
mAlarmClockData.setType(mDayType);
|
||||||
mAlarmClockData.setTime(timeStamp);
|
mAlarmClockData.setTime(timeStamp);
|
||||||
mAlarmClockData.setTitle(mViewDataBinding.etActivation.getText().toString());
|
mAlarmClockData.setTitle(mViewDataBinding.etActivation.getText().toString());
|
||||||
mAlarmClockData.setFile(mPictrueFilePath);
|
mAlarmClockData.setFile(mPictrueFilePath);
|
||||||
mAlarmClockData.setRemind_type(0);
|
mAlarmClockData.setRemind_type(mAlarmClockData.getRemind_type());
|
||||||
mAlarmClockData.setIs_onoff(1);
|
mAlarmClockData.setIs_onoff(mAlarmClockData.getIs_onoff());
|
||||||
mAlarmClockData.setFinished(false);
|
mAlarmClockData.setFinished(false);
|
||||||
mAlarmClockData.setClazz(mClockType);
|
mAlarmClockData.setClazz(mAlarmClockData.getClazz());
|
||||||
|
|
||||||
|
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>();
|
||||||
params.put("sn", Utils.getSerial());
|
params.put("sn", Utils.getSerial());
|
||||||
params.put("id", String.valueOf(mId));
|
params.put("id", String.valueOf(mAlarmClockData.getId()));
|
||||||
params.put("type", String.valueOf(mDayType));
|
params.put("type", String.valueOf(mDayType));
|
||||||
params.put("time", timeStamp);
|
params.put("time", timeStamp);
|
||||||
params.put("title", mViewDataBinding.etActivation.getText().toString());
|
params.put("title", mViewDataBinding.etActivation.getText().toString());
|
||||||
params.put("remind_type", "0");
|
params.put("remind_type", String.valueOf(mAlarmClockData.getRemind_type()));
|
||||||
params.put("is_onoff", "1");
|
params.put("is_onoff", String.valueOf(mAlarmClockData.getIs_onoff()));
|
||||||
params.put("class", String.valueOf(mClockType));
|
params.put("class", String.valueOf(mAlarmClockData.getClazz()));
|
||||||
|
|
||||||
|
|
||||||
mLoadingDialog = new LoadingDialog(this);
|
|
||||||
mLoadingDialog.setLoadingText("正在上传")
|
|
||||||
.setSuccessText("编辑成功")
|
|
||||||
.setFailedText("编辑失败")
|
|
||||||
.setInterceptBack(true)
|
|
||||||
.setLoadSpeed(LoadingDialog.Speed.SPEED_ONE)
|
|
||||||
.closeSuccessAnim()
|
|
||||||
.show();
|
|
||||||
|
|
||||||
if (mAlarmClockData.isIs_local()) {
|
if (mAlarmClockData.isIs_local()) {
|
||||||
Toaster.show("编辑成功");
|
Toaster.show("编辑成功");
|
||||||
mLoadingDialog.loadSuccess();
|
|
||||||
mLoadingDialog.close();
|
|
||||||
mAlarmClockData.setEdited(false);
|
mAlarmClockData.setEdited(false);
|
||||||
AlarmUtils.getInstance().updateAlarmClock(mAlarmClockData);
|
AlarmUtils.getInstance().updateAlarmClock(mAlarmClockData);
|
||||||
finish();
|
finish();
|
||||||
@@ -332,14 +263,11 @@ public class AlarmEditActivity extends BaseMvvmActivity<AlarmEditViewModel, Acti
|
|||||||
Log.e("checkContent", "onNext: " + baseResponse);
|
Log.e("checkContent", "onNext: " + baseResponse);
|
||||||
if (baseResponse.code == 200) {
|
if (baseResponse.code == 200) {
|
||||||
Toaster.show("编辑成功");
|
Toaster.show("编辑成功");
|
||||||
mLoadingDialog.loadSuccess();
|
|
||||||
mLoadingDialog.close();
|
|
||||||
mAlarmClockData.setEdited(false);
|
mAlarmClockData.setEdited(false);
|
||||||
AlarmUtils.getInstance().updateAlarmClock(mAlarmClockData);
|
AlarmUtils.getInstance().updateAlarmClock(mAlarmClockData);
|
||||||
finish();
|
finish();
|
||||||
} else {
|
} else {
|
||||||
Toaster.show("编辑失败:" + baseResponse.msg);
|
Toaster.show("编辑失败:" + baseResponse.msg);
|
||||||
mLoadingDialog.loadFailed();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,66 +284,11 @@ public class AlarmEditActivity extends BaseMvvmActivity<AlarmEditViewModel, Acti
|
|||||||
Log.e("checkContent", "onComplete: ");
|
Log.e("checkContent", "onComplete: ");
|
||||||
mViewDataBinding.tvAdd.setEnabled(true);
|
mViewDataBinding.tvAdd.setEnabled(true);
|
||||||
finish();
|
finish();
|
||||||
mLoadingDialog.close();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void showTimeFilterWindow() {
|
|
||||||
if (mMenuPopupWindow == null) {
|
|
||||||
View view = getLayoutInflater().inflate(R.layout.window_menu, null);
|
|
||||||
TextView tvMenuOne = view.findViewById(R.id.tv_menuOne);
|
|
||||||
TextView tvMenuTwo = view.findViewById(R.id.tv_menuTwo);
|
|
||||||
TextView tvMenuThree = view.findViewById(R.id.tv_menuThree);
|
|
||||||
TextView tvMenuFour = view.findViewById(R.id.tv_menuFour);
|
|
||||||
mMenuPopupWindow = new PopupWindow(view, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
|
|
||||||
mMenuPopupWindow.setOutsideTouchable(true);
|
|
||||||
tvMenuOne.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
mDayType = 1;
|
|
||||||
mViewDataBinding.tvType.setText("只响一次");
|
|
||||||
mMenuPopupWindow.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tvMenuTwo.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
mDayType = 2;
|
|
||||||
mViewDataBinding.tvType.setText("每天");
|
|
||||||
mMenuPopupWindow.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tvMenuThree.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
mDayType = 3;
|
|
||||||
mViewDataBinding.tvType.setText("周一至周五");
|
|
||||||
mMenuPopupWindow.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tvMenuFour.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
mDayType = 4;
|
|
||||||
mViewDataBinding.tvType.setText("周六至周日");
|
|
||||||
mMenuPopupWindow.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (mMenuPopupWindow.isShowing()) {
|
|
||||||
mMenuPopupWindow.dismiss();
|
|
||||||
} else {
|
|
||||||
Log.e(TAG, "showTimeFilterWindow: right " + mViewDataBinding.tvType.getRight());
|
|
||||||
Log.e(TAG, "showTimeFilterWindow: top " + mViewDataBinding.tvType.getTop());
|
|
||||||
Log.e(TAG, "showTimeFilterWindow: right " + mViewDataBinding.clType.getRight());
|
|
||||||
Log.e(TAG, "showTimeFilterWindow: top " + mViewDataBinding.clType.getTop());
|
|
||||||
mMenuPopupWindow.showAtLocation(mViewDataBinding.clType, Gravity.END, 20, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void openSelector() {
|
private void openSelector() {
|
||||||
PictureSelector.create(AlarmEditActivity.this)
|
PictureSelector.create(AlarmEditActivity.this)
|
||||||
.openGallery(SelectMimeType.ofAll())
|
.openGallery(SelectMimeType.ofAll())
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
package com.xxpatx.os.activity.alarm.list;
|
package com.xxpatx.os.activity.alarm.list;
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
|
import android.os.Handler;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
@@ -22,10 +26,13 @@ import com.xxpatx.os.bean.BaseResponse;
|
|||||||
import com.xxpatx.os.config.CommonConfig;
|
import com.xxpatx.os.config.CommonConfig;
|
||||||
import com.xxpatx.os.databinding.ActivityAlarmListBinding;
|
import com.xxpatx.os.databinding.ActivityAlarmListBinding;
|
||||||
import com.xxpatx.os.dialog.DeleteDialog;
|
import com.xxpatx.os.dialog.DeleteDialog;
|
||||||
|
import com.xxpatx.os.fragment.home.HomeFragment;
|
||||||
import com.xxpatx.os.network.NetInterfaceManager;
|
import com.xxpatx.os.network.NetInterfaceManager;
|
||||||
|
import com.xxpatx.os.push.PushManager;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.jzvd.Jzvd;
|
||||||
import io.reactivex.rxjava3.core.Observer;
|
import io.reactivex.rxjava3.core.Observer;
|
||||||
import io.reactivex.rxjava3.disposables.Disposable;
|
import io.reactivex.rxjava3.disposables.Disposable;
|
||||||
|
|
||||||
@@ -113,21 +120,35 @@ public class AlarmListActivity extends BaseMvvmActivity<AlarmListViewModel, Acti
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void initData() {
|
public void initData() {
|
||||||
|
registerAlarmClockReceiver();
|
||||||
mViewModel.getAlarmClockData().observe(this, new androidx.lifecycle.Observer<List<AlarmClockData>>() {
|
mViewModel.getAlarmClockData().observe(this, new androidx.lifecycle.Observer<List<AlarmClockData>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(List<AlarmClockData> alarmClockData) {
|
public void onChanged(List<AlarmClockData> alarmClockData) {
|
||||||
setAlarmClock(alarmClockData);
|
setAlarmClock(alarmClockData);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
mViewModel.getAlarmClock();
|
||||||
mViewModel.getAlarmClock(mType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
|
Log.e(TAG, "onResume: ");
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
mViewModel.getAlarmClock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
Jzvd.releaseAllVideos();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
Log.e(TAG, "onDestroy: ");
|
||||||
|
super.onDestroy();
|
||||||
|
unregisterReceivers();
|
||||||
|
}
|
||||||
|
|
||||||
private void showDialog(AlarmClockData alarmClockData) {
|
private void showDialog(AlarmClockData alarmClockData) {
|
||||||
DeleteDialog dialog = new DeleteDialog(this);
|
DeleteDialog dialog = new DeleteDialog(this);
|
||||||
@@ -154,7 +175,7 @@ public class AlarmListActivity extends BaseMvvmActivity<AlarmListViewModel, Acti
|
|||||||
if (alarmClockData.isIs_local()) {
|
if (alarmClockData.isIs_local()) {
|
||||||
alarmClockData.setDeleted(true);
|
alarmClockData.setDeleted(true);
|
||||||
AlarmUtils.getInstance().deleteAlarmClock(alarmClockData);
|
AlarmUtils.getInstance().deleteAlarmClock(alarmClockData);
|
||||||
mViewModel.getAlarmClock(mType);
|
mViewModel.getAlarmClock();
|
||||||
} else {
|
} else {
|
||||||
NetInterfaceManager.getInstance().deleteAlarmClockObservable(alarmClockData.getId())
|
NetInterfaceManager.getInstance().deleteAlarmClockObservable(alarmClockData.getId())
|
||||||
.compose(RxLifecycle.bindUntilEvent(getLifecycleSubject(), ActivityEvent.DESTROY))
|
.compose(RxLifecycle.bindUntilEvent(getLifecycleSubject(), ActivityEvent.DESTROY))
|
||||||
@@ -186,7 +207,7 @@ public class AlarmListActivity extends BaseMvvmActivity<AlarmListViewModel, Acti
|
|||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
Log.e("deleteAlarm", "onComplete: ");
|
Log.e("deleteAlarm", "onComplete: ");
|
||||||
mViewModel.getAlarmClock(mType);
|
mViewModel.getAlarmClock();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -194,19 +215,14 @@ public class AlarmListActivity extends BaseMvvmActivity<AlarmListViewModel, Acti
|
|||||||
|
|
||||||
|
|
||||||
public void setAlarmClock(List<AlarmClockData> alarmClockData) {
|
public void setAlarmClock(List<AlarmClockData> alarmClockData) {
|
||||||
List<AlarmClockData> localAddAlarm = AlarmUtils.getInstance().getLocalAddAlarm();
|
if (alarmClockData == null || alarmClockData.size() == 0) {
|
||||||
Log.e(TAG, "setAlarmClock: localAddAlarm size = " + localAddAlarm);
|
|
||||||
if (alarmClockData != null) {
|
|
||||||
localAddAlarm.addAll(alarmClockData);
|
|
||||||
}
|
|
||||||
if (localAddAlarm.size() == 0) {
|
|
||||||
mAlarmAdapter.setAlarmClockData(null);
|
mAlarmAdapter.setAlarmClockData(null);
|
||||||
// swipeRefreshLayout.setRefreshing(false);
|
// swipeRefreshLayout.setRefreshing(false);
|
||||||
mViewDataBinding.clNodata.setVisibility(View.VISIBLE);
|
mViewDataBinding.clNodata.setVisibility(View.VISIBLE);
|
||||||
mViewDataBinding.rvData.setVisibility(View.GONE);
|
mViewDataBinding.rvData.setVisibility(View.GONE);
|
||||||
// Toaster.show("没有数据");
|
// Toaster.show("没有数据");
|
||||||
} else {
|
} else {
|
||||||
mAlarmAdapter.setAlarmClockData(localAddAlarm);
|
mAlarmAdapter.setAlarmClockData(alarmClockData);
|
||||||
// swipeRefreshLayout.setRefreshing(false);
|
// swipeRefreshLayout.setRefreshing(false);
|
||||||
mViewDataBinding.clNodata.setVisibility(View.GONE);
|
mViewDataBinding.clNodata.setVisibility(View.GONE);
|
||||||
mViewDataBinding.rvData.setVisibility(View.VISIBLE);
|
mViewDataBinding.rvData.setVisibility(View.VISIBLE);
|
||||||
@@ -228,4 +244,33 @@ public class AlarmListActivity extends BaseMvvmActivity<AlarmListViewModel, Acti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void unregisterReceivers() {
|
||||||
|
if (mAlarmClockReceiver != null) {
|
||||||
|
unregisterReceiver(mAlarmClockReceiver);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerAlarmClockReceiver() {
|
||||||
|
if (null == mAlarmClockReceiver) {
|
||||||
|
mAlarmClockReceiver = new AlarmClockReceiver();
|
||||||
|
}
|
||||||
|
IntentFilter filter = new IntentFilter();
|
||||||
|
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||||
|
filter.addAction(PushManager.SET_ALARMCLOCK);
|
||||||
|
registerReceiver(mAlarmClockReceiver, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private AlarmClockReceiver mAlarmClockReceiver;
|
||||||
|
|
||||||
|
private class AlarmClockReceiver extends BroadcastReceiver {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
String action = intent.getAction();
|
||||||
|
Log.e(TAG, "onReceive: " + action);
|
||||||
|
if (PushManager.SET_ALARMCLOCK.equals(action)) {
|
||||||
|
mViewModel.getAlarmClock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,24 +39,15 @@ public class AlarmListViewModel extends BaseViewModel<ActivityAlarmListBinding,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void getAlarmClock() {
|
public void getAlarmClock() {
|
||||||
NetInterfaceManager.getInstance().getAlarmClock(true, getLifecycle(), new NetInterfaceManager.AlarmClockCallback() {
|
NetInterfaceManager.getInstance().getAlarmClock(getLifecycle(), new NetInterfaceManager.AlarmClockCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void setAlarmClock(List<AlarmClockData> alarmClockList) {
|
public void setAlarmClock(List<AlarmClockData> alarmClockList) {
|
||||||
if (alarmClockList.size() == 0) {
|
mAlarmClockData.setValue(alarmClockList);
|
||||||
setAlarmClockEmpty();
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAlarmClockEmpty() {
|
public void onError(String msg) {
|
||||||
|
Toaster.show(msg);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError() {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
111
app/src/main/java/com/xxpatx/os/activity/dock/DockActivity.java
Normal file
111
app/src/main/java/com/xxpatx/os/activity/dock/DockActivity.java
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
package com.xxpatx.os.activity.dock;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.lifecycle.Observer;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
import com.tencent.mmkv.MMKV;
|
||||||
|
import com.xxpatx.os.R;
|
||||||
|
import com.xxpatx.os.adapter.DockAppSelectedAdapter;
|
||||||
|
import com.xxpatx.os.base.mvvm.BaseMvvmActivity;
|
||||||
|
import com.xxpatx.os.bean.DockApp;
|
||||||
|
import com.xxpatx.os.config.CommonConfig;
|
||||||
|
import com.xxpatx.os.databinding.ActivityDockBinding;
|
||||||
|
import com.xxpatx.os.view.GridSpaceItemDecoration;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DockActivity extends BaseMvvmActivity<DockViewModel, ActivityDockBinding> {
|
||||||
|
private static final String TAG = "DockActivity";
|
||||||
|
|
||||||
|
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||||
|
|
||||||
|
public static final String DOCK_APP_KEY = "DockAppPackageKey";
|
||||||
|
|
||||||
|
|
||||||
|
private DockAppSelectedAdapter mDockAppSelectedAdapter;
|
||||||
|
|
||||||
|
public static final List<DockApp> DEFAULT_DOCK_APP = new ArrayList<DockApp>() {
|
||||||
|
private static final long serialVersionUID = -7406071324804131303L;
|
||||||
|
|
||||||
|
{
|
||||||
|
this.add(new DockApp("xxpatx.os.dialer"));
|
||||||
|
this.add(new DockApp("com.tencent.mm"));
|
||||||
|
this.add(new DockApp("com.ss.android.ugc.aweme"));
|
||||||
|
this.add(new DockApp("com.mediatek.camera"));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public static final List<String> INCLUDE_SYSTEM_APP =new ArrayList<String>(){{
|
||||||
|
this.add("com.mediatek.camera");
|
||||||
|
}};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initDataBinding() {
|
||||||
|
mViewModel.setCtx(this);
|
||||||
|
mViewModel.setLifecycle(getLifecycleSubject());
|
||||||
|
mViewModel.setVDBinding(mViewDataBinding);
|
||||||
|
mViewDataBinding.setClick(new BtnClick());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initView() {
|
||||||
|
mDockAppSelectedAdapter = new DockAppSelectedAdapter();
|
||||||
|
// if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
|
// mViewDataBinding.recyclerView.setLayoutManager(new GridLayoutManager(this, 3));
|
||||||
|
// mViewDataBinding.recyclerView.addItemDecoration(new GridSpaceItemDecoration(3, 20, 20));
|
||||||
|
// } else {
|
||||||
|
mViewDataBinding.recyclerView.setLayoutManager(new GridLayoutManager(this, 2));
|
||||||
|
mViewDataBinding.recyclerView.addItemDecoration(new GridSpaceItemDecoration(2, 10, 10));
|
||||||
|
// }
|
||||||
|
mViewDataBinding.recyclerView.setAdapter(mDockAppSelectedAdapter);
|
||||||
|
mViewDataBinding.ivBack.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initData() {
|
||||||
|
mViewModel.getAppSelectBeanListData().observe(this, new Observer<List<DockApp>>() {
|
||||||
|
@Override
|
||||||
|
public void onChanged(List<DockApp> dockApps) {
|
||||||
|
mDockAppSelectedAdapter.setDockAppList(dockApps);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// mDockAppSelectedAdapter.setSelectedPkgList(DEFAULT_DOCK_APP);
|
||||||
|
String jsonString = mMMKV.decodeString(DockActivity.DOCK_APP_KEY);
|
||||||
|
Log.e(TAG, "setDockApp: " + jsonString);
|
||||||
|
if (!TextUtils.isEmpty(jsonString)) {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
Type type = new TypeToken<List<DockApp>>() {
|
||||||
|
}.getType();
|
||||||
|
try {
|
||||||
|
List<DockApp> dockApps = gson.fromJson(jsonString, type);
|
||||||
|
mDockAppSelectedAdapter.setSelectedPkgList(dockApps);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "setDockApp: " + e.getMessage());
|
||||||
|
mMMKV.encode(DockActivity.DOCK_APP_KEY, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mViewModel.getPackageList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLayoutId() {
|
||||||
|
return R.layout.activity_dock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class BtnClick {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.xxpatx.os.activity.dock;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.pm.ResolveInfo;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.xxpatx.os.base.mvvm.BaseViewModel;
|
||||||
|
import com.xxpatx.os.bean.DockApp;
|
||||||
|
import com.xxpatx.os.databinding.ActivityDockBinding;
|
||||||
|
import com.xxpatx.os.utils.ApkUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DockViewModel extends BaseViewModel<ActivityDockBinding, ActivityDockBinding> {
|
||||||
|
private static final String TAG = "DockViewModel";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ActivityDockBinding getVDBinding() {
|
||||||
|
return binding;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private MutableLiveData<List<DockApp>> mAppSelectBeanListData = new MutableLiveData<>();
|
||||||
|
|
||||||
|
public MutableLiveData<List<DockApp>> getAppSelectBeanListData() {
|
||||||
|
return mAppSelectBeanListData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getPackageList() {
|
||||||
|
PackageManager pm = getCtx().getPackageManager();
|
||||||
|
List<DockApp> dockAppList = new ArrayList<>();
|
||||||
|
dockAppList.add(new DockApp("电话", "xxpatx.os.dialer", ""));
|
||||||
|
// 创建一个类别为CATEGORY_LAUNCHER的该包名的Intent
|
||||||
|
Intent resolveIntent = new Intent(Intent.ACTION_MAIN, null);
|
||||||
|
resolveIntent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||||
|
|
||||||
|
// 通过getPackageManager()的queryIntentActivities方法遍历,得到所有能打开的app的packageName
|
||||||
|
List<ResolveInfo> resolveinfoList = pm.queryIntentActivities(resolveIntent, 0);
|
||||||
|
|
||||||
|
for (ResolveInfo resolveInfo : resolveinfoList) {
|
||||||
|
String pkgName = resolveInfo.activityInfo.packageName;
|
||||||
|
if (ApkUtils.excludePackageName.contains(pkgName)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (ApkUtils.isSystemApp(getCtx(), pkgName)) {
|
||||||
|
if (DockActivity.INCLUDE_SYSTEM_APP.contains(pkgName)) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.e(TAG, "getPackageList: " + pkgName);
|
||||||
|
DockApp dockApp = new DockApp(resolveInfo.activityInfo.loadLabel(pm).toString(),
|
||||||
|
pkgName, resolveInfo.activityInfo.name);
|
||||||
|
dockAppList.add(dockApp);
|
||||||
|
}
|
||||||
|
mAppSelectBeanListData.setValue(dockAppList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -27,8 +27,12 @@ import androidx.fragment.app.Fragment;
|
|||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
import androidx.lifecycle.Observer;
|
import androidx.lifecycle.Observer;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import com.blankj.utilcode.util.NetworkUtils;
|
import com.blankj.utilcode.util.NetworkUtils;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.hjq.permissions.OnPermissionCallback;
|
import com.hjq.permissions.OnPermissionCallback;
|
||||||
import com.hjq.permissions.Permission;
|
import com.hjq.permissions.Permission;
|
||||||
import com.hjq.permissions.XXPermissions;
|
import com.hjq.permissions.XXPermissions;
|
||||||
@@ -38,12 +42,16 @@ import com.tencent.mmkv.MMKV;
|
|||||||
import com.xxpatx.os.BuildConfig;
|
import com.xxpatx.os.BuildConfig;
|
||||||
import com.xxpatx.os.R;
|
import com.xxpatx.os.R;
|
||||||
import com.xxpatx.os.activity.activation.ActivationActivity;
|
import com.xxpatx.os.activity.activation.ActivationActivity;
|
||||||
|
import com.xxpatx.os.activity.dock.DockActivity;
|
||||||
import com.xxpatx.os.activity.phone.PhoneActivity;
|
import com.xxpatx.os.activity.phone.PhoneActivity;
|
||||||
import com.xxpatx.os.activity.update.UpdateActivity;
|
import com.xxpatx.os.activity.update.UpdateActivity;
|
||||||
|
import com.xxpatx.os.adapter.DockAppAdapter;
|
||||||
|
import com.xxpatx.os.adapter.DockAppGridAdapter;
|
||||||
import com.xxpatx.os.base.BaseFragmentPagerAdapter;
|
import com.xxpatx.os.base.BaseFragmentPagerAdapter;
|
||||||
import com.xxpatx.os.base.mvvm.BaseMvvmActivity;
|
import com.xxpatx.os.base.mvvm.BaseMvvmActivity;
|
||||||
import com.xxpatx.os.bean.AppInfo;
|
import com.xxpatx.os.bean.AppInfo;
|
||||||
import com.xxpatx.os.bean.DesktopIcon;
|
import com.xxpatx.os.bean.DesktopIcon;
|
||||||
|
import com.xxpatx.os.bean.DockApp;
|
||||||
import com.xxpatx.os.bean.MapBean;
|
import com.xxpatx.os.bean.MapBean;
|
||||||
import com.xxpatx.os.config.CommonConfig;
|
import com.xxpatx.os.config.CommonConfig;
|
||||||
import com.xxpatx.os.databinding.ActivityMainBinding;
|
import com.xxpatx.os.databinding.ActivityMainBinding;
|
||||||
@@ -63,6 +71,7 @@ import com.xxpatx.os.view.ScaleCircleNavigator;
|
|||||||
|
|
||||||
import net.lucode.hackware.magicindicator.ViewPagerHelper;
|
import net.lucode.hackware.magicindicator.ViewPagerHelper;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -92,6 +101,9 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
|||||||
private CameraManager cameraManager;
|
private CameraManager cameraManager;
|
||||||
private boolean flashing = false;
|
private boolean flashing = false;
|
||||||
|
|
||||||
|
private DockAppAdapter mDockAppAdapter;
|
||||||
|
private DockAppGridAdapter mDockAppGridAdapter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisconnected() {
|
public void onDisconnected() {
|
||||||
Log.e(TAG, "onDisconnected: ");
|
Log.e(TAG, "onDisconnected: ");
|
||||||
@@ -203,6 +215,7 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
|||||||
if (mFragments.size() > 1) {
|
if (mFragments.size() > 1) {
|
||||||
mViewDataBinding.viewPager.setCurrentItem(defaultCurrent);
|
mViewDataBinding.viewPager.setCurrentItem(defaultCurrent);
|
||||||
}
|
}
|
||||||
|
|
||||||
NotificationService.setListener(this);
|
NotificationService.setListener(this);
|
||||||
updateIconBg();
|
updateIconBg();
|
||||||
|
|
||||||
@@ -462,7 +475,48 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
|||||||
startActivity(new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"));
|
startActivity(new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setDockApp();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setDockApp() {
|
||||||
|
mDockAppGridAdapter = new DockAppGridAdapter(MainActivity.this);
|
||||||
|
mViewDataBinding.gridView.setAdapter(mDockAppGridAdapter);
|
||||||
|
|
||||||
|
mDockAppAdapter = new DockAppAdapter();
|
||||||
|
GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 5);
|
||||||
|
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
|
||||||
|
linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
||||||
|
mViewDataBinding.recyclerView.setLayoutManager(gridLayoutManager);
|
||||||
|
mViewDataBinding.recyclerView.setAdapter(mDockAppAdapter);
|
||||||
|
String jsonString = mMMKV.decodeString(DockActivity.DOCK_APP_KEY);
|
||||||
|
Log.e(TAG, "initView: dock = " + jsonString);
|
||||||
|
if (!TextUtils.isEmpty(jsonString)) {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
Type type = new TypeToken<List<DockApp>>() {
|
||||||
|
}.getType();
|
||||||
|
try {
|
||||||
|
List<DockApp> dockApps = gson.fromJson(jsonString, type);
|
||||||
|
if (dockApps != null && !dockApps.isEmpty()) {
|
||||||
|
mDockAppAdapter.setDockApps(dockApps);
|
||||||
|
mViewDataBinding.gridView.setNumColumns(dockApps.size());
|
||||||
|
mDockAppGridAdapter.setDockApps(dockApps);
|
||||||
|
} else {
|
||||||
|
mDockAppAdapter.setDockApps(DockActivity.DEFAULT_DOCK_APP);
|
||||||
|
mViewDataBinding.gridView.setNumColumns(DockActivity.DEFAULT_DOCK_APP.size());
|
||||||
|
mDockAppGridAdapter.setDockApps(DockActivity.DEFAULT_DOCK_APP);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "initView: " + e.getMessage());
|
||||||
|
mMMKV.encode(DockActivity.DOCK_APP_KEY, "");
|
||||||
|
mDockAppAdapter.setDockApps(DockActivity.DEFAULT_DOCK_APP);
|
||||||
|
mViewDataBinding.gridView.setNumColumns(DockActivity.DEFAULT_DOCK_APP.size());
|
||||||
|
mDockAppGridAdapter.setDockApps(DockActivity.DEFAULT_DOCK_APP);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mDockAppAdapter.setDockApps(DockActivity.DEFAULT_DOCK_APP);
|
||||||
|
mViewDataBinding.gridView.setNumColumns(DockActivity.DEFAULT_DOCK_APP.size());
|
||||||
|
mDockAppGridAdapter.setDockApps(DockActivity.DEFAULT_DOCK_APP);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String Launcher3 = "com.android.launcher3";
|
public static final String Launcher3 = "com.android.launcher3";
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import android.view.View;
|
|||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
|
||||||
import com.xxpatx.os.R;
|
import com.xxpatx.os.R;
|
||||||
|
import com.xxpatx.os.alarm.AlarmUtils;
|
||||||
import com.xxpatx.os.base.BaseDataBindingActivity;
|
import com.xxpatx.os.base.BaseDataBindingActivity;
|
||||||
import com.xxpatx.os.databinding.ActivityNoticeBinding;
|
import com.xxpatx.os.databinding.ActivityNoticeBinding;
|
||||||
import com.xxpatx.os.utils.WakeUpUtils;
|
import com.xxpatx.os.utils.WakeUpUtils;
|
||||||
@@ -39,10 +40,11 @@ public class NoticeActivity extends BaseDataBindingActivity {
|
|||||||
mBinding.positive.setOnClickListener(new View.OnClickListener() {
|
mBinding.positive.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
AlarmUtils.getInstance().updateAlarmFinished(mId);
|
||||||
|
mVibrator.cancel();
|
||||||
Intent noticeIntent = new Intent(NoticeActivity.this, NoticeInfoActivity.class);
|
Intent noticeIntent = new Intent(NoticeActivity.this, NoticeInfoActivity.class);
|
||||||
noticeIntent.putExtra("id", mId);
|
noticeIntent.putExtra("id", mId);
|
||||||
startActivity(noticeIntent);
|
startActivity(noticeIntent);
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import com.hjq.toast.Toaster;
|
|||||||
import com.tencent.mmkv.MMKV;
|
import com.tencent.mmkv.MMKV;
|
||||||
import com.xxpatx.os.BuildConfig;
|
import com.xxpatx.os.BuildConfig;
|
||||||
import com.xxpatx.os.R;
|
import com.xxpatx.os.R;
|
||||||
|
import com.xxpatx.os.activity.dock.DockActivity;
|
||||||
import com.xxpatx.os.activity.tts.TtsActivity;
|
import com.xxpatx.os.activity.tts.TtsActivity;
|
||||||
import com.xxpatx.os.activity.update.UpdateActivity;
|
import com.xxpatx.os.activity.update.UpdateActivity;
|
||||||
import com.xxpatx.os.base.mvvm.BaseMvvmActivity;
|
import com.xxpatx.os.base.mvvm.BaseMvvmActivity;
|
||||||
@@ -114,6 +115,11 @@ public class SettingActivity extends BaseMvvmActivity<SettingViewModel, Activity
|
|||||||
boolean dialTone = mMMKV.decodeBool(CommonConfig.DISABLE_DIAL_TONE_MODIFY, true);
|
boolean dialTone = mMMKV.decodeBool(CommonConfig.DISABLE_DIAL_TONE_MODIFY, true);
|
||||||
Log.e(TAG, "initView: dialTone = " + dialTone);
|
Log.e(TAG, "initView: dialTone = " + dialTone);
|
||||||
mViewDataBinding.setDialTone(dialTone);
|
mViewDataBinding.setDialTone(dialTone);
|
||||||
|
|
||||||
|
int code = Settings.System.getInt(getContentResolver(), CommonConfig.ACTION_STATUS_BAR_STATE, 1);
|
||||||
|
boolean statusBar = code == 1;
|
||||||
|
Log.e(TAG, "setStatusBar: statusBar = " + statusBar);
|
||||||
|
mViewDataBinding.setStatusBar(statusBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int REQUEST_CODE_DRAW_OVER_OTHER_APPS_PERMISSION = 200;
|
private static final int REQUEST_CODE_DRAW_OVER_OTHER_APPS_PERMISSION = 200;
|
||||||
@@ -278,6 +284,24 @@ public class SettingActivity extends BaseMvvmActivity<SettingViewModel, Activity
|
|||||||
mMMKV.encode(CommonConfig.DISABLE_DIAL_TONE_MODIFY, !dialTone);
|
mMMKV.encode(CommonConfig.DISABLE_DIAL_TONE_MODIFY, !dialTone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setStatusBar(View view) {
|
||||||
|
int code = Settings.System.getInt(getContentResolver(), CommonConfig.ACTION_STATUS_BAR_STATE, 1);
|
||||||
|
boolean statusBar = code == 1;
|
||||||
|
String statusbarStatus;
|
||||||
|
if (statusBar) {
|
||||||
|
statusbarStatus = CommonConfig.ACTION_HIDE_STATUS_BAR;
|
||||||
|
} else {
|
||||||
|
statusbarStatus = CommonConfig.ACTION_SHOW_STATUS_BAR;
|
||||||
|
}
|
||||||
|
Intent statusIntent = new Intent(statusbarStatus);
|
||||||
|
// statusIntent.setPackage("com.android.settings");
|
||||||
|
sendBroadcast(statusIntent);
|
||||||
|
|
||||||
|
Log.e(TAG, "setStatusBar: statusBar = " + statusBar);
|
||||||
|
mViewDataBinding.setStatusBar(!statusBar);
|
||||||
|
Settings.System.putInt(getContentResolver(), CommonConfig.ACTION_STATUS_BAR_STATE, code == 1 ? 0 : 1);
|
||||||
|
}
|
||||||
|
|
||||||
public void toInternet(View view) {
|
public void toInternet(View view) {
|
||||||
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
|
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
|
||||||
}
|
}
|
||||||
@@ -298,6 +322,8 @@ public class SettingActivity extends BaseMvvmActivity<SettingViewModel, Activity
|
|||||||
mViewModel.checkUpdate();
|
mViewModel.checkUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void toDockSetting(View view) {
|
||||||
|
startActivity(new Intent(SettingActivity.this, DockActivity.class));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.xxpatx.os.adapter;
|
package com.xxpatx.os.adapter;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.provider.Settings;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -10,24 +9,34 @@ import android.widget.ImageView;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.hjq.toast.Toaster;
|
||||||
import com.tencent.mmkv.MMKV;
|
import com.tencent.mmkv.MMKV;
|
||||||
import com.xxpatx.os.R;
|
import com.xxpatx.os.R;
|
||||||
import com.xxpatx.os.activity.quickapp.QuickAppActivity;
|
import com.xxpatx.os.activity.quickapp.QuickAppActivity;
|
||||||
import com.xxpatx.os.bean.AppSelectBean;
|
import com.xxpatx.os.bean.AppSelectBean;
|
||||||
import com.xxpatx.os.config.CommonConfig;
|
import com.xxpatx.os.config.CommonConfig;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class AppSelectedAdapter extends RecyclerView.Adapter<AppSelectedAdapter.Holder> {
|
public class AppSelectedAdapter extends RecyclerView.Adapter<AppSelectedAdapter.Holder> {
|
||||||
private static final String TAG = "AppSelectedAdapter";
|
private static final String TAG = "AppSelectedAdapter";
|
||||||
|
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||||
|
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private List<AppSelectBean> mAppSelectBeans;
|
private List<AppSelectBean> mAppSelectBeans;
|
||||||
private int unselectedStatus = -1;
|
// private int unselectedStatus = -1;
|
||||||
private int selecedPosition = unselectedStatus;
|
// private int selecedPosition = unselectedStatus;
|
||||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
private List<String> mPkgList = new ArrayList<>();
|
||||||
|
|
||||||
|
public void setPkgList(List<String> pkgList) {
|
||||||
|
this.mPkgList = pkgList;
|
||||||
|
Log.e(TAG, "setPkgList: " + mPkgList);
|
||||||
|
}
|
||||||
|
|
||||||
public void setAppSelectBeans(List<AppSelectBean> appSelectBeanList) {
|
public void setAppSelectBeans(List<AppSelectBean> appSelectBeanList) {
|
||||||
this.mAppSelectBeans = appSelectBeanList;
|
this.mAppSelectBeans = appSelectBeanList;
|
||||||
@@ -46,23 +55,59 @@ public class AppSelectedAdapter extends RecyclerView.Adapter<AppSelectedAdapter.
|
|||||||
AppSelectBean appSelectBean = mAppSelectBeans.get(position);
|
AppSelectBean appSelectBean = mAppSelectBeans.get(position);
|
||||||
holder.iv_icon.setImageDrawable(appSelectBean.getIcon());
|
holder.iv_icon.setImageDrawable(appSelectBean.getIcon());
|
||||||
holder.tv_name.setText(appSelectBean.getAppName());
|
holder.tv_name.setText(appSelectBean.getAppName());
|
||||||
if (selecedPosition == position) {
|
if (mPkgList.contains(appSelectBean.getPackageName())) {
|
||||||
holder.iv_select.setImageDrawable(mContext.getDrawable(R.drawable.icon_selected));
|
holder.iv_select.setImageDrawable(mContext.getDrawable(R.drawable.icon_selected));
|
||||||
|
holder.root.setBackground(mContext.getDrawable(R.drawable.app_select_background));
|
||||||
} else {
|
} else {
|
||||||
holder.iv_select.setImageDrawable(mContext.getDrawable(R.drawable.icon_unselected));
|
holder.iv_select.setImageDrawable(mContext.getDrawable(R.drawable.icon_unselected));
|
||||||
|
holder.root.setBackground(mContext.getDrawable(R.drawable.app_unselect_background));
|
||||||
}
|
}
|
||||||
holder.iv_select.setOnClickListener(new View.OnClickListener() {
|
holder.iv_select.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (position != selecedPosition) {
|
Log.e(TAG, "setQuickApp: " + appSelectBean.getPackageName());
|
||||||
holder.iv_select.setImageDrawable(mContext.getDrawable(R.drawable.icon_selected));
|
if (!mPkgList.contains(appSelectBean.getPackageName())) {
|
||||||
selecedPosition = position;
|
if (mPkgList.size() >= 4) {
|
||||||
Settings.Global.putString(mContext.getContentResolver(), QuickAppActivity.QUICK_APP_KEY, appSelectBean.getPackageName());
|
Toaster.show("最多选择4个");
|
||||||
} else {
|
} else {
|
||||||
|
mPkgList.add(appSelectBean.getPackageName());
|
||||||
|
holder.iv_select.setImageDrawable(mContext.getDrawable(R.drawable.icon_selected));
|
||||||
|
holder.root.setBackground(mContext.getDrawable(R.drawable.app_select_background));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mPkgList.remove(appSelectBean.getPackageName());
|
||||||
holder.iv_select.setImageDrawable(mContext.getDrawable(R.drawable.icon_unselected));
|
holder.iv_select.setImageDrawable(mContext.getDrawable(R.drawable.icon_unselected));
|
||||||
selecedPosition = -1;
|
holder.root.setBackground(mContext.getDrawable(R.drawable.app_unselect_background));
|
||||||
Settings.Global.putString(mContext.getContentResolver(),QuickAppActivity.QUICK_APP_KEY, "");
|
}
|
||||||
Log.e(TAG, "setQuickApp: empty");
|
if (mPkgList.size() == 0) {
|
||||||
|
mMMKV.encode(QuickAppActivity.QUICK_APP_KEY, "");
|
||||||
|
} else {
|
||||||
|
mMMKV.encode(QuickAppActivity.QUICK_APP_KEY, String.join(",", mPkgList));
|
||||||
|
}
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Log.e(TAG, "setQuickApp: " + appSelectBean.getPackageName());
|
||||||
|
if (!mPkgList.contains(appSelectBean.getPackageName())) {
|
||||||
|
if (mPkgList.size() >= 4) {
|
||||||
|
Toaster.show("最多选择4个");
|
||||||
|
} else {
|
||||||
|
mPkgList.add(appSelectBean.getPackageName());
|
||||||
|
holder.iv_select.setImageDrawable(mContext.getDrawable(R.drawable.icon_selected));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mPkgList.remove(appSelectBean.getPackageName());
|
||||||
|
holder.iv_select.setImageDrawable(mContext.getDrawable(R.drawable.icon_unselected));
|
||||||
|
}
|
||||||
|
if (mPkgList.size() == 0) {
|
||||||
|
mMMKV.encode(QuickAppActivity.QUICK_APP_KEY, "");
|
||||||
|
} else {
|
||||||
|
mMMKV.encode(QuickAppActivity.QUICK_APP_KEY, String.join(",", mPkgList));
|
||||||
}
|
}
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
@@ -77,9 +122,11 @@ public class AppSelectedAdapter extends RecyclerView.Adapter<AppSelectedAdapter.
|
|||||||
static class Holder extends RecyclerView.ViewHolder {
|
static class Holder extends RecyclerView.ViewHolder {
|
||||||
ImageView iv_select, iv_icon;
|
ImageView iv_select, iv_icon;
|
||||||
TextView tv_name;
|
TextView tv_name;
|
||||||
|
ConstraintLayout root;
|
||||||
|
|
||||||
Holder(@NonNull View itemView) {
|
Holder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
root = itemView.findViewById(R.id.root);
|
||||||
iv_select = itemView.findViewById(R.id.iv_select);
|
iv_select = itemView.findViewById(R.id.iv_select);
|
||||||
iv_icon = itemView.findViewById(R.id.iv_icon);
|
iv_icon = itemView.findViewById(R.id.iv_icon);
|
||||||
tv_name = itemView.findViewById(R.id.tv_name);
|
tv_name = itemView.findViewById(R.id.tv_name);
|
||||||
|
|||||||
82
app/src/main/java/com/xxpatx/os/adapter/DockAppAdapter.java
Normal file
82
app/src/main/java/com/xxpatx/os/adapter/DockAppAdapter.java
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
package com.xxpatx.os.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.xxpatx.os.R;
|
||||||
|
import com.xxpatx.os.bean.DockApp;
|
||||||
|
import com.xxpatx.os.service.NotificationService;
|
||||||
|
import com.xxpatx.os.utils.ApkUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DockAppAdapter extends RecyclerView.Adapter<DockAppAdapter.Holder> {
|
||||||
|
private static final String TAG = "DockAppAdapter";
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
private List<DockApp> mDockApps;
|
||||||
|
|
||||||
|
public void setDockApps(List<DockApp> dockAppList) {
|
||||||
|
this.mDockApps = dockAppList;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
mContext = parent.getContext();
|
||||||
|
return new Holder(LayoutInflater.from(mContext).inflate(R.layout.item_dock_app, parent, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||||
|
DockApp dockApp = mDockApps.get(position);
|
||||||
|
holder.iv_icon.setImageDrawable(ApkUtils.getAppDrawable(mContext, dockApp.getPackageName()));
|
||||||
|
holder.tv_name.setText(dockApp.getAppName());
|
||||||
|
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
ApkUtils.openPackage(mContext, dockApp.getPackageName(), dockApp.getClassName());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
int size = NotificationService.getNotificationLength(dockApp.getPackageName());
|
||||||
|
if (size == 0) {
|
||||||
|
holder.bg.setVisibility(View.GONE);
|
||||||
|
} else if (size < 99) {
|
||||||
|
holder.bg.setVisibility(View.VISIBLE);
|
||||||
|
holder.bg.setText(String.valueOf(size));
|
||||||
|
} else {
|
||||||
|
holder.bg.setVisibility(View.VISIBLE);
|
||||||
|
holder.bg.setText("99+");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return mDockApps == null ? 0 : mDockApps.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
static class Holder extends RecyclerView.ViewHolder {
|
||||||
|
ConstraintLayout root;
|
||||||
|
ImageView iv_icon;
|
||||||
|
TextView tv_name;
|
||||||
|
TextView bg;
|
||||||
|
|
||||||
|
Holder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
root = itemView.findViewById(R.id.root);
|
||||||
|
iv_icon = itemView.findViewById(R.id.iv_icon);
|
||||||
|
tv_name = itemView.findViewById(R.id.tv_name);
|
||||||
|
bg = itemView.findViewById(R.id.bg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
114
app/src/main/java/com/xxpatx/os/adapter/DockAppGridAdapter.java
Normal file
114
app/src/main/java/com/xxpatx/os/adapter/DockAppGridAdapter.java
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
package com.xxpatx.os.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
|
|
||||||
|
import com.xxpatx.os.R;
|
||||||
|
import com.xxpatx.os.activity.phone.PhoneActivity;
|
||||||
|
import com.xxpatx.os.bean.DockApp;
|
||||||
|
import com.xxpatx.os.service.NotificationService;
|
||||||
|
import com.xxpatx.os.utils.ApkUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DockAppGridAdapter extends BaseAdapter {
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
private List<DockApp> mDockApps;
|
||||||
|
|
||||||
|
public DockAppGridAdapter(Context context) {
|
||||||
|
mContext = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDockApps(List<DockApp> dockAppList) {
|
||||||
|
this.mDockApps = dockAppList;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return mDockApps == null ? 0 : mDockApps.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getItem(int position) {
|
||||||
|
return mDockApps.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
ViewHolder holder;
|
||||||
|
|
||||||
|
if (convertView == null) {
|
||||||
|
LayoutInflater inflater = LayoutInflater.from(mContext);
|
||||||
|
convertView = inflater.inflate(R.layout.item_dock_app, parent, false);
|
||||||
|
holder = new ViewHolder();
|
||||||
|
holder.root = convertView.findViewById(R.id.root);
|
||||||
|
holder.iv_icon = convertView.findViewById(R.id.iv_icon);
|
||||||
|
holder.tv_name = convertView.findViewById(R.id.tv_name);
|
||||||
|
holder.bg = convertView.findViewById(R.id.bg);
|
||||||
|
|
||||||
|
convertView.setTag(holder);
|
||||||
|
} else {
|
||||||
|
holder = (ViewHolder) convertView.getTag();
|
||||||
|
}
|
||||||
|
|
||||||
|
DockApp dockApp = mDockApps.get(position);
|
||||||
|
String pkg = dockApp.getPackageName();
|
||||||
|
switch (pkg) {
|
||||||
|
case "xxpatx.os.dialer":
|
||||||
|
holder.iv_icon.setImageDrawable(mContext.getDrawable(R.drawable.home_icon_dialer));
|
||||||
|
break;
|
||||||
|
case "com.mediatek.camera":
|
||||||
|
holder.iv_icon.setImageDrawable(mContext.getDrawable(R.drawable.com_android_camera));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
holder.iv_icon.setImageDrawable(ApkUtils.getAppDrawable(mContext, pkg));
|
||||||
|
}
|
||||||
|
holder.tv_name.setText(dockApp.getAppName());
|
||||||
|
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
switch (pkg) {
|
||||||
|
case "xxpatx.os.dialer":
|
||||||
|
mContext.startActivity(new Intent(mContext, PhoneActivity.class));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ApkUtils.openPackage(mContext, pkg, dockApp.getClassName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
int size = NotificationService.getNotificationLength(pkg);
|
||||||
|
if (size == 0) {
|
||||||
|
holder.bg.setVisibility(View.GONE);
|
||||||
|
} else if (size < 99) {
|
||||||
|
holder.bg.setVisibility(View.VISIBLE);
|
||||||
|
holder.bg.setText(String.valueOf(size));
|
||||||
|
} else {
|
||||||
|
holder.bg.setVisibility(View.VISIBLE);
|
||||||
|
holder.bg.setText("99+");
|
||||||
|
}
|
||||||
|
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
|
||||||
|
static class ViewHolder {
|
||||||
|
ConstraintLayout root;
|
||||||
|
ImageView iv_icon;
|
||||||
|
TextView tv_name;
|
||||||
|
TextView bg;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
package com.xxpatx.os.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
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.hjq.toast.Toaster;
|
||||||
|
import com.tencent.mmkv.MMKV;
|
||||||
|
import com.xxpatx.os.R;
|
||||||
|
import com.xxpatx.os.activity.dock.DockActivity;
|
||||||
|
import com.xxpatx.os.bean.DockApp;
|
||||||
|
import com.xxpatx.os.config.CommonConfig;
|
||||||
|
import com.xxpatx.os.gson.GsonUtils;
|
||||||
|
import com.xxpatx.os.utils.ApkUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DockAppSelectedAdapter extends RecyclerView.Adapter<DockAppSelectedAdapter.Holder> {
|
||||||
|
private static final String TAG = "AppSelectedAdapter";
|
||||||
|
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||||
|
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
private List<DockApp> mDockAppList;
|
||||||
|
private List<DockApp> mSelectedPkgList = new ArrayList<>();
|
||||||
|
|
||||||
|
public void setSelectedPkgList(List<DockApp> selectedPkgList) {
|
||||||
|
this.mSelectedPkgList = selectedPkgList;
|
||||||
|
Log.e(TAG, "setPkgList: " + mSelectedPkgList);
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDockAppList(List<DockApp> dockAppList) {
|
||||||
|
this.mDockAppList = dockAppList;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
mContext = parent.getContext();
|
||||||
|
return new Holder(LayoutInflater.from(mContext).inflate(R.layout.item_dock_app_select, parent, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||||
|
DockApp dockApp = mDockAppList.get(position);
|
||||||
|
String pkg = dockApp.getPackageName();
|
||||||
|
switch (pkg) {
|
||||||
|
case "xxpatx.os.dialer":
|
||||||
|
holder.iv_icon.setImageDrawable(mContext.getDrawable(R.drawable.home_icon_dialer));
|
||||||
|
break;
|
||||||
|
case "com.mediatek.camera":
|
||||||
|
holder.iv_icon.setImageDrawable(mContext.getDrawable(R.drawable.com_android_camera));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
holder.iv_icon.setImageDrawable(ApkUtils.getAppDrawable(mContext, dockApp.getPackageName()));
|
||||||
|
}
|
||||||
|
holder.tv_name.setText(dockApp.getAppName());
|
||||||
|
if (mSelectedPkgList.contains(dockApp)) {
|
||||||
|
holder.iv_select.setImageDrawable(mContext.getDrawable(R.drawable.icon_selected));
|
||||||
|
holder.root.setBackground(mContext.getDrawable(R.drawable.app_select_background));
|
||||||
|
} else {
|
||||||
|
holder.iv_select.setImageDrawable(mContext.getDrawable(R.drawable.icon_unselected));
|
||||||
|
holder.root.setBackground(mContext.getDrawable(R.drawable.app_unselect_background));
|
||||||
|
}
|
||||||
|
|
||||||
|
holder.iv_select.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
holder.selectApp(dockApp);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
holder.selectApp(dockApp);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return mDockAppList == null ? 0 : mDockAppList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
class Holder extends RecyclerView.ViewHolder {
|
||||||
|
ImageView iv_select, iv_icon;
|
||||||
|
TextView tv_name;
|
||||||
|
ConstraintLayout root;
|
||||||
|
|
||||||
|
Holder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
root = itemView.findViewById(R.id.root);
|
||||||
|
iv_select = itemView.findViewById(R.id.iv_select);
|
||||||
|
iv_icon = itemView.findViewById(R.id.iv_icon);
|
||||||
|
tv_name = itemView.findViewById(R.id.tv_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void selectApp(DockApp dockApp) {
|
||||||
|
Log.e(TAG, "selectApp: " + dockApp.getPackageName());
|
||||||
|
if (!mSelectedPkgList.contains(dockApp)) {
|
||||||
|
if (mSelectedPkgList.size() >= 5) {
|
||||||
|
Toaster.show("最多选择5个");
|
||||||
|
} else {
|
||||||
|
mSelectedPkgList.add(dockApp);
|
||||||
|
iv_select.setImageDrawable(mContext.getDrawable(R.drawable.icon_selected));
|
||||||
|
root.setBackground(mContext.getDrawable(R.drawable.app_select_background));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mSelectedPkgList.remove(dockApp);
|
||||||
|
iv_select.setImageDrawable(mContext.getDrawable(R.drawable.icon_unselected));
|
||||||
|
root.setBackground(mContext.getDrawable(R.drawable.app_unselect_background));
|
||||||
|
}
|
||||||
|
if (mSelectedPkgList.size() == 0) {
|
||||||
|
mMMKV.encode(DockActivity.DOCK_APP_KEY, "");
|
||||||
|
} else {
|
||||||
|
mMMKV.encode(DockActivity.DOCK_APP_KEY, GsonUtils.toJSONString(mSelectedPkgList));
|
||||||
|
}
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -242,7 +242,7 @@ public class AlarmAdapter extends RecyclerView.Adapter<AlarmAdapter.holder> {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
Intent intent = new Intent(mContext, AlarmEditActivity.class);
|
Intent intent = new Intent(mContext, AlarmEditActivity.class);
|
||||||
intent.putExtra("id", alarmClockData.getId());
|
intent.putExtra("AlarmClockData", alarmClockData);
|
||||||
mContext.startActivity(intent);
|
mContext.startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ public class AlarmClockData implements Serializable {
|
|||||||
String voice_md5;
|
String voice_md5;
|
||||||
String file;//图片或视频文件地址
|
String file;//图片或视频文件地址
|
||||||
String file_md5;
|
String file_md5;
|
||||||
int remind_type;
|
int remind_type; //提醒方式 1仅震动
|
||||||
int is_onoff;//0关闭 1开启
|
int is_onoff;//0关闭 1开启
|
||||||
@SerializedName("class")
|
@SerializedName("class")
|
||||||
int clazz;
|
int clazz;//分类 1吃药 2接送 3预约
|
||||||
|
|
||||||
boolean finished = false;
|
boolean finished = false;
|
||||||
boolean is_local = false;
|
boolean is_local = false;
|
||||||
|
|||||||
@@ -331,33 +331,7 @@ public class AlarmUtils {
|
|||||||
* @return 获取单个闹钟
|
* @return 获取单个闹钟
|
||||||
*/
|
*/
|
||||||
public AlarmClockData getDatabaseSingleAlarm(AlarmClockData data) {
|
public AlarmClockData getDatabaseSingleAlarm(AlarmClockData data) {
|
||||||
List<AlarmClockData> list = new ArrayList<>();
|
return getDatabaseSingleAlarm(data.getId());
|
||||||
String selectQuery = "SELECT * FROM " + AlarmOpenHelper.TABLE_ALARM + " where id =" + data.getId();
|
|
||||||
Cursor cursor = mDatabase.rawQuery(selectQuery, null);
|
|
||||||
if (cursor.moveToFirst()) {
|
|
||||||
do {
|
|
||||||
AlarmClockData alarmClockData = new AlarmClockData();
|
|
||||||
alarmClockData.setId(cursor.getInt(cursor.getColumnIndex(AlarmOpenHelper.KEY_ID)));
|
|
||||||
alarmClockData.setType(cursor.getInt(cursor.getColumnIndex(AlarmOpenHelper.KEY_TYPE)));
|
|
||||||
alarmClockData.setTime(cursor.getString(cursor.getColumnIndex(AlarmOpenHelper.KEY_TIME)));
|
|
||||||
alarmClockData.setTitle(cursor.getString(cursor.getColumnIndex(AlarmOpenHelper.KEY_TITLE)));
|
|
||||||
alarmClockData.setVoice(cursor.getString(cursor.getColumnIndex(AlarmOpenHelper.KEY_VOICE)));
|
|
||||||
alarmClockData.setVoice_md5(cursor.getString(cursor.getColumnIndex(AlarmOpenHelper.KEY_VOICE_MD5)));
|
|
||||||
alarmClockData.setFile(cursor.getString(cursor.getColumnIndex(AlarmOpenHelper.KEY_FILE)));
|
|
||||||
alarmClockData.setFile_md5(cursor.getString(cursor.getColumnIndex(AlarmOpenHelper.KEY_FILE_MD5)));
|
|
||||||
alarmClockData.setRemind_type(cursor.getInt(cursor.getColumnIndex(AlarmOpenHelper.KEY_REMIND_TYPE)));
|
|
||||||
alarmClockData.setIs_onoff(cursor.getInt(cursor.getColumnIndex(AlarmOpenHelper.KEY_IS_ONOFF)));
|
|
||||||
alarmClockData.setClazz(cursor.getInt(cursor.getColumnIndex(AlarmOpenHelper.KEY_CLAZZ)));
|
|
||||||
|
|
||||||
alarmClockData.setFinished(cursor.getInt(cursor.getColumnIndex(AlarmOpenHelper.KEY_FINISHED)) == 1);
|
|
||||||
alarmClockData.setIs_local(cursor.getInt(cursor.getColumnIndex(AlarmOpenHelper.KEY_IS_LOCAL)) == 1);
|
|
||||||
alarmClockData.setEdited(cursor.getInt(cursor.getColumnIndex(AlarmOpenHelper.KEY_EDITED)) == 1);
|
|
||||||
alarmClockData.setDeleted(cursor.getInt(cursor.getColumnIndex(AlarmOpenHelper.KEY_DELETED)) == 1);
|
|
||||||
list.add(alarmClockData);
|
|
||||||
} while (cursor.moveToNext());
|
|
||||||
}
|
|
||||||
cursor.close();
|
|
||||||
return list.size() == 0 ? null : list.get(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AlarmClockData getDatabaseSingleAlarm(int id) {
|
public AlarmClockData getDatabaseSingleAlarm(int id) {
|
||||||
|
|||||||
76
app/src/main/java/com/xxpatx/os/bean/DockApp.java
Normal file
76
app/src/main/java/com/xxpatx/os/bean/DockApp.java
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
package com.xxpatx.os.bean;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class DockApp implements Serializable {
|
||||||
|
private static final long serialVersionUID = 820554935375905745L;
|
||||||
|
|
||||||
|
String appName;
|
||||||
|
String packageName;
|
||||||
|
String className;
|
||||||
|
|
||||||
|
public DockApp(String appName, String packageName, String className) {
|
||||||
|
this.appName = appName;
|
||||||
|
this.packageName = packageName;
|
||||||
|
this.className = className;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DockApp(String packageName, String className) {
|
||||||
|
this.packageName = packageName;
|
||||||
|
this.className = className;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DockApp(String packageName) {
|
||||||
|
this.packageName = packageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAppName() {
|
||||||
|
return appName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppName(String appName) {
|
||||||
|
this.appName = appName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPackageName() {
|
||||||
|
return packageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPackageName(String packageName) {
|
||||||
|
this.packageName = packageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClassName() {
|
||||||
|
return className;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClassName(String className) {
|
||||||
|
this.className = className;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(@Nullable Object obj) {
|
||||||
|
if (obj instanceof DockApp) {
|
||||||
|
DockApp d = (DockApp) obj;
|
||||||
|
return
|
||||||
|
// Objects.equals(appName, d.appName);&&
|
||||||
|
Objects.equals(packageName, d.packageName);
|
||||||
|
// && Objects.equals(className, d.className);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -90,6 +90,12 @@ public class CommonConfig {
|
|||||||
/*禁用闹钟修改*/
|
/*禁用闹钟修改*/
|
||||||
public static final String DISABLE_CLOCK_MODIFY = "disable_clock_modify_key";
|
public static final String DISABLE_CLOCK_MODIFY = "disable_clock_modify_key";
|
||||||
|
|
||||||
|
public final static String ACTION_STATUS_BAR_STATE = "xiaoxintong_statusBar_state";
|
||||||
|
/*显示状态栏*/
|
||||||
|
public final static String ACTION_SHOW_STATUS_BAR = "xiaoxintong_show_statusBar";
|
||||||
|
/*隐藏状态栏*/
|
||||||
|
public final static String ACTION_HIDE_STATUS_BAR = "xiaoxintong_hide_statusBar";
|
||||||
|
|
||||||
|
|
||||||
public static final String AMAP_LOCATION_MAP_BEAN = "AMapLocation_MapBean_key";
|
public static final String AMAP_LOCATION_MAP_BEAN = "AMapLocation_MapBean_key";
|
||||||
public static final String AMAP_LOCATION_DISTRICT = "AMapLocationMapBean_key";
|
public static final String AMAP_LOCATION_DISTRICT = "AMapLocationMapBean_key";
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ public class ContactCacheHelper extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
public static final int DATABASE_VERSION = 1;
|
public static final int DATABASE_VERSION = 1;
|
||||||
public static final String DATABASE_NAME = "ContactDatabase.db";
|
public static final String DATABASE_NAME = "ContactDatabase.db";
|
||||||
// public static final String DATABASE_FILE_NAME = Environment.getExternalStorageDirectory().getPath() + File.separator + DATABASE_NAME;
|
|
||||||
public static final String DATABASE_FILE_NAME = DATABASE_NAME;
|
|
||||||
|
|
||||||
public static final String TABLE_ALARM = "ContactTable";
|
public static final String TABLE_ALARM = "ContactTable";
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import android.database.sqlite.SQLiteDatabase;
|
|||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.xxpatx.os.BuildConfig;
|
||||||
import com.xxpatx.os.bean.Contact;
|
import com.xxpatx.os.bean.Contact;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -25,12 +26,15 @@ public class ContactCacheUtils {
|
|||||||
public ContactCacheUtils(Context context) {
|
public ContactCacheUtils(Context context) {
|
||||||
this.mContext = context.getApplicationContext();
|
this.mContext = context.getApplicationContext();
|
||||||
// this.mContactHelper = new ContactCacheHelper(context, ContactCacheHelper.DATABASE_NAME, null, ContactCacheHelper.DATABASE_VERSION);
|
// this.mContactHelper = new ContactCacheHelper(context, ContactCacheHelper.DATABASE_NAME, null, ContactCacheHelper.DATABASE_VERSION);
|
||||||
// this.mContactHelper = new ContactCacheHelper(context,
|
if (BuildConfig.DEBUG) {
|
||||||
// context.getExternalCacheDir() + File.separator + ContactCacheHelper.DATABASE_NAME,
|
|
||||||
// null, ContactCacheHelper.DATABASE_VERSION);
|
|
||||||
this.mContactHelper = new ContactCacheHelper(context,
|
this.mContactHelper = new ContactCacheHelper(context,
|
||||||
Environment.getExternalStorageDirectory() + File.separator + ContactCacheHelper.DATABASE_NAME,
|
Environment.getExternalStorageDirectory() + File.separator + ContactCacheHelper.DATABASE_NAME,
|
||||||
null, ContactCacheHelper.DATABASE_VERSION);
|
null, ContactCacheHelper.DATABASE_VERSION);
|
||||||
|
} else {
|
||||||
|
this.mContactHelper = new ContactCacheHelper(context,
|
||||||
|
context.getExternalCacheDir() + File.separator + ContactCacheHelper.DATABASE_NAME,
|
||||||
|
null, ContactCacheHelper.DATABASE_VERSION);
|
||||||
|
}
|
||||||
this.mDatabase = mContactHelper.getWritableDatabase();
|
this.mDatabase = mContactHelper.getWritableDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -350,7 +350,6 @@ public class HomeFragment extends BaseMvvmFragment<HomeViewModel, FragmentHomeBi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void registerAlarmClockReceiver() {
|
private void registerAlarmClockReceiver() {
|
||||||
if (null == mAlarmClockReceiver) {
|
if (null == mAlarmClockReceiver) {
|
||||||
mAlarmClockReceiver = new AlarmClockReceiver();
|
mAlarmClockReceiver = new AlarmClockReceiver();
|
||||||
|
|||||||
@@ -78,12 +78,7 @@ public class HomeViewModel extends BaseViewModel<FragmentHomeBinding, FragmentEv
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAlarmClockEmpty() {
|
public void onError(String msg) {
|
||||||
mAlarmClockData.setValue(new ArrayList<>());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError() {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -61,20 +61,21 @@ import com.xxpatx.os.network.api.uiui.GoodsListApi;
|
|||||||
import com.xxpatx.os.network.api.uiui.GoodsTypeApi;
|
import com.xxpatx.os.network.api.uiui.GoodsTypeApi;
|
||||||
import com.xxpatx.os.network.api.uiui.GoodsTypeListApi;
|
import com.xxpatx.os.network.api.uiui.GoodsTypeListApi;
|
||||||
import com.xxpatx.os.network.api.uiui.HealthCodeApi;
|
import com.xxpatx.os.network.api.uiui.HealthCodeApi;
|
||||||
import com.xxpatx.os.network.api.uiui.SnIsActivationApi;
|
|
||||||
import com.xxpatx.os.network.api.uiui.contact.MailListAddApi;
|
|
||||||
import com.xxpatx.os.network.api.uiui.contact.MailListDeleteApi;
|
|
||||||
import com.xxpatx.os.network.api.uiui.RegionListApi;
|
import com.xxpatx.os.network.api.uiui.RegionListApi;
|
||||||
import com.xxpatx.os.network.api.uiui.RegionListCall;
|
import com.xxpatx.os.network.api.uiui.RegionListCall;
|
||||||
import com.xxpatx.os.network.api.uiui.ServeApi;
|
import com.xxpatx.os.network.api.uiui.ServeApi;
|
||||||
|
import com.xxpatx.os.network.api.uiui.SnIsActivationApi;
|
||||||
import com.xxpatx.os.network.api.uiui.UpdateAppIconApi;
|
import com.xxpatx.os.network.api.uiui.UpdateAppIconApi;
|
||||||
import com.xxpatx.os.network.api.uiui.UserInfoControl;
|
import com.xxpatx.os.network.api.uiui.UserInfoControl;
|
||||||
import com.xxpatx.os.network.api.uiui.alarmclock.AlarmClockAddApi;
|
import com.xxpatx.os.network.api.uiui.alarmclock.AlarmClockAddApi;
|
||||||
import com.xxpatx.os.network.api.uiui.alarmclock.AlarmClockApi;
|
import com.xxpatx.os.network.api.uiui.alarmclock.AlarmClockGetApi;
|
||||||
import com.xxpatx.os.network.api.uiui.alarmclock.AlarmClockDeleteApi;
|
import com.xxpatx.os.network.api.uiui.alarmclock.AlarmClockDeleteApi;
|
||||||
import com.xxpatx.os.network.api.uiui.alarmclock.AlarmClockEditApi;
|
import com.xxpatx.os.network.api.uiui.alarmclock.AlarmClockEditApi;
|
||||||
import com.xxpatx.os.network.api.uiui.alarmclock.AlarmClockQueryApi;
|
import com.xxpatx.os.network.api.uiui.alarmclock.AlarmClockQueryApi;
|
||||||
|
import com.xxpatx.os.network.api.uiui.alarmclock.AlarmClockUpdateApi;
|
||||||
import com.xxpatx.os.network.api.uiui.app.RunNewApp;
|
import com.xxpatx.os.network.api.uiui.app.RunNewApp;
|
||||||
|
import com.xxpatx.os.network.api.uiui.contact.MailListAddApi;
|
||||||
|
import com.xxpatx.os.network.api.uiui.contact.MailListDeleteApi;
|
||||||
import com.xxpatx.os.network.api.uiui.contact.MailListEditApi;
|
import com.xxpatx.os.network.api.uiui.contact.MailListEditApi;
|
||||||
import com.xxpatx.os.network.api.uiui.desktop.GetDesktopApi;
|
import com.xxpatx.os.network.api.uiui.desktop.GetDesktopApi;
|
||||||
import com.xxpatx.os.network.api.uiui.desktop.UpdateDesktopApi;
|
import com.xxpatx.os.network.api.uiui.desktop.UpdateDesktopApi;
|
||||||
@@ -90,7 +91,6 @@ import com.xxpatx.os.network.api.uiui.sn.SettingApi;
|
|||||||
import com.xxpatx.os.network.api.uiui.sn.SnInfoApi;
|
import com.xxpatx.os.network.api.uiui.sn.SnInfoApi;
|
||||||
import com.xxpatx.os.network.api.uiui.sn.SosRecordApi;
|
import com.xxpatx.os.network.api.uiui.sn.SosRecordApi;
|
||||||
import com.xxpatx.os.network.api.uiui.sn.UpdateAddressApi;
|
import com.xxpatx.os.network.api.uiui.sn.UpdateAddressApi;
|
||||||
import com.xxpatx.os.network.api.uiui.sn.UpdateAlarmClockApi;
|
|
||||||
import com.xxpatx.os.network.interceptor.RepeatRequestInterceptor;
|
import com.xxpatx.os.network.interceptor.RepeatRequestInterceptor;
|
||||||
import com.xxpatx.os.utils.Utils;
|
import com.xxpatx.os.utils.Utils;
|
||||||
|
|
||||||
@@ -362,7 +362,7 @@ public class NetInterfaceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Observable<BaseResponse> getUpdateAlarmObservable(int id) {
|
public Observable<BaseResponse> getUpdateAlarmObservable(int id) {
|
||||||
return mRetrofit.create(UpdateAlarmClockApi.class)
|
return mRetrofit.create(AlarmClockUpdateApi.class)
|
||||||
.updateAlarm(Utils.getSerial(), id)
|
.updateAlarm(Utils.getSerial(), id)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
@@ -466,7 +466,7 @@ public class NetInterfaceManager {
|
|||||||
|
|
||||||
public Observable<BaseResponse<List<AlarmClockData>>> getAlarmClockObservable() {
|
public Observable<BaseResponse<List<AlarmClockData>>> getAlarmClockObservable() {
|
||||||
return mRetrofit
|
return mRetrofit
|
||||||
.create(AlarmClockApi.class)
|
.create(AlarmClockGetApi.class)
|
||||||
.getAlarmClock(Utils.getSerial(), 0)
|
.getAlarmClock(Utils.getSerial(), 0)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
@@ -474,7 +474,7 @@ public class NetInterfaceManager {
|
|||||||
|
|
||||||
public Observable<BaseResponse<List<AlarmClockData>>> getAlarmClockObservable(int type) {
|
public Observable<BaseResponse<List<AlarmClockData>>> getAlarmClockObservable(int type) {
|
||||||
return mRetrofit
|
return mRetrofit
|
||||||
.create(AlarmClockApi.class)
|
.create(AlarmClockGetApi.class)
|
||||||
.getAlarmClock(Utils.getSerial(), type)
|
.getAlarmClock(Utils.getSerial(), type)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
@@ -1020,41 +1020,9 @@ public class NetInterfaceManager {
|
|||||||
public interface AlarmClockCallback {
|
public interface AlarmClockCallback {
|
||||||
void setAlarmClock(List<AlarmClockData> alarmClockList);
|
void setAlarmClock(List<AlarmClockData> alarmClockList);
|
||||||
|
|
||||||
void setAlarmClockEmpty();
|
void onError(String msg);
|
||||||
|
|
||||||
void onError();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getAlarmClock(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, AlarmClockCallback callback) {
|
|
||||||
// ConnectMode connectMode = ConnectMode.DEFAULT;
|
|
||||||
// if (refresh) {
|
|
||||||
// connectMode = ConnectMode.DEFAULT;
|
|
||||||
// }
|
|
||||||
// if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_ALARM_CLOCK, connectMode)) {
|
|
||||||
getAlarmClock(lifecycle, callback);
|
|
||||||
// } else {
|
|
||||||
// getAlarmClockCache(lifecycle, callback);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
// public void getAlarmClockCache(BehaviorSubject<ActivityEvent> lifecycle, AlarmClockCallback callback) {
|
|
||||||
// String jsonString = mCacheHelper.getAsString(UrlAddress.GET_ALARM_CLOCK);
|
|
||||||
// //为 "" 是已经请求成功的
|
|
||||||
// if (jsonString == null) {
|
|
||||||
// getAlarmClock(lifecycle, callback);
|
|
||||||
// } else {
|
|
||||||
// Gson gson = new Gson();
|
|
||||||
// Type type = new TypeToken<List<AlarmClockData>>() {
|
|
||||||
// }.getType();
|
|
||||||
// List<AlarmClockData> list = gson.fromJson(jsonString, type);
|
|
||||||
// if (list == null || list.size() == 0) {
|
|
||||||
// callback.setAlarmClockEmpty();
|
|
||||||
// } else {
|
|
||||||
// callback.setAlarmClock(list);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
public void getAlarmClockFragment(BehaviorSubject<FragmentEvent> lifecycle, AlarmClockCallback callback) {
|
public void getAlarmClockFragment(BehaviorSubject<FragmentEvent> lifecycle, AlarmClockCallback callback) {
|
||||||
getAlarmClockObservable()
|
getAlarmClockObservable()
|
||||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, FragmentEvent.DESTROY))
|
.compose(RxLifecycle.bindUntilEvent(lifecycle, FragmentEvent.DESTROY))
|
||||||
@@ -1092,31 +1060,30 @@ public class NetInterfaceManager {
|
|||||||
if (alarmClockData != null && alarmClockData.size() != 0) {
|
if (alarmClockData != null && alarmClockData.size() != 0) {
|
||||||
AlarmUtils.getInstance().setAlarmClockData(alarmClockData);
|
AlarmUtils.getInstance().setAlarmClockData(alarmClockData);
|
||||||
mMMKV.encode(UrlAddress.GET_ALARM_CLOCK, GsonUtils.toJSONString(alarmClockData));
|
mMMKV.encode(UrlAddress.GET_ALARM_CLOCK, GsonUtils.toJSONString(alarmClockData));
|
||||||
// if (callback != null) {
|
|
||||||
// callback.setAlarmClock(alarmClockData);
|
|
||||||
// }
|
|
||||||
} else {
|
} else {
|
||||||
AlarmUtils.getInstance().deleteAllAlarmClock();
|
AlarmUtils.getInstance().deleteAllAlarmClock();
|
||||||
AlarmUtils.getInstance().setAlarmClockData(null);
|
AlarmUtils.getInstance().setAlarmClockData(null);
|
||||||
mMMKV.encode(UrlAddress.GET_ALARM_CLOCK, "");
|
mMMKV.encode(UrlAddress.GET_ALARM_CLOCK, "");
|
||||||
// if (callback != null) {
|
if (callback != null) {
|
||||||
// callback.setAlarmClockEmpty();
|
callback.onError(listBaseResponse.msg);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AlarmUtils.getInstance().deleteAllAlarmClock();
|
AlarmUtils.getInstance().deleteAllAlarmClock();
|
||||||
AlarmUtils.getInstance().setAlarmClockData(null);
|
AlarmUtils.getInstance().setAlarmClockData(null);
|
||||||
mMMKV.encode(UrlAddress.GET_ALARM_CLOCK, "");
|
mMMKV.encode(UrlAddress.GET_ALARM_CLOCK, "");
|
||||||
// if (callback != null) {
|
if (callback != null) {
|
||||||
// callback.setAlarmClockEmpty();
|
callback.onError(listBaseResponse.msg);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(@NonNull Throwable e) {
|
public void onError(@NonNull Throwable e) {
|
||||||
Log.e("getAlarmClockObserver", "onError: " + e.getMessage());
|
Log.e("getAlarmClockObserver", "onError: " + e.getMessage());
|
||||||
if (callback != null) callback.onError();
|
if (callback != null) {
|
||||||
|
callback.onError("请检查网络连接");
|
||||||
|
}
|
||||||
onComplete();
|
onComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1124,8 +1091,10 @@ public class NetInterfaceManager {
|
|||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
Log.e("getAlarmClockObserver", "onComplete: ");
|
Log.e("getAlarmClockObserver", "onComplete: ");
|
||||||
List<AlarmClockData> list = AlarmUtils.getInstance().getOldData();
|
List<AlarmClockData> list = AlarmUtils.getInstance().getOldData();
|
||||||
|
Log.e("getAlarmClockObserver", "onComplete: list = " + list);
|
||||||
|
|
||||||
if (list == null || list.size() == 0) {
|
if (list == null || list.size() == 0) {
|
||||||
if (callback != null) callback.setAlarmClockEmpty();
|
if (callback != null) callback.setAlarmClock(null);
|
||||||
} else {
|
} else {
|
||||||
List<AlarmClockData> filter = list.stream().filter(alarmClockData -> !alarmClockData.isDeleted()).collect(Collectors.toList());
|
List<AlarmClockData> filter = list.stream().filter(alarmClockData -> !alarmClockData.isDeleted()).collect(Collectors.toList());
|
||||||
if (callback != null) callback.setAlarmClock(filter);
|
if (callback != null) callback.setAlarmClock(filter);
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ public class UrlAddress {
|
|||||||
*/
|
*/
|
||||||
/*获取设备是否激活*/
|
/*获取设备是否激活*/
|
||||||
public static final String GET_SN_IS_ACTIVATION = "sn/getSnIsActivation";
|
public static final String GET_SN_IS_ACTIVATION = "sn/getSnIsActivation";
|
||||||
/*爱心提醒通知成功接口*/
|
|
||||||
public static final String UPDATE_ALARM_CLOCK = "updateAlarmClock";
|
|
||||||
/*上传截屏图片*/
|
/*上传截屏图片*/
|
||||||
public static final String SEND_SCREENSHOT = "sn/uploadScreenshot";
|
public static final String SEND_SCREENSHOT = "sn/uploadScreenshot";
|
||||||
/*获取系统设置其它管控*/
|
/*获取系统设置其它管控*/
|
||||||
@@ -106,16 +104,18 @@ public class UrlAddress {
|
|||||||
/**
|
/**
|
||||||
* 闹钟
|
* 闹钟
|
||||||
*/
|
*/
|
||||||
|
/*获取闹钟*/
|
||||||
|
public static final String GET_ALARM_CLOCK = "getAlarmClock";
|
||||||
|
/*爱心提醒通知成功*/
|
||||||
|
public static final String ALARM_CLOCK_UPDATE = "updateAlarmClock";
|
||||||
|
/*编号查询闹钟*/
|
||||||
|
public static final String ALARM_CLOCK_BY_ID = "AlarmClock/alarmClockById";
|
||||||
/*添加闹钟*/
|
/*添加闹钟*/
|
||||||
public static final String ALARM_CLOCK_ADD = "AlarmClock/alarmClockAdd";
|
public static final String ALARM_CLOCK_ADD = "AlarmClock/alarmClockAdd";
|
||||||
/*编辑闹钟*/
|
/*编辑闹钟*/
|
||||||
public static final String ALARM_CLOCK_EDIT = "AlarmClock/alarmClockEdit";
|
public static final String ALARM_CLOCK_EDIT = "AlarmClock/alarmClockEdit";
|
||||||
/*编号查询闹钟*/
|
|
||||||
public static final String ALARM_CLOCK_BY_ID = "AlarmClock/alarmClockById";
|
|
||||||
/*删除闹钟*/
|
/*删除闹钟*/
|
||||||
public static final String ALARM_CLOCK_DELETE = "AlarmClock/alarmClockDelete";
|
public static final String ALARM_CLOCK_DELETE = "AlarmClock/alarmClockDelete";
|
||||||
/*获取闹钟*/
|
|
||||||
public static final String GET_ALARM_CLOCK = "getAlarmClock";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品购买
|
* 商品购买
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import io.reactivex.rxjava3.core.Observable;
|
|||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
import retrofit2.http.Query;
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
public interface AlarmClockApi {
|
public interface AlarmClockGetApi {
|
||||||
@GET(UrlAddress.GET_ALARM_CLOCK)
|
@GET(UrlAddress.GET_ALARM_CLOCK)
|
||||||
Observable<BaseResponse<List<AlarmClockData>>> getAlarmClock(
|
Observable<BaseResponse<List<AlarmClockData>>> getAlarmClock(
|
||||||
@Query("sn") String sn,
|
@Query("sn") String sn,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.xxpatx.os.network.api.uiui.sn;
|
package com.xxpatx.os.network.api.uiui.alarmclock;
|
||||||
|
|
||||||
import com.xxpatx.os.bean.BaseResponse;
|
import com.xxpatx.os.bean.BaseResponse;
|
||||||
import com.xxpatx.os.network.UrlAddress;
|
import com.xxpatx.os.network.UrlAddress;
|
||||||
@@ -8,9 +8,9 @@ import retrofit2.http.Field;
|
|||||||
import retrofit2.http.FormUrlEncoded;
|
import retrofit2.http.FormUrlEncoded;
|
||||||
import retrofit2.http.POST;
|
import retrofit2.http.POST;
|
||||||
|
|
||||||
public interface UpdateAlarmClockApi {
|
public interface AlarmClockUpdateApi {
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@POST(UrlAddress.UPDATE_ALARM_CLOCK)
|
@POST(UrlAddress.ALARM_CLOCK_UPDATE)
|
||||||
Observable<BaseResponse> updateAlarm(
|
Observable<BaseResponse> updateAlarm(
|
||||||
@Field("sn") String sn,
|
@Field("sn") String sn,
|
||||||
@Field("id") int id
|
@Field("id") int id
|
||||||
@@ -8,16 +8,18 @@ import java.util.List;
|
|||||||
|
|
||||||
public class MainSContact {
|
public class MainSContact {
|
||||||
public interface Presenter extends BasePresenter<MainSView> {
|
public interface Presenter extends BasePresenter<MainSView> {
|
||||||
void addAlarmClock();
|
|
||||||
void deleteAlarmClock();
|
|
||||||
//设置所有信息
|
|
||||||
void getAlarmClock();
|
void getAlarmClock();
|
||||||
|
void addAlarmClock();
|
||||||
|
void editAlarmClock();
|
||||||
|
void updateAlarmClock();
|
||||||
|
void deleteAlarmClock();
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface MainSView extends BaseView {
|
public interface MainSView extends BaseView {
|
||||||
void addAlarmClockFinish();
|
|
||||||
void deleteAlarmClockFinish();
|
|
||||||
//获取所有信息
|
|
||||||
void setAlarmClock(List<AlarmClockData> dataList);
|
void setAlarmClock(List<AlarmClockData> dataList);
|
||||||
|
void addAlarmClockFinish();
|
||||||
|
void editAlarmClockFinish();
|
||||||
|
void updateAlarmClockFinish();
|
||||||
|
void deleteAlarmClockFinish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.hjq.toast.Toaster;
|
||||||
import com.tencent.mmkv.MMKV;
|
import com.tencent.mmkv.MMKV;
|
||||||
import com.trello.rxlifecycle4.RxLifecycle;
|
import com.trello.rxlifecycle4.RxLifecycle;
|
||||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||||
@@ -39,10 +40,10 @@ import okhttp3.RequestBody;
|
|||||||
public class MainSPresenter implements MainSContact.Presenter {
|
public class MainSPresenter implements MainSContact.Presenter {
|
||||||
private static final String TAG = "MainSPresenter";
|
private static final String TAG = "MainSPresenter";
|
||||||
|
|
||||||
private static final int OK = 200;
|
MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||||
|
|
||||||
private MainSContact.MainSView mView;
|
private MainSContact.MainSView mView;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
|
||||||
|
|
||||||
private BehaviorSubject<ActivityEvent> lifecycle;
|
private BehaviorSubject<ActivityEvent> lifecycle;
|
||||||
|
|
||||||
@@ -69,6 +70,23 @@ public class MainSPresenter implements MainSContact.Presenter {
|
|||||||
this.mView = null;
|
this.mView = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getAlarmClock() {
|
||||||
|
NetInterfaceManager.getInstance().getAlarmClock(getLifecycle(), new NetInterfaceManager.AlarmClockCallback() {
|
||||||
|
@Override
|
||||||
|
public void setAlarmClock(List<AlarmClockData> alarmClockList) {
|
||||||
|
Log.e(TAG, "setAlarmClock: " + alarmClockList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String msg) {
|
||||||
|
Toaster.show(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private int addFinishStatu;
|
private int addFinishStatu;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -195,6 +213,16 @@ public class MainSPresenter implements MainSContact.Presenter {
|
|||||||
return NetInterfaceManager.getInstance().getAlarmClockAddObservable(params, body);
|
return NetInterfaceManager.getInstance().getAlarmClockAddObservable(params, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void editAlarmClock() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAlarmClock() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private int deleteFinishStatu;
|
private int deleteFinishStatu;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -282,24 +310,4 @@ public class MainSPresenter implements MainSContact.Presenter {
|
|||||||
return NetInterfaceManager.getInstance().deleteAlarmClockObservable(alarmClockData.getId());
|
return NetInterfaceManager.getInstance().deleteAlarmClockObservable(alarmClockData.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getAlarmClock() {
|
|
||||||
NetInterfaceManager.getInstance().getAlarmClock(true, getLifecycle(), new NetInterfaceManager.AlarmClockCallback() {
|
|
||||||
@Override
|
|
||||||
public void setAlarmClock(List<AlarmClockData> alarmClockList) {
|
|
||||||
Log.e(TAG, "setAlarmClock: " + alarmClockList);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAlarmClockEmpty() {
|
|
||||||
Log.e(TAG, "setAlarmClock: ");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError() {
|
|
||||||
Log.e(TAG, "setAlarmClock: ");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,8 +65,7 @@ import okhttp3.MediaType;
|
|||||||
import okhttp3.MultipartBody;
|
import okhttp3.MultipartBody;
|
||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
|
|
||||||
public class MainService extends BaseRxService
|
public class MainService extends BaseRxService implements MainSContact.MainSView, NetworkUtils.OnNetworkStatusChangedListener {
|
||||||
implements MainSContact.MainSView, NetworkUtils.OnNetworkStatusChangedListener {
|
|
||||||
private static final String TAG = "MainService";
|
private static final String TAG = "MainService";
|
||||||
|
|
||||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||||
@@ -97,26 +96,46 @@ public class MainService extends BaseRxService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private uploadAlarmClockReceiver mUploadAlarmClockReceiver;
|
private OperateAlarmClockReceiver mOperateAlarmClockReceiver;
|
||||||
|
|
||||||
private void registerRefreshReceiver() {
|
private void registerOperateAlarmClockReceiver() {
|
||||||
if (mUploadAlarmClockReceiver == null) {
|
if (mOperateAlarmClockReceiver == null) {
|
||||||
mUploadAlarmClockReceiver = new uploadAlarmClockReceiver();
|
mOperateAlarmClockReceiver = new OperateAlarmClockReceiver();
|
||||||
}
|
}
|
||||||
IntentFilter filter = new IntentFilter();
|
IntentFilter filter = new IntentFilter();
|
||||||
filter.addAction(uploadAlarmClockReceiver.UPLOAD_ALARM_RECEIVER_ACTION);
|
filter.addAction(ALARM_RECEIVER_ACTION_ADD);
|
||||||
registerReceiver(mUploadAlarmClockReceiver, filter);
|
filter.addAction(ALARM_RECEIVER_ACTION_EDIT);
|
||||||
|
filter.addAction(ALARM_RECEIVER_ACTION_UPDATE);
|
||||||
|
filter.addAction(ALARM_RECEIVER_ACTION_DELETE);
|
||||||
|
registerReceiver(mOperateAlarmClockReceiver, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class uploadAlarmClockReceiver extends BroadcastReceiver {
|
public static final String ALARM_RECEIVER_ACTION_ADD = "Receiver_AlarmClock_Action_Add";
|
||||||
public static final String UPLOAD_ALARM_RECEIVER_ACTION = "Receiver_Upload_AlarmClock_Action";
|
public static final String ALARM_RECEIVER_ACTION_EDIT = "Receiver_AlarmClock_Action_Edit";
|
||||||
|
public static final String ALARM_RECEIVER_ACTION_UPDATE = "Receiver_AlarmClock_Action_Update";
|
||||||
|
public static final String ALARM_RECEIVER_ACTION_DELETE = "Receiver_AlarmClock_Action_Delete";
|
||||||
|
|
||||||
|
public class OperateAlarmClockReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
Log.e("uploadAlarmClockReceiver", "onReceive: " + action);
|
Log.e("OperateAlarmClockReceiver", "onReceive: " + action);
|
||||||
if (!TextUtils.isEmpty(action)) {
|
if (TextUtils.isEmpty(action)) return;
|
||||||
|
switch (action) {
|
||||||
|
case ALARM_RECEIVER_ACTION_ADD:
|
||||||
mPresenter.addAlarmClock();
|
mPresenter.addAlarmClock();
|
||||||
|
break;
|
||||||
|
case ALARM_RECEIVER_ACTION_EDIT:
|
||||||
|
mPresenter.editAlarmClock();
|
||||||
|
break;
|
||||||
|
case ALARM_RECEIVER_ACTION_UPDATE:
|
||||||
|
mPresenter.updateAlarmClock();
|
||||||
|
break;
|
||||||
|
case ALARM_RECEIVER_ACTION_DELETE:
|
||||||
|
mPresenter.deleteAlarmClock();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,7 +168,7 @@ public class MainService extends BaseRxService
|
|||||||
registerAlarmReceiver();
|
registerAlarmReceiver();
|
||||||
registerTimeReceiver();
|
registerTimeReceiver();
|
||||||
registerLockScreenReceiver();
|
registerLockScreenReceiver();
|
||||||
registerRefreshReceiver();
|
registerOperateAlarmClockReceiver();
|
||||||
registerScreenLockReceiver();
|
registerScreenLockReceiver();
|
||||||
registerSmsReceiver();
|
registerSmsReceiver();
|
||||||
}
|
}
|
||||||
@@ -160,6 +179,31 @@ public class MainService extends BaseRxService
|
|||||||
return START_STICKY;
|
return START_STICKY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAlarmClock(List<AlarmClockData> dataList) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addAlarmClockFinish() {
|
||||||
|
mPresenter.deleteAlarmClock();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void editAlarmClockFinish() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAlarmClockFinish() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAlarmClockFinish() {
|
||||||
|
mPresenter.getAlarmClock();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
@@ -174,8 +218,8 @@ public class MainService extends BaseRxService
|
|||||||
if (lockScreenReceiver != null) {
|
if (lockScreenReceiver != null) {
|
||||||
unregisterReceiver(lockScreenReceiver);
|
unregisterReceiver(lockScreenReceiver);
|
||||||
}
|
}
|
||||||
if (mUploadAlarmClockReceiver != null) {
|
if (mOperateAlarmClockReceiver != null) {
|
||||||
unregisterReceiver(mUploadAlarmClockReceiver);
|
unregisterReceiver(mOperateAlarmClockReceiver);
|
||||||
}
|
}
|
||||||
if (mWindowReceiver != null) {
|
if (mWindowReceiver != null) {
|
||||||
unregisterReceiver(mWindowReceiver);
|
unregisterReceiver(mWindowReceiver);
|
||||||
@@ -185,21 +229,6 @@ public class MainService extends BaseRxService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addAlarmClockFinish() {
|
|
||||||
mPresenter.deleteAlarmClock();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteAlarmClockFinish() {
|
|
||||||
mPresenter.getAlarmClock();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAlarmClock(List<AlarmClockData> dataList) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isScreenOn() {
|
public boolean isScreenOn() {
|
||||||
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
||||||
// true为打开,false为关闭
|
// true为打开,false为关闭
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import com.arialyy.aria.core.Aria;
|
|||||||
import com.hjq.toast.Toaster;
|
import com.hjq.toast.Toaster;
|
||||||
import com.tencent.mmkv.MMKV;
|
import com.tencent.mmkv.MMKV;
|
||||||
import com.xxpatx.os.BuildConfig;
|
import com.xxpatx.os.BuildConfig;
|
||||||
|
import com.xxpatx.os.R;
|
||||||
import com.xxpatx.os.activity.quickapp.QuickAppActivity;
|
import com.xxpatx.os.activity.quickapp.QuickAppActivity;
|
||||||
import com.xxpatx.os.bean.AppInfo;
|
import com.xxpatx.os.bean.AppInfo;
|
||||||
import com.xxpatx.os.bean.DesktopIcon;
|
import com.xxpatx.os.bean.DesktopIcon;
|
||||||
@@ -508,9 +509,13 @@ public class ApkUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Drawable getAppDrawable(Context context, String pkg) {
|
public static Drawable getAppDrawable(Context context, String pkg) {
|
||||||
if (context == null || TextUtils.isEmpty(pkg)) {
|
if (context == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Drawable appIcon = context.getDrawable(R.mipmap.ic_launcher);
|
||||||
|
if (TextUtils.isEmpty(pkg)) {
|
||||||
|
return appIcon;
|
||||||
|
}
|
||||||
PackageManager packageManager = context.getPackageManager();
|
PackageManager packageManager = context.getPackageManager();
|
||||||
ApplicationInfo applicationInfo = null;
|
ApplicationInfo applicationInfo = null;
|
||||||
try {
|
try {
|
||||||
@@ -521,7 +526,7 @@ public class ApkUtils {
|
|||||||
if (applicationInfo != null) {
|
if (applicationInfo != null) {
|
||||||
return applicationInfo.loadIcon(packageManager);
|
return applicationInfo.loadIcon(packageManager);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return appIcon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<!-- 内部颜色 -->
|
<!-- 内部颜色 -->
|
||||||
<solid android:color="#444444" />
|
<!-- <solid android:color="#40000000" />-->
|
||||||
|
<gradient
|
||||||
|
android:angle="270"
|
||||||
|
android:endColor="#404d6c"
|
||||||
|
android:startColor="#606c88" />
|
||||||
|
|
||||||
<!-- 圆角的幅度 -->
|
<!-- 圆角的幅度 -->
|
||||||
<corners
|
<corners
|
||||||
android:bottomLeftRadius="8dp"
|
android:bottomLeftRadius="8dp"
|
||||||
@@ -10,9 +15,8 @@
|
|||||||
android:topRightRadius="8dp" />
|
android:topRightRadius="8dp" />
|
||||||
|
|
||||||
<padding
|
<padding
|
||||||
android:right="8dp"
|
|
||||||
android:left="8dp"
|
|
||||||
android:top="8dp"
|
|
||||||
android:bottom="8dp"
|
android:bottom="8dp"
|
||||||
/>
|
android:left="8dp"
|
||||||
|
android:right="8dp"
|
||||||
|
android:top="8dp" />
|
||||||
</shape>
|
</shape>
|
||||||
17
app/src/main/res/drawable/app_unselect_background.xml
Normal file
17
app/src/main/res/drawable/app_unselect_background.xml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<!-- 内部颜色 -->
|
||||||
|
<solid android:color="#40000000" />
|
||||||
|
<!-- 圆角的幅度 -->
|
||||||
|
<corners
|
||||||
|
android:bottomLeftRadius="8dp"
|
||||||
|
android:bottomRightRadius="8dp"
|
||||||
|
android:topLeftRadius="8dp"
|
||||||
|
android:topRightRadius="8dp" />
|
||||||
|
|
||||||
|
<padding
|
||||||
|
android:bottom="8dp"
|
||||||
|
android:left="8dp"
|
||||||
|
android:right="8dp"
|
||||||
|
android:top="8dp" />
|
||||||
|
</shape>
|
||||||
@@ -111,70 +111,6 @@
|
|||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:background="@drawable/add_alarm_background"
|
|
||||||
android:visibility="gone">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textView25"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="16dp"
|
|
||||||
android:text="闹钟类型"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="12sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<RadioGroup
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/textView25"
|
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/rb_all"
|
|
||||||
android:layout_width="36dp"
|
|
||||||
android:layout_height="36dp"
|
|
||||||
android:background="@drawable/tv_times_bg_medicine"
|
|
||||||
android:button="@null"
|
|
||||||
android:checked="true"
|
|
||||||
android:textColor="@color/radio_botton_gray"
|
|
||||||
android:textSize="9sp" />
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/rb_look"
|
|
||||||
android:layout_width="36dp"
|
|
||||||
android:layout_height="36dp"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:background="@drawable/tv_times_bg_look"
|
|
||||||
android:button="@null"
|
|
||||||
android:textColor="@color/radio_botton_gray"
|
|
||||||
android:textSize="9sp" />
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/rb_reserve"
|
|
||||||
android:layout_width="36dp"
|
|
||||||
android:layout_height="36dp"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:background="@drawable/tv_times_bg_reserve"
|
|
||||||
android:button="@null"
|
|
||||||
android:textColor="@color/radio_botton_gray"
|
|
||||||
android:textSize="9sp" />
|
|
||||||
|
|
||||||
</RadioGroup>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="120dp"
|
android:layout_height="120dp"
|
||||||
@@ -208,19 +144,6 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_type"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="16dp"
|
|
||||||
android:text="只响一次"
|
|
||||||
android:textColor="@color/title_gray"
|
|
||||||
android:textSize="12sp"
|
|
||||||
android:visibility="gone"
|
|
||||||
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="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -341,6 +264,7 @@
|
|||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:hint="请输入标题"
|
android:hint="请输入标题"
|
||||||
|
android:text="@{alarmClockData.title}"
|
||||||
android:padding="4dp"
|
android:padding="4dp"
|
||||||
android:maxLength="13"
|
android:maxLength="13"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
|
|||||||
73
app/src/main/res/layout/activity_dock.xml
Normal file
73
app/src/main/res/layout/activity_dock.xml
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?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.dock.DockActivity">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
<variable
|
||||||
|
name="click"
|
||||||
|
type="com.xxpatx.os.activity.dock.DockActivity.BtnClick" />
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:background="@drawable/control_bg"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/constraintLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_back"
|
||||||
|
android:layout_width="28dp"
|
||||||
|
android:layout_height="28dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/back_white"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="快捷应用"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="18sp"
|
||||||
|
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_appsize"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="14sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="@string/app_size" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recyclerView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/constraintLayout" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</layout>
|
||||||
@@ -44,12 +44,34 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/cl_bottom"
|
android:id="@+id/cl_bottom"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="110dp"
|
android:layout_height="88dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent">
|
app:layout_constraintBottom_toBottomOf="parent">
|
||||||
|
|
||||||
|
<GridView
|
||||||
|
android:id="@+id/gridView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:numColumns="auto_fit"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:stretchMode="columnWidth"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recyclerView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:itemCount="5"
|
||||||
|
tools:listitem="@layout/item_dock_app" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
|||||||
@@ -26,6 +26,10 @@
|
|||||||
name="dial_tone"
|
name="dial_tone"
|
||||||
type="Boolean" />
|
type="Boolean" />
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="status_bar"
|
||||||
|
type="Boolean" />
|
||||||
|
|
||||||
<variable
|
<variable
|
||||||
name="versionName"
|
name="versionName"
|
||||||
type="String" />
|
type="String" />
|
||||||
@@ -244,6 +248,45 @@
|
|||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:onClick="@{click::setStatusBar}">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="通知栏开关"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="25sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text='@{status_bar?"已开启":"未开启"}'
|
||||||
|
android:textColor="@{status_bar?@color/setting_enable_color:@color/setting_disable_color}"
|
||||||
|
android:textSize="25sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="未开启" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/lightGray"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -395,6 +438,56 @@
|
|||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:onClick="@{click::toDockSetting}">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="快捷图标设置"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="25sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="未开启"
|
||||||
|
android:textColor="@color/setting_disable_color"
|
||||||
|
android:textSize="25sp"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/icon_more"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/lightGray"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="80dp"
|
android:layout_height="80dp"
|
||||||
|
|||||||
68
app/src/main/res/layout/item_dock_app.xml
Normal file
68
app/src/main/res/layout/item_dock_app.xml
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<?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="match_parent">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/root"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
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">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_icon"
|
||||||
|
android:layout_width="68dp"
|
||||||
|
android:layout_height="68dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/home_icon_dialer"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/bg"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_marginStart="56dp"
|
||||||
|
android:layout_marginBottom="56dp"
|
||||||
|
android:background="@drawable/badge_bg"
|
||||||
|
android:gravity="center"
|
||||||
|
android:minWidth="24dp"
|
||||||
|
android:text="9"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/iv_icon"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/iv_icon" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:text="拨号"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/iv_icon"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/iv_icon"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/iv_icon" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
63
app/src/main/res/layout/item_dock_app_select.xml
Normal file
63
app/src/main/res/layout/item_dock_app_select.xml
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<?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="120dp"
|
||||||
|
android:background="@drawable/app_select_background"
|
||||||
|
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_select"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerInside"
|
||||||
|
android:src="@drawable/icon_unselected"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_icon"
|
||||||
|
android:layout_width="64dp"
|
||||||
|
android:layout_height="64dp"
|
||||||
|
android:src="@mipmap/ic_launcher"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="18sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/iv_icon"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/iv_icon"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/iv_icon" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Reference in New Issue
Block a user