version:1.2.4

fix:
update:优化显示未读短信和未接来电,增加手电筒和数据开关
This commit is contained in:
2024-09-24 10:30:27 +08:00
parent 5bb723bc48
commit f03f8df38d
55 changed files with 1327 additions and 206 deletions

View File

@@ -15,8 +15,8 @@ android {
applicationId "com.xxpatx.os" applicationId "com.xxpatx.os"
minSdkVersion 24 minSdkVersion 24
targetSdkVersion 29 targetSdkVersion 29
versionCode 1022 versionCode 1025
versionName "1.2.1" versionName "1.2.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View File

@@ -217,11 +217,26 @@
android:name=".activity.alarm.edit.AlarmEditActivity" android:name=".activity.alarm.edit.AlarmEditActivity"
android:launchMode="singleTask" android:launchMode="singleTask"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity
android:name=".activity.FlashlightActivity"
android:launchMode="singleTask"
android:theme="@style/AppTheme"
android:screenOrientation="portrait" />
<activity
android:name=".activity.NetworkActivity"
android:launchMode="singleTask"
android:theme="@style/AppTheme"
android:screenOrientation="portrait" />
<activity <activity
android:name=".activity.selectnumber.SelectNumberActivity" android:name=".activity.selectnumber.SelectNumberActivity"
android:launchMode="singleTask" android:launchMode="singleTask"
android:theme="@style/activity_styles" android:screenOrientation="portrait"
android:screenOrientation="portrait" /> android:theme="@style/activity_styles_full" />
<activity
android:name=".activity.ImeiActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/activity_styles_full" />
<activity <activity
android:name=".activity.screenlock.ScreenLockActivity" android:name=".activity.screenlock.ScreenLockActivity"
android:configChanges="keyboardHidden" android:configChanges="keyboardHidden"

View File

@@ -13,15 +13,14 @@ import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.xxpatx.os.R; import com.xxpatx.os.R;
import com.xxpatx.os.adapter.APPListAdapter; import com.xxpatx.os.adapter.APPListAdapter;
import com.xxpatx.os.base.BaseDataBindingActivity; import com.xxpatx.os.base.BaseDataBindingActivity;
import com.xxpatx.os.bean.AppListInfo; import com.xxpatx.os.bean.AppListInfo;
import com.xxpatx.os.custom.RecyclerViewSpacesItemDecoration;
import com.xxpatx.os.service.NotificationService; import com.xxpatx.os.service.NotificationService;
import com.xxpatx.os.utils.ApkUtils; import com.xxpatx.os.utils.ApkUtils;
import com.xxpatx.os.utils.BitmapUtils; import com.xxpatx.os.utils.BitmapUtils;
import com.xxpatx.os.view.RecyclerViewSpacesItemDecoration;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;

View File

@@ -0,0 +1,124 @@
package com.xxpatx.os.activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.database.ContentObserver;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraManager;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
import android.util.Log;
import android.view.View;
import androidx.databinding.DataBindingUtil;
import com.hjq.toast.Toaster;
import com.xxpatx.os.R;
import com.xxpatx.os.base.BaseDataBindingActivity;
import com.xxpatx.os.databinding.ActivityFlashlightBinding;
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;
public class FlashlightActivity extends BaseDataBindingActivity {
private ActivityFlashlightBinding mBinding;
private CameraManager cameraManager;
private ContentObserver mFlashLightObserver = new ContentObserver(new Handler(Looper.getMainLooper())) {
@Override
public void onChange(boolean selfChange) {
super.onChange(selfChange);
Log.e("mFlashLightObserver", "onChange: " + Settings.System.getInt(getContentResolver(), Settings.Secure.FLASHLIGHT_ENABLED, 0));
if (isFlashlightEnabled()) {
mBinding.ivStatu.setImageDrawable(getDrawable(R.drawable.icon_flash_light_open));
} else {
mBinding.ivStatu.setImageDrawable(getDrawable(R.drawable.icon_flash_light_close));
}
}
};
@Override
public boolean setNightMode() {
return true;
}
@Override
protected void initDataBinding() {
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_flashlight);
}
@Override
protected void initView() {
UltimateBarX.addStatusBarTopPadding(mBinding.clExit);
UltimateBarX.addNavigationBarBottomPadding(mBinding.clBottom);
getContentResolver().registerContentObserver(Settings.Secure.getUriFor(Settings.Secure.FLASHLIGHT_ENABLED),
true,
mFlashLightObserver);
cameraManager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
if (isFlashlightAvailable()) {
if (isFlashlightEnabled()) {
mBinding.ivStatu.setImageDrawable(getDrawable(R.drawable.icon_flash_light_open));
} else {
mBinding.ivStatu.setImageDrawable(getDrawable(R.drawable.icon_flash_light_close));
}
} else {
mBinding.tvFlashlightStatu.setText("手电筒不可用");
}
mBinding.clTrun.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (isFlashlightAvailable()) {
if (isFlashlightEnabled()) {
try {
String CameraId = cameraManager.getCameraIdList()[0];
cameraManager.setTorchMode(CameraId, false);
} catch (CameraAccessException e) {
e.printStackTrace();
}
mBinding.ivStatu.setImageDrawable(getDrawable(R.drawable.icon_flash_light_close));
Settings.Secure.putInt(getContentResolver(), Settings.Secure.FLASHLIGHT_ENABLED, 0);
} else {
try {
String CameraId = cameraManager.getCameraIdList()[0];
cameraManager.setTorchMode(CameraId, true);
} catch (Exception e) {
e.printStackTrace();
}
mBinding.ivStatu.setImageDrawable(getDrawable(R.drawable.icon_flash_light_open));
Settings.Secure.putInt(getContentResolver(), Settings.Secure.FLASHLIGHT_ENABLED, 1);
}
} else {
Toaster.show("手电筒不可用");
}
}
});
mBinding.ivBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
}
@Override
protected void initData() {
}
@Override
protected void onDestroy() {
super.onDestroy();
getContentResolver().unregisterContentObserver(mFlashLightObserver);
}
private boolean isFlashlightAvailable() {
return getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH);
}
private boolean isFlashlightEnabled() {
return Settings.Secure.getInt(getContentResolver(), Settings.Secure.FLASHLIGHT_ENABLED, 0) == 1;
}
}

View File

@@ -0,0 +1,55 @@
package com.xxpatx.os.activity;
import android.view.Gravity;
import android.view.View;
import androidx.databinding.DataBindingUtil;
import com.xxpatx.os.R;
import com.xxpatx.os.base.BaseDataBindingActivity;
import com.xxpatx.os.databinding.ActivityImeiBinding;
import com.xxpatx.os.utils.Utils;
public class ImeiActivity extends BaseDataBindingActivity {
private static final String TAG = "ImeiActivity";
private ActivityImeiBinding mBinding;
@Override
public boolean setNightMode() {
return true;
}
@Override
public boolean setfitWindow() {
return true;
}
@Override
protected void initDataBinding() {
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_imei);
mBinding.setClick(new BtnClick());
}
@Override
public void initView() {
getWindow().setGravity(Gravity.BOTTOM);
}
@Override
public void initData() {
mBinding.tvImei1.setText("IMEI1:" + Utils.getIMEI(this, 0));
mBinding.tvImei2.setText("IMEI2:" + Utils.getIMEI(this, 1));
mBinding.tvMeid.setText("MEID :" + Utils.getEmid(this));
}
public class BtnClick {
public void empty(View view) {
}
public void exit(View view) {
finish();
}
}
}

View File

@@ -0,0 +1,125 @@
package com.xxpatx.os.activity;
import android.content.Context;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.View;
import androidx.databinding.DataBindingUtil;
import com.blankj.utilcode.util.NetworkUtils;
import com.hjq.toast.Toaster;
import com.xxpatx.os.R;
import com.xxpatx.os.base.BaseDataBindingActivity;
import com.xxpatx.os.databinding.ActivityNetworkBinding;
import com.xxpatx.os.utils.Utils;
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;
public class NetworkActivity extends BaseDataBindingActivity implements NetworkUtils.OnNetworkStatusChangedListener {
private static final String TAG = "NetworkActivity";
private ActivityNetworkBinding mBinding;
@Override
public void onDisconnected() {
Log.e(TAG, "onDisconnected: ");
setDataStatus();
}
@Override
public void onConnected(NetworkUtils.NetworkType networkType) {
Log.e(TAG, "onConnected: ");
setDataStatus();
}
@Override
public boolean setNightMode() {
return true;
}
@Override
protected void initDataBinding() {
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_network);
}
@Override
protected void initView() {
UltimateBarX.addStatusBarTopPadding(mBinding.clExit);
UltimateBarX.addNavigationBarBottomPadding(mBinding.clBottom);
NetworkUtils.registerNetworkStatusChangedListener(this);
setDataStatus();
mBinding.clTrun.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (Utils.hasSimCard(NetworkActivity.this)) {
if (getDataEnabled()) {
setDataEnabled(false);
} else {
setDataEnabled(true);
}
setDataStatus();
} else {
Toaster.show("请插入SIM卡");
}
}
});
mBinding.ivBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
}
private void setDataStatus() {
if (getDataEnabled()) {
mBinding.ivStatu.setImageDrawable(getDrawable(R.drawable.icon_flash_light_open));
} else {
mBinding.ivStatu.setImageDrawable(getDrawable(R.drawable.icon_flash_light_close));
}
}
@Override
protected void initData() {
}
@Override
protected void onDestroy() {
super.onDestroy();
NetworkUtils.unregisterNetworkStatusChangedListener(this);
}
public void setDataEnabled(int slotIdx, boolean enable) {
int subid = SubscriptionManager.from(this).getActiveSubscriptionInfoForSimSlotIndex(slotIdx).getSubscriptionId();
TelephonyManager telephonyService = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
telephonyService.setDataEnabled(subid, enable);
Log.e(TAG, "setDataEnabled: subid = " + subid + " enable = " + enable);
}
public boolean getDataEnabled(int slotIdx) {
int subid = SubscriptionManager.from(this).getActiveSubscriptionInfoForSimSlotIndex(slotIdx).getSubscriptionId();
TelephonyManager telephonyService = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
boolean enabled = telephonyService.getDataEnabled(subid);
return enabled;
}
public void setDataEnabled(boolean enable) {
TelephonyManager telephonyService = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
telephonyService.setDataEnabled(enable);
Log.e(TAG, "setDataEnabled: enable = " + enable);
}
public boolean getDataEnabled() {
TelephonyManager telephonyService = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
boolean enabled = telephonyService.getDataEnabled();
return enabled;
}
}

View File

@@ -22,8 +22,8 @@ import com.luck.picture.lib.interfaces.OnResultCallbackListener;
import com.xxpatx.os.R; import com.xxpatx.os.R;
import com.xxpatx.os.alarm.AlarmClockData; import com.xxpatx.os.alarm.AlarmClockData;
import com.xxpatx.os.alarm.AlarmUtils; import com.xxpatx.os.alarm.AlarmUtils;
import com.xxpatx.os.base.GlideEngine;
import com.xxpatx.os.base.mvvm.BaseMvvmActivity; import com.xxpatx.os.base.mvvm.BaseMvvmActivity;
import com.xxpatx.os.custom.GlideEngine;
import com.xxpatx.os.databinding.ActivityAlarmAddBinding; import com.xxpatx.os.databinding.ActivityAlarmAddBinding;
import com.xxpatx.os.service.main.MainService; import com.xxpatx.os.service.main.MainService;
import com.xxpatx.os.utils.FFmpegUtils; import com.xxpatx.os.utils.FFmpegUtils;

View File

@@ -5,12 +5,8 @@ import android.content.res.ColorStateList;
import android.graphics.Color; import android.graphics.Color;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.PopupWindow;
import android.widget.TextView;
import com.bigkoo.pickerview.builder.TimePickerBuilder; import com.bigkoo.pickerview.builder.TimePickerBuilder;
import com.bigkoo.pickerview.listener.CustomListener; import com.bigkoo.pickerview.listener.CustomListener;
@@ -26,13 +22,12 @@ import com.luck.picture.lib.entity.LocalMedia;
import com.luck.picture.lib.interfaces.OnResultCallbackListener; import com.luck.picture.lib.interfaces.OnResultCallbackListener;
import com.trello.rxlifecycle4.RxLifecycle; import com.trello.rxlifecycle4.RxLifecycle;
import com.trello.rxlifecycle4.android.ActivityEvent; import com.trello.rxlifecycle4.android.ActivityEvent;
import com.xiasuhuei321.loadingdialog.view.LoadingDialog;
import com.xxpatx.os.R; import com.xxpatx.os.R;
import com.xxpatx.os.alarm.AlarmClockData; import com.xxpatx.os.alarm.AlarmClockData;
import com.xxpatx.os.alarm.AlarmUtils; import com.xxpatx.os.alarm.AlarmUtils;
import com.xxpatx.os.base.GlideEngine;
import com.xxpatx.os.base.mvvm.BaseMvvmActivity; import com.xxpatx.os.base.mvvm.BaseMvvmActivity;
import com.xxpatx.os.bean.BaseResponse; import com.xxpatx.os.bean.BaseResponse;
import com.xxpatx.os.custom.GlideEngine;
import com.xxpatx.os.databinding.ActivityAlarmEditBinding; import com.xxpatx.os.databinding.ActivityAlarmEditBinding;
import com.xxpatx.os.network.NetInterfaceManager; import com.xxpatx.os.network.NetInterfaceManager;
import com.xxpatx.os.utils.FFmpegUtils; import com.xxpatx.os.utils.FFmpegUtils;

View File

@@ -4,7 +4,7 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.os.Handler; import android.provider.Settings;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
@@ -26,7 +26,6 @@ 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 com.xxpatx.os.push.PushManager;
@@ -81,7 +80,8 @@ public class AlarmListActivity extends BaseMvvmActivity<AlarmListViewModel, Acti
@Override @Override
public void onLongClick(AlarmClockData alarmClockData) { public void onLongClick(AlarmClockData alarmClockData) {
boolean clockModify = mMMKV.decodeBool(CommonConfig.DISABLE_CLOCK_MODIFY, false); boolean clockModify = mMMKV.decodeBool(CommonConfig.DISABLE_CLOCK_MODIFY, false);
if (clockModify) { int alarm_clock_ctrl = Settings.Global.getInt(getContentResolver(), CommonConfig.ALARM_CLOCK_CTRL, 0);
if (clockModify || alarm_clock_ctrl == 0) {
Toaster.showLong("已禁用闹钟修改"); Toaster.showLong("已禁用闹钟修改");
} else { } else {
showDialog(alarmClockData); showDialog(alarmClockData);
@@ -237,7 +237,8 @@ public class AlarmListActivity extends BaseMvvmActivity<AlarmListViewModel, Acti
public void add(View view) { public void add(View view) {
boolean clockModify = mMMKV.decodeBool(CommonConfig.DISABLE_CLOCK_MODIFY, false); boolean clockModify = mMMKV.decodeBool(CommonConfig.DISABLE_CLOCK_MODIFY, false);
if (clockModify) { int alarm_clock_ctrl = Settings.Global.getInt(getContentResolver(), CommonConfig.ALARM_CLOCK_CTRL, 0);
if (clockModify || alarm_clock_ctrl == 0) {
Toaster.showLong("已禁用闹钟修改"); Toaster.showLong("已禁用闹钟修改");
} else { } else {
startActivity(new Intent(AlarmListActivity.this, AlarmAddActivity.class)); startActivity(new Intent(AlarmListActivity.this, AlarmAddActivity.class));

View File

@@ -1,12 +1,6 @@
package com.xxpatx.os.activity.contact; package com.xxpatx.os.activity.contact;
import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri; import android.net.Uri;
import android.provider.MediaStore;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
@@ -19,9 +13,9 @@ import com.luck.picture.lib.interfaces.OnResultCallbackListener;
import com.trello.rxlifecycle4.RxLifecycle; import com.trello.rxlifecycle4.RxLifecycle;
import com.trello.rxlifecycle4.android.ActivityEvent; import com.trello.rxlifecycle4.android.ActivityEvent;
import com.xxpatx.os.R; import com.xxpatx.os.R;
import com.xxpatx.os.base.GlideEngine;
import com.xxpatx.os.base.mvvm.BaseMvvmActivity; import com.xxpatx.os.base.mvvm.BaseMvvmActivity;
import com.xxpatx.os.bean.BaseResponse; import com.xxpatx.os.bean.BaseResponse;
import com.xxpatx.os.custom.GlideEngine;
import com.xxpatx.os.databinding.ActivityAddContactBinding; import com.xxpatx.os.databinding.ActivityAddContactBinding;
import com.xxpatx.os.network.NetInterfaceManager; import com.xxpatx.os.network.NetInterfaceManager;
import com.xxpatx.os.utils.FileUtil; import com.xxpatx.os.utils.FileUtil;
@@ -29,7 +23,6 @@ import com.xxpatx.os.utils.GlideLoadUtils;
import com.xxpatx.os.utils.Utils; import com.xxpatx.os.utils.Utils;
import java.io.File; import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -41,8 +34,6 @@ import okhttp3.MediaType;
import okhttp3.MultipartBody; import okhttp3.MultipartBody;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import static com.xxpatx.os.utils.FileUtil.uriToFile;
public class AddContactActivity extends BaseMvvmActivity<AddContactViewModel, ActivityAddContactBinding> { public class AddContactActivity extends BaseMvvmActivity<AddContactViewModel, ActivityAddContactBinding> {
private static final String TAG = "AddContactActivity"; private static final String TAG = "AddContactActivity";
@@ -114,7 +105,7 @@ public class AddContactActivity extends BaseMvvmActivity<AddContactViewModel, Ac
avatarFile = FileUtil.drawableToFile(AddContactActivity.this, R.drawable.default_avatar, "avatar"); avatarFile = FileUtil.drawableToFile(AddContactActivity.this, R.drawable.default_avatar, "avatar");
} else { } else {
Uri uri = Uri.parse(avatarFilePath); Uri uri = Uri.parse(avatarFilePath);
avatarFile = uriToFile(uri, AddContactActivity.this); avatarFile = FileUtil.uriToFile(uri, AddContactActivity.this);
} }
MediaType mediaType = MediaType.Companion.parse("image/png"); MediaType mediaType = MediaType.Companion.parse("image/png");
RequestBody requestBody = RequestBody.Companion.create(avatarFile, mediaType); RequestBody requestBody = RequestBody.Companion.create(avatarFile, mediaType);

View File

@@ -21,9 +21,9 @@ import com.luck.picture.lib.entity.LocalMedia;
import com.luck.picture.lib.interfaces.OnResultCallbackListener; import com.luck.picture.lib.interfaces.OnResultCallbackListener;
import com.xiasuhuei321.loadingdialog.view.LoadingDialog; import com.xiasuhuei321.loadingdialog.view.LoadingDialog;
import com.xxpatx.os.R; import com.xxpatx.os.R;
import com.xxpatx.os.base.GlideEngine;
import com.xxpatx.os.base.mvvm.BaseMvvmActivity; import com.xxpatx.os.base.mvvm.BaseMvvmActivity;
import com.xxpatx.os.bean.Contact; import com.xxpatx.os.bean.Contact;
import com.xxpatx.os.custom.GlideEngine;
import com.xxpatx.os.databinding.ActivityAddWechatContactBinding; import com.xxpatx.os.databinding.ActivityAddWechatContactBinding;
import com.xxpatx.os.db.ContactCacheUtils; import com.xxpatx.os.db.ContactCacheUtils;
import com.xxpatx.os.utils.ScreenUtil; import com.xxpatx.os.utils.ScreenUtil;

View File

@@ -23,10 +23,10 @@ import com.luck.picture.lib.entity.LocalMedia;
import com.luck.picture.lib.interfaces.OnResultCallbackListener; import com.luck.picture.lib.interfaces.OnResultCallbackListener;
import com.xiasuhuei321.loadingdialog.view.LoadingDialog; import com.xiasuhuei321.loadingdialog.view.LoadingDialog;
import com.xxpatx.os.R; import com.xxpatx.os.R;
import com.xxpatx.os.base.GlideEngine;
import com.xxpatx.os.base.mvvm.BaseMvvmActivity; import com.xxpatx.os.base.mvvm.BaseMvvmActivity;
import com.xxpatx.os.bean.BaseResponse; import com.xxpatx.os.bean.BaseResponse;
import com.xxpatx.os.bean.Contact; import com.xxpatx.os.bean.Contact;
import com.xxpatx.os.custom.GlideEngine;
import com.xxpatx.os.databinding.ActivityEditContactBinding; import com.xxpatx.os.databinding.ActivityEditContactBinding;
import com.xxpatx.os.utils.FileUtil; import com.xxpatx.os.utils.FileUtil;
import com.xxpatx.os.utils.ScreenUtil; import com.xxpatx.os.utils.ScreenUtil;

View File

@@ -22,9 +22,9 @@ import com.xxpatx.os.adapter.CityAdapter;
import com.xxpatx.os.adapter.DistrictAdapter; import com.xxpatx.os.adapter.DistrictAdapter;
import com.xxpatx.os.base.mvvm.BaseMvvmActivity; import com.xxpatx.os.base.mvvm.BaseMvvmActivity;
import com.xxpatx.os.bean.AddressBean; import com.xxpatx.os.bean.AddressBean;
import com.xxpatx.os.custom.RecyclerViewSpacesItemDecoration;
import com.xxpatx.os.databinding.ActivityLocationBinding; import com.xxpatx.os.databinding.ActivityLocationBinding;
import com.xxpatx.os.manager.AmapManager; import com.xxpatx.os.manager.AmapManager;
import com.xxpatx.os.view.RecyclerViewSpacesItemDecoration;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;

View File

@@ -1,5 +1,6 @@
package com.xxpatx.os.activity.main; package com.xxpatx.os.activity.main;
import android.Manifest;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ComponentName; import android.content.ComponentName;
@@ -9,11 +10,14 @@ import android.content.IntentFilter;
import android.content.ServiceConnection; import android.content.ServiceConnection;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.database.Cursor;
import android.hardware.camera2.CameraAccessException; import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCharacteristics; import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraManager; import android.hardware.camera2.CameraManager;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.provider.CallLog;
import android.provider.ContactsContract;
import android.provider.Settings; import android.provider.Settings;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
@@ -22,13 +26,12 @@ import android.view.View;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.core.app.NotificationManagerCompat; import androidx.core.app.NotificationManagerCompat;
import androidx.fragment.app.Fragment; 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.Gson;
@@ -44,7 +47,6 @@ import com.xxpatx.os.R;
import com.xxpatx.os.activity.dock.DockActivity; 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.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;
@@ -65,14 +67,15 @@ import com.xxpatx.os.utils.AppUsedTimeUtils;
import com.xxpatx.os.utils.DayUtils; import com.xxpatx.os.utils.DayUtils;
import com.xxpatx.os.utils.TimeUtils; import com.xxpatx.os.utils.TimeUtils;
import com.xxpatx.os.utils.Utils; import com.xxpatx.os.utils.Utils;
import com.xxpatx.os.utils.WiFiUtils;
import com.xxpatx.os.view.ScaleCircleNavigator; import com.xxpatx.os.view.ScaleCircleNavigator;
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX; import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;
import net.lucode.hackware.magicindicator.ViewPagerHelper; import net.lucode.hackware.magicindicator.ViewPagerHelper;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBinding> implements NetworkUtils.OnNetworkStatusChangedListener, NotificationService.NotificationListener { public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBinding> implements NetworkUtils.OnNetworkStatusChangedListener, NotificationService.NotificationListener {
@@ -119,6 +122,7 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
public void onListenerUpdate() { public void onListenerUpdate() {
Log.e(TAG, "onListenerUpdate: "); Log.e(TAG, "onListenerUpdate: ");
updateIconBg(); updateIconBg();
mDockAppGridAdapter.notifyDataSetChanged();
} }
@Override @Override
@@ -284,6 +288,122 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
} }
} }
/**
* 利用系统CallLog获取通话历史记录
*
* @param num 要读取记录的数量
* @return
*/
public void getCallHistoryList(int num) {
Cursor cs;
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_CALL_LOG)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.READ_CALL_LOG}, 1000);
}
cs = getContentResolver().query(CallLog.Calls.CONTENT_URI, //系统方式获取通讯录存储地址
new String[]{
CallLog.Calls.CACHED_NAME, //姓名
CallLog.Calls.NUMBER, //号码
CallLog.Calls.TYPE, //呼入/呼出(2)/未接
CallLog.Calls.DATE, //拨打时间
CallLog.Calls.DURATION, //通话时长
}, null, null, CallLog.Calls.DEFAULT_SORT_ORDER);
int i = 0;
if (cs != null && cs.getCount() > 0) {
Date date = new Date(System.currentTimeMillis());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String date_today = simpleDateFormat.format(date);
for (cs.moveToFirst(); (!cs.isAfterLast()) && i < num; cs.moveToNext(), i++) {
String callName = cs.getString(0); //名称
String callNumber = cs.getString(1); //号码
//如果名字为空,在通讯录查询一次有没有对应联系人
if (callName == null || callName.equals("")) {
String[] cols = {ContactsContract.PhoneLookup.DISPLAY_NAME};
//设置查询条件
String selection = ContactsContract.CommonDataKinds.Phone.NUMBER + "='" + callNumber + "'";
Cursor cursor = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
cols, selection, null, null);
int nameFieldColumnIndex = cursor.getColumnIndex(ContactsContract.PhoneLookup.DISPLAY_NAME);
if (cursor.getCount() > 0) {
cursor.moveToFirst();
callName = cursor.getString(nameFieldColumnIndex);
}
cursor.close();
}
//通话类型
int callType = Integer.parseInt(cs.getString(2));
String callTypeStr = "";
switch (callType) {
case CallLog.Calls.INCOMING_TYPE:
callTypeStr = "CALLIN";
break;
case CallLog.Calls.OUTGOING_TYPE:
callTypeStr = "CALLOUT";
break;
case CallLog.Calls.MISSED_TYPE:
callTypeStr = "CAllMISS";
break;
default:
//其他类型的,例如新增号码等记录不算进通话记录里,直接跳过
Log.i("ssss", "" + callType);
i--;
continue;
}
//拨打时间
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date callDate = new Date(Long.parseLong(cs.getString(3)));
String callDateStr = sdf.format(callDate);
if (callDateStr.equals(date_today)) { //判断是否为今天
sdf = new SimpleDateFormat("HH:mm");
callDateStr = sdf.format(callDate);
} else if (date_today.contains(callDateStr.substring(0, 7))) { //判断是否为当月
sdf = new SimpleDateFormat("dd");
int callDay = Integer.valueOf(sdf.format(callDate));
int day = Integer.valueOf(sdf.format(date));
if (day - callDay == 1) {
callDateStr = "昨天";
} else {
sdf = new SimpleDateFormat("MM-dd");
callDateStr = sdf.format(callDate);
}
} else if (date_today.contains(callDateStr.substring(0, 4))) { //判断是否为当年
sdf = new SimpleDateFormat("MM-dd");
callDateStr = sdf.format(callDate);
}
//通话时长
int callDuration = Integer.parseInt(cs.getString(4));
int min = callDuration / 60;
int sec = callDuration % 60;
String callDurationStr = "";
if (sec > 0) {
if (min > 0) {
callDurationStr = min + "" + sec + "";
} else {
callDurationStr = sec + "";
}
}
/**
* callName 名字
* callNumber 号码
* callTypeStr 通话类型
* callDateStr 通话日期
* callDurationStr 通话时长
* 请在此处执行相关UI或存储操作之后会查询下一条通话记录
*/
Log.i("Msg", "callName" + callName);
Log.i("Msg", "callNumber" + callNumber);
Log.i("Msg", "callTypeStr" + callTypeStr);
Log.i("Msg", "callDateStr" + callDateStr);
Log.i("Msg", "callDurationStr" + callDurationStr);
}
}
}
@Override @Override
public void initData() { public void initData() {
mViewModel.getDesktopIconData().observe(this, new Observer<ArrayList<DesktopIcon>>() { mViewModel.getDesktopIconData().observe(this, new Observer<ArrayList<DesktopIcon>>() {
@@ -716,6 +836,7 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
registerUpdateDesktopReceiver(); registerUpdateDesktopReceiver();
registmUpdateAddressReceiver(); registmUpdateAddressReceiver();
registerTimeReceiver(); registerTimeReceiver();
registerMissCallReceiver();
} }
private void unregisterAllReceiver() { private void unregisterAllReceiver() {
@@ -734,6 +855,9 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
if (mTimeChangedReceiver != null) { if (mTimeChangedReceiver != null) {
unregisterReceiver(mTimeChangedReceiver); unregisterReceiver(mTimeChangedReceiver);
} }
if (mMissCallReceiver != null) {
unregisterReceiver(mMissCallReceiver);
}
} }
private void registNewAppReceiver() { private void registNewAppReceiver() {
@@ -785,7 +909,7 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
} }
} }
public static final String ACTION_PACKAGE_HIDE = "com.uiui.aios.ACTION_PACKAGE_HIDE"; public static final String ACTION_PACKAGE_HIDE = "com.xxpatx.os.ACTION_PACKAGE_HIDE";
private UpdateDesktopReceiver mUpdateDesktopReceiver; private UpdateDesktopReceiver mUpdateDesktopReceiver;
@@ -859,6 +983,31 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
} }
} }
private MissCallReceiver mMissCallReceiver;
public void registerMissCallReceiver() {
if (mMissCallReceiver == null) {
mMissCallReceiver = new MissCallReceiver();
}
IntentFilter filter = new IntentFilter();
filter.addAction("com.android.phone.NotificationMgr.MissedCall_intent");
registerReceiver(mMissCallReceiver, filter);
}
private class MissCallReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if ("com.android.phone.NotificationMgr.MissedCall_intent".equals(action)) {
int mMissCallCount = intent.getExtras().getInt("MissedCallNumber");
Log.e("MissCallReceiver", "onReceive: " + mMissCallCount);
mDockAppGridAdapter.notifyDataSetChanged();
}
}
}
private void setTime() { private void setTime() {
LiveEventBus LiveEventBus
.get("time") .get("time")

View File

@@ -1,5 +1,9 @@
package com.xxpatx.os.activity.phone; package com.xxpatx.os.activity.phone;
import android.content.ContentValues;
import android.database.Cursor;
import android.provider.CallLog;
import android.util.Log;
import android.view.View; import android.view.View;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
@@ -73,7 +77,33 @@ public class PhoneActivity extends BaseMvvmActivity<PhoneViewModel, ActivityPhon
@Override @Override
protected void initData() { protected void initData() {
updateMissCallRecord();
}
private void updateMissCallRecord() {
Cursor cursor = getContentResolver().query(CallLog.Calls.CONTENT_URI,
new String[]{CallLog.Calls._ID, CallLog.Calls.TYPE, CallLog.Calls.IS_READ},
" " + CallLog.Calls.TYPE + "=? and " + CallLog.Calls.IS_READ + "=?",
new String[]{String.valueOf(CallLog.Calls.MISSED_TYPE), "0"},
CallLog.Calls.DEFAULT_SORT_ORDER);
if (cursor != null && cursor.moveToFirst()) {
while (!cursor.isAfterLast()) {
String id = cursor.getString(cursor.getColumnIndex(CallLog.Calls._ID));
int is_read = cursor.getInt(cursor.getColumnIndex(CallLog.Calls.IS_READ));
Log.e(TAG, "updateMissCallRecord: id = " + id + " is_read = " + is_read);
ContentValues values = new ContentValues();
values.put(CallLog.Calls.IS_READ, 1);
int rowsAffected = getContentResolver().update(CallLog.Calls.CONTENT_URI,
values,
CallLog.Calls._ID + "=?",
new String[]{String.valueOf(id)}
);
Log.e(TAG, "updateMissCallRecord: rowsAffected = " + rowsAffected);
cursor.moveToNext();
}
cursor.close();
}
} }
@Override @Override

View File

@@ -9,6 +9,8 @@ import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.Gravity;
import android.view.View;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@@ -31,6 +33,16 @@ public class SelectNumberActivity extends BaseMvvmActivity<SelectNumberViewModel
private TelecomManager telecomManager; private TelecomManager telecomManager;
private PhoneAdapter mPhoneAdapter; private PhoneAdapter mPhoneAdapter;
@Override
public boolean setNightMode() {
return true;
}
@Override
public boolean setfitWindow() {
return true;
}
@Override @Override
public int getLayoutId() { public int getLayoutId() {
return R.layout.activity_select_number; return R.layout.activity_select_number;
@@ -41,19 +53,21 @@ public class SelectNumberActivity extends BaseMvvmActivity<SelectNumberViewModel
mViewModel.setCtx(this); mViewModel.setCtx(this);
mViewModel.setVDBinding(mViewDataBinding); mViewModel.setVDBinding(mViewDataBinding);
mViewModel.setLifecycle(getLifecycleSubject()); mViewModel.setLifecycle(getLifecycleSubject());
// mViewDataBinding.setClick(new BtnClick()); mViewDataBinding.setClick(new BtnClick());
} }
@Override @Override
public void initView() { public void initView() {
Intent intent =getIntent(); getWindow().setGravity(Gravity.BOTTOM);
if (intent==null){
Intent intent = getIntent();
if (intent == null) {
finish(); finish();
return; return;
} }
String phone = intent.getStringExtra("phone_number"); String phone = intent.getStringExtra("phone_number");
if (TextUtils.isEmpty(phone)){ if (TextUtils.isEmpty(phone)) {
finish(); finish();
return; return;
} }
@@ -82,7 +96,7 @@ public class SelectNumberActivity extends BaseMvvmActivity<SelectNumberViewModel
@Override @Override
public void initData() { public void initData() {
List<SubscriptionInfo> subscriptionInfos = subscriptionManager.getActiveSubscriptionInfoList(); List<SubscriptionInfo> subscriptionInfos = subscriptionManager.getActiveSubscriptionInfoList();
List<String> stringList =new ArrayList<>(); List<String> stringList = new ArrayList<>();
for (SubscriptionInfo subscriptionInfo : subscriptionInfos) { for (SubscriptionInfo subscriptionInfo : subscriptionInfos) {
Log.e(TAG, "initData: id = " + subscriptionInfo.getSubscriptionId()); Log.e(TAG, "initData: id = " + subscriptionInfo.getSubscriptionId());
Log.e(TAG, "initData: mCardString = " + subscriptionInfo.getCardString()); Log.e(TAG, "initData: mCardString = " + subscriptionInfo.getCardString());
@@ -98,4 +112,14 @@ public class SelectNumberActivity extends BaseMvvmActivity<SelectNumberViewModel
Log.e(TAG, "initData: end"); Log.e(TAG, "initData: end");
} }
public class BtnClick {
public void empty(View view) {
}
public void exit(View view) {
finish();
}
}
} }

View File

@@ -100,7 +100,7 @@ public class SettingActivity extends BaseMvvmActivity<SettingViewModel, Activity
} }
private void setStatus() { private void setStatus() {
boolean showFloatWindow = mMMKV.decodeBool(CommonConfig.FLOAT_WINDOW, CommonConfig.FLOAT_WINDOW_STATU); boolean showFloatWindow = Settings.Global.getInt(getContentResolver(), CommonConfig.HOVER_HOME, CommonConfig.HOVER_HOME_STATUS) == 1;
Log.e(TAG, "initView: showFloatWindow = " + showFloatWindow); Log.e(TAG, "initView: showFloatWindow = " + showFloatWindow);
mViewDataBinding.setFloatWindowEnable(showFloatWindow); mViewDataBinding.setFloatWindowEnable(showFloatWindow);
@@ -149,7 +149,7 @@ public class SettingActivity extends BaseMvvmActivity<SettingViewModel, Activity
private void showFloatingWindow() { private void showFloatingWindow() {
mViewDataBinding.setFloatWindowEnable(true); mViewDataBinding.setFloatWindowEnable(true);
mMMKV.encode(CommonConfig.FLOAT_WINDOW, true); Settings.Global.putInt(getContentResolver(), CommonConfig.HOVER_HOME, 1);
startService(new Intent(SettingActivity.this, MainService.class)); startService(new Intent(SettingActivity.this, MainService.class));
sendBroadcast(new Intent(MainService.ACTION_FLOAT_WINDOW_ON)); sendBroadcast(new Intent(MainService.ACTION_FLOAT_WINDOW_ON));
} }
@@ -157,7 +157,7 @@ public class SettingActivity extends BaseMvvmActivity<SettingViewModel, Activity
private void hideFloatingWindow() { private void hideFloatingWindow() {
mViewDataBinding.setFloatWindowEnable(false); mViewDataBinding.setFloatWindowEnable(false);
mMMKV.encode(CommonConfig.FLOAT_WINDOW, false); Settings.Global.putInt(getContentResolver(), CommonConfig.HOVER_HOME, 0);
startService(new Intent(SettingActivity.this, MainService.class)); startService(new Intent(SettingActivity.this, MainService.class));
sendBroadcast(new Intent(MainService.ACTION_FLOAT_WINDOW_OFF)); sendBroadcast(new Intent(MainService.ACTION_FLOAT_WINDOW_OFF));
} }
@@ -206,7 +206,7 @@ public class SettingActivity extends BaseMvvmActivity<SettingViewModel, Activity
public class BtnClick { public class BtnClick {
public void openFloat(View view) { public void openFloat(View view) {
boolean floatWindowEnable = mMMKV.decodeBool(CommonConfig.FLOAT_WINDOW, CommonConfig.FLOAT_WINDOW_STATU); boolean floatWindowEnable = Settings.Global.getInt(getContentResolver(), CommonConfig.HOVER_HOME, CommonConfig.HOVER_HOME_STATUS) == 1;
if (floatWindowEnable) { if (floatWindowEnable) {
hideFloatingWindow(); hideFloatingWindow();
} else { } else {
@@ -267,7 +267,7 @@ public class SettingActivity extends BaseMvvmActivity<SettingViewModel, Activity
intent.putExtra("auto_answer", !autoAccept); intent.putExtra("auto_answer", !autoAccept);
sendBroadcast(intent); sendBroadcast(intent);
} else { } else {
boolean floatWindowEnable = mMMKV.decodeBool(CommonConfig.FLOAT_WINDOW, CommonConfig.FLOAT_WINDOW_STATU); boolean floatWindowEnable = Settings.Global.getInt(getContentResolver(), CommonConfig.HOVER_HOME, CommonConfig.HOVER_HOME_STATUS) == 1;
if (floatWindowEnable) { if (floatWindowEnable) {
Toaster.showLong("因为系统限制,请先关闭悬浮窗功能,开启自动接听后再打开悬浮窗"); Toaster.showLong("因为系统限制,请先关闭悬浮窗功能,开启自动接听后再打开悬浮窗");
} else { } else {

View File

@@ -58,6 +58,7 @@ public class CallRecordAdapter extends RecyclerView.Adapter<CallRecordAdapter.Ho
@Override @Override
public void onBindViewHolder(@NonNull Holder holder, int position) { public void onBindViewHolder(@NonNull Holder holder, int position) {
RecordsInfo recordsInfo = mRecordsInfoList.get(position); RecordsInfo recordsInfo = mRecordsInfoList.get(position);
// Log.e(TAG, "onBindViewHolder: _id = " + recordsInfo.getId());
String phone = recordsInfo.getNumber(); String phone = recordsInfo.getNumber();
holder.tv_phone.setText(phone); holder.tv_phone.setText(phone);
holder.tv_name.setText(getName(phone)); holder.tv_name.setText(getName(phone));
@@ -84,9 +85,25 @@ public class CallRecordAdapter extends RecyclerView.Adapter<CallRecordAdapter.Ho
break; break;
} }
holder.tv_time.setText(mSimpleDateFormat.format(new Date(recordsInfo.getDate()))); holder.tv_time.setText(mSimpleDateFormat.format(new Date(recordsInfo.getDate())));
holder.root.setOnClickListener(new View.OnClickListener() { holder.iv_avatar.setOnClickListener(view -> call(phone));
holder.cl_info.setOnClickListener(view -> call(phone));
holder.iv_remove.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
try {
mContext.getContentResolver().delete(CallLog.Calls.CONTENT_URI, CallLog.Calls._ID + "=?", new String[]{String.valueOf(recordsInfo.getId())});
mRecordsInfoList.remove(position);
notifyDataSetChanged();
} catch (Exception e) {
Log.e(TAG, "onClick: " + e.getMessage());
}
}
});
}
private void call(String phone) {
if (Utils.isMultiSim(mContext)) { if (Utils.isMultiSim(mContext)) {
Intent intent = new Intent(mContext, SelectNumberActivity.class); Intent intent = new Intent(mContext, SelectNumberActivity.class);
intent.putExtra("phone_number", phone); intent.putExtra("phone_number", phone);
@@ -103,22 +120,6 @@ public class CallRecordAdapter extends RecyclerView.Adapter<CallRecordAdapter.Ho
} }
} }
} }
});
holder.iv_remove.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String queryString = "number=" + recordsInfo.getNumber();
try {
mContext.getContentResolver().delete(CallLog.Calls.CONTENT_URI, queryString, null);
mRecordsInfoList.remove(position);
notifyDataSetChanged();
} catch (Exception e) {
Log.e(TAG, "onClick: " + e.getMessage());
}
}
});
}
private String getName(String phone) { private String getName(String phone) {
if (mContactMap != null) { if (mContactMap != null) {
@@ -145,7 +146,7 @@ public class CallRecordAdapter extends RecyclerView.Adapter<CallRecordAdapter.Ho
} }
class Holder extends RecyclerView.ViewHolder { class Holder extends RecyclerView.ViewHolder {
ConstraintLayout root; ConstraintLayout root, cl_info;
NiceImageView iv_avatar; NiceImageView iv_avatar;
ImageView iv_remove; ImageView iv_remove;
ImageView tv_state; ImageView tv_state;
@@ -156,6 +157,7 @@ public class CallRecordAdapter extends RecyclerView.Adapter<CallRecordAdapter.Ho
public Holder(@NonNull View itemView) { public Holder(@NonNull View itemView) {
super(itemView); super(itemView);
root = itemView.findViewById(R.id.root); root = itemView.findViewById(R.id.root);
cl_info = itemView.findViewById(R.id.cl_info);
iv_avatar = itemView.findViewById(R.id.iv_avatar); iv_avatar = itemView.findViewById(R.id.iv_avatar);
iv_remove = itemView.findViewById(R.id.iv_remove); iv_remove = itemView.findViewById(R.id.iv_remove);
tv_state = itemView.findViewById(R.id.tv_state); tv_state = itemView.findViewById(R.id.tv_state);

View File

@@ -2,7 +2,7 @@ package com.xxpatx.os.adapter;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.util.Log; import android.provider.Settings;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@@ -13,23 +13,19 @@ import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.google.gson.JsonObject; import com.hjq.toast.Toaster;
import com.xxpatx.os.R; import com.xxpatx.os.R;
import com.xxpatx.os.activity.service.ServiceActivity; import com.xxpatx.os.activity.service.ServiceActivity;
import com.xxpatx.os.bean.BaseResponse;
import com.xxpatx.os.bean.DailyAppBean; import com.xxpatx.os.bean.DailyAppBean;
import com.xxpatx.os.config.CommonConfig;
import com.xxpatx.os.dialog.DailyAppDialog; import com.xxpatx.os.dialog.DailyAppDialog;
import com.xxpatx.os.manager.AppStatusManager; import com.xxpatx.os.manager.AppStatusManager;
import com.xxpatx.os.network.NetInterfaceManager;
import com.xxpatx.os.service.NotificationService; import com.xxpatx.os.service.NotificationService;
import com.xxpatx.os.utils.ApkUtils; import com.xxpatx.os.utils.ApkUtils;
import com.xxpatx.os.utils.AppUsedTimeUtils; import com.xxpatx.os.utils.AppUsedTimeUtils;
import java.util.List; import java.util.List;
import io.reactivex.rxjava3.core.Observer;
import io.reactivex.rxjava3.disposables.Disposable;
public class DailyAppAdapter extends RecyclerView.Adapter<DailyAppAdapter.Holder> { public class DailyAppAdapter extends RecyclerView.Adapter<DailyAppAdapter.Holder> {
private static final String TAG = "DailyAppAdapter"; private static final String TAG = "DailyAppAdapter";
@@ -95,6 +91,11 @@ public class DailyAppAdapter extends RecyclerView.Adapter<DailyAppAdapter.Holder
private void showDialog(DailyAppBean dailyAppBean) { private void showDialog(DailyAppBean dailyAppBean) {
int appLockCtrl = Settings.Global.getInt(mContext.getContentResolver(), CommonConfig.APP_LOCK_CTRL, 0);
if (appLockCtrl == 0) {
Toaster.showLong("已禁止桌面编辑");
return;
}
DailyAppDialog dailyAppDialog = new DailyAppDialog(mContext); DailyAppDialog dailyAppDialog = new DailyAppDialog(mContext);
dailyAppDialog.setTitle("放到桌面"); dailyAppDialog.setTitle("放到桌面");
dailyAppDialog.setMessage(dailyAppBean.getAppName()); dailyAppDialog.setMessage(dailyAppBean.getAppName());

View File

@@ -2,6 +2,9 @@ package com.xxpatx.os.adapter;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.database.Cursor;
import android.provider.CallLog;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@@ -20,6 +23,7 @@ import com.xxpatx.os.utils.ApkUtils;
import java.util.List; import java.util.List;
public class DockAppGridAdapter extends BaseAdapter { public class DockAppGridAdapter extends BaseAdapter {
private static final String TAG = "DockAppGridAdapter";
private Context mContext; private Context mContext;
private List<DockApp> mDockApps; private List<DockApp> mDockApps;
@@ -91,7 +95,16 @@ public class DockAppGridAdapter extends BaseAdapter {
} }
} }
}); });
int size = NotificationService.getNotificationLength(pkg); int size;
switch (pkg) {
case "com.android.dialer":
case "xxpatx.os.dialer":
size = readMissCall();
Log.e(TAG, "getView: readMissCall = " + size);
break;
default:
size = NotificationService.getNotificationLength(pkg);
}
if (size == 0) { if (size == 0) {
holder.bg.setVisibility(View.GONE); holder.bg.setVisibility(View.GONE);
} else if (size < 99) { } else if (size < 99) {
@@ -105,6 +118,20 @@ public class DockAppGridAdapter extends BaseAdapter {
return convertView; return convertView;
} }
private int readMissCall() {
int result = 0;
Cursor cursor = mContext.getContentResolver().query(CallLog.Calls.CONTENT_URI,
new String[]{CallLog.Calls._ID, CallLog.Calls.TYPE, CallLog.Calls.IS_READ},
" " + CallLog.Calls.TYPE + "=? and " + CallLog.Calls.IS_READ + "=?",
new String[]{String.valueOf(CallLog.Calls.MISSED_TYPE), "0"},
CallLog.Calls.DEFAULT_SORT_ORDER);
if (cursor != null) {
result = cursor.getCount();
cursor.close();
}
return result;
}
static class ViewHolder { static class ViewHolder {
ConstraintLayout root; ConstraintLayout root;
ImageView iv_icon; ImageView iv_icon;

View File

@@ -90,14 +90,13 @@ public class PhoneAdapter extends RecyclerView.Adapter<PhoneAdapter.Holder> {
public class Holder extends RecyclerView.ViewHolder { public class Holder extends RecyclerView.ViewHolder {
ConstraintLayout root; ConstraintLayout root;
TextView tv_sim, tv_number; TextView tv_number;
ImageView iv_card; ImageView iv_card;
public Holder(@NonNull View itemView) { public Holder(@NonNull View itemView) {
super(itemView); super(itemView);
root = itemView.findViewById(R.id.root); root = itemView.findViewById(R.id.root);
iv_card = itemView.findViewById(R.id.iv_card); iv_card = itemView.findViewById(R.id.iv_card);
tv_sim = itemView.findViewById(R.id.tv_sim);
tv_number = itemView.findViewById(R.id.tv_number); tv_number = itemView.findViewById(R.id.tv_number);
} }
} }

View File

@@ -10,12 +10,21 @@ import java.io.Serializable;
public class RecordsInfo implements Serializable { public class RecordsInfo implements Serializable {
private static final long serialVersionUID = -8677336093725878416L; private static final long serialVersionUID = -8677336093725878416L;
String id;
String name; String name;
String number; String number;
long date; long date;
int duration; int duration;
int type; int type;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() { public String getName() {
return name; return name;
} }

View File

@@ -5,7 +5,6 @@ import com.google.gson.Gson;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
public class SystemSettings implements Serializable { public class SystemSettings implements Serializable {
@@ -37,7 +36,7 @@ public class SystemSettings implements Serializable {
int qch_restore; int qch_restore;
int setting_browserInput; int setting_browserInput;
int dev_mode; int dev_mode;
List<Contact> setting_sos; String setting_sos;
String setting_volume; String setting_volume;
String setting_luminance; String setting_luminance;
String setting_typeface; String setting_typeface;
@@ -55,11 +54,22 @@ public class SystemSettings implements Serializable {
int setting_location; int setting_location;
int setting_charge; int setting_charge;
int setting_other_appInstaller; int setting_other_appInstaller;
int is_health; int is_health;
int is_shopping; int is_shopping;
int is_info; int is_info;
int is_quickapp;//快捷应用开关 0关1开
String quickapp; //快捷应用包名
int is_seek;//查找模式开关 0关1开
int is_lose;//丢失模式开关 0关1开
String lose_str; //丢失模式描述文字
int last_screen;
int hover_home;
int sos_ctrl;
int alarm_clock_ctrl;
int app_lock_ctrl;
int exit_ctrl;
int connect_page_ctrl;
int connect_edit_ctrl;
public int getQch_restore() { public int getQch_restore() {
return qch_restore; return qch_restore;
@@ -262,11 +272,11 @@ public class SystemSettings implements Serializable {
this.setting_hotspot = setting_hotspot; this.setting_hotspot = setting_hotspot;
} }
public List<Contact> getSetting_sos() { public String getSetting_sos() {
return setting_sos; return setting_sos;
} }
public void setSetting_sos(List<Contact> setting_sos) { public void setSetting_sos(String setting_sos) {
this.setting_sos = setting_sos; this.setting_sos = setting_sos;
} }
@@ -422,6 +432,110 @@ public class SystemSettings implements Serializable {
this.is_info = is_info; this.is_info = is_info;
} }
public int getIs_quickapp() {
return is_quickapp;
}
public void setIs_quickapp(int is_quickapp) {
this.is_quickapp = is_quickapp;
}
public String getQuickapp() {
return quickapp;
}
public void setQuickapp(String quickapp) {
this.quickapp = quickapp;
}
public int getIs_seek() {
return is_seek;
}
public void setIs_seek(int is_seek) {
this.is_seek = is_seek;
}
public int getIs_lose() {
return is_lose;
}
public void setIs_lose(int is_lose) {
this.is_lose = is_lose;
}
public String getLose_str() {
return lose_str;
}
public void setLose_str(String lose_str) {
this.lose_str = lose_str;
}
public int getLast_screen() {
return last_screen;
}
public void setLast_screen(int last_screen) {
this.last_screen = last_screen;
}
public int getHover_home() {
return hover_home;
}
public void setHover_home(int hover_home) {
this.hover_home = hover_home;
}
public int getSos_ctrl() {
return sos_ctrl;
}
public void setSos_ctrl(int sos_ctrl) {
this.sos_ctrl = sos_ctrl;
}
public int getAlarm_clock_ctrl() {
return alarm_clock_ctrl;
}
public void setAlarm_clock_ctrl(int alarm_clock_ctrl) {
this.alarm_clock_ctrl = alarm_clock_ctrl;
}
public int getApp_lock_ctrl() {
return app_lock_ctrl;
}
public void setApp_lock_ctrl(int app_lock_ctrl) {
this.app_lock_ctrl = app_lock_ctrl;
}
public int getExit_ctrl() {
return exit_ctrl;
}
public void setExit_ctrl(int exit_ctrl) {
this.exit_ctrl = exit_ctrl;
}
public int getConnect_page_ctrl() {
return connect_page_ctrl;
}
public void setConnect_page_ctrl(int connect_page_ctrl) {
this.connect_page_ctrl = connect_page_ctrl;
}
public int getConnect_edit_ctrl() {
return connect_edit_ctrl;
}
public void setConnect_edit_ctrl(int connect_edit_ctrl) {
this.connect_edit_ctrl = connect_edit_ctrl;
}
@Override @Override
public String toString() { public String toString() {
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString(); return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();

View File

@@ -81,9 +81,11 @@ public class CommonConfig {
public static final String VOICE_BROADCAST = "voice_broadcast_key"; public static final String VOICE_BROADCAST = "voice_broadcast_key";
/*微信语音自动接听*/ /*微信语音自动接听*/
public static final String WECHAT_CALL_AUTO_ACCEPT = "wechat_call_auto_accept"; public static final String WECHAT_CALL_AUTO_ACCEPT = "wechat_call_auto_accept";
/*本地设置的*/
/*悬浮窗*/ /*悬浮窗*/
public static final String FLOAT_WINDOW = "FloatWindowEnable"; // public static final String FLOAT_WINDOW = "FloatWindowEnable";
public static final boolean FLOAT_WINDOW_STATU = false; // public static final boolean FLOAT_WINDOW_STATU = false;
/*禁用音量键*/ /*禁用音量键*/
public static final String DISABLE_VOLUME_KEY = "disable_volume_key"; public static final String DISABLE_VOLUME_KEY = "disable_volume_key";
/*修改联系人禁用*/ /*修改联系人禁用*/
@@ -91,6 +93,20 @@ 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 static final String HOVER_HOME = "hover_home";
/*默认状态*/
public static final int HOVER_HOME_STATUS = 0;
/*禁用SOS*/
public static final String DISABLE_SOS = "sos_ctrl";
/*禁用闹钟修改*/
public static final String ALARM_CLOCK_CTRL = "alarm_clock_ctrl";
/*应用锁定开关*/
public static final String APP_LOCK_CTRL = "app_lock_ctrl";
public final static String ACTION_STATUS_BAR_STATE = "xiaoxintong_statusBar_state"; 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_SHOW_STATUS_BAR = "xiaoxintong_show_statusBar";
@@ -100,4 +116,6 @@ public class CommonConfig {
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";
} }

View File

@@ -1,4 +1,4 @@
package com.xxpatx.os.view; package com.xxpatx.os.custom;
import android.content.Context; import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;

View File

@@ -1,4 +1,4 @@
package com.xxpatx.os.view; package com.xxpatx.os.custom;
// add by codemx.cn ---- 20190712 ---plus- start // add by codemx.cn ---- 20190712 ---plus- start

View File

@@ -1,4 +1,4 @@
package com.xxpatx.os.base; package com.xxpatx.os.custom;
import android.content.Context; import android.content.Context;
import android.widget.ImageView; import android.widget.ImageView;

View File

@@ -1,4 +1,4 @@
package com.xxpatx.os.view; package com.xxpatx.os.custom;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;

View File

@@ -1,4 +1,4 @@
package com.xxpatx.os.view; package com.xxpatx.os.custom;
import android.graphics.Rect; import android.graphics.Rect;
import android.view.View; import android.view.View;

View File

@@ -1,4 +1,4 @@
package com.xxpatx.os.view; package com.xxpatx.os.custom;
import android.graphics.Rect; import android.graphics.Rect;
import android.view.View; import android.view.View;

View File

@@ -1,4 +1,4 @@
package com.xxpatx.os.view; package com.xxpatx.os.custom;
import android.util.SparseArray; import android.util.SparseArray;

View File

@@ -27,8 +27,8 @@ import com.trello.rxlifecycle4.RxLifecycle;
import com.trello.rxlifecycle4.android.FragmentEvent; import com.trello.rxlifecycle4.android.FragmentEvent;
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.screenlock.ScreenLockActivity;
import com.xxpatx.os.activity.dailyapp.DailyAppActivity; 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.activity.service.ServiceActivity;
import com.xxpatx.os.base.BaseFragment; import com.xxpatx.os.base.BaseFragment;
import com.xxpatx.os.bean.BaseResponse; import com.xxpatx.os.bean.BaseResponse;
@@ -48,7 +48,6 @@ import com.xxpatx.os.utils.IconUtils;
import com.xxpatx.os.view.MyGridLayout; import com.xxpatx.os.view.MyGridLayout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import io.reactivex.rxjava3.core.Observer; import io.reactivex.rxjava3.core.Observer;
import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.disposables.Disposable;
@@ -403,6 +402,11 @@ public class AppListFragment extends BaseFragment {
} }
private void showHideDialog(DesktopIcon desktopIcon) { 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 label = desktopIcon.getTitle();
String pkg = desktopIcon.getPackage(); String pkg = desktopIcon.getPackage();
DailyAppDialog dailyAppDialog = new DailyAppDialog(mContext); DailyAppDialog dailyAppDialog = new DailyAppDialog(mContext);

View File

@@ -4,7 +4,6 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraManager; import android.hardware.camera2.CameraManager;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
@@ -26,20 +25,19 @@ import com.qweather.sdk.bean.weather.WeatherNowBean;
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.FlashlightActivity;
import com.xxpatx.os.activity.NetworkActivity;
import com.xxpatx.os.activity.contact.AddWechatContactActivity; 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.setting.SettingActivity;
import com.xxpatx.os.activity.weather.WeatherActivity; import com.xxpatx.os.activity.weather.WeatherActivity;
import com.xxpatx.os.alarm.AlarmClockData; import com.xxpatx.os.alarm.AlarmClockData;
import com.xxpatx.os.alarm.AlarmUtils; import com.xxpatx.os.alarm.AlarmUtils;
import com.xxpatx.os.base.mvvm.fragment.BaseMvvmFragment; 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.DesktopIcon;
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.FragmentHomeBinding; import com.xxpatx.os.databinding.FragmentHomeBinding;
import com.xxpatx.os.dialog.SingleDialog; import com.xxpatx.os.dialog.SingleDialog;
import com.xxpatx.os.network.NetInterfaceManager;
import com.xxpatx.os.push.PushManager; import com.xxpatx.os.push.PushManager;
import com.xxpatx.os.utils.ApkUtils; import com.xxpatx.os.utils.ApkUtils;
import com.xxpatx.os.utils.DayUtils; 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) { private void showNoData(String title, String msg) {
SingleDialog dialog = new SingleDialog(mContext); SingleDialog dialog = new SingleDialog(mContext);
dialog.setTitle(title) dialog.setTitle(title)
@@ -501,24 +468,26 @@ public class HomeFragment extends BaseMvvmFragment<HomeViewModel, FragmentHomeBi
} }
public void openNetwork(View view) { 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) { public void openFlash(View view) {
try { startActivity(new Intent(mContext, FlashlightActivity.class));
String cameraId = cameraManager.getCameraIdList()[0]; // try {
cameraManager.setTorchMode(cameraId, !flashing); // String cameraId = cameraManager.getCameraIdList()[0];
flashing = !flashing; // cameraManager.setTorchMode(cameraId, !flashing);
mViewDataBinding.setFlashing(flashing); // flashing = !flashing;
} catch (CameraAccessException e) { // mViewDataBinding.setFlashing(flashing);
e.printStackTrace(); // } catch (CameraAccessException e) {
Log.e(TAG, "openFlash: " + e.getMessage()); // e.printStackTrace();
Toaster.show("打开手电筒失败"); // Log.e(TAG, "openFlash: " + e.getMessage());
} // Toaster.show("打开手电筒失败");
// }
} }
public void openCalendar(View view) { public void openCalendar(View view) {
ApkUtils.openApp(mContext, "cn.etouch.ecalendar"); ApkUtils.openApp(mContext, "com.honghui.huangli");
} }
public void toWeather(View view) { public void toWeather(View view) {

View File

@@ -15,6 +15,7 @@ import android.view.View;
import com.hjq.toast.Toaster; 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.ImeiActivity;
import com.xxpatx.os.activity.contact.AddWechatContactActivity; import com.xxpatx.os.activity.contact.AddWechatContactActivity;
import com.xxpatx.os.activity.selectnumber.SelectNumberActivity; import com.xxpatx.os.activity.selectnumber.SelectNumberActivity;
import com.xxpatx.os.base.mvvm.fragment.BaseMvvmFragment; import com.xxpatx.os.base.mvvm.fragment.BaseMvvmFragment;
@@ -92,12 +93,16 @@ public class DialerFragment extends BaseMvvmFragment<DialerViewModel, FragmentDi
@Override @Override
public void onTextChanged(CharSequence s, int start, int before, int count) { public void onTextChanged(CharSequence s, int start, int before, int count) {
Log.e("initView", "onTextChanged: " + s); Log.e("initView", "onTextChanged: " + s);
if ("*#*#4636#*#*".contentEquals(s)) { String code = s.toString();
ApkUtils.openPackage(mContext, "com.android.settings", "com.android.settings.Settings$TestingSettingsActivity"); switch (code) {
} else if ("*#*#0011234#*#*".contentEquals(s)) { case "*#*#4636#*#*":
ApkUtils.openPackage(mContext, "com.mediatek.factorymode", "com.mediatek.factorymode.FactoryMode"); case "*#*#0011234#*#*":
} else if ("*#*#0011231#*#*".contentEquals(s)) { case "*#*#0011231#*#*":
ApkUtils.openPackage(mContext, "com.android.agingtest", "com.android.agingtest.AgingTest"); 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); 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 @Override

View File

@@ -68,7 +68,8 @@ public class RecordViewModel extends BaseViewModel<FragmentRecordBinding, Fragme
* *
*/ */
Cursor cursor = resolver.query(CallLog.Calls.CONTENT_URI, // 查询通话记录的URI 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.NUMBER// 通话记录的电话号码
, CallLog.Calls.DATE// 通话记录的日期 , CallLog.Calls.DATE// 通话记录的日期
, CallLog.Calls.DURATION// 通话时长 , CallLog.Calls.DURATION// 通话时长
@@ -78,6 +79,7 @@ public class RecordViewModel extends BaseViewModel<FragmentRecordBinding, Fragme
// 3.通过Cursor获得数据 // 3.通过Cursor获得数据
List<RecordsInfo> list = new ArrayList<>(); List<RecordsInfo> list = new ArrayList<>();
while (cursor.moveToNext()) { while (cursor.moveToNext()) {
String id = cursor.getString(cursor.getColumnIndex(CallLog.Calls._ID));
String name = cursor.getString(cursor.getColumnIndex(CallLog.Calls.CACHED_NAME)); String name = cursor.getString(cursor.getColumnIndex(CallLog.Calls.CACHED_NAME));
String number = cursor.getString(cursor.getColumnIndex(CallLog.Calls.NUMBER)); String number = cursor.getString(cursor.getColumnIndex(CallLog.Calls.NUMBER));
long dateLong = cursor.getLong(cursor.getColumnIndex(CallLog.Calls.DATE)); 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)); int type = cursor.getInt(cursor.getColumnIndex(CallLog.Calls.TYPE));
RecordsInfo recordsInfo = new RecordsInfo(); RecordsInfo recordsInfo = new RecordsInfo();
recordsInfo.setId(id);
recordsInfo.setName(name); recordsInfo.setName(name);
recordsInfo.setNumber(number); recordsInfo.setNumber(number);
recordsInfo.setDate(dateLong); recordsInfo.setDate(dateLong);

View File

@@ -2,6 +2,7 @@ package com.xxpatx.os.fragment.settings;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.provider.Settings;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
@@ -154,8 +155,13 @@ public class SettingsFragment extends BaseMvvmFragment<SettingsViewModel, Fragme
} }
public void openEmergency(View view) { public void openEmergency(View view) {
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)); startActivity(new Intent(mContext, EmergencyActivity.class));
} }
}
public void toAppstore(View view) { public void toAppstore(View view) {
if (!ApkUtils.openPackage(mContext, "com.xxpatx.store")) { if (!ApkUtils.openPackage(mContext, "com.xxpatx.store")) {

View File

@@ -31,7 +31,7 @@ public class AppStatusManager {
public static final String APP_STATUS_MANAGER_KEY = "AppStatusManagerSet"; public static final String APP_STATUS_MANAGER_KEY = "AppStatusManagerSet";
private static final Set<String> defaultHiedApp = new HashSet<String>() {{ private static final Set<String> defaultHiedApp = new HashSet<String>() {{
this.add("om.android.fmradio");//收音机 this.add("om.android.fmradio");//收音机
this.add("com.android.mms");//信息 // this.add("com.android.mms");//信息
this.add("com.android.gallery3d"); this.add("com.android.gallery3d");
this.add("com.android.documentsui"); this.add("com.android.documentsui");
this.add("com.android.calculator2"); this.add("com.android.calculator2");

View File

@@ -68,9 +68,9 @@ 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.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.AlarmClockGetApi;
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.alarmclock.AlarmClockUpdateApi;
import com.xxpatx.os.network.api.uiui.app.RunNewApp; import com.xxpatx.os.network.api.uiui.app.RunNewApp;
@@ -1203,18 +1203,7 @@ public class NetInterfaceManager {
mMMKV.encode("is_health", systemSettings.getIs_health()); mMMKV.encode("is_health", systemSettings.getIs_health());
mMMKV.encode("is_shopping", systemSettings.getIs_shopping()); mMMKV.encode("is_shopping", systemSettings.getIs_shopping());
mMMKV.encode("is_info", systemSettings.getIs_info()); mMMKV.encode("is_info", systemSettings.getIs_info());
List<Contact> setting_sos = systemSettings.getSetting_sos(); String s = systemSettings.getSetting_sos();
if (setting_sos == null || setting_sos.size() == 0) {
mCacheHelper.put(UrlAddress.GET_SETTINGS, "");
if (callback != null) callback.setEmpty();
} else {
List<Contact> emergencyContact = setting_sos.stream().filter(contact -> contact.getIs_urgent() == 1).collect(Collectors.toList());
mCacheHelper.put(UrlAddress.GET_SETTINGS, GsonUtils.toJSONString(setting_sos));
if (callback != null) {
callback.setContact(setting_sos);
callback.setEmergencyContact(emergencyContact);
}
}
} else { } else {
mCacheHelper.put(UrlAddress.GET_SETTINGS, ""); mCacheHelper.put(UrlAddress.GET_SETTINGS, "");
if (callback != null) callback.setEmpty(); if (callback != null) callback.setEmpty();

View File

@@ -153,12 +153,12 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
// ApkUtils.UninstallAPP(this, "com.joytv.live"); // ApkUtils.UninstallAPP(this, "com.joytv.live");
// ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader"); // ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
mFloatWindowEnable = mMMKV.decodeBool(CommonConfig.FLOAT_WINDOW, CommonConfig.FLOAT_WINDOW_STATU); mFloatWindowEnable = Settings.Global.getInt(getContentResolver(), CommonConfig.HOVER_HOME, CommonConfig.HOVER_HOME_STATUS) == 1;
mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE); mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
showPopupWindow(); showPopupWindow();
Aria.init(this);
Aria.download(this).register(); Aria.download(this).register();
mPresenter = new MainSPresenter(this); mPresenter = new MainSPresenter(this);
mPresenter.attachView(this); mPresenter.attachView(this);
mPresenter.setLifecycle(lifecycleSubject); mPresenter.setLifecycle(lifecycleSubject);
@@ -532,8 +532,8 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
} }
} }
public static final String ACTION_FLOAT_WINDOW_ON = "com.tt.float.window.on"; public static final String ACTION_FLOAT_WINDOW_ON = "com.xxpatx.os.float.window.on";
public static final String ACTION_FLOAT_WINDOW_OFF = "com.tt.float.window.off"; public static final String ACTION_FLOAT_WINDOW_OFF = "com.xxpatx.os.float.window.off";
private WindowReceiver mWindowReceiver; private WindowReceiver mWindowReceiver;
@@ -557,12 +557,12 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
} }
switch (action) { switch (action) {
case ACTION_FLOAT_WINDOW_ON: case ACTION_FLOAT_WINDOW_ON:
mMMKV.encode(CommonConfig.FLOAT_WINDOW, true); // Settings.Global.putInt(getContentResolver(), CommonConfig.HOVER_HOME, 1);
mFloatWindowEnable = true; mFloatWindowEnable = true;
showPopupWindow(); showPopupWindow();
break; break;
case ACTION_FLOAT_WINDOW_OFF: case ACTION_FLOAT_WINDOW_OFF:
mMMKV.encode(CommonConfig.FLOAT_WINDOW, false); // Settings.Global.putInt(getContentResolver(), CommonConfig.HOVER_HOME, 0);
mFloatWindowEnable = false; mFloatWindowEnable = false;
if (mWindowManager != null && mBallView != null) { if (mWindowManager != null && mBallView != null) {
if (mBallView.isAttachedToWindow()) { if (mBallView.isAttachedToWindow()) {
@@ -638,7 +638,7 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
} }
private void killBackgroundApp() { private void killBackgroundApp() {
List<String> pkgList = ApkUtils.queryFilterAppList(this); List<String> pkgList = ApkUtils.getRuningPackageList(this);
for (String pkg : pkgList) { for (String pkg : pkgList) {
if (pkg.equalsIgnoreCase(BuildConfig.APPLICATION_ID) if (pkg.equalsIgnoreCase(BuildConfig.APPLICATION_ID)
|| "com.xxpatx.sn".equals(pkg) || "com.xxpatx.sn".equals(pkg)

View File

@@ -1,5 +1,6 @@
package com.xxpatx.os.utils; package com.xxpatx.os.utils;
import android.app.ActivityManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
@@ -51,6 +52,8 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Set; import java.util.Set;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers; import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
@@ -386,12 +389,12 @@ public class ApkUtils {
resolveInfos.add(resolveInfo); resolveInfos.add(resolveInfo);
} }
} else { } else {
// if ("com.xxpatx.sn".equals(pkg)) { if ("com.android.mms".equals(pkg)) {
// resolveInfos.add(resolveInfo); resolveInfos.add(resolveInfo);
// } else { } else {
Log.e(TAG, "getAppstoreAppInfo: pkgSet ! contains " + pkg); Log.e(TAG, "getAppstoreAppInfo: pkgSet ! contains " + pkg);
AppStatusManager.getInstance().addHidedApp(pkg); AppStatusManager.getInstance().addHidedApp(pkg);
// } }
} }
} else { } else {
if (allPackages.contains(pkg) && !excludePackageName.contains(pkg)) { if (allPackages.contains(pkg) && !excludePackageName.contains(pkg)) {
@@ -492,6 +495,34 @@ public class ApkUtils {
return applicationInfos; return applicationInfos;
} }
public static List<String> getRuningPackageList(Context context) {
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> runningAppProcesses = activityManager.getRunningAppProcesses();
Set<String> map = runningAppProcesses.stream().map(new Function<ActivityManager.RunningAppProcessInfo, String>() {
@Override
public String apply(ActivityManager.RunningAppProcessInfo runningAppProcessInfo) {
String processName = runningAppProcessInfo.processName;
String[] split = processName.split(":");
return split[0];
}
}).collect(Collectors.toSet());
map.remove("system");
map.remove("android");
map.remove("com.android.networkstack.process");
map.remove("android.process.media");
map.remove("com.android.dreams.basic");
map.remove("com.android.musicfx");
map.remove("say.whatever");
Set<String> filter = map.stream().filter(new Predicate<String>() {
@Override
public boolean test(String s) {
return !ApkUtils.isSystemApp(context, s);
}
}).collect(Collectors.toSet());
Log.e(TAG, "getRuningPackageList: " + filter);
return new ArrayList<>(filter);
}
public static PackageInfo getPackageInfo(Context context, String pkg) { public static PackageInfo getPackageInfo(Context context, String pkg) {
PackageManager packageManager = context.getPackageManager(); PackageManager packageManager = context.getPackageManager();
PackageInfo packageInfo = null; PackageInfo packageInfo = null;

View File

@@ -324,19 +324,19 @@ public class Utils {
return result; return result;
} }
public static boolean isMultiSim(Context context){ public static boolean isMultiSim(Context context) {
boolean result = false; boolean result = false;
TelecomManager telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); TelecomManager telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
if(telecomManager != null){ if (telecomManager != null) {
List<PhoneAccountHandle> phoneAccountHandleList = telecomManager.getCallCapablePhoneAccounts(); List<PhoneAccountHandle> phoneAccountHandleList = telecomManager.getCallCapablePhoneAccounts();
result = phoneAccountHandleList.size() >= 2; result = phoneAccountHandleList.size() >= 2;
} }
return result; return result;
} }
public static void call(Context context, int id, String telNum){ public static void call(Context context, int id, String telNum) {
TelecomManager telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); TelecomManager telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
if(telecomManager != null){ if (telecomManager != null) {
List<PhoneAccountHandle> phoneAccountHandleList = telecomManager.getCallCapablePhoneAccounts(); List<PhoneAccountHandle> phoneAccountHandleList = telecomManager.getCallCapablePhoneAccounts();
Intent intent = new Intent(); Intent intent = new Intent();
intent.setAction(Intent.ACTION_CALL); intent.setAction(Intent.ACTION_CALL);
@@ -346,4 +346,24 @@ public class Utils {
} }
} }
@SuppressLint("HardwareIds")
public static String getIMEI(Context context, int slotIndex) {
String imei;
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
imei = tm.getImei(slotIndex);
} else {
imei = tm.getDeviceId(slotIndex);
}
if (TextUtils.isEmpty(imei)) {
return "暂无数据";
}
return imei;
}
public static String getEmid(Context context) {
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
String meid = telephonyManager.getDeviceId();
return meid;
}
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 736 B

After

Width:  |  Height:  |  Size: 1023 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 969 B

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 内部颜色 -->
<solid android:color="#03C666" />
<!-- 圆角的幅度 -->
<corners android:radius="32dp" />
<padding
android:bottom="8dp"
android:left="12dp"
android:right="12dp"
android:top="8dp" />
</shape>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 内部颜色 -->
<solid android:color="@color/white" />
<!-- 圆角的幅度 -->
<corners android:radius="16dp" />
<padding
android:bottom="8dp"
android:left="8dp"
android:right="8dp"
android:top="8dp" />
</shape>

View File

@@ -0,0 +1,92 @@
<?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.FlashlightActivity">
<data>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#323a4c">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_exit"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@drawable/general_setting_bg"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_back"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="16dp"
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" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_trun"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@+id/cl_bottom"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cl_exit"
app:layout_constraintVertical_bias="0.385">
<TextView
android:id="@+id/tv_flashlight_statu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="手电筒"
android:textColor="@color/white"
android:textSize="30sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_statu"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="64dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/icon_flash_light_close"
app:layout_constraintEnd_toEndOf="@+id/tv_flashlight_statu"
app:layout_constraintStart_toStartOf="@+id/tv_flashlight_statu"
app:layout_constraintTop_toBottomOf="@+id/tv_flashlight_statu" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_bottom"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@@ -0,0 +1,108 @@
<?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.ImeiActivity">
<data>
<variable
name="click"
type="com.xxpatx.os.activity.ImeiActivity.BtnClick" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:onClick="@{click::exit}">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:background="@drawable/select_number_bg"
android:onClick="@{click::empty}"
android:orientation="vertical"
android:padding="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:maxLines="1"
android:text="移动设备识别码"
android:textColor="@color/black"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_imei1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:maxLines="1"
android:text="移动设备识别码"
android:textColor="@color/ok_button"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_imei2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:maxLines="1"
android:text="移动设备识别码"
android:textColor="@color/ok_button"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_meid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:maxLines="1"
android:text="移动设备识别码"
android:textColor="@color/ok_button"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="12dp"
android:background="@drawable/imei_button_bg"
android:gravity="center"
android:maxLines="1"
android:onClick="@{click::exit}"
android:text="确定"
android:textColor="@color/white"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@@ -0,0 +1,92 @@
<?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.NetworkActivity">
<data>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#323a4c">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_exit"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@drawable/general_setting_bg"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_back"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="16dp"
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" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_trun"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@+id/cl_bottom"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cl_exit"
app:layout_constraintVertical_bias="0.385">
<TextView
android:id="@+id/tv_flashlight_statu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="移动数据"
android:textColor="@color/white"
android:textSize="30sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_statu"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="64dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/icon_flash_light_close"
app:layout_constraintEnd_toEndOf="@+id/tv_flashlight_statu"
app:layout_constraintStart_toStartOf="@+id/tv_flashlight_statu"
app:layout_constraintTop_toBottomOf="@+id/tv_flashlight_statu" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_bottom"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@@ -6,21 +6,73 @@
<data> <data>
<variable
name="click"
type="com.xxpatx.os.activity.selectnumber.SelectNumberActivity.BtnClick" />
</data> </data>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="match_parent"
android:onClick="@{click::exit}">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/select_number_bg"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:onClick="@{click::empty}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<TextView
android:id="@+id/textView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:maxLines="1"
android:text="本次拨号使用"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView" android:id="@+id/recyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:background="@drawable/phone_background" android:background="@drawable/phone_background"
app:layout_constraintBottom_toBottomOf="parent" android:minHeight="64dp"
app:layout_constraintBottom_toTopOf="@+id/textView6"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toBottomOf="@+id/textView5" />
<TextView
android:id="@+id/textView6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:gravity="center"
android:maxLines="1"
android:onClick="@{click::exit}"
android:padding="4dp"
android:text="取消"
android:textColor="#00bc14"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>

View File

@@ -39,7 +39,7 @@
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout2" android:id="@+id/cl_info"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
@@ -95,8 +95,8 @@
<View <View
android:id="@+id/view" android:id="@+id/view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1px" android:layout_height="2px"
android:background="@color/gray" android:background="@color/noti_font_color"
app:layout_constraintBottom_toBottomOf="parent" /> app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -15,7 +15,7 @@
<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="88dp"
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"
@@ -28,6 +28,7 @@
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/home_icon_dialer" android:src="@drawable/home_icon_dialer"
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"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
@@ -36,8 +37,8 @@
android:id="@+id/bg" android:id="@+id/bg"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="24dp" android:layout_height="24dp"
android:layout_marginStart="56dp" android:layout_marginStart="52dp"
android:layout_marginBottom="56dp" android:layout_marginBottom="52dp"
android:background="@drawable/badge_bg" android:background="@drawable/badge_bg"
android:gravity="center" android:gravity="center"
android:minWidth="24dp" android:minWidth="24dp"

View File

@@ -22,16 +22,7 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"> app:layout_constraintStart_toStartOf="parent">
<TextView
android:id="@+id/tv_sim"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:gravity="center"
android:maxLines="1"
android:text="SIM卡"
android:textColor="@color/black"
android:textSize="14sp" />
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp" android:layout_width="0dp"
@@ -56,8 +47,8 @@
android:id="@+id/tv_number" android:id="@+id/tv_number"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="11" android:layout_weight="5"
android:gravity="center" android:gravity="left|center_vertical"
android:maxLines="1" android:maxLines="1"
android:text="1234567890" android:text="1234567890"
android:textColor="@color/black" android:textColor="@color/black"
@@ -65,6 +56,13 @@
</LinearLayout> </LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:background="@color/gray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -48,6 +48,27 @@
<item name="android:windowCloseOnTouchOutside">true</item> <item name="android:windowCloseOnTouchOutside">true</item>
</style> </style>
<style name="activity_styles_full" parent="Theme.AppCompat.Light.Dialog">
<item name="android:windowFullscreen">true</item>
<!--设置dialog的背景-->
<item name="android:windowBackground">@android:color/transparent</item>
<!--设置Dialog的windowFrame框为无-->
<item name="android:windowFrame">@null</item>
<!--设置无标题-->
<item name="windowNoTitle">true</item>
<!--是否浮现在activity之上-->
<!--为false会导致windowCloseOnTouchOutside 失效-->
<item name="android:windowIsFloating">false</item>
<!--是否半透明-->
<item name="android:windowIsTranslucent">true</item>
<!--设置窗口内容不覆盖-->
<item name="android:windowContentOverlay">@null</item>
<!--设置动画在这里使用让它继承系统的Animation.Dialog-->
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<!--背景是否模糊显示-->
<item name="android:backgroundDimEnabled">true</item>
</style>
<style name="DialogStylesWithoutClose" parent="Theme.AppCompat.Light.DarkActionBar"> <style name="DialogStylesWithoutClose" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- <item name="android:windowFullscreen">true</item>--> <!-- <item name="android:windowFullscreen">true</item>-->
<!--设置dialog的背景--> <!--设置dialog的背景-->