version:1.3.8
fix: update:修复不能自动接听,增加桌面地址显示开关
This commit is contained in:
@@ -85,7 +85,7 @@ public class EmergencyActivity extends BaseMvvmActivity<EmergencyViewModel, Acti
|
||||
String latitude = mMMKV.decodeString(CommonConfig.MAP_LATITUDE_KEY, "");
|
||||
String address = mMMKV.decodeString(CommonConfig.MAP_ADDRESS_KEY, "");
|
||||
NetInterfaceManager.getInstance()
|
||||
.getSOSRecordObservable(longitude, latitude, address)
|
||||
.getSosRecordObservable(longitude, latitude, address)
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
|
||||
@@ -170,8 +170,8 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
||||
Log.e(TAG, "getContacts: " + ContactsUtils.isExist(MainActivity.this, "13220282310"));
|
||||
Log.e(TAG, "getContacts: " + ContactsUtils.getContactId(MainActivity.this, "13220282310"));
|
||||
ContactsUtils.isThePhoneExist(MainActivity.this, "13220282310");
|
||||
ContactsUtils.getContacts(MainActivity.this);
|
||||
ContactsUtils.getLocalContacts(MainActivity.this);
|
||||
// ContactsUtils.getContacts(MainActivity.this);
|
||||
// ContactsUtils.getLocalContacts(MainActivity.this);
|
||||
|
||||
|
||||
// UltimateBarX.addStatusBarTopPadding(mViewDataBinding.root);
|
||||
@@ -181,6 +181,7 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
||||
if (BuildConfig.DEBUG) {
|
||||
// SystemClock.setCurrentTimeMillis(1662123600000L);//09-02
|
||||
// SystemClock.setCurrentTimeMillis(1662210000000L);//09-03
|
||||
Utils.getAndroiodScreenProperty(this);
|
||||
}
|
||||
|
||||
// if (!isNotificationListenersEnabled()) {
|
||||
|
||||
@@ -70,6 +70,7 @@ public class SystemSettings implements Serializable {
|
||||
int exit_ctrl;
|
||||
int connect_page_ctrl;
|
||||
int connect_edit_ctrl;
|
||||
int desktop_location;
|
||||
|
||||
public int getQch_restore() {
|
||||
return qch_restore;
|
||||
@@ -536,6 +537,14 @@ public class SystemSettings implements Serializable {
|
||||
this.connect_edit_ctrl = connect_edit_ctrl;
|
||||
}
|
||||
|
||||
public int getDesktop_location() {
|
||||
return desktop_location;
|
||||
}
|
||||
|
||||
public void setDesktop_location(int desktop_location) {
|
||||
this.desktop_location = desktop_location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
|
||||
|
||||
@@ -2,6 +2,10 @@ package com.xxpatx.os.config;
|
||||
|
||||
public class CommonConfig {
|
||||
public static final String MMKV_ID = "InterProcessKV";
|
||||
|
||||
/*保存的应用版本号*/
|
||||
public final static String APP_VERSION_CODE = "APP_VERSION_CODE";
|
||||
|
||||
/*桌面图标个数*/
|
||||
public final static int DESKTOP_LIST_SIZE = 3 * 3;
|
||||
|
||||
@@ -23,6 +27,9 @@ public class CommonConfig {
|
||||
|
||||
/*让桌面更新定位信息*/
|
||||
public static final String UIUIAIOS_UPDATE_ADDRESS_ACTION = "UIUIAIOS_UPDATE_ADDRESS";
|
||||
/*桌面显示定位信息*/
|
||||
public static final String UIUIAIOS_UPDATE_DESKTOP_LOCATION = "UIUIAIOS_UPDATE_DESKTOP_LOCATIO";
|
||||
public static final String UIUIAIOS_DESKTOP_LOCATION_STATUS = "UIUIAIOS_DESKTOP_LOCATIO_STATUS";
|
||||
|
||||
/*应用市场所有包名*/
|
||||
public static final String UIUI_APPSTORE_PACKAGE_LIST = "UIUI_APPSTORE_PACKAGE_LIST_KEY";
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.xxpatx.os.fragment.settings;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
@@ -23,11 +26,14 @@ import com.xxpatx.os.activity.emergency.EmergencyActivity;
|
||||
import com.xxpatx.os.activity.setting.SettingActivity;
|
||||
import com.xxpatx.os.base.mvvm.fragment.BaseMvvmFragment;
|
||||
import com.xxpatx.os.bean.MapBean;
|
||||
import com.xxpatx.os.bean.SystemSettings;
|
||||
import com.xxpatx.os.config.CommonConfig;
|
||||
import com.xxpatx.os.databinding.FragmentSettingsBinding;
|
||||
import com.xxpatx.os.manager.AmapManager;
|
||||
import com.xxpatx.os.utils.ApkUtils;
|
||||
|
||||
import static com.xxpatx.os.config.CommonConfig.UIUIAIOS_DESKTOP_LOCATION_STATUS;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
* Use the {@link SettingsFragment#newInstance} factory method to
|
||||
@@ -83,7 +89,21 @@ public class SettingsFragment extends BaseMvvmFragment<SettingsViewModel, Fragme
|
||||
@Override
|
||||
protected void initView(Bundle bundle) {
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
initView();
|
||||
String addr = mMMKV.decodeString(CommonConfig.MAP_ADDRESS_KEY);
|
||||
if (TextUtils.isEmpty(addr) || "nullnull".equals(addr) || "null".equals(addr)) {
|
||||
mViewDataBinding.tvLocation2.setText("获取地址失败");
|
||||
} else {
|
||||
mViewDataBinding.tvLocation2.setText(addr);
|
||||
}
|
||||
int status = mMMKV.decodeInt(UIUIAIOS_DESKTOP_LOCATION_STATUS, 0);
|
||||
if (status == 1) {
|
||||
mViewDataBinding.clLocation.setVisibility(View.VISIBLE);
|
||||
mViewDataBinding.tvLocationTips.setVisibility(View.GONE);
|
||||
} else {
|
||||
mViewDataBinding.clLocation.setVisibility(View.INVISIBLE);
|
||||
mViewDataBinding.tvLocationTips.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,10 +115,15 @@ public class SettingsFragment extends BaseMvvmFragment<SettingsViewModel, Fragme
|
||||
mViewDataBinding.tvLocation2.setText(mapBean.getAddress());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
getLocation();
|
||||
mViewModel.mSystemSettingsData.observe(this, new Observer<SystemSettings>() {
|
||||
@Override
|
||||
public void onChanged(SystemSettings systemSettings) {
|
||||
mViewDataBinding.setSystemSettings(systemSettings);
|
||||
mMMKV.encode(UIUIAIOS_DESKTOP_LOCATION_STATUS, systemSettings.getDesktop_location());
|
||||
}
|
||||
});
|
||||
mViewModel.getSetting();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,23 +147,42 @@ public class SettingsFragment extends BaseMvvmFragment<SettingsViewModel, Fragme
|
||||
}
|
||||
|
||||
private void registerReceivers() {
|
||||
|
||||
if (mDesktopLocationReceiver == null) {
|
||||
mDesktopLocationReceiver = new DesktopLocationReceiver();
|
||||
}
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||
filter.addAction(CommonConfig.UIUIAIOS_UPDATE_DESKTOP_LOCATION);
|
||||
mContext.registerReceiver(mDesktopLocationReceiver, filter);
|
||||
}
|
||||
|
||||
private void unregisterReceivers() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void getLocation() {
|
||||
String addr = mMMKV.decodeString(CommonConfig.MAP_ADDRESS_KEY);
|
||||
if (TextUtils.isEmpty(addr) || "nullnull".equals(addr) || "null".equals(addr)) {
|
||||
mViewDataBinding.tvLocation2.setText("获取地址失败");
|
||||
} else {
|
||||
mViewDataBinding.tvLocation2.setText(addr);
|
||||
if (mDesktopLocationReceiver != null) {
|
||||
mContext.unregisterReceiver(mDesktopLocationReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
private DesktopLocationReceiver mDesktopLocationReceiver;
|
||||
|
||||
class DesktopLocationReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
Log.e("DesktopLocationReceiver", "onReceive: " + action);
|
||||
if (CommonConfig.UIUIAIOS_UPDATE_DESKTOP_LOCATION.equals(action)) {
|
||||
int desktopLocation = intent.getIntExtra("DesktopLocation", 0);
|
||||
if (desktopLocation == 1) {
|
||||
mViewDataBinding.clLocation.setVisibility(View.VISIBLE);
|
||||
mViewDataBinding.tvLocationTips.setVisibility(View.GONE);
|
||||
mMMKV.encode(UIUIAIOS_DESKTOP_LOCATION_STATUS, 1);
|
||||
} else {
|
||||
mViewDataBinding.clLocation.setVisibility(View.INVISIBLE);
|
||||
mViewDataBinding.tvLocationTips.setVisibility(View.VISIBLE);
|
||||
mMMKV.encode(UIUIAIOS_DESKTOP_LOCATION_STATUS, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class BtnClick {
|
||||
|
||||
|
||||
@@ -1,10 +1,22 @@
|
||||
package com.xxpatx.os.fragment.settings;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.FragmentEvent;
|
||||
import com.xxpatx.os.base.mvvm.BaseViewModel;
|
||||
import com.xxpatx.os.bean.BaseResponse;
|
||||
import com.xxpatx.os.bean.SystemSettings;
|
||||
import com.xxpatx.os.config.CommonConfig;
|
||||
import com.xxpatx.os.databinding.FragmentSettingsBinding;
|
||||
import com.xxpatx.os.network.NetInterfaceManager;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class SettingsViewModel extends BaseViewModel<FragmentSettingsBinding, FragmentEvent> {
|
||||
private static final String TAG = "SettingsViewModel";
|
||||
@@ -25,5 +37,36 @@ public class SettingsViewModel extends BaseViewModel<FragmentSettingsBinding, Fr
|
||||
|
||||
}
|
||||
|
||||
public MutableLiveData<SystemSettings> mSystemSettingsData = new MutableLiveData<>();
|
||||
|
||||
public void getSetting() {
|
||||
NetInterfaceManager.getInstance().getSettingControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<SystemSettings>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getSetting", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<SystemSettings> baseResponse) {
|
||||
Log.e("getSetting", "onNext: " + baseResponse);
|
||||
if (baseResponse.code == 200) {
|
||||
SystemSettings systemSettings = baseResponse.data;
|
||||
mSystemSettingsData.setValue(systemSettings);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getSetting", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getSetting", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,9 +30,10 @@ public class AppStatusManager {
|
||||
private Set<String> hidedAppSet;
|
||||
|
||||
public static final String APP_STATUS_MANAGER_KEY = "AppStatusManagerSet";
|
||||
|
||||
private static final Set<String> defaultHiedApp = new HashSet<String>() {{
|
||||
this.add("om.android.fmradio");//收音机
|
||||
// this.add("com.android.mms");//信息
|
||||
this.add("com.android.mms");//信息
|
||||
this.add("com.android.gallery3d");
|
||||
this.add("com.android.documentsui");
|
||||
this.add("com.android.calculator2");
|
||||
@@ -71,6 +72,13 @@ public class AppStatusManager {
|
||||
mMMKV.encode(CommonConfig.HIDE_CALENDAR_KEY, true);
|
||||
Log.e(TAG, "AppStatusManager: hide calendar");
|
||||
}
|
||||
long oldVersionCode = mMMKV.decodeLong(CommonConfig.APP_VERSION_CODE, 0);
|
||||
if (oldVersionCode == 0) {
|
||||
addHidedApp("com.android.stk");
|
||||
addHidedApp("com.tencent.mm");
|
||||
addHidedApp("com.ss.android.ugc.aweme");
|
||||
addHidedApp("com.android.mms");
|
||||
}
|
||||
}
|
||||
|
||||
public static void init(Context context) {
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.xxpatx.os.bean.AddressInfo;
|
||||
import com.xxpatx.os.bean.AlarmClockId;
|
||||
import com.xxpatx.os.bean.AppInfo;
|
||||
import com.xxpatx.os.bean.ArticleList;
|
||||
import com.xxpatx.os.bean.BaiduMapGeoBean;
|
||||
import com.xxpatx.os.bean.BaseResponse;
|
||||
import com.xxpatx.os.bean.Contact;
|
||||
import com.xxpatx.os.bean.DemandBean;
|
||||
@@ -46,7 +45,6 @@ import com.xxpatx.os.disklrucache.CacheHelper;
|
||||
import com.xxpatx.os.gson.GsonUtils;
|
||||
import com.xxpatx.os.manager.ConnectManager;
|
||||
import com.xxpatx.os.manager.ConnectMode;
|
||||
import com.xxpatx.os.network.api.amap.GeocodingApi;
|
||||
import com.xxpatx.os.network.api.qweather.LookupApi;
|
||||
import com.xxpatx.os.network.api.uiui.ActivityListApi;
|
||||
import com.xxpatx.os.network.api.uiui.AddressIndexApi;
|
||||
@@ -132,9 +130,6 @@ public class NetInterfaceManager {
|
||||
private Retrofit mRetrofit;
|
||||
private OkHttpClient okHttpClient;
|
||||
|
||||
private Retrofit mAmapRetrofit;
|
||||
private OkHttpClient mAmapOkHttpClient;
|
||||
|
||||
private Retrofit mQweatherRetrofit;
|
||||
private OkHttpClient mQweatherOkHttpClient;
|
||||
|
||||
@@ -175,31 +170,6 @@ public class NetInterfaceManager {
|
||||
.build();
|
||||
}
|
||||
|
||||
if (mAmapOkHttpClient == null) {
|
||||
//如果无法生存缓存文件目录,检测权限使用已经加上,检测手机是否把文件读写权限禁止了
|
||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||
builder.connectTimeout(TIME_OUT, TimeUnit.SECONDS); // 设置连接超时时间
|
||||
builder.writeTimeout(TIME_OUT, TimeUnit.SECONDS);// 设置写入超时时间
|
||||
builder.readTimeout(TIME_OUT, TimeUnit.SECONDS);// 设置读取数据超时时间
|
||||
builder.retryOnConnectionFailure(true);// 设置进行连接失败重试
|
||||
builder.addInterceptor(new RepeatRequestInterceptor());
|
||||
|
||||
// 设置缓存文件路径
|
||||
String cacheDirectory = mContext.getExternalCacheDir().getAbsolutePath() + "/OkHttpCache";
|
||||
Cache cache = new Cache(new File(cacheDirectory), CACHE_SIZE);
|
||||
builder.cache(cache);// 设置缓存
|
||||
mAmapOkHttpClient = builder.build();
|
||||
}
|
||||
|
||||
if (mAmapRetrofit == null) {
|
||||
mAmapRetrofit = new Retrofit.Builder()
|
||||
.client(mAmapOkHttpClient)
|
||||
.baseUrl(UrlAddress.AMAP_ROOT_URL)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
|
||||
.build();
|
||||
}
|
||||
|
||||
if (mQweatherOkHttpClient == null) {
|
||||
//如果无法生存缓存文件目录,检测权限使用已经加上,检测手机是否把文件读写权限禁止了
|
||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||
@@ -280,14 +250,6 @@ public class NetInterfaceManager {
|
||||
return okHttpClient;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Observable<BaiduMapGeoBean> getGeoObservable(String address) {
|
||||
return mAmapRetrofit.create(GeocodingApi.class)
|
||||
.geocoding(address, "json", "RGAsG7hN9gbDxeruqF4Lsf0ro6pp362O")
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<QweatherLookup> getLookupObservable(String address) {
|
||||
return mQweatherRetrofit.create(LookupApi.class)
|
||||
.lookup(address, "c5928a6a274c4a1cb80957a293b27898")
|
||||
@@ -295,7 +257,6 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
|
||||
public static RequestBody convertToRequestBody(String param) {
|
||||
RequestBody requestBody = RequestBody.create(MediaType.parse("text/plain"), param);
|
||||
return requestBody;
|
||||
@@ -349,14 +310,14 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<SystemSettings>> getsettingControl() {
|
||||
public Observable<BaseResponse<SystemSettings>> getSettingControl() {
|
||||
return mRetrofit.create(SettingApi.class)
|
||||
.getSetting(Utils.getSerial())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse> getSOSRecordObservable(String longitude, String latitude, String address) {
|
||||
public Observable<BaseResponse> getSosRecordObservable(String longitude, String latitude, String address) {
|
||||
return mRetrofit.create(SosRecordApi.class)
|
||||
.sendSosRecord(Utils.getSerial(), longitude, latitude, address)
|
||||
.subscribeOn(Schedulers.io())
|
||||
@@ -1182,18 +1143,18 @@ public class NetInterfaceManager {
|
||||
}
|
||||
|
||||
public void getSystemSettings(BehaviorSubject<ActivityEvent> lifecycle, ContactCallback callback) {
|
||||
getsettingControl()
|
||||
getSettingControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(getSystemSettingsObserver(callback));
|
||||
}
|
||||
|
||||
public void getSystemSettings(ContactCallback callback) {
|
||||
getsettingControl()
|
||||
getSettingControl()
|
||||
.subscribe(getSystemSettingsObserver(callback));
|
||||
}
|
||||
|
||||
public void getSystemSettings() {
|
||||
getsettingControl()
|
||||
getSettingControl()
|
||||
.subscribe(getSystemSettingsObserver(null));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,7 @@ package com.xxpatx.os.network;
|
||||
|
||||
public class UrlAddress {
|
||||
public static final String ROOT_URL = "https://ghapi.mdmsaas.cn/android/";
|
||||
/*百度地图*/
|
||||
@Deprecated
|
||||
public static final String AMAP_ROOT_URL = "https://api.map.baidu.com/";
|
||||
|
||||
/*和风天气*/
|
||||
public static final String QWEATHER_ROOT_URL = "https://geoapi.qweather.com/";
|
||||
|
||||
@@ -157,11 +155,6 @@ public class UrlAddress {
|
||||
|
||||
|
||||
|
||||
|
||||
/*逆地理编码*/
|
||||
@Deprecated
|
||||
public static final String GEOCODING = "geocoding/v3/";
|
||||
|
||||
/*城市搜索*/
|
||||
public static final String CITY_LOOKUP = "v2/city/lookup";
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.xxpatx.os.network.api.amap;
|
||||
|
||||
import com.xxpatx.os.bean.BaiduMapGeoBean;
|
||||
import com.xxpatx.os.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface GeocodingApi {
|
||||
@GET(UrlAddress.GEOCODING)
|
||||
Observable<BaiduMapGeoBean> geocoding(
|
||||
@Query("address") String address,
|
||||
@Query("output") String output,
|
||||
@Query("ak") String key
|
||||
);
|
||||
}
|
||||
@@ -375,6 +375,7 @@ public class WeAccessibilityService extends AccessibilityService {
|
||||
Point point = getPointtByNode(node);
|
||||
Log.e(TAG, "stepAnswer: " + point);
|
||||
clickByNode(point.x, point.y - 50);
|
||||
clickByNode(point.x, point.y);
|
||||
// clickNode(node);
|
||||
Log.e(TAG, "stepAnswer: mCurrentStep " + mCurrentStep + " done");
|
||||
mCurrentStep = Step.WAITING;
|
||||
|
||||
@@ -50,7 +50,9 @@ import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@@ -165,6 +167,17 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
mPresenter.addAlarmClock();
|
||||
|
||||
long oldVersionCode = mMMKV.decodeLong(CommonConfig.APP_VERSION_CODE, 0);
|
||||
if (oldVersionCode == 1038) {
|
||||
|
||||
}
|
||||
if (oldVersionCode < BuildConfig.VERSION_CODE) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
mMMKV.encode(CommonConfig.APP_VERSION_CODE, BuildConfig.VERSION_CODE);
|
||||
|
||||
registerAlarmReceiver();
|
||||
registerTimeReceiver();
|
||||
registerLockScreenReceiver();
|
||||
@@ -637,13 +650,22 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
|
||||
isBallShown = true;
|
||||
}
|
||||
|
||||
private static final Set<String> skip_kill_app = new HashSet<String>() {{
|
||||
this.add(BuildConfig.APPLICATION_ID);
|
||||
this.add("com.xxpatx.sn");
|
||||
this.add("com.tencent.mm");
|
||||
this.add("com.google.android.inputmethod.pinyin");
|
||||
this.add("com.sohu.inputmethod.sogou");
|
||||
this.add("com.baidu.input");
|
||||
this.add("com.tencent.wetype");
|
||||
this.add("com.tencent.qqpinyin");
|
||||
this.add("com.iflytek.inputmethod");
|
||||
}};
|
||||
|
||||
private void killBackgroundApp() {
|
||||
List<String> pkgList = ApkUtils.getRuningPackageList(this);
|
||||
for (String pkg : pkgList) {
|
||||
if (pkg.equalsIgnoreCase(BuildConfig.APPLICATION_ID)
|
||||
|| "com.xxpatx.sn".equals(pkg)
|
||||
|| "com.tencent.mm".equals(pkg)
|
||||
) {
|
||||
if (skip_kill_app.contains(pkg)) {
|
||||
continue;
|
||||
}
|
||||
killBackgroundProcesses(pkg);
|
||||
|
||||
@@ -25,7 +25,9 @@ import android.telecom.PhoneAccountHandle;
|
||||
import android.telecom.TelecomManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
@@ -119,8 +121,8 @@ public class Utils {
|
||||
context.startActivity(i);
|
||||
}
|
||||
|
||||
private static String Launcher3 = "com.android.launcher3";
|
||||
private static String Launcher3Class = "com.android.launcher3.Launcher";
|
||||
private static final String Launcher3 = "com.android.launcher3";
|
||||
private static final String Launcher3Class = "com.android.launcher3.Launcher";
|
||||
|
||||
public static void setDefaultDesktop(Context context, String pkg, String className) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
@@ -384,4 +386,26 @@ public class Utils {
|
||||
return cachePath;
|
||||
}
|
||||
|
||||
public static String getAndroiodScreenProperty(Context context) {
|
||||
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
wm.getDefaultDisplay().getRealMetrics(dm);
|
||||
int width = dm.widthPixels; // 屏幕宽度(像素)
|
||||
int height = dm.heightPixels; // 屏幕高度(像素)
|
||||
float density = dm.density; // 屏幕密度(0.75 / 1.0 / 1.5)
|
||||
int densityDpi = dm.densityDpi; // 屏幕密度dpi(120 / 160 / 240)
|
||||
// 屏幕宽度算法:屏幕宽度(像素)/屏幕密度
|
||||
int screenWidth = (int) (width / density); // 屏幕宽度(dp)
|
||||
int screenHeight = (int) (height / density);// 屏幕高度(dp)
|
||||
|
||||
Log.e("getAndroiodScreenProperty", "屏幕宽度(像素):" + width);
|
||||
Log.e("getAndroiodScreenProperty", "屏幕高度(像素):" + height);
|
||||
Log.e("getAndroiodScreenProperty", "屏幕密度(0.75 / 1.0 / 1.5):" + density);
|
||||
Log.e("getAndroiodScreenProperty", "屏幕密度dpi(120 / 160 / 240):" + densityDpi);
|
||||
Log.e("getAndroiodScreenProperty", "屏幕宽度(dp):" + screenWidth);
|
||||
Log.e("getAndroiodScreenProperty", "屏幕高度(dp):" + screenHeight);
|
||||
|
||||
Log.e("getAndroiodScreenProperty", "smallestScreenWidthDp: " + context.getResources().getConfiguration().smallestScreenWidthDp);
|
||||
return width + "×" + height;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,12 @@
|
||||
<variable
|
||||
name="click"
|
||||
type="com.xxpatx.os.fragment.settings.SettingsFragment.BtnClick" />
|
||||
|
||||
<variable
|
||||
name="systemSettings"
|
||||
type="com.xxpatx.os.bean.SystemSettings" />
|
||||
|
||||
<import type="android.view.View" />
|
||||
</data>
|
||||
|
||||
<FrameLayout
|
||||
@@ -280,48 +286,69 @@
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clLocation"
|
||||
android:layout_width="330dp"
|
||||
android:layout_height="144dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/card_location_background"
|
||||
android:onClick="@{click::getAddress}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/cl_contact">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView14"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:adjustViewBounds="true"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clLocation"
|
||||
android:layout_width="match_parent"
|
||||
tools:visibility="visible"
|
||||
android:layout_height="match_parent"
|
||||
android:onClick="@{click::getAddress}"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_location_refresh"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
android:visibility="@{systemSettings.desktop_location==1?View.VISIBLE:View.INVISIBLE}">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView14"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:onClick="@{click::getAddress}"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_location_refresh"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_location2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:gravity="center"
|
||||
android:maxLines="3"
|
||||
android:text="我的位置"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="19sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/imageView14"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_location2"
|
||||
android:layout_width="0dp"
|
||||
android:id="@+id/tv_location_tips"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:gravity="center"
|
||||
android:maxLines="3"
|
||||
android:text="我的位置"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:maxLines="1"
|
||||
android:text="定位功能未开放"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="19sp"
|
||||
android:textStyle="bold"
|
||||
tools:visibility="gone"
|
||||
android:visibility="@{systemSettings.desktop_location==1?View.GONE:View.VISIBLE}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/imageView14"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
Reference in New Issue
Block a user