version:1.3
fix: update:sos界面拨打所有电话
@@ -15,8 +15,8 @@ android {
|
|||||||
applicationId "com.uiui.os"
|
applicationId "com.uiui.os"
|
||||||
minSdkVersion 24
|
minSdkVersion 24
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 2
|
versionCode 4
|
||||||
versionName "1.1"
|
versionName "1.3"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,8 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
// implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
compileOnly files('libs/framework.jar')
|
||||||
implementation files('libs/QWeather_Public_Android_V4.6.jar')
|
implementation files('libs/QWeather_Public_Android_V4.6.jar')
|
||||||
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||||
@@ -184,3 +185,23 @@ dependencies {
|
|||||||
implementation 'com.arialyy.aria:core:3.8.15'
|
implementation 'com.arialyy.aria:core:3.8.15'
|
||||||
annotationProcessor 'com.arialyy.aria:compiler:3.8.15'
|
annotationProcessor 'com.arialyy.aria:compiler:3.8.15'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
preBuild {
|
||||||
|
doLast {
|
||||||
|
def imlFile = file(project.name + ".iml")
|
||||||
|
// def imlFile = file("..\\.idea\\modules\\" + project.name + "\\" + rootProject.name + "." + project.name + ".iml")
|
||||||
|
println 'Change ' + project.name + '.iml order'
|
||||||
|
try {
|
||||||
|
def parsedXml = (new XmlParser()).parse(imlFile)
|
||||||
|
def jdkNode = parsedXml.component[1].orderEntry.find { it.'@type' == 'jdk' }
|
||||||
|
parsedXml.component[1].remove(jdkNode)
|
||||||
|
def sdkString = "Android API " + android.compileSdkVersion.substring("android-".length()) + " Platform"
|
||||||
|
println 'what' + sdkString
|
||||||
|
new Node(parsedXml.component[1], 'orderEntry', ['type': 'jdk', 'jdkName': sdkString, 'jdkType': 'Android SDK'])
|
||||||
|
groovy.xml.XmlUtil.serialize(parsedXml, new FileOutputStream(imlFile))
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
// nop, iml not found
|
||||||
|
println "no iml found"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
BIN
app/libs/framework.jar
Normal file
@@ -3,6 +3,8 @@
|
|||||||
package="com.uiui.os"
|
package="com.uiui.os"
|
||||||
android:sharedUserId="android.uid.system">
|
android:sharedUserId="android.uid.system">
|
||||||
|
|
||||||
|
<!-- 清单文件中, 申明监听通话精确状态权限,该权限需要android:sharedUserId="android.uid.system" -->
|
||||||
|
<uses-permission android:name="android.permission.READ_PRECISE_PHONE_STATE" />
|
||||||
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
|
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
|
||||||
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
|
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
|
||||||
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
|
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
|
||||||
@@ -21,6 +23,7 @@
|
|||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- 允许读设备等信息,用于问题排查 -->
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- 允许读设备等信息,用于问题排查 -->
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".base.BaseApplication"
|
android:name=".base.BaseApplication"
|
||||||
@@ -29,13 +32,18 @@
|
|||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:largeHeap="true"
|
android:largeHeap="true"
|
||||||
|
android:requestLegacyExternalStorage="true"
|
||||||
android:restoreAnyVersion="true"
|
android:restoreAnyVersion="true"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:requestLegacyExternalStorage="true"
|
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity android:name=".activity.NoticeActivity"
|
<activity
|
||||||
|
android:name=".activity.EmergencyActivity"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
/>
|
||||||
|
<activity
|
||||||
|
android:name=".activity.NoticeActivity"
|
||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
android:theme="@style/activity_styles"/>
|
android:theme="@style/activity_styles" />
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name=".service.AlarmService"
|
android:name=".service.AlarmService"
|
||||||
@@ -44,7 +52,15 @@
|
|||||||
<service
|
<service
|
||||||
android:name=".service.MainService"
|
android:name=".service.MainService"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="true" />
|
android:exported="true">
|
||||||
|
<intent-filter android:priority="1000">
|
||||||
|
<action android:name="android.intent.action.USER_PRESENT" />
|
||||||
|
<action android:name="android.intent.action.SCREEN_ON" />
|
||||||
|
<action android:name="android.intent.action.SCREEN_OFF" />
|
||||||
|
|
||||||
|
<data android:scheme="package" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.MainActivity"
|
android:name=".activity.MainActivity"
|
||||||
|
|||||||
221
app/src/main/java/com/uiui/os/activity/EmergencyActivity.java
Normal file
@@ -0,0 +1,221 @@
|
|||||||
|
package com.uiui.os.activity;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.app.StatusBarManager;
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
import android.provider.Settings;
|
||||||
|
import android.telephony.PhoneStateListener;
|
||||||
|
import android.telephony.TelephonyManager;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.uiui.os.R;
|
||||||
|
import com.uiui.os.bean.BaseResponse;
|
||||||
|
import com.uiui.os.network.NetInterfaceManager;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||||
|
import io.reactivex.rxjava3.annotations.NonNull;
|
||||||
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
|
import io.reactivex.rxjava3.core.Observer;
|
||||||
|
import io.reactivex.rxjava3.disposables.Disposable;
|
||||||
|
import io.reactivex.rxjava3.functions.Consumer;
|
||||||
|
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||||
|
|
||||||
|
public class EmergencyActivity extends AppCompatActivity {
|
||||||
|
@BindView(R.id.tv_countdown)
|
||||||
|
TextView tv_countdown;
|
||||||
|
@BindView(R.id.iv_finish)
|
||||||
|
ImageView iv_finish;
|
||||||
|
private Disposable subscribe;
|
||||||
|
private String TAG = EmergencyActivity.class.getSimpleName();
|
||||||
|
private boolean needDial = false;
|
||||||
|
private boolean isCalling = false;
|
||||||
|
private List<String> phoneListSet;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Log.e(TAG, "onCreate: ");
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_emergency);
|
||||||
|
ButterKnife.bind(this);
|
||||||
|
Intent intent = getIntent();
|
||||||
|
// String setting_sos = intent.getStringExtra("setting_sos");
|
||||||
|
// if (TextUtils.isEmpty(setting_sos)) {
|
||||||
|
// finish();
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
String setting_sos = Settings.System.getString(getContentResolver(), "setting_sos");
|
||||||
|
if (TextUtils.isEmpty(setting_sos)) return;
|
||||||
|
phoneListSet = new ArrayList<>(Arrays.asList(setting_sos.split(",")));
|
||||||
|
Log.e(TAG, "onCreate: " + phoneListSet);
|
||||||
|
|
||||||
|
final Long time = 3L;
|
||||||
|
subscribe = Observable.interval(1, TimeUnit.SECONDS)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(aLong -> {
|
||||||
|
Log.e("TAG", "倒计时:" + aLong);
|
||||||
|
if (aLong < time && !subscribe.isDisposed()) {
|
||||||
|
tv_countdown.setText("倒计时(" + (time - aLong - 1) + ")秒");
|
||||||
|
Log.e(TAG, "accept: " + (time - aLong - 1));
|
||||||
|
} else {
|
||||||
|
NetInterfaceManager.getInstance()
|
||||||
|
.getSOSRecordObservable()
|
||||||
|
.subscribe(new Observer<BaseResponse>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
Log.e("SOSRecord", "onSubscribe: ");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@NonNull BaseResponse baseResponse) {
|
||||||
|
Log.e("SOSRecord", "onNext: " + baseResponse);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@NonNull Throwable e) {
|
||||||
|
Log.e("SOSRecord", "onError: " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
Log.e("SOSRecord", "onComplete: ");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
needDial = true;
|
||||||
|
Intent intent1 = new Intent(Intent.ACTION_CALL);
|
||||||
|
Uri data = Uri.parse("tel:" + phoneListSet.get(0));
|
||||||
|
intent1.setData(data);
|
||||||
|
startActivity(intent1);
|
||||||
|
isCalling = true;
|
||||||
|
phoneListSet.remove(0);
|
||||||
|
// finish();
|
||||||
|
subscribe.dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
iv_finish.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// TelephonyManager telM = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
|
||||||
|
// telM.listen(new PhoneStateListener() {
|
||||||
|
// /**
|
||||||
|
// * 当有精确通话状态时回调
|
||||||
|
// * Callback invoked when precise device call state changes
|
||||||
|
// * @hide 隐藏api, 给系统app使用的
|
||||||
|
// */
|
||||||
|
// public void onPreciseCallStateChanged(PreciseCallState callState) {
|
||||||
|
// //当有精确通话状态时回调
|
||||||
|
// Log.e(TAG, "onPreciseCallStateChanged: " + callState);
|
||||||
|
// }
|
||||||
|
// }, PhoneStateListener.LISTEN_PRECISE_CALL_STATE); //需要权限android.permission.READ_PRECISE_PHONE_STATE
|
||||||
|
//
|
||||||
|
// StatusBarManager mStatusBarManager = (StatusBarManager) getApplicationContext().getSystemService(Context.STATUS_BAR_SERVICE);
|
||||||
|
//// mStatusBarManager.disable(StatusBarManager.DISABLE_HOME);//隐藏home键
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
Log.e(TAG, "onResume: ");
|
||||||
|
Log.e(TAG, "onResume: " + phoneListSet);
|
||||||
|
if (needDial) {
|
||||||
|
if (phoneListSet == null || phoneListSet.size() == 0) return;
|
||||||
|
Handler.getMain().postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Intent intent1 = new Intent(Intent.ACTION_CALL);
|
||||||
|
Uri data = Uri.parse("tel:" + phoneListSet.get(0));
|
||||||
|
intent1.setData(data);
|
||||||
|
startActivity(intent1);
|
||||||
|
isCalling = true;
|
||||||
|
phoneListSet.remove(0);
|
||||||
|
}
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
Log.e(TAG, "onDestroy: ");
|
||||||
|
if (subscribe != null) {
|
||||||
|
subscribe.dispose();
|
||||||
|
subscribe = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// class MobileCallReceiver extends BroadcastReceiver {
|
||||||
|
// @Override
|
||||||
|
// public void onReceive(Context context, Intent intent) {
|
||||||
|
// if (intent.getAction() == null) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//// switch (intent.getAction()) {
|
||||||
|
//// case CustomAction.PRECISE_CALL_STATE:
|
||||||
|
//// int callState = intent.getIntExtra("foreground_state", -2);
|
||||||
|
//// switch (callState) {
|
||||||
|
//// case PreciseCallState.PRECISE_CALL_STATE_IDLE:
|
||||||
|
//// Log.d(TAG, "IDLE");
|
||||||
|
//// break;
|
||||||
|
//// case PreciseCallState.PRECISE_CALL_STATE_DIALING:
|
||||||
|
//// Log.d(TAG, "DIALING");
|
||||||
|
//// break;
|
||||||
|
//// case PreciseCallState.PRECISE_CALL_STATE_ALERTING:
|
||||||
|
//// Log.d(TAG, "ALERTING isHandFree=" + isHandFree);
|
||||||
|
//// break;
|
||||||
|
//// case PreciseCallState.PRECISE_CALL_STATE_ACTIVE:
|
||||||
|
//// Log.d(TAG, "ACTIVE");
|
||||||
|
//// break;
|
||||||
|
//// case PreciseCallState.PRECISE_CALL_STATE_INCOMING:
|
||||||
|
//// Log.d(TAG, "INCOMING来电");
|
||||||
|
//// break;
|
||||||
|
//// case PreciseCallState.PRECISE_CALL_STATE_DISCONNECTING:
|
||||||
|
//// Log.d(TAG, "DISCONNECTING");
|
||||||
|
//// break;
|
||||||
|
//// case PreciseCallState.PRECISE_CALL_STATE_DISCONNECTED:
|
||||||
|
//// Log.d(TAG, "DISCONNECTED");
|
||||||
|
//// break;
|
||||||
|
//// }
|
||||||
|
//// break;
|
||||||
|
//// case TelephonyManager.ACTION_PHONE_STATE_CHANGED:
|
||||||
|
//// break;
|
||||||
|
//// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 精确的九大通话状态
|
||||||
|
// public class PreciseCallState {
|
||||||
|
// public static final int PRECISE_CALL_STATE_IDLE = 0; //通话空闲
|
||||||
|
// public static final int PRECISE_CALL_STATE_ACTIVE = 1; //正在通话(活动中)
|
||||||
|
// public static final int PRECISE_CALL_STATE_HOLDING = 2; //通话挂起(例如我和多个人通话,其中一个通话在活动,而其它通话就会进入挂起状态)
|
||||||
|
// public static final int PRECISE_CALL_STATE_DIALING = 3; //拨号开始
|
||||||
|
// public static final int PRECISE_CALL_STATE_ALERTING = 4; //正在呼出(提醒对方接电话)
|
||||||
|
// public static final int PRECISE_CALL_STATE_INCOMING = 5; //对方来电
|
||||||
|
// public static final int PRECISE_CALL_STATE_WAITING = 6; //第三方来电等待(例如我正在和某人通话,而其他人打入时就会就进入等待状态)
|
||||||
|
// public static final int PRECISE_CALL_STATE_DISCONNECTED = 7; //挂断完成
|
||||||
|
// public static final int PRECISE_CALL_STATE_DISCONNECTING = 8; //正在挂断
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -7,14 +7,12 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageInfo;
|
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.format.DateUtils;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
|
||||||
@@ -26,7 +24,9 @@ import androidx.viewpager.widget.ViewPager;
|
|||||||
|
|
||||||
import com.alarmclock.uiui.IAlarmAidlInterface;
|
import com.alarmclock.uiui.IAlarmAidlInterface;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
import com.uiui.os.BuildConfig;
|
||||||
import com.uiui.os.R;
|
import com.uiui.os.R;
|
||||||
import com.uiui.os.base.BaseActivity;
|
import com.uiui.os.base.BaseActivity;
|
||||||
import com.uiui.os.bean.AlarmItem;
|
import com.uiui.os.bean.AlarmItem;
|
||||||
@@ -35,8 +35,9 @@ import com.uiui.os.fragment.AppListFragment;
|
|||||||
import com.uiui.os.fragment.BaseFragmentPagerAdapter;
|
import com.uiui.os.fragment.BaseFragmentPagerAdapter;
|
||||||
import com.uiui.os.fragment.CustomFragment;
|
import com.uiui.os.fragment.CustomFragment;
|
||||||
import com.uiui.os.network.NetInterfaceManager;
|
import com.uiui.os.network.NetInterfaceManager;
|
||||||
|
import com.uiui.os.service.MainService;
|
||||||
import com.uiui.os.utils.APKUtils;
|
import com.uiui.os.utils.APKUtils;
|
||||||
import com.uiui.os.utils.TimeUtils;
|
import com.uiui.os.utils.AppUsedTimeUtils;
|
||||||
import com.uiui.os.utils.Utils;
|
import com.uiui.os.utils.Utils;
|
||||||
import com.uiui.os.view.ScaleCircleNavigator;
|
import com.uiui.os.view.ScaleCircleNavigator;
|
||||||
|
|
||||||
@@ -106,7 +107,7 @@ public class MainActivity extends BaseActivity {
|
|||||||
try {
|
try {
|
||||||
String json = mIAlarmAidlInterface.getAlarm();
|
String json = mIAlarmAidlInterface.getAlarm();
|
||||||
Log.e(TAG, "onServiceConnected: " + json);
|
Log.e(TAG, "onServiceConnected: " + json);
|
||||||
if (json.equalsIgnoreCase("暂无闹钟")) {
|
if ("暂无闹钟".equalsIgnoreCase(json) || TextUtils.isEmpty(json)) {
|
||||||
customFragment.setAlarmItem(null);
|
customFragment.setAlarmItem(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -140,6 +141,7 @@ public class MainActivity extends BaseActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void initData() {
|
public void initData() {
|
||||||
registmNewAppReceiver();
|
registmNewAppReceiver();
|
||||||
|
registerSOSNumberReceiver();
|
||||||
fragments.add(customFragment);
|
fragments.add(customFragment);
|
||||||
ArrayList<ApplicationInfo> applicationInfoList = APKUtils.queryFilterAppInfo(this);
|
ArrayList<ApplicationInfo> applicationInfoList = APKUtils.queryFilterAppInfo(this);
|
||||||
int x = 0;
|
int x = 0;
|
||||||
@@ -239,63 +241,108 @@ public class MainActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private NewAppReceiver mNewAppReceiver;
|
@Override
|
||||||
|
protected void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
AppUsedTimeUtils.getInstance().setAppPackageName(BuildConfig.APPLICATION_ID);
|
||||||
|
AppUsedTimeUtils.getInstance().setStartTime(System.currentTimeMillis());
|
||||||
|
getAlarmData();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
String packagename = TimeUtils.getInstance().getAppPackageName();
|
SendRunningApp(MainActivity.this);
|
||||||
Log.e("SendcloseApp", "packagename=" + packagename);
|
|
||||||
TimeUtils.getInstance().setEndTime(System.currentTimeMillis());
|
|
||||||
if (packagename != null && packagename.length() > 0) {
|
|
||||||
ApplicationInfo app = APKUtils.getApplicationInfo(this, packagename);
|
|
||||||
PackageManager pm = getPackageManager();
|
|
||||||
if (app != null) {
|
|
||||||
Log.e(TAG, "onResume: " + app.loadLabel(pm).toString());
|
|
||||||
Log.e(TAG, "onResume: " + app.packageName);
|
|
||||||
NetInterfaceManager.getInstance().getAppUsageRecordControl()
|
|
||||||
.sendappUsageRecord(Utils.getSerial(),
|
|
||||||
app.loadLabel(pm).toString(), app.packageName,
|
|
||||||
TimeUtils.getInstance().getStartTime() / 1000,
|
|
||||||
TimeUtils.getInstance().getEndTime() / 1000)
|
|
||||||
.subscribe(new Observer<BaseResponse>() {
|
|
||||||
@Override
|
|
||||||
public void onSubscribe(Disposable d) {
|
|
||||||
Log.e("onResume", "onSubscribe: ");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNext(BaseResponse baseResponse) {
|
|
||||||
Log.e("onResume", "onNext: " + baseResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
Log.e("onResume", "onError: " + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onComplete() {
|
|
||||||
Log.e("onResume", "onComplete: ");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
TimeUtils.getInstance().setAppPackageName("");
|
|
||||||
} else {
|
|
||||||
Log.e("fht", "app = null" + packagename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
getAlarmData();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SendRunningApp(Context context) {
|
||||||
|
AppUsedTimeUtils.getInstance().setAppPackageName(BuildConfig.APPLICATION_ID);
|
||||||
|
AppUsedTimeUtils.getInstance().setStartTime(System.currentTimeMillis());
|
||||||
|
long time = AppUsedTimeUtils.getInstance().getStartTime();
|
||||||
|
JsonObject jsonObject = new JsonObject();
|
||||||
|
jsonObject.addProperty("app_package", BuildConfig.APPLICATION_ID);
|
||||||
|
jsonObject.addProperty("version_name", APKUtils.getAPPVersionName(context, BuildConfig.APPLICATION_ID));
|
||||||
|
jsonObject.addProperty("start_time", time / 1000);
|
||||||
|
String jsonString = jsonObject.toString();
|
||||||
|
Log.e(TAG, "SendRunningApp: " + jsonString);
|
||||||
|
NetInterfaceManager.getInstance()
|
||||||
|
.getRunningAppObservable(jsonString)
|
||||||
|
.subscribe(new Observer<BaseResponse>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
Log.e("SendRunningApp", "onSubscribe: ");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(BaseResponse baseResponse) {
|
||||||
|
Log.e("SendRunningApp", "onSubscribe: " + baseResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
Log.e("SendRunningApp", "onError: " + e.getMessage());
|
||||||
|
onComplete();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
Log.e("SendRunningApp", "onComplete: ");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onRestart() {
|
protected void onRestart() {
|
||||||
super.onRestart();
|
super.onRestart();
|
||||||
|
AppUsedTimeUtils.getInstance().setEndTime(System.currentTimeMillis());
|
||||||
|
String packagename = AppUsedTimeUtils.getInstance().getAppPackageName();
|
||||||
|
Log.e(TAG, "onRestart packagename == " + packagename);
|
||||||
|
if (!TextUtils.isEmpty(packagename)) {
|
||||||
|
Log.e(TAG, "onRestart: " + APKUtils.getAppNameByPackage(MainActivity.this, packagename));
|
||||||
|
Log.e(TAG, "onRestart: " + packagename);
|
||||||
|
NetInterfaceManager.getInstance().getAppUsageRecordControl()
|
||||||
|
.sendappUsageRecord(Utils.getSerial(),
|
||||||
|
APKUtils.getAppNameByPackage(MainActivity.this, packagename),
|
||||||
|
packagename,
|
||||||
|
AppUsedTimeUtils.getInstance().getStartTime() / 1000,
|
||||||
|
AppUsedTimeUtils.getInstance().getEndTime() / 1000)
|
||||||
|
.subscribe(new Observer<BaseResponse>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
Log.e("sendappUsageRecord", "onSubscribe: ");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(BaseResponse baseResponse) {
|
||||||
|
Log.e("sendappUsageRecord", "onNext: " + baseResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
Log.e("sendappUsageRecord", "onError: " + e.getMessage());
|
||||||
|
onComplete();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
Log.e("sendappUsageRecord", "onComplete: ");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Log.e("onRestart", "app = null" + packagename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
|
AppUsedTimeUtils.getInstance().setEndTime(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registmNewAppReceiver() {
|
private void registmNewAppReceiver() {
|
||||||
@@ -309,6 +356,8 @@ public class MainActivity extends BaseActivity {
|
|||||||
registerReceiver(mNewAppReceiver, filter);
|
registerReceiver(mNewAppReceiver, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private NewAppReceiver mNewAppReceiver;
|
||||||
|
|
||||||
class NewAppReceiver extends BroadcastReceiver {
|
class NewAppReceiver extends BroadcastReceiver {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
@@ -320,4 +369,26 @@ public class MainActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SOSNumberReceiver sosNumberReceiver;
|
||||||
|
|
||||||
|
private void registerSOSNumberReceiver() {
|
||||||
|
if (sosNumberReceiver == null) {
|
||||||
|
sosNumberReceiver = new SOSNumberReceiver();
|
||||||
|
}
|
||||||
|
IntentFilter filter = new IntentFilter();
|
||||||
|
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||||
|
filter.addAction("setting_sos");
|
||||||
|
registerReceiver(sosNumberReceiver, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
class SOSNumberReceiver extends BroadcastReceiver {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
Log.e(TAG, "onReceive: " + intent.getAction());
|
||||||
|
String setting_sos = intent.getStringExtra("setting_sos");
|
||||||
|
if (TextUtils.isEmpty(setting_sos)) return;
|
||||||
|
customFragment.setSosNumber();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
67
app/src/main/java/com/uiui/os/adapter/SOSNnmberAdapter.java
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
package com.uiui.os.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.uiui.os.R;
|
||||||
|
import com.uiui.os.activity.EmergencyActivity;
|
||||||
|
import com.uiui.os.bean.AlarmItem;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SOSNnmberAdapter extends RecyclerView.Adapter<SOSNnmberAdapter.ViewHolder> {
|
||||||
|
private List<String> phoneNumberList;
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
public void setPhoneNumberList(List<String> phoneList) {
|
||||||
|
this.phoneNumberList = phoneList;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
mContext = parent.getContext();
|
||||||
|
return new SOSNnmberAdapter.ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_sosnumber, parent, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||||
|
String phone = phoneNumberList.get(position);
|
||||||
|
holder.tv_number.setText(phone);
|
||||||
|
holder.root.setOnClickListener(v -> {
|
||||||
|
Intent intent = new Intent(mContext, EmergencyActivity.class);
|
||||||
|
intent.putExtra("setting_sos", phone);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
mContext.startActivity(intent);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return phoneNumberList == null ? 0 : phoneNumberList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
TextView tv_number;
|
||||||
|
TextView tv_dial;
|
||||||
|
ConstraintLayout root;
|
||||||
|
|
||||||
|
ViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
tv_number = itemView.findViewById(R.id.tv_number);
|
||||||
|
tv_dial = itemView.findViewById(R.id.tv_dial);
|
||||||
|
root = itemView.findViewById(R.id.root);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@ import com.uiui.os.network.NetInterfaceManager;
|
|||||||
import com.uiui.os.service.MainService;
|
import com.uiui.os.service.MainService;
|
||||||
import com.uiui.os.utils.AlarmUtils;
|
import com.uiui.os.utils.AlarmUtils;
|
||||||
import com.uiui.os.utils.AmapManager;
|
import com.uiui.os.utils.AmapManager;
|
||||||
import com.uiui.os.utils.TimeUtils;
|
import com.uiui.os.utils.AppUsedTimeUtils;
|
||||||
|
|
||||||
|
|
||||||
public class BaseApplication extends Application {
|
public class BaseApplication extends Application {
|
||||||
@@ -51,7 +51,7 @@ public class BaseApplication extends Application {
|
|||||||
Aria.init(this);
|
Aria.init(this);
|
||||||
Aria.get(this).getDownloadConfig().setMaxTaskNum(1);
|
Aria.get(this).getDownloadConfig().setMaxTaskNum(1);
|
||||||
Aria.get(this).getDownloadConfig().setConvertSpeed(true);
|
Aria.get(this).getDownloadConfig().setConvertSpeed(true);
|
||||||
TimeUtils.init(this);
|
AppUsedTimeUtils.init(this);
|
||||||
AlarmUtils.init(this);
|
AlarmUtils.init(this);
|
||||||
HeConfig.init("HE2111041506381545", "32b5ec69545e44119583a5e0ed4e87df");
|
HeConfig.init("HE2111041506381545", "32b5ec69545e44119583a5e0ed4e87df");
|
||||||
AmapManager.init(this);
|
AmapManager.init(this);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import com.uiui.os.network.NetInterfaceManager;
|
|||||||
import com.uiui.os.utils.APKUtils;
|
import com.uiui.os.utils.APKUtils;
|
||||||
import com.uiui.os.utils.BitmapUtils;
|
import com.uiui.os.utils.BitmapUtils;
|
||||||
import com.uiui.os.utils.IconUtils;
|
import com.uiui.os.utils.IconUtils;
|
||||||
import com.uiui.os.utils.TimeUtils;
|
import com.uiui.os.utils.AppUsedTimeUtils;
|
||||||
import com.uiui.os.view.MyGridLayout;
|
import com.uiui.os.view.MyGridLayout;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -125,6 +125,7 @@ public class AppListFragment extends Fragment {
|
|||||||
String val = IconUtils.appIconList.get(i);
|
String val = IconUtils.appIconList.get(i);
|
||||||
int resID = getActivity().getResources().getIdentifier(val, "drawable", "com.uiui.os");
|
int resID = getActivity().getResources().getIdentifier(val, "drawable", "com.uiui.os");
|
||||||
if (resID == 0) {
|
if (resID == 0) {
|
||||||
|
Log.e(TAG, "getView: not found src : " + applicationInfo.packageName);
|
||||||
iv.setImageDrawable(applicationInfo.loadIcon(pm));
|
iv.setImageDrawable(applicationInfo.loadIcon(pm));
|
||||||
} else {
|
} else {
|
||||||
iv.setImageDrawable(getActivity().getResources().getDrawable(resID));
|
iv.setImageDrawable(getActivity().getResources().getDrawable(resID));
|
||||||
@@ -154,8 +155,8 @@ public class AppListFragment extends Fragment {
|
|||||||
ApplicationInfo applicationInfo = applicationInfos.get(index);
|
ApplicationInfo applicationInfo = applicationInfos.get(index);
|
||||||
if (applicationInfo != null) {
|
if (applicationInfo != null) {
|
||||||
APKUtils.openPackage(v.getContext(), applicationInfo.packageName);
|
APKUtils.openPackage(v.getContext(), applicationInfo.packageName);
|
||||||
TimeUtils.getInstance().setAppPackageName(applicationInfo.packageName);
|
AppUsedTimeUtils.getInstance().setAppPackageName(applicationInfo.packageName);
|
||||||
TimeUtils.getInstance().setStartTime(System.currentTimeMillis());
|
AppUsedTimeUtils.getInstance().setStartTime(System.currentTimeMillis());
|
||||||
SendRunningApp(getActivity());
|
SendRunningApp(getActivity());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -163,8 +164,8 @@ public class AppListFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void SendRunningApp(Context context) {
|
private void SendRunningApp(Context context) {
|
||||||
String packageName = TimeUtils.getInstance().getAppPackageName();
|
String packageName = AppUsedTimeUtils.getInstance().getAppPackageName();
|
||||||
long time = TimeUtils.getInstance().getStartTime();
|
long time = AppUsedTimeUtils.getInstance().getStartTime();
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
jsonObject.addProperty("app_package", packageName);
|
jsonObject.addProperty("app_package", packageName);
|
||||||
jsonObject.addProperty("version_name", APKUtils.getAPPVersionName(context, packageName));
|
jsonObject.addProperty("version_name", APKUtils.getAPPVersionName(context, packageName));
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.uiui.os.fragment;
|
|||||||
|
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
@@ -41,10 +42,14 @@ import com.qweather.sdk.view.QWeather;
|
|||||||
import com.tencent.mmkv.MMKV;
|
import com.tencent.mmkv.MMKV;
|
||||||
import com.uiui.os.BuildConfig;
|
import com.uiui.os.BuildConfig;
|
||||||
import com.uiui.os.R;
|
import com.uiui.os.R;
|
||||||
|
import com.uiui.os.activity.EmergencyActivity;
|
||||||
import com.uiui.os.adapter.AlarmClockAdapter;
|
import com.uiui.os.adapter.AlarmClockAdapter;
|
||||||
import com.uiui.os.adapter.NotificationAdapter;
|
import com.uiui.os.adapter.NotificationAdapter;
|
||||||
|
import com.uiui.os.adapter.SOSNnmberAdapter;
|
||||||
import com.uiui.os.bean.AlarmClockData;
|
import com.uiui.os.bean.AlarmClockData;
|
||||||
import com.uiui.os.bean.AlarmItem;
|
import com.uiui.os.bean.AlarmItem;
|
||||||
|
import com.uiui.os.bean.BaseResponse;
|
||||||
|
import com.uiui.os.network.NetInterfaceManager;
|
||||||
import com.uiui.os.utils.AmapManager;
|
import com.uiui.os.utils.AmapManager;
|
||||||
import com.uiui.os.utils.APKUtils;
|
import com.uiui.os.utils.APKUtils;
|
||||||
import com.uiui.os.utils.AppUtil;
|
import com.uiui.os.utils.AppUtil;
|
||||||
@@ -52,10 +57,15 @@ import com.uiui.os.utils.Utils;
|
|||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
import io.reactivex.rxjava3.annotations.NonNull;
|
||||||
|
import io.reactivex.rxjava3.core.Observer;
|
||||||
|
import io.reactivex.rxjava3.disposables.Disposable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,6 +98,15 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
|||||||
TextView wifi_ssid;
|
TextView wifi_ssid;
|
||||||
@BindView(R.id.cl_wifi)
|
@BindView(R.id.cl_wifi)
|
||||||
ConstraintLayout cl_wifi;
|
ConstraintLayout cl_wifi;
|
||||||
|
@BindView(R.id.iv_sos)
|
||||||
|
ImageView iv_sos;
|
||||||
|
@BindView(R.id.rv_sos)
|
||||||
|
RecyclerView rv_sos;
|
||||||
|
@BindView(R.id.cl_sos)
|
||||||
|
ConstraintLayout cl_soso;
|
||||||
|
@BindView(R.id.iv_note_nodata)
|
||||||
|
ImageView iv_note_nodata;
|
||||||
|
|
||||||
|
|
||||||
private String TAG = CustomFragment.class.getSimpleName();
|
private String TAG = CustomFragment.class.getSimpleName();
|
||||||
private int[] mShaderColors = new int[]{0xFFfa3db5, 0xFFF8867E, 0xFFF79F6B, 0xFFF79F6B, 0xFFF79F6B, 0xFFF8867E, 0xFFfa3db5};
|
private int[] mShaderColors = new int[]{0xFFfa3db5, 0xFFF8867E, 0xFFF79F6B, 0xFFF79F6B, 0xFFF79F6B, 0xFFF8867E, 0xFFfa3db5};
|
||||||
@@ -95,7 +114,10 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
|||||||
private List<AlarmItem> alarmItemList;
|
private List<AlarmItem> alarmItemList;
|
||||||
private NotificationAdapter notificationAdapter;
|
private NotificationAdapter notificationAdapter;
|
||||||
private AlarmClockAdapter alarmClockAdapter;
|
private AlarmClockAdapter alarmClockAdapter;
|
||||||
|
private SOSNnmberAdapter sosNnmberAdapter;
|
||||||
private MMKV mmkv;
|
private MMKV mmkv;
|
||||||
|
private Context context;
|
||||||
|
private ContentResolver mCRv;
|
||||||
|
|
||||||
// TODO: Rename parameter arguments, choose names that match
|
// TODO: Rename parameter arguments, choose names that match
|
||||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||||
@@ -227,11 +249,11 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
|||||||
int status = intent.getIntExtra("status", BatteryManager.BATTERY_STATUS_UNKNOWN);
|
int status = intent.getIntExtra("status", BatteryManager.BATTERY_STATUS_UNKNOWN);
|
||||||
if (status == BatteryManager.BATTERY_STATUS_CHARGING) {
|
if (status == BatteryManager.BATTERY_STATUS_CHARGING) {
|
||||||
if (rootView != null) {
|
if (rootView != null) {
|
||||||
iv_charging.setVisibility(View.VISIBLE);
|
// iv_charging.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (rootView != null) {
|
if (rootView != null) {
|
||||||
iv_charging.setVisibility(View.GONE);
|
// iv_charging.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -243,6 +265,8 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
|||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
rootView = inflater.inflate(R.layout.fragment_custom, container, false);
|
rootView = inflater.inflate(R.layout.fragment_custom, container, false);
|
||||||
|
context = rootView.getContext();
|
||||||
|
mCRv = context.getContentResolver();
|
||||||
ButterKnife.bind(this, rootView);
|
ButterKnife.bind(this, rootView);
|
||||||
initView();
|
initView();
|
||||||
initData();
|
initData();
|
||||||
@@ -281,10 +305,42 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
|||||||
alarmClockAdapter = new AlarmClockAdapter();
|
alarmClockAdapter = new AlarmClockAdapter();
|
||||||
rv_clock.setLayoutManager(new LinearLayoutManager(getActivity()));
|
rv_clock.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
rv_clock.setAdapter(alarmClockAdapter);
|
rv_clock.setAdapter(alarmClockAdapter);
|
||||||
|
sosNnmberAdapter = new SOSNnmberAdapter();
|
||||||
|
rv_sos.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
|
rv_sos.setAdapter(sosNnmberAdapter);
|
||||||
|
cl_soso.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent intent = new Intent(getActivity(), EmergencyActivity.class);
|
||||||
|
// intent.putExtra("setting_sos", phone);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
getActivity().startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
setAlarm();
|
setAlarm();
|
||||||
refreshMemory();
|
refreshMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
setAlarm();
|
||||||
|
setSosNumber();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSosNumber() {
|
||||||
|
String setting_sos = Settings.System.getString(mCRv, "setting_sos");
|
||||||
|
if (TextUtils.isEmpty(setting_sos)) {
|
||||||
|
// rv_sos.setVisibility(View.GONE);
|
||||||
|
// iv_sos.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
// rv_sos.setVisibility(View.VISIBLE);
|
||||||
|
// iv_sos.setVisibility(View.GONE);
|
||||||
|
List<String> phoneList = new ArrayList<>(Arrays.asList(setting_sos.split(",")));
|
||||||
|
sosNnmberAdapter.setPhoneNumberList(phoneList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setAlarm() {
|
private void setAlarm() {
|
||||||
if (rootView == null) return;
|
if (rootView == null) return;
|
||||||
if (alarmItemList == null) {
|
if (alarmItemList == null) {
|
||||||
@@ -328,7 +384,13 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
|||||||
}.getType();
|
}.getType();
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
List<AlarmClockData> data = gson.fromJson(jsonString, type);
|
List<AlarmClockData> data = gson.fromJson(jsonString, type);
|
||||||
|
List<AlarmClockData> showData = data.subList(0, 1);
|
||||||
notificationAdapter.setDataList(data);
|
notificationAdapter.setDataList(data);
|
||||||
|
recyclerView.setVisibility(View.VISIBLE);
|
||||||
|
iv_note_nodata.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
recyclerView.setVisibility(View.GONE);
|
||||||
|
iv_note_nodata.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,7 +431,7 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
|||||||
|
|
||||||
|
|
||||||
private void killBackgroundApp() {
|
private void killBackgroundApp() {
|
||||||
List<String> pkgList = APKUtils.queryFilterAppList(getActivity());
|
List<String> pkgList = APKUtils.queryFilterAppList(context);
|
||||||
for (String pkg : pkgList) {
|
for (String pkg : pkgList) {
|
||||||
if (pkg.equalsIgnoreCase(BuildConfig.APPLICATION_ID)) continue;
|
if (pkg.equalsIgnoreCase(BuildConfig.APPLICATION_ID)) continue;
|
||||||
killBackgroundProcesses(pkg);
|
killBackgroundProcesses(pkg);
|
||||||
@@ -380,7 +442,7 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
|||||||
ActivityManager activityManager;
|
ActivityManager activityManager;
|
||||||
try {
|
try {
|
||||||
activityManager = (ActivityManager)
|
activityManager = (ActivityManager)
|
||||||
getActivity().getSystemService(Context.ACTIVITY_SERVICE);
|
context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||||
activityManager.killBackgroundProcesses(packageName);
|
activityManager.killBackgroundProcesses(packageName);
|
||||||
Method forceStopPackage = activityManager.getClass()
|
Method forceStopPackage = activityManager.getClass()
|
||||||
.getDeclaredMethod("forceStopPackage", String.class);
|
.getDeclaredMethod("forceStopPackage", String.class);
|
||||||
@@ -395,8 +457,8 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void refreshMemory() {
|
private void refreshMemory() {
|
||||||
long avail = AppUtil.getAvailMemory(getActivity());
|
long avail = AppUtil.getAvailMemory(context);
|
||||||
long total = AppUtil.getTotalMemory(getActivity());
|
long total = AppUtil.getTotalMemory(context);
|
||||||
int x = (int) (((total - avail) / (double) total) * 100);
|
int x = (int) (((total - avail) / (double) total) * 100);
|
||||||
cpv.setProgressColor(mShaderColors);
|
cpv.setProgressColor(mShaderColors);
|
||||||
cpv.showAnimation(0, x, 1000);
|
cpv.showAnimation(0, x, 1000);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.uiui.os.bean.BaseResponse;
|
|||||||
import com.uiui.os.network.api.AlarmClockApi;
|
import com.uiui.os.network.api.AlarmClockApi;
|
||||||
import com.uiui.os.network.api.AppUsageRecordApi;
|
import com.uiui.os.network.api.AppUsageRecordApi;
|
||||||
import com.uiui.os.network.api.RunNewApp;
|
import com.uiui.os.network.api.RunNewApp;
|
||||||
|
import com.uiui.os.network.api.SOSRecord;
|
||||||
import com.uiui.os.network.api.SendScreenshotApi;
|
import com.uiui.os.network.api.SendScreenshotApi;
|
||||||
import com.uiui.os.utils.MD5Util;
|
import com.uiui.os.utils.MD5Util;
|
||||||
import com.uiui.os.utils.Utils;
|
import com.uiui.os.utils.Utils;
|
||||||
@@ -168,6 +169,13 @@ public class NetInterfaceManager {
|
|||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Observable<BaseResponse> getSOSRecordObservable() {
|
||||||
|
return mRetrofit.create(SOSRecord.class)
|
||||||
|
.sendSOSRecord(Utils.getSerial())
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
|
}
|
||||||
|
|
||||||
public AppUsageRecordApi getAppUsageRecordControl() {
|
public AppUsageRecordApi getAppUsageRecordControl() {
|
||||||
return mRetrofit.create(AppUsageRecordApi.class);
|
return mRetrofit.create(AppUsageRecordApi.class);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,4 +10,7 @@ public class URLAddress {
|
|||||||
public static final String RUN_NEW_APP = "app/runNewApp";
|
public static final String RUN_NEW_APP = "app/runNewApp";
|
||||||
//上传截图
|
//上传截图
|
||||||
public static final String SEND_SCREENSHOT = "sn/uploadScreenshot";
|
public static final String SEND_SCREENSHOT = "sn/uploadScreenshot";
|
||||||
|
//sos记录
|
||||||
|
public static final String SOS_RECORD = "sosRecord";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
17
app/src/main/java/com/uiui/os/network/api/SOSRecord.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package com.uiui.os.network.api;
|
||||||
|
|
||||||
|
import com.uiui.os.bean.BaseResponse;
|
||||||
|
import com.uiui.os.network.URLAddress;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
|
import retrofit2.http.Field;
|
||||||
|
import retrofit2.http.FormUrlEncoded;
|
||||||
|
import retrofit2.http.POST;
|
||||||
|
|
||||||
|
public interface SOSRecord {
|
||||||
|
@FormUrlEncoded
|
||||||
|
@POST(URLAddress.SOS_RECORD)
|
||||||
|
Observable<BaseResponse> sendSOSRecord(
|
||||||
|
@Field("sn") String sn
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -4,6 +4,8 @@ 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.content.pm.ApplicationInfo;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
@@ -17,6 +19,7 @@ import com.arialyy.aria.core.Aria;
|
|||||||
import com.arialyy.aria.core.task.DownloadTask;
|
import com.arialyy.aria.core.task.DownloadTask;
|
||||||
import com.blankj.utilcode.util.ImageUtils;
|
import com.blankj.utilcode.util.ImageUtils;
|
||||||
import com.blankj.utilcode.util.NetworkUtils;
|
import com.blankj.utilcode.util.NetworkUtils;
|
||||||
|
import com.uiui.os.BuildConfig;
|
||||||
import com.uiui.os.activity.MainContact;
|
import com.uiui.os.activity.MainContact;
|
||||||
import com.uiui.os.activity.MainPresenter;
|
import com.uiui.os.activity.MainPresenter;
|
||||||
import com.uiui.os.activity.NoticeActivity;
|
import com.uiui.os.activity.NoticeActivity;
|
||||||
@@ -24,9 +27,10 @@ import com.uiui.os.base.BaseService;
|
|||||||
import com.uiui.os.bean.AlarmClockData;
|
import com.uiui.os.bean.AlarmClockData;
|
||||||
import com.uiui.os.bean.BaseResponse;
|
import com.uiui.os.bean.BaseResponse;
|
||||||
import com.uiui.os.network.NetInterfaceManager;
|
import com.uiui.os.network.NetInterfaceManager;
|
||||||
|
import com.uiui.os.utils.APKUtils;
|
||||||
import com.uiui.os.utils.CmdUtil;
|
import com.uiui.os.utils.CmdUtil;
|
||||||
import com.uiui.os.utils.ForegroundAppUtil;
|
import com.uiui.os.utils.ForegroundAppUtil;
|
||||||
import com.uiui.os.utils.TimeUtils;
|
import com.uiui.os.utils.AppUsedTimeUtils;
|
||||||
import com.uiui.os.utils.ToastUtil;
|
import com.uiui.os.utils.ToastUtil;
|
||||||
import com.uiui.os.utils.Utils;
|
import com.uiui.os.utils.Utils;
|
||||||
|
|
||||||
@@ -36,9 +40,7 @@ import java.io.File;
|
|||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.rxjava3.core.Observable;
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
@@ -92,6 +94,7 @@ public class MainService extends BaseService implements MainContact.MainView, Ne
|
|||||||
mPresenter.getAlarmClock();
|
mPresenter.getAlarmClock();
|
||||||
registerAlarmReceiver();
|
registerAlarmReceiver();
|
||||||
registerTimeReceiver();
|
registerTimeReceiver();
|
||||||
|
registerLockScreenReceiver();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -185,7 +188,6 @@ public class MainService extends BaseService implements MainContact.MainView, Ne
|
|||||||
private final static long ONE_HOURS_TIME = 60 * 60 * 1000;
|
private final static long ONE_HOURS_TIME = 60 * 60 * 1000;
|
||||||
private final static long TEN_MINUTES_TIME = 60 * 10 * 1000;
|
private final static long TEN_MINUTES_TIME = 60 * 10 * 1000;
|
||||||
|
|
||||||
|
|
||||||
private void isScreenshot() {
|
private void isScreenshot() {
|
||||||
//1、检测应用使用情况,如果设备长时间运行一个应用,超过1小时,启动截屏一次。
|
//1、检测应用使用情况,如果设备长时间运行一个应用,超过1小时,启动截屏一次。
|
||||||
//2、检测设备在非正常时间使用时,使用第三方应用,在运行10分钟后,启动截屏功能一次
|
//2、检测设备在非正常时间使用时,使用第三方应用,在运行10分钟后,启动截屏功能一次
|
||||||
@@ -193,8 +195,8 @@ public class MainService extends BaseService implements MainContact.MainView, Ne
|
|||||||
// TODO: 2021/12/20 计算当前app打开时间
|
// TODO: 2021/12/20 计算当前app打开时间
|
||||||
String topPackageName = ForegroundAppUtil.getForegroundPackageName(MainService.this);
|
String topPackageName = ForegroundAppUtil.getForegroundPackageName(MainService.this);
|
||||||
Log.e(TAG, "isScreenshot: " + topPackageName);
|
Log.e(TAG, "isScreenshot: " + topPackageName);
|
||||||
String pkg = TimeUtils.getInstance().getAppPackageName();
|
String pkg = AppUsedTimeUtils.getInstance().getAppPackageName();
|
||||||
if (TextUtils.isEmpty(pkg)) {
|
if (TextUtils.isEmpty(pkg)|| BuildConfig.APPLICATION_ID.equals(pkg)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,8 +206,8 @@ public class MainService extends BaseService implements MainContact.MainView, Ne
|
|||||||
Log.e(TAG, "isScreenshot: screenOn = " + screenOn);
|
Log.e(TAG, "isScreenshot: screenOn = " + screenOn);
|
||||||
if (!screenOn) return;
|
if (!screenOn) return;
|
||||||
|
|
||||||
long startTime = TimeUtils.getInstance().getStartTime();
|
long startTime = AppUsedTimeUtils.getInstance().getStartTime();
|
||||||
if (TimeUtils.getInstance().isNormalTime()) {//正常时间段
|
if (AppUsedTimeUtils.getInstance().isNormalTime()) {//正常时间段
|
||||||
if (System.currentTimeMillis() - startTime >= ONE_HOURS_TIME) {
|
if (System.currentTimeMillis() - startTime >= ONE_HOURS_TIME) {
|
||||||
Log.e(TAG, "isScreenshot: " + "截图");
|
Log.e(TAG, "isScreenshot: " + "截图");
|
||||||
doscreenshot(this);
|
doscreenshot(this);
|
||||||
@@ -253,21 +255,21 @@ public class MainService extends BaseService implements MainContact.MainView, Ne
|
|||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
throw new FileNotFoundException(filePath);
|
throw new FileNotFoundException(filePath);
|
||||||
}
|
}
|
||||||
Bitmap bitmap = BitmapFactory.decodeFile(filePath);
|
// Bitmap bitmap = BitmapFactory.decodeFile(filePath);
|
||||||
if (bitmap.getWidth() < bitmap.getHeight()) {
|
// if (bitmap.getWidth() < bitmap.getHeight()) {
|
||||||
bitmap = ImageUtils.rotate(bitmap, -90, bitmap.getWidth(), bitmap.getHeight());
|
// bitmap = ImageUtils.rotate(bitmap, -90, bitmap.getWidth(), bitmap.getHeight());
|
||||||
}
|
// }
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
// ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
|
// bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
|
||||||
file.createNewFile();
|
// file.createNewFile();
|
||||||
FileOutputStream fos = new FileOutputStream(file);
|
// FileOutputStream fos = new FileOutputStream(file);
|
||||||
InputStream is = new ByteArrayInputStream(baos.toByteArray());
|
// InputStream is = new ByteArrayInputStream(baos.toByteArray());
|
||||||
int x;
|
// int x;
|
||||||
byte[] b = new byte[1024 * 100];
|
// byte[] b = new byte[1024 * 100];
|
||||||
while ((x = is.read(b)) != -1) {
|
// while ((x = is.read(b)) != -1) {
|
||||||
fos.write(b, 0, x);
|
// fos.write(b, 0, x);
|
||||||
}
|
// }
|
||||||
fos.close();
|
// fos.close();
|
||||||
RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file);
|
RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file);
|
||||||
MultipartBody.Part body = MultipartBody.Part.createFormData("file", file.getName(), requestFile);
|
MultipartBody.Part body = MultipartBody.Part.createFormData("file", file.getName(), requestFile);
|
||||||
return getSendFile(filePath, body);
|
return getSendFile(filePath, body);
|
||||||
@@ -298,6 +300,89 @@ public class MainService extends BaseService implements MainContact.MainView, Ne
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private LockScreenReceiver lockScreenReceiver;
|
||||||
|
|
||||||
|
private void registerLockScreenReceiver() {
|
||||||
|
if (lockScreenReceiver == null) {
|
||||||
|
lockScreenReceiver = new LockScreenReceiver();
|
||||||
|
}
|
||||||
|
IntentFilter filter = new IntentFilter();
|
||||||
|
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||||
|
filter.addAction(Intent.ACTION_USER_PRESENT);
|
||||||
|
filter.addAction(Intent.ACTION_SCREEN_ON);
|
||||||
|
filter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||||
|
registerReceiver(lockScreenReceiver, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
static class LockScreenReceiver extends BroadcastReceiver {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
String action = intent.getAction();
|
||||||
|
if (TextUtils.isEmpty(action)) return;
|
||||||
|
Log.e(TAG, "onReceive: " + action);
|
||||||
|
switch (action) {
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
case Intent.ACTION_USER_PRESENT:
|
||||||
|
resetStartTime(context);
|
||||||
|
break;
|
||||||
|
case Intent.ACTION_SCREEN_ON:
|
||||||
|
|
||||||
|
break;
|
||||||
|
case Intent.ACTION_SCREEN_OFF:
|
||||||
|
//关闭屏幕上传数据
|
||||||
|
sendAppUsed(context);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void resetStartTime(Context context) {
|
||||||
|
String topPackageName = ForegroundAppUtil.getForegroundPackageName(context);
|
||||||
|
Log.e(TAG, "resetStartTime: " + topPackageName);
|
||||||
|
AppUsedTimeUtils.getInstance().setAppPackageName(topPackageName);
|
||||||
|
AppUsedTimeUtils.getInstance().setStartTime(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void sendAppUsed(Context context) {
|
||||||
|
String packagename = AppUsedTimeUtils.getInstance().getAppPackageName();
|
||||||
|
Log.e(TAG, "onResume packagename == " + packagename);
|
||||||
|
// AppUsedTimeUtils.getInstance().setEndTime(System.currentTimeMillis());
|
||||||
|
if (!TextUtils.isEmpty(packagename)) {
|
||||||
|
NetInterfaceManager.getInstance().getAppUsageRecordControl()
|
||||||
|
.sendappUsageRecord(Utils.getSerial(),
|
||||||
|
APKUtils.getAppNameByPackage(context, packagename),
|
||||||
|
packagename,
|
||||||
|
AppUsedTimeUtils.getInstance().getStartTime() / 1000,
|
||||||
|
AppUsedTimeUtils.getInstance().getEndTime() / 1000)
|
||||||
|
.subscribe(new Observer<BaseResponse>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
Log.e("sendAppUsed", "onSubscribe: ");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(BaseResponse baseResponse) {
|
||||||
|
Log.e("sendAppUsed", "onNext: " + baseResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
Log.e("sendAppUsed", "onError: " + e.getMessage());
|
||||||
|
onComplete();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
Log.e("sendAppUsed", "onComplete: ");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Log.e("fht", "app = null" + packagename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//在这里处理任务执行中的状态,如进度进度条的刷新
|
//在这里处理任务执行中的状态,如进度进度条的刷新
|
||||||
@Download.onTaskRunning
|
@Download.onTaskRunning
|
||||||
protected void running(DownloadTask task) {
|
protected void running(DownloadTask task) {
|
||||||
|
|||||||
@@ -13,14 +13,24 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.uiui.os.BuildConfig;
|
import com.uiui.os.BuildConfig;
|
||||||
|
|
||||||
|
import java.text.Collator;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class APKUtils {
|
public class APKUtils {
|
||||||
private static String[] excludePackageName = {BuildConfig.APPLICATION_ID};
|
private static HashSet<String> excludePackageName = new HashSet<String>() {{
|
||||||
|
this.add(BuildConfig.APPLICATION_ID);
|
||||||
|
this.add("org.chromium.browser");
|
||||||
|
this.add("com.sprd.sprdnote");
|
||||||
|
this.add("com.android.deskclock");
|
||||||
|
this.add("com.alldocube.store");
|
||||||
|
}};
|
||||||
|
private static String TAG = APKUtils.class.getSimpleName();
|
||||||
|
|
||||||
|
|
||||||
public static ArrayList<ApplicationInfo> queryFilterAppInfo(Context context) {
|
public static ArrayList<ApplicationInfo> queryFilterAppInfo(Context context) {
|
||||||
@@ -37,6 +47,7 @@ public class APKUtils {
|
|||||||
List<ResolveInfo> resolveinfoList = pm.queryIntentActivities(resolveIntent, 0);
|
List<ResolveInfo> resolveinfoList = pm.queryIntentActivities(resolveIntent, 0);
|
||||||
Set<String> allowPackages = new HashSet();
|
Set<String> allowPackages = new HashSet();
|
||||||
for (ResolveInfo resolveInfo : resolveinfoList) {
|
for (ResolveInfo resolveInfo : resolveinfoList) {
|
||||||
|
Log.i(TAG, "queryFilterAppInfo: " + resolveInfo.activityInfo.packageName);
|
||||||
allowPackages.add(resolveInfo.activityInfo.packageName);
|
allowPackages.add(resolveInfo.activityInfo.packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,11 +59,28 @@ public class APKUtils {
|
|||||||
// if(app.uid > 10000){//通过uid排除系统应用,在一些手机上效果不好
|
// if(app.uid > 10000){//通过uid排除系统应用,在一些手机上效果不好
|
||||||
// applicationInfos.add(app);
|
// applicationInfos.add(app);
|
||||||
// }
|
// }
|
||||||
if (allowPackages.contains(app.packageName) && !Arrays.asList(excludePackageName).contains(app.packageName)) {
|
if (allowPackages.contains(app.packageName) && !excludePackageName.contains(app.packageName)) {
|
||||||
// if (allowPackages.contains(app.packageName)) {
|
// if (allowPackages.contains(app.packageName)) {
|
||||||
applicationInfos.add(app);
|
applicationInfos.add(app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
applicationInfos.sort(new Comparator<ApplicationInfo>() {
|
||||||
|
@Override
|
||||||
|
public int compare(ApplicationInfo o1, ApplicationInfo o2) {
|
||||||
|
return Collator.getInstance(Locale.CHINESE).compare(o1.loadLabel(pm).toString(),o2.loadLabel(pm).toString());
|
||||||
|
// return o1.loadLabel(pm).toString().compareTo(o2.loadLabel(pm).toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
applicationInfos.sort(new Comparator<ApplicationInfo>() {
|
||||||
|
@Override
|
||||||
|
public int compare(ApplicationInfo o1, ApplicationInfo o2) {
|
||||||
|
if ((o1.flags & ApplicationInfo.FLAG_SYSTEM) <= (o2.flags & ApplicationInfo.FLAG_SYSTEM)) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
return applicationInfos;
|
return applicationInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,4 +208,15 @@ public class APKUtils {
|
|||||||
return versionName;
|
return versionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getAppNameByPackage(Context context, String pkg) {
|
||||||
|
PackageManager packageManager = context.getPackageManager();
|
||||||
|
try {
|
||||||
|
ApplicationInfo applicationInfo = packageManager.getApplicationInfo(pkg, PackageManager.GET_META_DATA);
|
||||||
|
String packageName = packageManager.getApplicationLabel(applicationInfo).toString();
|
||||||
|
return packageName;
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
169
app/src/main/java/com/uiui/os/utils/AppUsedTimeUtils.java
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
package com.uiui.os.utils;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.provider.Settings;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AppUsedTimeUtils {
|
||||||
|
private static final String TAG = AppUsedTimeUtils.class.getSimpleName();
|
||||||
|
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
private static AppUsedTimeUtils sInstance;
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
private SimpleDateFormat ruleSDF = new SimpleDateFormat("HH:mm:ss");
|
||||||
|
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
private AppTimeinfo appTimeinfo;
|
||||||
|
|
||||||
|
private AppUsedTimeUtils(Context context) {
|
||||||
|
this.mContext = context;
|
||||||
|
appTimeinfo = getAppTimeinfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init(Context context) {
|
||||||
|
if (sInstance == null) {
|
||||||
|
sInstance = new AppUsedTimeUtils(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AppUsedTimeUtils getInstance() {
|
||||||
|
if (sInstance == null) {
|
||||||
|
throw new IllegalStateException("You must be init TimeUtils first");
|
||||||
|
}
|
||||||
|
return sInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String normalStartTime = "8:00:00";
|
||||||
|
private static String unusualStartTime = "22:00:00";
|
||||||
|
|
||||||
|
static class AppTimeinfo implements Serializable {
|
||||||
|
private static final long serialVersionUID = 5373751133823666192L;
|
||||||
|
|
||||||
|
AppTimeinfo() {
|
||||||
|
this.appPackageName = "";
|
||||||
|
this.endTime = 0;
|
||||||
|
this.startTime = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String appPackageName;
|
||||||
|
private long endTime;
|
||||||
|
private long startTime;
|
||||||
|
|
||||||
|
public String getAppPackageName() {
|
||||||
|
return appPackageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppPackageName(String appPackageName) {
|
||||||
|
this.appPackageName = appPackageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getEndTime() {
|
||||||
|
return endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndTime(long endTime) {
|
||||||
|
this.endTime = endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getStartTime() {
|
||||||
|
return startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartTime(long startTime) {
|
||||||
|
this.startTime = startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized public void setAppPackageName(String name) {
|
||||||
|
appTimeinfo.setAppPackageName(name);
|
||||||
|
setAppTimeinfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized public String getAppPackageName() {
|
||||||
|
return appTimeinfo.getAppPackageName();
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized public void setStartTime(long time) {
|
||||||
|
appTimeinfo.setStartTime(time);
|
||||||
|
setAppTimeinfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized public long getStartTime() {
|
||||||
|
return appTimeinfo.getStartTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized public void setEndTime(long time) {
|
||||||
|
appTimeinfo.setEndTime(time);
|
||||||
|
setAppTimeinfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized public long getEndTime() {
|
||||||
|
return appTimeinfo.getEndTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized private AppTimeinfo getAppTimeinfo() {
|
||||||
|
String jsonString = Settings.System.getString(mContext.getContentResolver(), "runningAppInfo");
|
||||||
|
if (TextUtils.isEmpty(jsonString)) {
|
||||||
|
return new AppTimeinfo();
|
||||||
|
}
|
||||||
|
Log.e(TAG, "getAppTimeinfo: " + jsonString);
|
||||||
|
Type type = new TypeToken<AppTimeinfo>() {
|
||||||
|
}.getType();
|
||||||
|
Gson gson = new Gson();
|
||||||
|
AppTimeinfo appTimeinfo = gson.fromJson(jsonString, type);
|
||||||
|
return appTimeinfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized private void setAppTimeinfo() {
|
||||||
|
String jsonString = JsonParser.parseString(appTimeinfo.toString()).getAsJsonObject().toString();
|
||||||
|
Settings.System.putString(mContext.getContentResolver(), "runningAppInfo", jsonString);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final long DAY_TIME = 1000 * 60 * 60 * 24;
|
||||||
|
|
||||||
|
public boolean isNormalTime() {
|
||||||
|
long nowTime = System.currentTimeMillis();
|
||||||
|
String nowTimeString = ruleSDF.format(new Date(nowTime)); // 时间戳转换日期
|
||||||
|
try {
|
||||||
|
Date startDate = ruleSDF.parse(normalStartTime);
|
||||||
|
Date endDate = ruleSDF.parse(unusualStartTime);
|
||||||
|
Date now = ruleSDF.parse(nowTimeString);
|
||||||
|
Log.e(TAG, "isScreenshot: startDate = " + startDate);
|
||||||
|
Log.e(TAG, "isScreenshot: endDate = " + endDate);
|
||||||
|
Log.e(TAG, "isScreenshot: now = " + now);
|
||||||
|
if (startDate.getTime() <= now.getTime() && now.getTime() <= endDate.getTime()) {
|
||||||
|
return true;
|
||||||
|
} else if (endDate.getTime() < now.getTime() && now.getTime() <= startDate.getTime() + DAY_TIME) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Log.e(TAG, "isScreenshot: " + e.getMessage());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -18,6 +18,7 @@ public class IconUtils {
|
|||||||
this.add("com.android.dialer");//电话
|
this.add("com.android.dialer");//电话
|
||||||
this.add("com.android.gallery3d");//图库
|
this.add("com.android.gallery3d");//图库
|
||||||
this.add("com.android.mms.ui");//信息
|
this.add("com.android.mms.ui");//信息
|
||||||
|
this.add("com.android.messaging");//信息
|
||||||
this.add("com.android.music");//音乐
|
this.add("com.android.music");//音乐
|
||||||
this.add("com.android.providers.downloads.ui");//下载
|
this.add("com.android.providers.downloads.ui");//下载
|
||||||
this.add("com.android.quicksearchbox");//搜索
|
this.add("com.android.quicksearchbox");//搜索
|
||||||
@@ -45,6 +46,7 @@ public class IconUtils {
|
|||||||
this.add("com_android_dialer");
|
this.add("com_android_dialer");
|
||||||
this.add("com_android_gallery3d_app");
|
this.add("com_android_gallery3d_app");
|
||||||
this.add("com_android_mms_ui");
|
this.add("com_android_mms_ui");
|
||||||
|
this.add("com_android_mms_ui");
|
||||||
this.add("com_android_music");
|
this.add("com_android_music");
|
||||||
this.add("com_android_providers_downloads_ui");
|
this.add("com_android_providers_downloads_ui");
|
||||||
this.add("com_android_quicksearchbox");
|
this.add("com_android_quicksearchbox");
|
||||||
|
|||||||
@@ -1,93 +0,0 @@
|
|||||||
package com.uiui.os.utils;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import java.text.ParseException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class TimeUtils {
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
|
||||||
private static TimeUtils sInstance;
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
private SimpleDateFormat ruleSDF = new SimpleDateFormat("HH:mm:ss");
|
|
||||||
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
||||||
private String TAG = TimeUtils.class.getSimpleName();
|
|
||||||
|
|
||||||
private TimeUtils(Context context) {
|
|
||||||
this.mContext = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void init(Context context) {
|
|
||||||
if (sInstance == null) {
|
|
||||||
sInstance = new TimeUtils(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TimeUtils getInstance() {
|
|
||||||
if (sInstance == null) {
|
|
||||||
throw new IllegalStateException("You must be init TimeUtils first");
|
|
||||||
}
|
|
||||||
return sInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String normalStartTime = "8:00:00";
|
|
||||||
private static String unusualStartTime = "22:00:00";
|
|
||||||
|
|
||||||
private String appPackageName;
|
|
||||||
private long endTime = 0;
|
|
||||||
private long startTime = 0;
|
|
||||||
|
|
||||||
public void setAppPackageName(String name) {
|
|
||||||
this.appPackageName = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAppPackageName() {
|
|
||||||
return appPackageName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStartTime(long time) {
|
|
||||||
this.startTime = time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getStartTime() {
|
|
||||||
return startTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEndTime(long time) {
|
|
||||||
this.endTime = time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getEndTime() {
|
|
||||||
return endTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final long DAY_TIME = 1000 * 60 * 60 * 24;
|
|
||||||
|
|
||||||
public boolean isNormalTime() {
|
|
||||||
long nowTime = System.currentTimeMillis();
|
|
||||||
String nowTimeString = ruleSDF.format(new Date(nowTime)); // 时间戳转换日期
|
|
||||||
try {
|
|
||||||
Date startDate = ruleSDF.parse(normalStartTime);
|
|
||||||
Date endDate = ruleSDF.parse(unusualStartTime);
|
|
||||||
Date now = ruleSDF.parse(nowTimeString);
|
|
||||||
Log.e(TAG, "isScreenshot: startDate = " + startDate);
|
|
||||||
Log.e(TAG, "isScreenshot: endDate = " + endDate);
|
|
||||||
Log.e(TAG, "isScreenshot: now = " + now);
|
|
||||||
if (startDate.getTime() <= now.getTime() && now.getTime() <= endDate.getTime()) {
|
|
||||||
return true;
|
|
||||||
} else if (endDate.getTime() < now.getTime() && now.getTime() <= startDate.getTime() + DAY_TIME) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
Log.e(TAG, "isScreenshot: " + e.getMessage());
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.6 KiB |
BIN
app/src/main/res/drawable-hdpi/note_nodata.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/close.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<!-- 内部颜色 -->
|
<!-- 内部颜色 -->
|
||||||
<solid android:color="@color/white" />
|
<solid android:color="@color/notice_blue" />
|
||||||
<!-- 圆角的幅度 -->
|
<!-- 圆角的幅度 -->
|
||||||
<corners
|
<corners
|
||||||
android:bottomLeftRadius="30dp"
|
android:bottomLeftRadius="30dp"
|
||||||
|
|||||||
49
app/src/main/res/layout-land/activity_emergency.xml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".activity.EmergencyActivity">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView12"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="68dp"
|
||||||
|
android:text="紧急呼叫功能已开启"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="40sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_countdown"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:text="倒计时(3)秒"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/textView12" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_finish"
|
||||||
|
android:layout_width="96dp"
|
||||||
|
android:layout_height="96dp"
|
||||||
|
android:layout_marginBottom="48dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/close"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.499"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:text="天气预报"
|
android:text="天气预报"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="19sp"
|
android:textSize="15sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
@@ -92,20 +92,35 @@
|
|||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:text="爱心守护"
|
android:text="爱心守护"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="19sp"
|
android:textSize="15sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_note_nodata"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="150dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerInside"
|
||||||
|
android:src="@drawable/note_nodata"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
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="0dp"
|
android:layout_height="0dp"
|
||||||
|
android:overScrollMode="never"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView4" />
|
app:layout_constraintTop_toBottomOf="@+id/textView4" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/cl_sos"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="8dp"
|
android:layout_margin="8dp"
|
||||||
@@ -113,18 +128,20 @@
|
|||||||
android:background="@drawable/custom_background">
|
android:background="@drawable/custom_background">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/textView7"
|
||||||
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"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:text="紧急呼叫"
|
android:text="紧急呼叫"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="19sp"
|
android:textSize="15sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/iv_sos"
|
||||||
android:layout_width="64dp"
|
android:layout_width="64dp"
|
||||||
android:layout_height="80dp"
|
android:layout_height="80dp"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
@@ -134,6 +151,16 @@
|
|||||||
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" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rv_sos"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/textView7" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -160,7 +187,7 @@
|
|||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:text="我的闹钟"
|
android:text="我的闹钟"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="19sp"
|
android:textSize="15sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
@@ -173,7 +200,7 @@
|
|||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:text="添加闹钟"
|
android:text="添加闹钟"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="17sp"
|
android:textSize="15sp"
|
||||||
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"
|
||||||
@@ -205,7 +232,7 @@
|
|||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:text="设备电量"
|
android:text="设备电量"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="19sp"
|
android:textSize="15sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
@@ -231,7 +258,7 @@
|
|||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="24sp"
|
android:textSize="20sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.497"
|
app:layout_constraintHorizontal_bias="0.497"
|
||||||
@@ -255,7 +282,7 @@
|
|||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:text="我的WiFi"
|
android:text="我的WiFi"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="19sp"
|
android:textSize="15sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
@@ -278,7 +305,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="24sp"
|
android:textSize="0sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
@@ -297,14 +324,16 @@
|
|||||||
android:layout_width="140dp"
|
android:layout_width="140dp"
|
||||||
android:layout_height="140dp"
|
android:layout_height="140dp"
|
||||||
app:cpvDuration="1000"
|
app:cpvDuration="1000"
|
||||||
app:cpvLabelTextSize="34sp"
|
app:cpvLabelTextSize="26sp"
|
||||||
app:cpvNormalColor="#D8D6D7"
|
app:cpvNormalColor="#D8D6D7"
|
||||||
app:cpvShowTick="false"
|
app:cpvShowTick="false"
|
||||||
app:cpvStrokeWidth="20dp"
|
app:cpvStrokeWidth="20dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.481"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.48" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView2"
|
android:id="@+id/textView2"
|
||||||
@@ -314,7 +343,7 @@
|
|||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:text="一键加速"
|
android:text="一键加速"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="19sp"
|
android:textSize="15sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|||||||
50
app/src/main/res/layout-port/activity_emergency.xml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".activity.EmergencyActivity">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView12"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="192dp"
|
||||||
|
android:text="紧急呼叫功能已开启"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="34sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_countdown"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="64dp"
|
||||||
|
android:text="倒计时(3)秒"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/textView12" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_finish"
|
||||||
|
android:layout_width="96dp"
|
||||||
|
android:layout_height="96dp"
|
||||||
|
android:layout_marginBottom="100dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/close"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:text="天气预报"
|
android:text="天气预报"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="19sp"
|
android:textSize="15sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
@@ -91,15 +91,29 @@
|
|||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:text="爱心守护"
|
android:text="爱心守护"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="19sp"
|
android:textSize="15sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_note_nodata"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="150dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerInside"
|
||||||
|
android:src="@drawable/note_nodata"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
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="0dp"
|
android:layout_height="0dp"
|
||||||
|
android:overScrollMode="never"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView4" />
|
app:layout_constraintTop_toBottomOf="@+id/textView4" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -112,6 +126,7 @@
|
|||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/cl_sos"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="8dp"
|
android:layout_margin="8dp"
|
||||||
@@ -119,18 +134,20 @@
|
|||||||
android:background="@drawable/custom_background">
|
android:background="@drawable/custom_background">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/textView11"
|
||||||
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"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:text="紧急呼叫"
|
android:text="紧急呼叫"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="19sp"
|
android:textSize="15sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/iv_sos"
|
||||||
android:layout_width="64dp"
|
android:layout_width="64dp"
|
||||||
android:layout_height="80dp"
|
android:layout_height="80dp"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
@@ -140,6 +157,16 @@
|
|||||||
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" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rv_sos"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/textView11" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
@@ -158,7 +185,7 @@
|
|||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:text="我的闹钟"
|
android:text="我的闹钟"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="19sp"
|
android:textSize="15sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
@@ -171,7 +198,7 @@
|
|||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:text="添加闹钟"
|
android:text="添加闹钟"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="17sp"
|
android:textSize="15sp"
|
||||||
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"
|
||||||
@@ -209,7 +236,7 @@
|
|||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:text="设备电量"
|
android:text="设备电量"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="19sp"
|
android:textSize="15sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
@@ -219,7 +246,7 @@
|
|||||||
android:layout_width="70dp"
|
android:layout_width="70dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerCrop"
|
||||||
android:src="@drawable/charging"
|
android:src="@drawable/charging"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="@+id/tv_battery"
|
app:layout_constraintEnd_toEndOf="@+id/tv_battery"
|
||||||
@@ -235,7 +262,7 @@
|
|||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="24sp"
|
android:textSize="20sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.497"
|
app:layout_constraintHorizontal_bias="0.497"
|
||||||
@@ -258,7 +285,7 @@
|
|||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:text="我的WiFi"
|
android:text="我的WiFi"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="19sp"
|
android:textSize="15sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
@@ -279,7 +306,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="24sp"
|
android:textSize="20sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
@@ -305,6 +332,7 @@
|
|||||||
android:layout_height="160dp"
|
android:layout_height="160dp"
|
||||||
android:layout_margin="8dp"
|
android:layout_margin="8dp"
|
||||||
app:cpvDuration="1000"
|
app:cpvDuration="1000"
|
||||||
|
app:cpvLabelTextSize="26sp"
|
||||||
app:cpvNormalColor="#D8D6D7"
|
app:cpvNormalColor="#D8D6D7"
|
||||||
app:cpvShowTick="false"
|
app:cpvShowTick="false"
|
||||||
app:cpvStrokeWidth="28dp"
|
app:cpvStrokeWidth="28dp"
|
||||||
@@ -321,7 +349,7 @@
|
|||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:text="一键加速"
|
android:text="一键加速"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="19sp"
|
android:textSize="15sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|||||||
@@ -8,8 +8,7 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp">
|
||||||
android:background="@drawable/alarmclcok_background">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_title"
|
android:id="@+id/tv_title"
|
||||||
@@ -44,6 +43,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:text="30秒"
|
android:text="30秒"
|
||||||
|
android:textColor="@color/white"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|||||||
33
app/src/main/res/layout/item_sosnumber.xml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/root"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="4dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_number"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/red"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.4"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.0" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_dial"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="32dp"
|
||||||
|
android:text="拨号"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/tv_number"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/tv_number" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 4.2 KiB |
@@ -12,5 +12,6 @@
|
|||||||
<color name="yellow">#F8B551</color>
|
<color name="yellow">#F8B551</color>
|
||||||
<color name="notice_blue">#0480FF</color>
|
<color name="notice_blue">#0480FF</color>
|
||||||
<color name="ok_button">#4D4B50</color>
|
<color name="ok_button">#4D4B50</color>
|
||||||
|
<color name="red">#FF0000</color>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -22,6 +22,11 @@ allprojects {
|
|||||||
jcenter()
|
jcenter()
|
||||||
maven { url "https://jitpack.io" }
|
maven { url "https://jitpack.io" }
|
||||||
}
|
}
|
||||||
|
gradle.projectsEvaluated {
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
options.compilerArgs.add('-Xbootclasspath/p:app/libs/framework.jar')
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
task clean(type: Delete) {
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
rootProject.name='老人平板桌面'
|
|
||||||
include ':app'
|
include ':app'
|
||||||
|
rootProject.name='老人平板桌面'
|
||||||