version:1.2.4
fix: update:优化显示未读短信和未接来电,增加手电筒和数据开关
This commit is contained in:
@@ -27,8 +27,8 @@ import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.FragmentEvent;
|
||||
import com.xxpatx.os.BuildConfig;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.screenlock.ScreenLockActivity;
|
||||
import com.xxpatx.os.activity.dailyapp.DailyAppActivity;
|
||||
import com.xxpatx.os.activity.screenlock.ScreenLockActivity;
|
||||
import com.xxpatx.os.activity.service.ServiceActivity;
|
||||
import com.xxpatx.os.base.BaseFragment;
|
||||
import com.xxpatx.os.bean.BaseResponse;
|
||||
@@ -48,7 +48,6 @@ import com.xxpatx.os.utils.IconUtils;
|
||||
import com.xxpatx.os.view.MyGridLayout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
@@ -403,6 +402,11 @@ public class AppListFragment extends BaseFragment {
|
||||
}
|
||||
|
||||
private void showHideDialog(DesktopIcon desktopIcon) {
|
||||
int appLockCtrl = Settings.Global.getInt(mContext.getContentResolver(), CommonConfig.APP_LOCK_CTRL, 0);
|
||||
if (appLockCtrl == 0) {
|
||||
Toaster.showLong("已禁止桌面编辑");
|
||||
return;
|
||||
}
|
||||
String label = desktopIcon.getTitle();
|
||||
String pkg = desktopIcon.getPackage();
|
||||
DailyAppDialog dailyAppDialog = new DailyAppDialog(mContext);
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.hardware.camera2.CameraAccessException;
|
||||
import android.hardware.camera2.CameraManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@@ -26,20 +25,19 @@ import com.qweather.sdk.bean.weather.WeatherNowBean;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xxpatx.os.BuildConfig;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.FlashlightActivity;
|
||||
import com.xxpatx.os.activity.NetworkActivity;
|
||||
import com.xxpatx.os.activity.contact.AddWechatContactActivity;
|
||||
import com.xxpatx.os.activity.emergency.EmergencyActivity;
|
||||
import com.xxpatx.os.activity.setting.SettingActivity;
|
||||
import com.xxpatx.os.activity.weather.WeatherActivity;
|
||||
import com.xxpatx.os.alarm.AlarmClockData;
|
||||
import com.xxpatx.os.alarm.AlarmUtils;
|
||||
import com.xxpatx.os.base.mvvm.fragment.BaseMvvmFragment;
|
||||
import com.xxpatx.os.bean.Contact;
|
||||
import com.xxpatx.os.bean.DesktopIcon;
|
||||
import com.xxpatx.os.bean.MapBean;
|
||||
import com.xxpatx.os.config.CommonConfig;
|
||||
import com.xxpatx.os.databinding.FragmentHomeBinding;
|
||||
import com.xxpatx.os.dialog.SingleDialog;
|
||||
import com.xxpatx.os.network.NetInterfaceManager;
|
||||
import com.xxpatx.os.push.PushManager;
|
||||
import com.xxpatx.os.utils.ApkUtils;
|
||||
import com.xxpatx.os.utils.DayUtils;
|
||||
@@ -378,37 +376,6 @@ public class HomeFragment extends BaseMvvmFragment<HomeViewModel, FragmentHomeBi
|
||||
}
|
||||
}
|
||||
|
||||
private void checkSosNumber() {
|
||||
NetInterfaceManager.getInstance().getContactList(new NetInterfaceManager.ContactCallback() {
|
||||
@Override
|
||||
public void setContact(List<Contact> contactList) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEmergencyContact(List<Contact> emergencyContact) {
|
||||
if (emergencyContact == null || emergencyContact.size() == 0) {
|
||||
showNoData("温馨提示", "请在小程序上面设置紧急联系人");
|
||||
} else {
|
||||
Intent intent = new Intent(mContext, EmergencyActivity.class);
|
||||
// intent.putExtra("setting_sos", phone);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEmpty() {
|
||||
showNoData("温馨提示", "请在小程序上面设置紧急联系人");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showNoData(String title, String msg) {
|
||||
SingleDialog dialog = new SingleDialog(mContext);
|
||||
dialog.setTitle(title)
|
||||
@@ -501,24 +468,26 @@ public class HomeFragment extends BaseMvvmFragment<HomeViewModel, FragmentHomeBi
|
||||
}
|
||||
|
||||
public void openNetwork(View view) {
|
||||
startActivity(new Intent(Settings.ACTION_DATA_USAGE_SETTINGS));
|
||||
// startActivity(new Intent(Settings.ACTION_DATA_USAGE_SETTINGS));
|
||||
startActivity(new Intent(mContext, NetworkActivity.class));
|
||||
}
|
||||
|
||||
public void openFlash(View view) {
|
||||
try {
|
||||
String cameraId = cameraManager.getCameraIdList()[0];
|
||||
cameraManager.setTorchMode(cameraId, !flashing);
|
||||
flashing = !flashing;
|
||||
mViewDataBinding.setFlashing(flashing);
|
||||
} catch (CameraAccessException e) {
|
||||
e.printStackTrace();
|
||||
Log.e(TAG, "openFlash: " + e.getMessage());
|
||||
Toaster.show("打开手电筒失败");
|
||||
}
|
||||
startActivity(new Intent(mContext, FlashlightActivity.class));
|
||||
// try {
|
||||
// String cameraId = cameraManager.getCameraIdList()[0];
|
||||
// cameraManager.setTorchMode(cameraId, !flashing);
|
||||
// flashing = !flashing;
|
||||
// mViewDataBinding.setFlashing(flashing);
|
||||
// } catch (CameraAccessException e) {
|
||||
// e.printStackTrace();
|
||||
// Log.e(TAG, "openFlash: " + e.getMessage());
|
||||
// Toaster.show("打开手电筒失败");
|
||||
// }
|
||||
}
|
||||
|
||||
public void openCalendar(View view) {
|
||||
ApkUtils.openApp(mContext, "cn.etouch.ecalendar");
|
||||
ApkUtils.openApp(mContext, "com.honghui.huangli");
|
||||
}
|
||||
|
||||
public void toWeather(View view) {
|
||||
|
||||
@@ -15,6 +15,7 @@ import android.view.View;
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.ImeiActivity;
|
||||
import com.xxpatx.os.activity.contact.AddWechatContactActivity;
|
||||
import com.xxpatx.os.activity.selectnumber.SelectNumberActivity;
|
||||
import com.xxpatx.os.base.mvvm.fragment.BaseMvvmFragment;
|
||||
@@ -92,12 +93,16 @@ public class DialerFragment extends BaseMvvmFragment<DialerViewModel, FragmentDi
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
Log.e("initView", "onTextChanged: " + s);
|
||||
if ("*#*#4636#*#*".contentEquals(s)) {
|
||||
ApkUtils.openPackage(mContext, "com.android.settings", "com.android.settings.Settings$TestingSettingsActivity");
|
||||
} else if ("*#*#0011234#*#*".contentEquals(s)) {
|
||||
ApkUtils.openPackage(mContext, "com.mediatek.factorymode", "com.mediatek.factorymode.FactoryMode");
|
||||
} else if ("*#*#0011231#*#*".contentEquals(s)) {
|
||||
ApkUtils.openPackage(mContext, "com.android.agingtest", "com.android.agingtest.AgingTest");
|
||||
String code = s.toString();
|
||||
switch (code) {
|
||||
case "*#*#4636#*#*":
|
||||
case "*#*#0011234#*#*":
|
||||
case "*#*#0011231#*#*":
|
||||
case "*#06#":
|
||||
openCode(s);
|
||||
mViewDataBinding.etPhone.setText("");
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,6 +111,32 @@ public class DialerFragment extends BaseMvvmFragment<DialerViewModel, FragmentDi
|
||||
Log.e("initView", "afterTextChanged: " + s);
|
||||
}
|
||||
});
|
||||
mViewDataBinding.ivDelete.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View view) {
|
||||
mViewDataBinding.etPhone.setText("");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void openCode(CharSequence s) {
|
||||
String code = s.toString();
|
||||
switch (code) {
|
||||
case "*#*#4636#*#*":
|
||||
ApkUtils.openPackage(mContext, "com.android.settings", "com.android.settings.Settings$TestingSettingsActivity");
|
||||
break;
|
||||
case "*#*#0011234#*#*":
|
||||
ApkUtils.openPackage(mContext, "com.mediatek.factorymode", "com.mediatek.factorymode.FactoryMode");
|
||||
break;
|
||||
case "*#*#0011231#*#*":
|
||||
ApkUtils.openPackage(mContext, "com.android.agingtest", "com.android.agingtest.AgingTest");
|
||||
break;
|
||||
case "*#06#":
|
||||
startActivity(new Intent(mContext, ImeiActivity.class));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -68,7 +68,8 @@ public class RecordViewModel extends BaseViewModel<FragmentRecordBinding, Fragme
|
||||
*
|
||||
*/
|
||||
Cursor cursor = resolver.query(CallLog.Calls.CONTENT_URI, // 查询通话记录的URI
|
||||
new String[]{CallLog.Calls.CACHED_NAME// 通话记录的联系人
|
||||
new String[]{CallLog.Calls._ID
|
||||
, CallLog.Calls.CACHED_NAME// 通话记录的联系人
|
||||
, CallLog.Calls.NUMBER// 通话记录的电话号码
|
||||
, CallLog.Calls.DATE// 通话记录的日期
|
||||
, CallLog.Calls.DURATION// 通话时长
|
||||
@@ -78,6 +79,7 @@ public class RecordViewModel extends BaseViewModel<FragmentRecordBinding, Fragme
|
||||
// 3.通过Cursor获得数据
|
||||
List<RecordsInfo> list = new ArrayList<>();
|
||||
while (cursor.moveToNext()) {
|
||||
String id = cursor.getString(cursor.getColumnIndex(CallLog.Calls._ID));
|
||||
String name = cursor.getString(cursor.getColumnIndex(CallLog.Calls.CACHED_NAME));
|
||||
String number = cursor.getString(cursor.getColumnIndex(CallLog.Calls.NUMBER));
|
||||
long dateLong = cursor.getLong(cursor.getColumnIndex(CallLog.Calls.DATE));
|
||||
@@ -86,6 +88,7 @@ public class RecordViewModel extends BaseViewModel<FragmentRecordBinding, Fragme
|
||||
int type = cursor.getInt(cursor.getColumnIndex(CallLog.Calls.TYPE));
|
||||
|
||||
RecordsInfo recordsInfo = new RecordsInfo();
|
||||
recordsInfo.setId(id);
|
||||
recordsInfo.setName(name);
|
||||
recordsInfo.setNumber(number);
|
||||
recordsInfo.setDate(dateLong);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.xxpatx.os.fragment.settings;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@@ -154,7 +155,12 @@ public class SettingsFragment extends BaseMvvmFragment<SettingsViewModel, Fragme
|
||||
}
|
||||
|
||||
public void openEmergency(View view) {
|
||||
startActivity(new Intent(mContext, EmergencyActivity.class));
|
||||
int sos_ctrl = Settings.Global.getInt(mContext.getContentResolver(), CommonConfig.DISABLE_SOS, 1);
|
||||
if (sos_ctrl == 0) {
|
||||
Toaster.showLong("SOS功能已关闭");
|
||||
} else {
|
||||
startActivity(new Intent(mContext, EmergencyActivity.class));
|
||||
}
|
||||
}
|
||||
|
||||
public void toAppstore(View view) {
|
||||
|
||||
Reference in New Issue
Block a user