init
15
.gitignore
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
||||
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
||||
BIN
app/AppLock.jks
Normal file
76
app/build.gradle.kts
Normal file
@ -0,0 +1,76 @@
|
||||
import java.util.Date
|
||||
import java.text.SimpleDateFormat
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("kotlin-kapt")
|
||||
id("applovin-quality-service")
|
||||
id("com.google.gms.google-services")
|
||||
id("com.google.firebase.crashlytics")
|
||||
}
|
||||
applovin {
|
||||
apiKey = "hHy0TRZ_kHJAhCLAt5VqWT8vs5MIFuy1ovD8xKl9_ZsgCRVgFp7wgir1hEE6w1uxluE1n4w27wUS2MVr5X8XXh"
|
||||
}
|
||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||
android {
|
||||
namespace = "com.moretool.free.applock.watcher"
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
// com.moretool.free.applock.watcher
|
||||
applicationId = "com.moretool.free.applock.test"
|
||||
minSdk = 23
|
||||
targetSdk = 34
|
||||
versionCode = 4
|
||||
versionName = "1.0.3"
|
||||
setProperty("archivesBaseName", "AppLock_V" + versionName + "(${versionCode})_$timestamp")
|
||||
testInstrumentationRunner = "androidx.watcher.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation("androidx.appcompat:appcompat:1.6.1")
|
||||
implementation("com.google.android.material:material:1.12.0")
|
||||
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
||||
implementation("androidx.legacy:legacy-support-v4:1.0.0")
|
||||
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.7.0")
|
||||
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0")
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
androidTestImplementation("androidx.watcher.ext:junit:1.1.5")
|
||||
androidTestImplementation("androidx.watcher.espresso:espresso-core:3.5.1")
|
||||
|
||||
implementation("androidx.room:room-ktx:2.6.1")
|
||||
implementation("androidx.room:room-runtime:2.6.1")
|
||||
kapt("androidx.room:room-compiler:2.6.1")
|
||||
implementation ("androidx.work:work-runtime:2.9.0") // 使用最新版本
|
||||
|
||||
|
||||
implementation("com.applovin:applovin-sdk:12.5.0")
|
||||
implementation("com.applovin.mediation:vungle-adapter:7.3.2.2")
|
||||
implementation("com.applovin.mediation:bytedance-adapter:5.9.0.6.0")
|
||||
implementation ("com.applovin.mediation:mintegral-adapter:16.7.51.0")
|
||||
|
||||
|
||||
implementation(platform("com.google.firebase:firebase-bom:32.3.1"))
|
||||
implementation("com.google.firebase:firebase-analytics-ktx")
|
||||
implementation("com.google.firebase:firebase-crashlytics-ktx")
|
||||
}
|
||||
29
app/google-services.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "256027015132",
|
||||
"project_id": "applock---applock-password",
|
||||
"storage_bucket": "applock---applock-password.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:256027015132:android:ebe0480b13f40f85ebc119",
|
||||
"android_client_info": {
|
||||
"package_name": "com.moretool.free.applock.test"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyB0L_4gDRYg77W6iJ5A71p_U8ifG_xkdpA"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
32
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
-keepclassmembers class com.moretool.free.applock.watcher.utilsmanager.MyValues{
|
||||
public static final java.lang.String DBName;
|
||||
public static final int DBVersion;
|
||||
}
|
||||
-keepclassmembers class *{
|
||||
@androidx.room.Query <methods>;
|
||||
}
|
||||
|
||||
-keep class com.moretool.free.applock.watcher.room.AppDataBase { *; }
|
||||
-keep class com.moretool.free.applock.watcher.room.EntityAppDao { *; }
|
||||
-keep class com.moretool.free.applock.watcher.room.EntityApp { *; }
|
||||
@ -0,0 +1,26 @@
|
||||
package com.moretool.free.applock.watcher;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented watcher, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under watcher.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.moretool.free.applock.watcher", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
55
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<!-- <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>-->
|
||||
<!-- <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"/>-->
|
||||
<!-- <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>-->
|
||||
|
||||
<uses-permission
|
||||
android:name="android.permission.PACKAGE_USAGE_STATS"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
<queries>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent>
|
||||
</queries>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<application
|
||||
android:name=".AppLockApplication"
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/applock"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/applock"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.AppLock"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".pageview.PassWordActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".pageview.WelComeActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".pageview.MainActivity"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"/>
|
||||
|
||||
|
||||
<service android:name="com.moretool.free.applock.watcher.MyService" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@ -0,0 +1,52 @@
|
||||
package com.moretool.free.applock.watcher;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.applovin.sdk.AppLovinMediationProvider;
|
||||
import com.applovin.sdk.AppLovinSdk;
|
||||
import com.applovin.sdk.AppLovinSdkInitializationConfiguration;
|
||||
import com.applovin.sdk.AppLovinSdkSettings;
|
||||
import com.moretool.free.applock.watcher.room.EntityApp;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.AppManager;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.DataSaveManager;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.MyValues;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.RoomAction;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class AppLockApplication extends Application {
|
||||
|
||||
public static boolean isSuccess = false;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
Log.d("--------------","-----------onCreate=");
|
||||
MyValues.lockApplication = this;
|
||||
init();
|
||||
DataSaveManager.init(this);
|
||||
DataSaveManager.resetOpCount();
|
||||
Set<EntityApp> entityApps = AppManager.queryDeviceApps(this);
|
||||
RoomAction.insertRoom(entityApps);
|
||||
}
|
||||
|
||||
|
||||
private void init() {
|
||||
AppLovinSdkInitializationConfiguration.Builder initConfigBuilder = AppLovinSdkInitializationConfiguration.builder(MyValues.YOUR_SDK_KEY, this);
|
||||
initConfigBuilder.setMediationProvider(AppLovinMediationProvider.MAX);
|
||||
AppLovinSdk.getInstance(this).initialize(initConfigBuilder.build(), appLovinSdkConfiguration -> {
|
||||
isSuccess = true;
|
||||
LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(MyValues.MAX_INIT_ACTION));
|
||||
});
|
||||
// AppLovinSdk.getInstance(this).getSettings().setVerboseLogging(true);
|
||||
// AppLovinSdk.getInstance(this).showMediationDebugger();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,113 @@
|
||||
package com.moretool.free.applock.watcher;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
|
||||
import com.moretool.free.applock.watcher.room.AppDataBase;
|
||||
import com.moretool.free.applock.watcher.room.EntityApp;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.AppManager;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.RoomAction;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class ForgroundService extends Service {
|
||||
private String lastLockPackName = "";
|
||||
private LockAction lockAction;
|
||||
private Boolean isTop = true;
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
Log.d("-------","------------ForgroundService--"+Thread.currentThread().getName());
|
||||
initNotification();
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
while (true){
|
||||
lockAction = LockAction.getActionInstance(ForgroundService.this);
|
||||
while (isTop) {
|
||||
String packageName = AppManager.getUsage(ForgroundService.this);
|
||||
Log.d("--------------", "-----------packageName=" + packageName);
|
||||
if (Objects.equals(packageName, "")) {
|
||||
continue;
|
||||
}
|
||||
EntityApp entityApp = AppDataBase.getDbInstance().getEntityAppDao().queryByPagName(packageName);
|
||||
if (entityApp == null) {
|
||||
lockAction.HideLockView();
|
||||
lastLockPackName = packageName;
|
||||
continue;
|
||||
}
|
||||
if (Objects.equals(packageName, lastLockPackName)) {
|
||||
continue;
|
||||
}
|
||||
if (entityApp.isLocked()) {
|
||||
if (!Objects.equals(packageName, lastLockPackName)) {
|
||||
RoomAction.onRunMain(() -> {
|
||||
lockAction.showLockView();
|
||||
});
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
RoomAction.onRunMain(() -> {
|
||||
lockAction.HideLockView();
|
||||
});
|
||||
}
|
||||
lastLockPackName = packageName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
|
||||
private void initNotification() {
|
||||
String channelName = "埋点上传";
|
||||
|
||||
String channelId = "channelId";
|
||||
// 发送通知,把service置于前台
|
||||
NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
// 从Android 8.0开始,需要注册通知通道
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
NotificationChannel channel = new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_HIGH);
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
Notification notification = new NotificationCompat.Builder(this, channelId)
|
||||
.setSmallIcon(R.mipmap.ic_launcher)
|
||||
.setContentTitle("埋点Log上报")
|
||||
.setContentText("服务正在运行,请勿关闭")
|
||||
// .setAutoCancel(false)
|
||||
// .setOngoing(true)
|
||||
.build();
|
||||
// 注意第一个参数不能为0
|
||||
startForeground(1, notification);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
stopForeground(true);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,104 @@
|
||||
package com.moretool.free.applock.watcher;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.os.Build;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.moretool.free.applock.watcher.databinding.LockActionViewBinding;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.AppManager;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.DataSaveManager;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.custome.InputListener;
|
||||
|
||||
public class LockAction {
|
||||
|
||||
private Context context;
|
||||
|
||||
private LockActionViewBinding lockActionViewBinding;
|
||||
private WindowManager manager;
|
||||
|
||||
private static LockAction lockAction;
|
||||
private WindowManager.LayoutParams layParams;
|
||||
|
||||
public LockAction(Context context) {
|
||||
this.context = context;
|
||||
manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||
lockActionViewBinding = LockActionViewBinding.inflate(LayoutInflater.from(context), null, false);
|
||||
setLocation();
|
||||
lockActionViewBinding.inputView.setInputListener(new InputListener() {
|
||||
@Override
|
||||
public void onInputComplete(String pin) {
|
||||
|
||||
String curPin = DataSaveManager.getCurPin();
|
||||
if (curPin.equals(pin)) {
|
||||
HideLockView();
|
||||
} else {
|
||||
Toast.makeText(context, context.getString(R.string.unlock_app), Toast.LENGTH_SHORT).show();
|
||||
AppManager.startVibrator(context);
|
||||
lockActionViewBinding.inputView.clearPin();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInputUnComplete(String pin) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setLocation() {
|
||||
int type = 0;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
|
||||
} else {
|
||||
type = WindowManager.LayoutParams.TYPE_PHONE;
|
||||
}
|
||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
manager.getDefaultDisplay().getMetrics(displayMetrics);
|
||||
int flag = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN |
|
||||
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
|
||||
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS |
|
||||
WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
|
||||
layParams = new WindowManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, type, flag, PixelFormat.RGBA_8888);
|
||||
// layParams.type = type;
|
||||
// layParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
// layParams.height = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
//
|
||||
// layParams.format = PixelFormat.RGBA_8888;
|
||||
// layParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
|
||||
// WindowManager.LayoutParams.FLAG_FULLSCREEN |
|
||||
// WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
|
||||
// WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS |
|
||||
// WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
|
||||
|
||||
}
|
||||
|
||||
public static LockAction getActionInstance(Context context) {
|
||||
if (lockAction == null) {
|
||||
lockAction = new LockAction(context);
|
||||
}
|
||||
return lockAction;
|
||||
}
|
||||
|
||||
public void showLockView() {
|
||||
lockActionViewBinding.inputView.clearPin();
|
||||
if (lockActionViewBinding.getRoot().getWindowToken() == null) {
|
||||
manager.addView(lockActionViewBinding.getRoot(), layParams);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void HideLockView() {
|
||||
if (lockActionViewBinding.getRoot().getWindowToken() != null) {
|
||||
manager.removeView(lockActionViewBinding.getRoot());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package com.moretool.free.applock.watcher;
|
||||
|
||||
import android.app.IntentService;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.moretool.free.applock.watcher.room.AppDataBase;
|
||||
import com.moretool.free.applock.watcher.room.EntityApp;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.AppManager;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.RoomAction;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
public class MyService extends IntentService {
|
||||
private String lastLockPackName = "";
|
||||
private LockAction lockAction;
|
||||
private Boolean isTop = true;
|
||||
|
||||
public MyService() {
|
||||
super("name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
Log.d("--------------","-----------onDestroy");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHandleIntent(@Nullable Intent intent) {
|
||||
lockAction = LockAction.getActionInstance(this);
|
||||
while (isTop) {
|
||||
String packageName = AppManager.getUsage(this);
|
||||
Log.d("--------------","-----------packageName="+packageName);
|
||||
if (Objects.equals(packageName, "")) {
|
||||
continue;
|
||||
}
|
||||
EntityApp entityApp = AppDataBase.getDbInstance().getEntityAppDao().queryByPagName(packageName);
|
||||
if (entityApp == null) {
|
||||
lockAction.HideLockView();
|
||||
lastLockPackName = packageName;
|
||||
continue;
|
||||
}
|
||||
if (Objects.equals(packageName, lastLockPackName)) {
|
||||
continue;
|
||||
}
|
||||
if (entityApp.isLocked()) {
|
||||
if (!Objects.equals(packageName, lastLockPackName)) {
|
||||
RoomAction.onRunMain(() -> {
|
||||
lockAction.showLockView();
|
||||
});
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
RoomAction.onRunMain(() -> {
|
||||
lockAction.HideLockView();
|
||||
});
|
||||
}
|
||||
lastLockPackName = packageName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package com.moretool.free.applock.watcher;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.app.JobIntentService;
|
||||
import androidx.work.Worker;
|
||||
import androidx.work.WorkerParameters;
|
||||
|
||||
import com.moretool.free.applock.watcher.room.AppDataBase;
|
||||
import com.moretool.free.applock.watcher.room.EntityApp;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.AppManager;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.RoomAction;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class MyWorker extends JobIntentService {
|
||||
private String lastLockPackName = "";
|
||||
private LockAction lockAction;
|
||||
private Boolean isTop = true;
|
||||
|
||||
public static void enqueueWork(Context context, Intent work) {
|
||||
enqueueWork(context, MyWorker.class, 23, work);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHandleWork(@NonNull Intent intent) {
|
||||
lockAction = LockAction.getActionInstance(this);
|
||||
while (isTop) {
|
||||
String packageName = AppManager.getUsage(this);
|
||||
Log.d("--------------", "-----------packageName=" + packageName);
|
||||
if (Objects.equals(packageName, "")) {
|
||||
continue;
|
||||
}
|
||||
EntityApp entityApp = AppDataBase.getDbInstance().getEntityAppDao().queryByPagName(packageName);
|
||||
if (entityApp == null) {
|
||||
lockAction.HideLockView();
|
||||
lastLockPackName = packageName;
|
||||
continue;
|
||||
}
|
||||
if (Objects.equals(packageName, lastLockPackName)) {
|
||||
continue;
|
||||
}
|
||||
if (entityApp.isLocked()) {
|
||||
if (!Objects.equals(packageName, lastLockPackName)) {
|
||||
RoomAction.onRunMain(() -> {
|
||||
lockAction.showLockView();
|
||||
});
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
RoomAction.onRunMain(() -> {
|
||||
lockAction.HideLockView();
|
||||
});
|
||||
}
|
||||
lastLockPackName = packageName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,161 @@
|
||||
package com.moretool.free.applock.watcher.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.applovin.mediation.ads.MaxInterstitialAd;
|
||||
import com.moretool.free.applock.watcher.R;
|
||||
import com.moretool.free.applock.watcher.databinding.ItemAppBinding;
|
||||
import com.moretool.free.applock.watcher.dealad.AdTool;
|
||||
import com.moretool.free.applock.watcher.listener.LockListener;
|
||||
import com.moretool.free.applock.watcher.pageview.PassWordActivity;
|
||||
import com.moretool.free.applock.watcher.pageview.SuccessDialog;
|
||||
import com.moretool.free.applock.watcher.room.EntityApp;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.AppManager;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.DataSaveManager;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.RoomAction;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AppAdapter extends RecyclerView.Adapter<AppAdapter.AppViewHolder> {
|
||||
|
||||
private List<EntityApp> entityApps = new ArrayList<>();
|
||||
|
||||
private Context mCon;
|
||||
|
||||
private boolean mLockList;
|
||||
|
||||
private List<MaxInterstitialAd> ads;
|
||||
|
||||
|
||||
|
||||
private LockListener lockListener;
|
||||
|
||||
public AppAdapter(Context context, boolean lock, List<MaxInterstitialAd> listAd) {
|
||||
this.mCon = context;
|
||||
this.mLockList = lock;
|
||||
ads = listAd;
|
||||
|
||||
}
|
||||
|
||||
public void setLockListener(LockListener lockListener) {
|
||||
this.lockListener = lockListener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public AppViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
ItemAppBinding itemAppBinding = ItemAppBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||
return new AppViewHolder(itemAppBinding);
|
||||
}
|
||||
|
||||
public void setEntityApps(List<EntityApp> apps) {
|
||||
entityApps = apps;
|
||||
notifyDataSetChanged();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull AppViewHolder holder, @SuppressLint("RecyclerView") int position) {
|
||||
EntityApp entityApp = entityApps.get(position);
|
||||
String label = entityApp.getLabel();
|
||||
holder.itemAppBinding.appLabel.setText(label);
|
||||
Drawable icon = AppManager.getIcon(mCon, entityApp.getPagName());
|
||||
if (icon != null) {
|
||||
holder.itemAppBinding.appLogo.setImageDrawable(icon);
|
||||
}
|
||||
holder.itemAppBinding.appLocked.setSelected(entityApp.isLocked());
|
||||
holder.itemAppBinding.appLocked.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String msg = "";
|
||||
DataSaveManager.setOpCount();
|
||||
boolean selected = holder.itemAppBinding.appLocked.isSelected();
|
||||
holder.itemAppBinding.appLocked.setSelected(!selected);
|
||||
boolean selectedNew = holder.itemAppBinding.appLocked.isSelected();
|
||||
entityApp.setLocked(selectedNew);
|
||||
RoomAction.updateRoom(entityApp);
|
||||
if (selectedNew) {
|
||||
if (!mLockList) {
|
||||
entityApps.remove(entityApp);
|
||||
notifyItemRemoved(position);
|
||||
}
|
||||
msg = String.format(mCon.getString(R.string.lock_app), label);
|
||||
} else {
|
||||
if (mLockList) {
|
||||
entityApps.remove(entityApp);
|
||||
notifyItemRemoved(position);
|
||||
}
|
||||
msg = String.format(mCon.getString(R.string.unlock_app), label);
|
||||
}
|
||||
|
||||
int opCount = DataSaveManager.getOpCount();
|
||||
if (opCount % 5 == 0) {
|
||||
showMyAd(msg);
|
||||
Log.d("---------tt","---------showMyAd opCount="+opCount);
|
||||
} else {
|
||||
Log.d("---------tt","---------no showMyAd opCount="+opCount);
|
||||
// Toast.makeText(mCon, msg, Toast.LENGTH_SHORT).show();
|
||||
setCallBack(msg);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void setCallBack(String message){
|
||||
if(lockListener!= null){
|
||||
lockListener.onSwitch(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
|
||||
return entityApps.size();
|
||||
}
|
||||
|
||||
static class AppViewHolder extends RecyclerView.ViewHolder {
|
||||
private ItemAppBinding itemAppBinding;
|
||||
|
||||
public AppViewHolder(@NonNull ItemAppBinding itemView) {
|
||||
super(itemView.getRoot());
|
||||
itemAppBinding = itemView;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void showMyAd(String msg) {
|
||||
MaxInterstitialAd ad = AdTool.randomCache(ads);
|
||||
if (ad != null) {
|
||||
AdTool.setStatusBack(ad, new AdTool.adStatusBack() {
|
||||
@Override
|
||||
public void adShowFail() {
|
||||
setCallBack(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adShowHide() {
|
||||
setCallBack(msg);
|
||||
ads = AdTool.initAdInstance();
|
||||
}
|
||||
});
|
||||
ad.showAd();
|
||||
} else {
|
||||
setCallBack(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.moretool.free.applock.watcher.adapter;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentPagerAdapter;
|
||||
|
||||
import com.moretool.free.applock.watcher.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class VpAdapter extends FragmentPagerAdapter {
|
||||
|
||||
private List<Fragment> mList;
|
||||
|
||||
private String[] tabTitle;
|
||||
|
||||
|
||||
public VpAdapter(@NonNull FragmentManager fm, List<Fragment> list, String[] strings) {
|
||||
super(fm);
|
||||
mList = list;
|
||||
tabTitle = strings;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
return mList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
return tabTitle[position];
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,125 @@
|
||||
package com.moretool.free.applock.watcher.dealad;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.applovin.mediation.MaxAd;
|
||||
import com.applovin.mediation.MaxAdListener;
|
||||
import com.applovin.mediation.MaxError;
|
||||
import com.applovin.mediation.ads.MaxInterstitialAd;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.MyValues;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class AdTool {
|
||||
|
||||
private static List<MaxInterstitialAd> adList = new ArrayList<>();
|
||||
|
||||
|
||||
public static MaxInterstitialAd randomCache(List<MaxInterstitialAd> list) {
|
||||
Collections.shuffle(list);
|
||||
for (MaxInterstitialAd ad : list) {
|
||||
if (ad.isReady()) {
|
||||
Log.d("-----------","------------ad="+ad.getAdUnitId());
|
||||
return ad;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static List<MaxInterstitialAd> initAdInstance(){
|
||||
if(adList.isEmpty()){
|
||||
MaxInterstitialAd unit1 = new MaxInterstitialAd(MyValues.MAX_UNIT1,MyValues.lockApplication);
|
||||
MaxInterstitialAd unit2 = new MaxInterstitialAd(MyValues.MAX_UNIT2,MyValues.lockApplication);
|
||||
MaxInterstitialAd unit3 = new MaxInterstitialAd(MyValues.MAX_UNIT3,MyValues.lockApplication);
|
||||
adList.add(unit1);
|
||||
adList.add(unit2);
|
||||
adList.add(unit3);
|
||||
}
|
||||
for(MaxInterstitialAd ad:adList){
|
||||
if(!ad.isReady()){
|
||||
Log.d("---------tt","--------start-loadAd ad="+ad.getAdUnitId());
|
||||
ad.loadAd();
|
||||
ad.setListener(new MaxAdListener() {
|
||||
@Override
|
||||
public void onAdLoaded(@NonNull MaxAd maxAd) {
|
||||
Log.d("---------tt","---------onAdLoaded= maxAd="+maxAd.getAdUnitId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdDisplayed(@NonNull MaxAd maxAd) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdHidden(@NonNull MaxAd maxAd) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdClicked(@NonNull MaxAd maxAd) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdLoadFailed(@NonNull String s, @NonNull MaxError maxError) {
|
||||
Log.d("---------tt","---------onAdLoadFailed= s="+s+" getMessage->"+maxError.getMessage()+"maxError getCode->"+maxError.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdDisplayFailed(@NonNull MaxAd maxAd, @NonNull MaxError maxError) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
return adList;
|
||||
}
|
||||
|
||||
|
||||
public static void setStatusBack(MaxInterstitialAd max,adStatusBack adStatusBack){
|
||||
max.setListener(new MaxAdListener() {
|
||||
@Override
|
||||
public void onAdLoaded(@NonNull MaxAd maxAd) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdDisplayed(@NonNull MaxAd maxAd) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdHidden(@NonNull MaxAd maxAd) {
|
||||
adStatusBack.adShowHide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdClicked(@NonNull MaxAd maxAd) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdLoadFailed(@NonNull String s, @NonNull MaxError maxError) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdDisplayFailed(@NonNull MaxAd maxAd, @NonNull MaxError maxError) {
|
||||
adStatusBack.adShowFail();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public interface adStatusBack {
|
||||
void adShowFail();
|
||||
void adShowHide();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.moretool.free.applock.watcher.listener;
|
||||
|
||||
public interface LockListener {
|
||||
void onSwitch(String msg);
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package com.moretool.free.applock.watcher.listener;
|
||||
|
||||
public interface PermissionBtnListener {
|
||||
|
||||
void onClickUsage();
|
||||
|
||||
void onClickOverlay();
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.moretool.free.applock.watcher.listener;
|
||||
|
||||
import com.moretool.free.applock.watcher.room.EntityApp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface QueryListener {
|
||||
|
||||
void onQueryResult(List<EntityApp> list);
|
||||
|
||||
// void onQueryResultSingle(EntityApp entityApp);
|
||||
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
package com.moretool.free.applock.watcher.pageview;
|
||||
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.applovin.mediation.ads.MaxInterstitialAd;
|
||||
import com.moretool.free.applock.watcher.R;
|
||||
import com.moretool.free.applock.watcher.adapter.AppAdapter;
|
||||
import com.moretool.free.applock.watcher.dealad.AdTool;
|
||||
import com.moretool.free.applock.watcher.listener.LockListener;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.MyValues;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LockFragment extends Fragment {
|
||||
|
||||
private LockViewModel mViewModel;
|
||||
private boolean isLocked;
|
||||
|
||||
private RecyclerView recyclerViewApp;
|
||||
private AppAdapter appAdapter;
|
||||
private List<MaxInterstitialAd> listAd;
|
||||
private SuccessDialog successDialog;
|
||||
|
||||
public static LockFragment newInstance(boolean locked) {
|
||||
LockFragment lockFragment = new LockFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean(MyValues.fragment_locked_key, locked);
|
||||
lockFragment.setArguments(bundle);
|
||||
return lockFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_lock, container, false);
|
||||
recyclerViewApp = view.findViewById(R.id.app_recycler);
|
||||
listAd = AdTool.initAdInstance();
|
||||
Log.d("-----------","------------onCreateView");
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
mViewModel = new ViewModelProvider(this).get(LockViewModel.class);
|
||||
Bundle arguments = getArguments();
|
||||
if (arguments != null)
|
||||
isLocked = getArguments().getBoolean(MyValues.fragment_locked_key);
|
||||
mViewModel.updateData(isLocked);
|
||||
initAppRecycle();
|
||||
mViewModel.getMutableLiveData().observe(requireActivity(), list -> {
|
||||
appAdapter.setEntityApps(list);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
mViewModel.updateData(isLocked);
|
||||
}
|
||||
|
||||
private void initAppRecycle() {
|
||||
appAdapter = new AppAdapter(requireContext(), isLocked, listAd);
|
||||
appAdapter.setLockListener(new LockListener() {
|
||||
@Override
|
||||
public void onSwitch(String msg) {
|
||||
successDialog = new SuccessDialog(requireContext(),msg);
|
||||
successDialog.show(getChildFragmentManager(), "");
|
||||
}
|
||||
});
|
||||
recyclerViewApp.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||
recyclerViewApp.setAdapter(appAdapter);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.moretool.free.applock.watcher.pageview;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import com.moretool.free.applock.watcher.listener.QueryListener;
|
||||
import com.moretool.free.applock.watcher.room.EntityApp;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.RoomAction;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LockViewModel extends ViewModel {
|
||||
|
||||
private MutableLiveData<List<EntityApp>> mutableLiveData = new MutableLiveData<>();
|
||||
|
||||
|
||||
public MutableLiveData<List<EntityApp>> getMutableLiveData() {
|
||||
return mutableLiveData;
|
||||
}
|
||||
|
||||
public void updateData(boolean lock){
|
||||
RoomAction.queryRoom(lock, new QueryListener() {
|
||||
@Override
|
||||
public void onQueryResult(List<EntityApp> list) {
|
||||
mutableLiveData.setValue(list);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,247 @@
|
||||
package com.moretool.free.applock.watcher.pageview;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import androidx.work.WorkManager;
|
||||
|
||||
import com.applovin.mediation.ads.MaxInterstitialAd;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.moretool.free.applock.watcher.MyService;
|
||||
import com.moretool.free.applock.watcher.R;
|
||||
import com.moretool.free.applock.watcher.adapter.VpAdapter;
|
||||
import com.moretool.free.applock.watcher.dealad.AdTool;
|
||||
import com.moretool.free.applock.watcher.listener.PermissionBtnListener;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.AppManager;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.MyValues;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.Permission;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MainActivity extends AppCompatActivity implements PermissionBtnListener {
|
||||
|
||||
private PermissionDialog dialog;
|
||||
private TabLayout tabLayout;
|
||||
|
||||
private ViewPager viewPager;
|
||||
|
||||
private String[] tabTitle;
|
||||
|
||||
private ImageView menu;
|
||||
private DrawerLayout drawerLayout;
|
||||
private RelativeLayout layoutReset;
|
||||
private List<MaxInterstitialAd> listAd;
|
||||
private TextView tvVersion;
|
||||
|
||||
private WorkManager workManager;
|
||||
|
||||
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
//WorkManager
|
||||
workManager = WorkManager.getInstance(this);
|
||||
setContentView(R.layout.activity_main);
|
||||
tabLayout = findViewById(R.id.tab_layout);
|
||||
viewPager = findViewById(R.id.view_pager);
|
||||
menu = findViewById(R.id.im_menu);
|
||||
tvVersion = findViewById(R.id.tv_version);
|
||||
listAd = AdTool.initAdInstance();
|
||||
|
||||
layoutReset = findViewById(R.id.re_reset);
|
||||
drawerLayout = findViewById(R.id.drawer);
|
||||
menu.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
drawerLayout.openDrawer(Gravity.LEFT);
|
||||
}
|
||||
});
|
||||
|
||||
startService(new Intent(this, MyService.class));
|
||||
|
||||
// startWork();
|
||||
initTabVp();
|
||||
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
// if (ContextCompat.checkSelfPermission(this, Manifest.permission.FOREGROUND_SERVICE)
|
||||
// != PackageManager.PERMISSION_GRANTED) {
|
||||
// ActivityCompat.requestPermissions(this,
|
||||
// new String[]{Manifest.permission.FOREGROUND_SERVICE},
|
||||
// 12);
|
||||
// }
|
||||
// }
|
||||
// checkPermission();
|
||||
|
||||
|
||||
getPermission();
|
||||
|
||||
layoutReset.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showMyAd();
|
||||
}
|
||||
});
|
||||
|
||||
String appVersion = AppManager.getAppVersion(this);
|
||||
if (appVersion == null) {
|
||||
tvVersion.setText("V1.0.0");
|
||||
} else {
|
||||
String format = String.format(getString(R.string.app_v), appVersion);
|
||||
tvVersion.setText(format);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void checkPermission() {
|
||||
NotificationManager manager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
if(manager.areNotificationsEnabled()){
|
||||
|
||||
}else {
|
||||
Intent localIntent = new Intent();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {//8.0及以上
|
||||
localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
localIntent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
|
||||
localIntent.setData(Uri.fromParts("package", getPackageName(), null));
|
||||
} else {//5.0以上到8.0以下
|
||||
localIntent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
|
||||
localIntent.putExtra("app_package", getPackageName());
|
||||
localIntent.putExtra("app_uid", getApplicationInfo().uid);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private void startWork() {
|
||||
|
||||
// Intent workIntent = new Intent(this, MyWorker.class);
|
||||
// MyWorker.enqueueWork(this, workIntent);
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// startForegroundService(new Intent(this, ForgroundService.class));
|
||||
// } else {
|
||||
// startService(new Intent(this, ForgroundService.class));
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void showMyAd() {
|
||||
MaxInterstitialAd ad = AdTool.randomCache(listAd);
|
||||
if (ad != null) {
|
||||
AdTool.setStatusBack(ad, new AdTool.adStatusBack() {
|
||||
@Override
|
||||
public void adShowFail() {
|
||||
interReset();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adShowHide() {
|
||||
interReset();
|
||||
listAd = AdTool.initAdInstance();
|
||||
}
|
||||
});
|
||||
ad.showAd(MainActivity.this);
|
||||
} else {
|
||||
interReset();
|
||||
}
|
||||
}
|
||||
|
||||
private void interReset() {
|
||||
Intent intent = new Intent(MainActivity.this, PassWordActivity.class);
|
||||
intent.putExtra(MyValues.password_key, MyValues.password_type2);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@SuppressLint("MissingInflatedId")
|
||||
private void initTabVp() {
|
||||
tabTitle = new String[]{getString(R.string.unlocked), getString(R.string.Locked)};
|
||||
List<Fragment> fragmentList = new ArrayList<>();
|
||||
fragmentList.add(LockFragment.newInstance(false));
|
||||
fragmentList.add(LockFragment.newInstance(true));
|
||||
VpAdapter vpAdapter = new VpAdapter(getSupportFragmentManager(), fragmentList, tabTitle);
|
||||
viewPager.setAdapter(vpAdapter);
|
||||
|
||||
tabLayout.setupWithViewPager(viewPager);
|
||||
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
LockFragment fragment = (LockFragment) fragmentList.get(position);
|
||||
fragment.refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getPermission() {
|
||||
boolean getUsagePermission = Permission.isGetUsagePermission(this);
|
||||
boolean overlays = Permission.isOverlays(this);
|
||||
if (getUsagePermission && overlays) {
|
||||
|
||||
} else {
|
||||
if (dialog == null) {
|
||||
dialog = new PermissionDialog(this);
|
||||
dialog.setPermissionBtnListener(this);
|
||||
}
|
||||
dialog.show(getSupportFragmentManager(), "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickUsage() {
|
||||
Permission.requestUsage(this, MyValues.request_code_usage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickOverlay() {
|
||||
Permission.requestOverlays(this, MyValues.request_code_overlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
switch (requestCode) {
|
||||
case MyValues.request_code_usage, MyValues.request_code_overlay:
|
||||
hideDialog();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void hideDialog() {
|
||||
if (Permission.allAllowPermission(this)) {
|
||||
if (dialog != null) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,122 @@
|
||||
package com.moretool.free.applock.watcher.pageview;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.applovin.mediation.ads.MaxInterstitialAd;
|
||||
import com.moretool.free.applock.watcher.R;
|
||||
import com.moretool.free.applock.watcher.dealad.AdTool;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.DataSaveManager;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.MyValues;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.custome.InputListener;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.custome.InputNumberView;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class PassWordActivity extends AppCompatActivity {
|
||||
|
||||
private int mType;
|
||||
private TextView tvHint;
|
||||
private TextView textButton;
|
||||
private InputNumberView inputNumberView;
|
||||
private String curPin;
|
||||
private ImageView imBack;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_pass_word);
|
||||
mType = getIntent().getIntExtra(MyValues.password_key, MyValues.password_type0);
|
||||
tvHint = findViewById(R.id.tv_hint);
|
||||
textButton = findViewById(R.id.tv_button);
|
||||
imBack = findViewById(R.id.imBack);
|
||||
inputNumberView = findViewById(R.id.input_view);
|
||||
initView();
|
||||
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
imBack.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
if (mType == MyValues.password_type0) {
|
||||
tvHint.setText(getString(R.string.enter_your_pin));
|
||||
textButton.setText(getString(R.string.Continue));
|
||||
imBack.setVisibility(View.VISIBLE);
|
||||
textButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(PassWordActivity.this, PassWordActivity.class);
|
||||
intent.putExtra(MyValues.password_key, MyValues.password_type1);
|
||||
intent.putExtra(MyValues.password_pin_key, curPin);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
} else if (mType == MyValues.password_type1) {
|
||||
imBack.setVisibility(View.VISIBLE);
|
||||
tvHint.setText(getString(R.string.verify_your_pin));
|
||||
textButton.setText(getString(R.string.Save));
|
||||
String setPin = getIntent().getStringExtra(MyValues.password_pin_key);
|
||||
textButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (Objects.equals(setPin, curPin)) {
|
||||
DataSaveManager.setCurPin(curPin);
|
||||
Intent intent = new Intent(PassWordActivity.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
} else {
|
||||
Toast.makeText(PassWordActivity.this, getString(R.string.pwd_verifi_fail), Toast.LENGTH_SHORT).show();
|
||||
inputNumberView.clearPin();
|
||||
textButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
} else if (mType == MyValues.password_type2) {
|
||||
|
||||
imBack.setVisibility(View.VISIBLE);
|
||||
tvHint.setText(getString(R.string.reset_your_pin));
|
||||
textButton.setText(getString(R.string.Save));
|
||||
textButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
resetPin();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
inputNumberView.setInputListener(new InputListener() {
|
||||
@Override
|
||||
public void onInputComplete(String pin) {
|
||||
textButton.setVisibility(View.VISIBLE);
|
||||
curPin = pin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInputUnComplete(String pin) {
|
||||
textButton.setVisibility(View.GONE);
|
||||
curPin = pin;
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void resetPin(){
|
||||
DataSaveManager.setCurPin(curPin);
|
||||
Toast.makeText(PassWordActivity.this, getString(R.string.reset_success), Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
package com.moretool.free.applock.watcher.pageview;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import com.moretool.free.applock.watcher.R;
|
||||
import com.moretool.free.applock.watcher.databinding.DialogPermissionBinding;
|
||||
import com.moretool.free.applock.watcher.listener.PermissionBtnListener;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.Permission;
|
||||
|
||||
public class PermissionDialog extends DialogFragment {
|
||||
private DialogPermissionBinding dialogPermissionBinding;
|
||||
private PermissionBtnListener permissionBtnListener;
|
||||
private Context mContext;
|
||||
|
||||
|
||||
public PermissionDialog(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
dialogPermissionBinding = DialogPermissionBinding.inflate(inflater, null, false);
|
||||
init();
|
||||
return dialogPermissionBinding.getRoot();
|
||||
}
|
||||
|
||||
public void setPermissionBtnListener(PermissionBtnListener permissionBtnListener) {
|
||||
this.permissionBtnListener = permissionBtnListener;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
refreshBtnStatus(mContext);
|
||||
}
|
||||
|
||||
public void refreshBtnStatus(Context context) {
|
||||
boolean getUsagePermission = Permission.isGetUsagePermission(context);
|
||||
boolean isOverlay = Permission.isOverlays(context);
|
||||
dialogPermissionBinding.tvUsageButton.setSelected(getUsagePermission);
|
||||
dialogPermissionBinding.tvOverlayButton.setSelected(isOverlay);
|
||||
}
|
||||
|
||||
private void init() {
|
||||
|
||||
setCancelable(false);
|
||||
Window window = getDialog().getWindow();
|
||||
window.setBackgroundDrawableResource(R.color.rgb_00000000);
|
||||
window.getDecorView().setPadding(0, 0, 0, 0);
|
||||
WindowManager.LayoutParams wlp = window.getAttributes();
|
||||
wlp.gravity = Gravity.CENTER;
|
||||
wlp.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
wlp.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
window.setAttributes(wlp);
|
||||
|
||||
dialogPermissionBinding.tvUsageButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!dialogPermissionBinding.tvUsageButton.isSelected()) {
|
||||
permissionBtnListener.onClickUsage();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
dialogPermissionBinding.tvOverlayButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!dialogPermissionBinding.tvOverlayButton.isSelected()) {
|
||||
permissionBtnListener.onClickOverlay();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package com.moretool.free.applock.watcher.pageview;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import com.moretool.free.applock.watcher.R;
|
||||
import com.moretool.free.applock.watcher.databinding.DialogSuccessBinding;
|
||||
import com.moretool.free.applock.watcher.listener.PermissionBtnListener;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.Permission;
|
||||
|
||||
public class SuccessDialog extends DialogFragment {
|
||||
private DialogSuccessBinding successBinding;
|
||||
private PermissionBtnListener permissionBtnListener;
|
||||
private Context mContext;
|
||||
private String msg;
|
||||
|
||||
|
||||
public SuccessDialog(Context context,String message) {
|
||||
mContext = context;
|
||||
msg = message;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
successBinding = DialogSuccessBinding.inflate(inflater, null, false);
|
||||
init();
|
||||
return successBinding.getRoot();
|
||||
}
|
||||
|
||||
public void setPermissionBtnListener(PermissionBtnListener permissionBtnListener) {
|
||||
this.permissionBtnListener = permissionBtnListener;
|
||||
}
|
||||
|
||||
|
||||
private void init() {
|
||||
setCancelable(true);
|
||||
Window window = getDialog().getWindow();
|
||||
window.setBackgroundDrawableResource(R.color.rgb_00000000);
|
||||
window.getDecorView().setPadding(0, 0, 0, 0);
|
||||
WindowManager.LayoutParams wlp = window.getAttributes();
|
||||
wlp.gravity = Gravity.CENTER;
|
||||
wlp.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
wlp.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
window.setAttributes(wlp);
|
||||
successBinding.title.setText(msg);
|
||||
successBinding.okBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,127 @@
|
||||
package com.moretool.free.applock.watcher.pageview;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
|
||||
import com.applovin.mediation.ads.MaxInterstitialAd;
|
||||
import com.moretool.free.applock.watcher.AppLockApplication;
|
||||
import com.moretool.free.applock.watcher.R;
|
||||
import com.moretool.free.applock.watcher.dealad.AdTool;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.DataSaveManager;
|
||||
import com.moretool.free.applock.watcher.utilsmanager.MyValues;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class WelComeActivity extends AppCompatActivity {
|
||||
|
||||
private Handler handler = new Handler();
|
||||
private Runnable runnable;
|
||||
private int time = 120;
|
||||
|
||||
private List<MaxInterstitialAd> list;
|
||||
private boolean hasShow = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_wel_come);
|
||||
Log.d("------", "---------onCreate");
|
||||
|
||||
runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.d("-----run time-", "---------run time=" + time);
|
||||
if (time > 0) {
|
||||
if (!hasShow) {
|
||||
showMyAd(false);
|
||||
}
|
||||
time--;
|
||||
handler.postDelayed(this, 100);
|
||||
} else {
|
||||
if (!hasShow) {
|
||||
showMyAd(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
if (AppLockApplication.isSuccess) {
|
||||
startLoad();
|
||||
} else {
|
||||
receiver();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
handler.removeCallbacks(runnable);
|
||||
}
|
||||
|
||||
|
||||
public void showMyAd(boolean doAction) {
|
||||
MaxInterstitialAd ad = AdTool.randomCache(list);
|
||||
if (ad != null) {
|
||||
hasShow = true;
|
||||
handler.removeCallbacks(runnable);
|
||||
AdTool.setStatusBack(ad, new AdTool.adStatusBack() {
|
||||
@Override
|
||||
public void adShowFail() {
|
||||
welComplete();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adShowHide() {
|
||||
welComplete();
|
||||
|
||||
}
|
||||
});
|
||||
ad.showAd( );
|
||||
} else {
|
||||
hasShow = false;
|
||||
if (doAction) {
|
||||
welComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void receiver() {
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
startLoad();
|
||||
|
||||
}
|
||||
}, new IntentFilter(MyValues.MAX_INIT_ACTION));
|
||||
}
|
||||
|
||||
private void startLoad() {
|
||||
list = AdTool.initAdInstance();
|
||||
handler.post(runnable);
|
||||
}
|
||||
|
||||
private void welComplete() {
|
||||
String curPin = DataSaveManager.getCurPin();
|
||||
if (curPin.isEmpty()) {
|
||||
startActivity(new Intent(WelComeActivity.this, PassWordActivity.class));
|
||||
} else {
|
||||
startActivity(new Intent(WelComeActivity.this, MainActivity.class));
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.moretool.free.applock.watcher.room;
|
||||
|
||||
import androidx.room.Database;
|
||||
import androidx.room.Room;
|
||||
import androidx.room.RoomDatabase;
|
||||
|
||||
import com.moretool.free.applock.watcher.utilsmanager.MyValues;
|
||||
|
||||
|
||||
@Database(
|
||||
entities = {EntityApp.class},
|
||||
version = MyValues.DBVersion,
|
||||
exportSchema = false
|
||||
)
|
||||
public abstract class AppDataBase extends RoomDatabase {
|
||||
private static AppDataBase appDataBaseInstance;
|
||||
|
||||
public abstract EntityAppDao getEntityAppDao();
|
||||
public static synchronized AppDataBase getDbInstance(){
|
||||
if(appDataBaseInstance == null){
|
||||
appDataBaseInstance = Room.databaseBuilder(MyValues.lockApplication,AppDataBase.class,MyValues.DBName).build();
|
||||
}
|
||||
return appDataBaseInstance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package com.moretool.free.applock.watcher.room;
|
||||
|
||||
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.Index;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
import com.moretool.free.applock.watcher.utilsmanager.MyValues;
|
||||
|
||||
@Entity(tableName = MyValues.DB_TABLE_NAME,indices = {@Index(value = {"pagName"}, unique = true)})
|
||||
public class EntityApp {
|
||||
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
private int id;
|
||||
|
||||
private String pagName;
|
||||
|
||||
private String label;
|
||||
private boolean locked;
|
||||
|
||||
|
||||
public boolean isLocked() {
|
||||
return locked;
|
||||
}
|
||||
|
||||
public void setLocked(boolean locked) {
|
||||
this.locked = locked;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setPagName(String pagName) {
|
||||
this.pagName = pagName;
|
||||
}
|
||||
|
||||
public String getPagName() {
|
||||
return pagName;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.moretool.free.applock.watcher.room;
|
||||
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Update;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface EntityAppDao {
|
||||
|
||||
|
||||
|
||||
@Query("select * from app_table where pagName=:pagName")
|
||||
EntityApp queryByPagName(String pagName);
|
||||
|
||||
|
||||
@Update
|
||||
void updateData(EntityApp entityApp);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.IGNORE)
|
||||
void insertData(EntityApp entityApp);
|
||||
|
||||
@Query("select * from app_table where locked=:isLock")
|
||||
List<EntityApp> findApp(boolean isLock);
|
||||
}
|
||||
@ -0,0 +1,99 @@
|
||||
package com.moretool.free.applock.watcher.utilsmanager;
|
||||
|
||||
import android.app.Service;
|
||||
import android.app.usage.UsageEvents;
|
||||
import android.app.usage.UsageStatsManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Vibrator;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArraySet;
|
||||
|
||||
import com.moretool.free.applock.watcher.room.EntityApp;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class AppManager {
|
||||
|
||||
|
||||
public static Set<EntityApp> queryDeviceApps(Context con) {
|
||||
|
||||
Set<EntityApp> list = new ArraySet<>();
|
||||
PackageManager packageManager = con.getPackageManager();
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN, null);
|
||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
List<ResolveInfo> resolveInfoList = packageManager.queryIntentActivities(intent, PackageManager.MATCH_ALL);
|
||||
|
||||
for (ResolveInfo info : resolveInfoList) {
|
||||
String pkgName = info.activityInfo.packageName;
|
||||
if (pkgName == con.getPackageName()) {
|
||||
continue;
|
||||
}
|
||||
EntityApp entityApp = new EntityApp();
|
||||
entityApp.setPagName(pkgName);
|
||||
try {
|
||||
ApplicationInfo applicationInfo = packageManager.getApplicationInfo(pkgName, PackageManager.GET_UNINSTALLED_PACKAGES);
|
||||
CharSequence applicationLabel = packageManager.getApplicationLabel(applicationInfo);
|
||||
entityApp.setLabel(applicationLabel.toString());
|
||||
list.add(entityApp);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
return list;
|
||||
|
||||
}
|
||||
public static String getAppVersion(Context context) {
|
||||
String versionN = "";
|
||||
try {
|
||||
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
|
||||
versionN = ((PackageInfo) packageInfo).versionName;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return null;
|
||||
}
|
||||
return versionN;
|
||||
}
|
||||
public static void startVibrator(Context context) {
|
||||
Vibrator vib = (Vibrator) context.getSystemService(Service.VIBRATOR_SERVICE);
|
||||
vib.vibrate(400);
|
||||
}
|
||||
|
||||
public static String getUsage(Context context) {
|
||||
UsageStatsManager sUsageStatsManager = (UsageStatsManager) context.getSystemService(Context.USAGE_STATS_SERVICE);
|
||||
long endTime = System.currentTimeMillis();
|
||||
long beginTime = endTime - 10000;
|
||||
String result = "";
|
||||
UsageEvents.Event event = new UsageEvents.Event();
|
||||
UsageEvents usageEvents = sUsageStatsManager.queryEvents(beginTime, endTime);
|
||||
while (usageEvents.hasNextEvent()) {
|
||||
usageEvents.getNextEvent(event);
|
||||
if (event.getEventType() == UsageEvents.Event.MOVE_TO_FOREGROUND) {
|
||||
result = event.getPackageName();
|
||||
}
|
||||
}
|
||||
if (!TextUtils.isEmpty(result)) {
|
||||
return result;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static Drawable getIcon(Context context, String packageName) {
|
||||
PackageManager manager = context.getPackageManager();
|
||||
Drawable icon;
|
||||
try {
|
||||
icon = manager.getApplicationIcon(manager.getApplicationInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES));
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return null;
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package com.moretool.free.applock.watcher.utilsmanager;
|
||||
|
||||
import static android.content.Context.MODE_PRIVATE;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
public class DataSaveManager {
|
||||
|
||||
private static SharedPreferences sharedPreferences;
|
||||
private static SharedPreferences.Editor editor;
|
||||
|
||||
public static void init(Context context) {
|
||||
if (sharedPreferences == null) {
|
||||
sharedPreferences = context.getSharedPreferences(MyValues.SPName, MODE_PRIVATE);
|
||||
}
|
||||
if (editor == null) {
|
||||
editor = sharedPreferences.edit();
|
||||
}
|
||||
}
|
||||
|
||||
public static void setCurPin(String pin) {
|
||||
editor.putString(MyValues.SP_KEY_CUR_PIN, pin);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static String getCurPin() {
|
||||
return sharedPreferences.getString(MyValues.SP_KEY_CUR_PIN, "");
|
||||
}
|
||||
|
||||
|
||||
public static void setOpCount() {
|
||||
MyValues.OP_COUNT = MyValues.OP_COUNT + 1;
|
||||
editor.putInt(MyValues.SP_KEY_OP_COUNT, MyValues.OP_COUNT);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static void resetOpCount() {
|
||||
MyValues.OP_COUNT = 0;
|
||||
editor.putInt(MyValues.SP_KEY_OP_COUNT, MyValues.OP_COUNT);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static int getOpCount() {
|
||||
return sharedPreferences.getInt(MyValues.SP_KEY_OP_COUNT, MyValues.OP_COUNT);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.moretool.free.applock.watcher.utilsmanager;
|
||||
|
||||
import com.moretool.free.applock.watcher.AppLockApplication;
|
||||
|
||||
public class MyValues {
|
||||
public static final String DBName = "app_room";
|
||||
|
||||
public static final String SPName = "shared_name";
|
||||
public static final int DBVersion = 1;
|
||||
|
||||
public static final String DB_TABLE_NAME = "app_table";
|
||||
public static AppLockApplication lockApplication;
|
||||
public static String password_key = "password_key";
|
||||
public static String password_pin_key = "password_pin_key";
|
||||
public static int password_type0 = 0;
|
||||
public static int password_type1 = 1;
|
||||
public static int password_type2 = 2;
|
||||
|
||||
public static String SP_KEY_CUR_PIN = "sp_key_cur_pin";
|
||||
|
||||
|
||||
public static String SP_KEY_OP_COUNT = "sp_key_op_count";
|
||||
|
||||
public static int OP_COUNT = 0;
|
||||
|
||||
public static final int request_code_usage = 1;
|
||||
public static final int request_code_overlay = 2;
|
||||
|
||||
public static String fragment_locked_key = "fragment_type";
|
||||
|
||||
public static final String YOUR_SDK_KEY = "gtOv1uuZoSrXBVgJLKgwRTRrMdPLV_x0C1uFOPrTCBTyJzWJNcFniU1uxQBHoOdWAA7o5CWPlaCrm5qKqe5iHx";
|
||||
|
||||
public static final String MAX_INIT_ACTION = "ad_action";
|
||||
public static final String MAX_UNIT1 = "7909c224e62ecf91";
|
||||
|
||||
public static final String MAX_UNIT2 = "7bd117f19afcdc14";
|
||||
public static final String MAX_UNIT3 = "48f16f94dc4b5c5b";
|
||||
|
||||
|
||||
// public static final String MAX_UNIT1 = "52a884c9d906cce6";
|
||||
// public static final String MAX_UNIT2 = "f024cc276320bb25";
|
||||
// public static final String MAX_UNIT3 = "48f16f94dc4b5c5b";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.moretool.free.applock.watcher.utilsmanager;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AppOpsManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.provider.Settings;
|
||||
|
||||
public class Permission {
|
||||
|
||||
public static boolean isGetUsagePermission(Context context) {
|
||||
AppOpsManager opsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
|
||||
int mode = opsManager.checkOpNoThrow("android:get_usage_stats", android.os.Process.myUid(), context.getPackageName());
|
||||
return mode == AppOpsManager.MODE_ALLOWED;
|
||||
}
|
||||
|
||||
public static void requestOverlays(Activity activity, int requestCode) {
|
||||
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + activity.getPackageName()));
|
||||
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
|
||||
// //8.0
|
||||
// } else {
|
||||
// // 6.0、7.0、9.0
|
||||
// Uri uri = Uri.fromParts("package", activity.getPackageName(), null);
|
||||
// intent.setData(uri);
|
||||
// }
|
||||
activity.startActivityForResult(intent, requestCode);
|
||||
}
|
||||
|
||||
|
||||
public static void requestUsage(Activity context, int requestCode) {
|
||||
Intent intent = new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS);
|
||||
// Uri uri = Uri.fromParts("package", context.getPackageName(), null);
|
||||
// intent.setData(uri);
|
||||
context.startActivityForResult(intent, requestCode);
|
||||
}
|
||||
|
||||
public static boolean isOverlays(Context context) {
|
||||
return Settings.canDrawOverlays(context);
|
||||
}
|
||||
|
||||
|
||||
public static boolean allAllowPermission(Context context) {
|
||||
boolean getUsagePermission = Permission.isGetUsagePermission(context);
|
||||
boolean overlays = Permission.isOverlays(context);
|
||||
return getUsagePermission && overlays;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
package com.moretool.free.applock.watcher.utilsmanager;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import com.moretool.free.applock.watcher.listener.QueryListener;
|
||||
import com.moretool.free.applock.watcher.room.AppDataBase;
|
||||
import com.moretool.free.applock.watcher.room.EntityApp;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class RoomAction {
|
||||
|
||||
private static ExecutorService uiService;
|
||||
private static Handler mainHandler;
|
||||
|
||||
private static ExecutorService getUiService() {
|
||||
if (uiService == null) {
|
||||
uiService = Executors.newSingleThreadExecutor();
|
||||
}
|
||||
return uiService;
|
||||
}
|
||||
|
||||
private static Handler getMainHandler() {
|
||||
if (mainHandler == null) {
|
||||
mainHandler = new Handler(Looper.getMainLooper());
|
||||
}
|
||||
return mainHandler;
|
||||
}
|
||||
|
||||
public static void insertRoom(Set<EntityApp> list) {
|
||||
getUiService().execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (EntityApp entityApp : list) {
|
||||
AppDataBase.getDbInstance().getEntityAppDao().insertData(entityApp);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public static void queryRoom(boolean isLock, QueryListener listener) {
|
||||
getUiService().execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<EntityApp> appList = AppDataBase.getDbInstance().getEntityAppDao().findApp(isLock);
|
||||
getMainHandler().post(() -> {
|
||||
listener.onQueryResult(appList);
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public static void onRunMain(Runnable runnable){
|
||||
getMainHandler().post(runnable);
|
||||
|
||||
}
|
||||
|
||||
// public static void queryBYName(String name, QueryListener listener) {
|
||||
// getUiService().execute(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// EntityApp entityApp = AppDataBase.getDbInstance().getEntityAppDao().queryByPagName(name);
|
||||
// getMainHandler().post(() -> {
|
||||
// listener.onQueryResultSingle(entityApp);
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
public static void updateRoom(EntityApp entityApp) {
|
||||
getUiService().execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
AppDataBase.getDbInstance().getEntityAppDao().updateData(entityApp);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.moretool.free.applock.watcher.utilsmanager.custome;
|
||||
|
||||
public interface InputListener {
|
||||
|
||||
void onInputComplete(String pin);
|
||||
|
||||
void onInputUnComplete(String pin);
|
||||
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
package com.moretool.free.applock.watcher.utilsmanager.custome;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.moretool.free.applock.watcher.R;
|
||||
|
||||
public class InputNumberView extends FrameLayout {
|
||||
|
||||
private RecyclerView recyclerViewNumber;
|
||||
private RecyclerView recyclerViewPin;
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private StringBuilder myPin;
|
||||
private int pinLength = 4;
|
||||
|
||||
private InputListener inputListener;
|
||||
private PinAdapter pinAdapter;
|
||||
|
||||
@SuppressLint("MissingInflatedId")
|
||||
public InputNumberView(Context context) {
|
||||
super(context);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
public void setInputListener(InputListener inputListener) {
|
||||
this.inputListener = inputListener;
|
||||
}
|
||||
|
||||
public InputNumberView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
|
||||
private void initView(Context context) {
|
||||
myPin = new StringBuilder();
|
||||
mContext = context;
|
||||
View inflate = LayoutInflater.from(context).inflate(R.layout.input_view, null);
|
||||
recyclerViewNumber = inflate.findViewById(R.id.recycler_view_number);
|
||||
recyclerViewPin = inflate.findViewById(R.id.recycler_view_pin);
|
||||
addView(inflate);
|
||||
|
||||
|
||||
NumberAdapter numberAdapter = new NumberAdapter();
|
||||
recyclerViewNumber.setAdapter(numberAdapter);
|
||||
recyclerViewNumber.setLayoutManager(new GridLayoutManager(mContext, 3));
|
||||
|
||||
|
||||
pinAdapter = new PinAdapter();
|
||||
recyclerViewPin.setAdapter(pinAdapter);
|
||||
recyclerViewPin.setLayoutManager(new LinearLayoutManager(mContext, RecyclerView.HORIZONTAL, false));
|
||||
|
||||
|
||||
numberAdapter.setNumberClick(new NumberClick() {
|
||||
@Override
|
||||
public void onNumber(String number) {
|
||||
if (myPin.length() >= pinLength) {
|
||||
myPin.delete(0, myPin.length());
|
||||
}
|
||||
myPin.append(number);
|
||||
pinAdapter.updateItem(myPin.toString());
|
||||
if (myPin.length() == pinLength) {
|
||||
inputListener.onInputComplete(myPin.toString());
|
||||
}else {
|
||||
inputListener.onInputUnComplete(myPin.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDelete() {
|
||||
if (myPin.length() >= 1) {
|
||||
myPin.deleteCharAt(myPin.length() - 1);
|
||||
}
|
||||
pinAdapter.updateItem(myPin.toString());
|
||||
if (myPin.length() < pinLength) {
|
||||
inputListener.onInputUnComplete(myPin.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void clearPin(){
|
||||
myPin.delete(0, myPin.length());
|
||||
pinAdapter.updateItem(myPin.toString());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
package com.moretool.free.applock.watcher.utilsmanager.custome;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.moretool.free.applock.watcher.databinding.ItemNumberViewBinding;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class NumberAdapter extends RecyclerView.Adapter<NumberAdapter.NumberVh> {
|
||||
private NumberClick numberClick;
|
||||
|
||||
public void setNumberClick(NumberClick numberClick) {
|
||||
this.numberClick = numberClick;
|
||||
}
|
||||
|
||||
private String[] numbers = new String[]{"1","2","3","4","5","6","7","8","9","-1","0","-2"};
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public NumberVh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
ItemNumberViewBinding numberViewBinding = ItemNumberViewBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||
|
||||
return new NumberVh(numberViewBinding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull NumberVh holder, int position) {
|
||||
String number = numbers[position];
|
||||
if(position == 9&& Objects.equals(number, "-1")){
|
||||
holder.numberViewBinding.linear.setVisibility(View.GONE);
|
||||
}else if(position == 11&&Objects.equals(number, "-2")){
|
||||
holder.numberViewBinding.linear.setVisibility(View.VISIBLE);
|
||||
holder.numberViewBinding.textNumber.setVisibility(View.GONE);
|
||||
holder.numberViewBinding.imDelete.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
holder.numberViewBinding.linear.setVisibility(View.VISIBLE);
|
||||
holder.numberViewBinding.textNumber.setText(numbers[position]);
|
||||
holder.numberViewBinding.imDelete.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
holder.numberViewBinding.textNumber.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
numberClick.onNumber(number);
|
||||
}
|
||||
});
|
||||
|
||||
holder.numberViewBinding.imDelete.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
numberClick.onDelete();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 12;
|
||||
}
|
||||
|
||||
public static class NumberVh extends RecyclerView.ViewHolder{
|
||||
|
||||
private ItemNumberViewBinding numberViewBinding;
|
||||
public NumberVh(@NonNull ItemNumberViewBinding binding) {
|
||||
super(binding.getRoot());
|
||||
numberViewBinding = binding;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package com.moretool.free.applock.watcher.utilsmanager.custome;
|
||||
|
||||
public interface NumberClick {
|
||||
|
||||
void onNumber(String number);
|
||||
|
||||
void onDelete();
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
package com.moretool.free.applock.watcher.utilsmanager.custome;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.moretool.free.applock.watcher.databinding.ItemNumberViewBinding;
|
||||
import com.moretool.free.applock.watcher.databinding.ItemPinViewBinding;
|
||||
|
||||
public class PinAdapter extends RecyclerView.Adapter<PinAdapter.NumberVh> {
|
||||
|
||||
private String mPin = "";
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public NumberVh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
ItemPinViewBinding binding = ItemPinViewBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||
|
||||
return new NumberVh(binding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull NumberVh holder, int position) {
|
||||
if (position == 0) {
|
||||
holder.pinViewBinding.viewSpace.setVisibility(View.GONE);
|
||||
} else {
|
||||
holder.pinViewBinding.viewSpace.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (position > mPin.length()-1) {
|
||||
holder.pinViewBinding.imPin.setSelected(false);
|
||||
}else {
|
||||
holder.pinViewBinding.imPin.setSelected(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateItem(String pin) {
|
||||
mPin = pin;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
public static class NumberVh extends RecyclerView.ViewHolder {
|
||||
|
||||
private ItemPinViewBinding pinViewBinding;
|
||||
|
||||
public NumberVh(@NonNull ItemPinViewBinding binding) {
|
||||
super(binding.getRoot());
|
||||
pinViewBinding = binding;
|
||||
}
|
||||
}
|
||||
}
|
||||
6
app/src/main/res/color/selector_tab_color.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:color="@color/rgb_DCDCDC" />
|
||||
<item android:color="@color/rgb_5571ec" android:state_selected="true"/>
|
||||
</selector>
|
||||
30
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/back.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M395.2,513.6l323.1,-312.4c19.1,-18.4 19.1,-48.3 0,-66.7 -19.1,-18.4 -49.9,-18.4 -69,0L291.8,480.3c-19.1,18.4 -19.1,48.3 0,66.7l357.6,345.7c9.5,9.2 22,13.8 34.5,13.8 12.5,0 25,-4.6 34.5,-13.8 19.1,-18.4 19.1,-48.2 0,-66.7L395.2,513.6z"
|
||||
android:fillColor="#272636"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/back_white.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M395.2,513.6l323.1,-312.4c19.1,-18.4 19.1,-48.3 0,-66.7 -19.1,-18.4 -49.9,-18.4 -69,0L291.8,480.3c-19.1,18.4 -19.1,48.3 0,66.7l357.6,345.7c9.5,9.2 22,13.8 34.5,13.8 12.5,0 25,-4.6 34.5,-13.8 19.1,-18.4 19.1,-48.2 0,-66.7L395.2,513.6z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
||||
7
app/src/main/res/drawable/bg_button.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="12dp"/>
|
||||
<solid android:color="@color/rgb_6dbdef"/>
|
||||
|
||||
</shape>
|
||||
7
app/src/main/res/drawable/bg_drawer_menu.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="12dp"/>
|
||||
<solid android:color="@color/rgb_67b19c"/>
|
||||
|
||||
</shape>
|
||||
6
app/src/main/res/drawable/bg_item_number.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid android:color="@color/rgb_6dbdef"/>
|
||||
|
||||
</shape>
|
||||
7
app/src/main/res/drawable/bg_permiasion_dialog.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="12dp"/>
|
||||
<solid android:color="@color/white"/>
|
||||
|
||||
</shape>
|
||||
15
app/src/main/res/drawable/delete.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M934.2,853.3H373.9c-12.6,0 -25.2,-4.8 -33,-14.5l-284.1,-293c-18.8,-19.3 -18.8,-49.9 0,-67.6L340.9,185.2c7.9,-9.7 20.4,-14.5 33,-14.5h560.3C960.9,170.7 981.3,191.6 981.3,219v586.1c0,27.3 -20.4,48.3 -47.1,48.3zM392.7,756.7h494.5V267.3H392.7L155.7,512l237,244.7z"
|
||||
android:fillColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M738,677.8c-12.6,0 -23.6,-4.8 -33,-14.5l-227.6,-233.5c-18.9,-19.3 -18.9,-49.9 0,-67.6 18.8,-19.3 48.6,-19.3 65.9,0l227.6,233.4c18.9,19.3 18.9,49.9 0,67.6 -9.4,9.7 -22,14.5 -32.9,14.5z"
|
||||
android:fillColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M510.4,677.8c-12.5,0 -23.6,-4.8 -32.9,-14.5 -18.9,-19.3 -18.9,-49.9 0,-67.6l227.6,-233.4c18.9,-19.3 48.6,-19.3 65.9,0 17.3,19.3 18.9,49.9 0,67.6l-227.6,233.4c-9.4,9.7 -20.4,14.5 -33,14.5z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/go_icon.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#FFffffff"
|
||||
android:pathData="M431.5,1024c-12.8,0 -25.6,-4.9 -35.3,-14.6 -19.5,-19.5 -19.5,-51.2 0,-70.7l426.7,-426.7L396.2,85.3c-19.5,-19.5 -19.5,-51.2 0,-70.7 19.5,-19.5 51.2,-19.5 70.7,0L928.9,476.7c19.5,19.5 19.5,51.2 0,70.7l-462,462c-9.8,9.8 -22.6,14.6 -35.3,14.6z"/>
|
||||
</vector>
|
||||
170
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/item_pin_normal.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<stroke android:width="1dp" android:color="@color/white"/>
|
||||
<solid android:color="@color/rgb_00000000"/>
|
||||
<size
|
||||
android:width="20dp"
|
||||
android:height="20dp" />
|
||||
</shape>
|
||||
9
app/src/main/res/drawable/item_pin_selected.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid android:color="@color/white" />
|
||||
<size
|
||||
android:width="33dp"
|
||||
android:height="33dp" />
|
||||
|
||||
</shape>
|
||||
12
app/src/main/res/drawable/lock.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M768,416h-32v-96c0,-59.6 -23.4,-115.8 -65.8,-158.2S571.6,96 512,96s-115.8,23.4 -158.2,65.8S288,260.4 288,320v96h-32c-70.4,0 -128,57.6 -128,128v256c0,70.4 57.6,128 128,128h512c70.4,0 128,-57.6 128,-128L896,544c0,-70.4 -57.6,-128 -128,-128zM352,320c0,-42.5 16.7,-82.6 47,-113s70.4,-47 113,-47 82.6,16.7 113,47 47,70.4 47,113v96L352,416v-96zM832,800c0,17 -6.7,33 -18.9,45.1S785,864 768,864L256,864c-17,0 -33,-6.7 -45.1,-18.9S192,817 192,800L192,544c0,-17 6.7,-33 18.9,-45.1S239,480 256,480h512c17,0 33,6.7 45.1,18.9S832,527 832,544v256z"
|
||||
android:fillColor="#67b19c"/>
|
||||
<path
|
||||
android:pathData="M512,576c-26.5,0 -48,21.5 -48,48 0,14.2 6.2,27 16,35.8V736c0,17.6 14.4,32 32,32s32,-14.4 32,-32v-76.2c9.8,-8.8 16,-21.6 16,-35.8 0,-26.5 -21.5,-48 -48,-48z"
|
||||
android:fillColor="#67b19c"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/menu.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M64.1,831.8c0,-24.7 20.1,-44.8 44.8,-44.8h420.2c24.7,0 44.8,20.1 44.8,44.8 0,24.7 -20.1,44.8 -44.8,44.8H108.9c-24.8,0 -44.8,-20 -44.8,-44.8zM64.1,511.7c0,-24.7 20.1,-44.8 44.8,-44.8h676.2c24.7,0 44.8,20.1 44.8,44.8 0,24.7 -20.1,44.8 -44.8,44.8H108.9c-24.8,-0.1 -44.8,-20.1 -44.8,-44.8zM785.1,556.4H108.9M108.9,466.9h676.2M64.1,192.2c0,-24.7 20.1,-44.8 44.8,-44.8h806.2c24.7,0 44.8,20.1 44.8,44.8 0,24.7 -20.1,44.8 -44.8,44.8H108.9c-24.8,0 -44.8,-20.1 -44.8,-44.8z"
|
||||
android:fillColor="#67b19c"/>
|
||||
</vector>
|
||||
6
app/src/main/res/drawable/permssion_normal.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/rgb_DCDCDC" />
|
||||
<corners android:radius="10dp" />
|
||||
</shape>
|
||||
6
app/src/main/res/drawable/permssion_selected.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/rgb_6dbdef" />
|
||||
<corners android:radius="10dp" />
|
||||
</shape>
|
||||
6
app/src/main/res/drawable/selector_app_lock.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true" android:drawable="@drawable/lock"/>
|
||||
<item android:drawable="@drawable/unlock"/>
|
||||
|
||||
</selector>
|
||||
6
app/src/main/res/drawable/selector_permssion.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true" android:drawable="@drawable/permssion_normal"/>
|
||||
<item android:drawable="@drawable/permssion_selected"/>
|
||||
|
||||
</selector>
|
||||
7
app/src/main/res/drawable/selector_pin.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@drawable/item_pin_normal" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/item_pin_selected" />
|
||||
|
||||
</selector>
|
||||
12
app/src/main/res/drawable/unlock.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M768,416L352,416v-96c0,-42.5 16.7,-82.6 47,-113s70.4,-47 113,-47c37.9,0 74.7,13.6 103.6,38.4 28.7,24.5 47.9,58.2 54.1,95 3,17.4 19.5,29.2 36.9,26.2s29.2,-19.5 26.2,-36.9c-8.7,-51.5 -35.6,-98.7 -75.7,-132.9C616.7,115.1 565.1,96 512,96c-59.6,0 -115.8,23.4 -158.2,65.8S288,260.4 288,320v96h-32c-70.4,0 -128,57.6 -128,128v256c0,70.4 57.6,128 128,128h512c70.4,0 128,-57.6 128,-128L896,544c0,-70.4 -57.6,-128 -128,-128zM832,800c0,17 -6.7,33 -18.9,45.1S785,864 768,864L256,864c-17,0 -33,-6.7 -45.1,-18.9S192,817 192,800L192,544c0,-17 6.7,-33 18.9,-45.1S239,480 256,480h512c17,0 33,6.7 45.1,18.9S832,527 832,544v256z"
|
||||
android:fillColor="#DCDCDC"/>
|
||||
<path
|
||||
android:pathData="M512,576c-26.5,0 -48,21.5 -48,48 0,14.2 6.2,27 16,35.8V736c0,17.6 14.4,32 32,32s32,-14.4 32,-32v-76.2c9.8,-8.8 16,-21.6 16,-35.8 0,-26.5 -21.5,-48 -48,-48z"
|
||||
android:fillColor="#DCDCDC"/>
|
||||
</vector>
|
||||
134
app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,134 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.drawerlayout.widget.DrawerLayout 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/drawer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".pageview.MainActivity">
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/view_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/tab_layout"
|
||||
android:layout_below="@id/app_name" />
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tab_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
app:tabTextAppearance="@style/TabLayoutStyle"
|
||||
app:tabSelectedTextColor="@color/white"
|
||||
app:tabTextColor="@color/rgb_a2b4b0"
|
||||
android:background="@color/rgb_67b19c"
|
||||
android:layout_alignParentBottom="true"
|
||||
app:tabIndicatorHeight="0dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/app_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_menu"
|
||||
android:layout_width="57dp"
|
||||
android:layout_height="57dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:src="@drawable/menu" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="left"
|
||||
android:background="@color/white">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="63dp"
|
||||
android:layout_height="63dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="25dp"
|
||||
android:src="@mipmap/applock" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/re_reset"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:layout_below="@id/icon"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="33dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:background="@drawable/bg_drawer_menu"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="25dp"
|
||||
android:paddingEnd="15dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/reset_pin"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/go_icon" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/re_about"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:layout_below="@id/re_reset"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="22dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:background="@drawable/bg_drawer_menu"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="25dp"
|
||||
android:paddingEnd="15dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/version"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:id="@+id/tv_version"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
67
app/src/main/res/layout/activity_pass_word.xml
Normal file
@ -0,0 +1,67 @@
|
||||
<?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"
|
||||
android:background="@color/rgb_5571ec"
|
||||
tools:context=".pageview.PassWordActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imBack"
|
||||
android:layout_width="43dp"
|
||||
android:layout_height="43dp"
|
||||
android:src="@drawable/back_white"
|
||||
android:padding="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imLogo"
|
||||
android:layout_width="83dp"
|
||||
android:layout_height="83dp"
|
||||
android:layout_marginTop="80dp"
|
||||
android:src="@mipmap/applock"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="33dp"
|
||||
android:text="@string/enter_your_pin"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/imLogo" />
|
||||
|
||||
|
||||
<com.moretool.free.applock.watcher.utilsmanager.custome.InputNumberView
|
||||
android:id="@+id/input_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_hint" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_button"
|
||||
android:layout_width="160dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_below="@id/input_view"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="30dp"
|
||||
android:background="@drawable/bg_button"
|
||||
android:gravity="center"
|
||||
android:text="@string/Continue"
|
||||
android:visibility="gone"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/input_view" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
34
app/src/main/res/layout/activity_wel_come.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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"
|
||||
android:orientation="vertical"
|
||||
tools:context=".pageview.WelComeActivity">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="200dp"
|
||||
android:src="@mipmap/applock" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminateTint="@color/rgb_67b19c"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="20dp" />
|
||||
|
||||
</LinearLayout>
|
||||
83
app/src/main/res/layout/dialog_permission.xml
Normal file
@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:context=".pageview.MainActivity">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:background="@drawable/bg_permiasion_dialog"
|
||||
android:padding="20dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:id="@+id/logo"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:src="@mipmap/applock"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/logo"
|
||||
android:layout_marginTop="25dp"
|
||||
android:text="@string/permission_required"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_usage_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/tv_usage_button"
|
||||
android:gravity="center"
|
||||
android:layout_alignBottom="@id/tv_usage_button"
|
||||
android:text="@string/detect"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_usage_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:layout_below="@id/title"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:background="@drawable/selector_permssion"
|
||||
android:gravity="center"
|
||||
android:text="@string/Permit" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_overlay_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/tv_overlay_button"
|
||||
android:gravity="center"
|
||||
android:layout_alignBottom="@id/tv_overlay_button"
|
||||
android:text="@string/overlay"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_overlay_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:layout_below="@id/tv_usage_button"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:background="@drawable/selector_permssion"
|
||||
android:gravity="center"
|
||||
android:text="@string/Permit" />
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
||||
48
app/src/main/res/layout/dialog_success.xml
Normal file
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:context=".pageview.MainActivity">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="50dp"
|
||||
android:layout_marginEnd="50dp"
|
||||
android:background="@drawable/bg_permiasion_dialog"
|
||||
android:padding="20dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:id="@+id/logo"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:src="@mipmap/applock"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/logo"
|
||||
android:layout_marginTop="25dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ok_btn"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="40dp"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:layout_below="@id/title"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@drawable/selector_permssion"
|
||||
android:gravity="center"
|
||||
android:text="@string/ok" />
|
||||
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
||||
13
app/src/main/res/layout/fragment_lock.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".pageview.LockFragment">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/app_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</FrameLayout>
|
||||
23
app/src/main/res/layout/input_view.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view_pin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/recycler_view_pin"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="30dp" />
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
41
app/src/main/res/layout/item_app.xml
Normal file
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="65dp"
|
||||
android:paddingStart="28dp"
|
||||
android:paddingEnd="28dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/app_logo"
|
||||
android:layout_width="38dp"
|
||||
android:layout_height="38dp"
|
||||
android:layout_centerVertical="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/app_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="28dp"
|
||||
android:layout_toEndOf="@id/app_logo"
|
||||
android:text="@string/overlay"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/app_locked"
|
||||
android:layout_width="27dp"
|
||||
android:layout_height="27dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:src="@drawable/selector_app_lock" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@color/rgb_DCDCDC" />
|
||||
|
||||
</RelativeLayout>
|
||||
26
app/src/main/res/layout/item_number_view.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/linear"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_number"
|
||||
android:layout_width="55dp"
|
||||
android:layout_height="55dp"
|
||||
android:background="@drawable/bg_item_number"
|
||||
android:gravity="center"
|
||||
android:text="1"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="19sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_delete"
|
||||
android:layout_width="37dp"
|
||||
android:layout_height="37dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/delete" />
|
||||
|
||||
</LinearLayout>
|
||||
18
app/src/main/res/layout/item_pin_view.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/linear"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
android:layout_width="20dp"
|
||||
android:id="@+id/view_space"
|
||||
android:layout_height="1dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_pin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/selector_pin" />
|
||||
|
||||
</LinearLayout>
|
||||
57
app/src/main/res/layout/lock_action_view.xml
Normal file
@ -0,0 +1,57 @@
|
||||
<?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"
|
||||
android:background="@color/rgb_5571ec"
|
||||
tools:context=".pageview.PassWordActivity">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imLogo"
|
||||
android:layout_width="83dp"
|
||||
android:layout_height="83dp"
|
||||
android:layout_marginTop="80dp"
|
||||
android:src="@mipmap/applock"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="33dp"
|
||||
android:text="@string/enter_your_pin"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/imLogo" />
|
||||
|
||||
|
||||
<com.moretool.free.applock.watcher.utilsmanager.custome.InputNumberView
|
||||
android:id="@+id/input_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_hint" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_button"
|
||||
android:layout_width="160dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_below="@id/input_view"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="30dp"
|
||||
android:background="@drawable/bg_button"
|
||||
android:gravity="center"
|
||||
android:text="@string/Continue"
|
||||
android:visibility="gone"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/input_view" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
24
app/src/main/res/layout/tab_view.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/rgb_6dbdef"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/overlay"
|
||||
android:textColor="@color/selector_tab_color"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:id="@+id/view"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/rgb_67b19c" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
6
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
6
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 982 B |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/applock.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
7
app/src/main/res/values-night/themes.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Base.Theme.AppLock" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<!-- Customize your dark theme here. -->
|
||||
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
|
||||
</style>
|
||||
</resources>
|
||||
12
app/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="rgb_67b19c">#67b19c</color>
|
||||
<color name="rgb_6dbdef">#6dbdef</color>
|
||||
<color name="rgb_5571ec">#5571ec</color>
|
||||
<color name="rgb_DCDCDC">#DCDCDC</color>
|
||||
<color name="rgb_00000000">#00000000</color>
|
||||
<color name="rgb_805571ec">#805571EC</color>
|
||||
<color name="rgb_a2b4b0">#a2b4b0</color>
|
||||
</resources>
|
||||
4
app/src/main/res/values/dimen.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="tab_text_size">17sp</dimen>
|
||||
</resources>
|
||||
23
app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<resources>
|
||||
<string name="app_name">AppLock</string>
|
||||
<string name="enter_your_pin">Enter your pin</string>
|
||||
<string name="verify_your_pin">Verify your pin</string>
|
||||
<string name="reset_your_pin">Reset your pin</string>
|
||||
<string name="Continue">Continue</string>
|
||||
<string name="Save">Save</string>
|
||||
<string name="permission_required">Permissions Required</string>
|
||||
<string name="detect">Detect Launched App</string>
|
||||
<string name="overlay">Show Over Other Apps</string>
|
||||
<string name="Permit">Permit</string>
|
||||
<string name="Permitted">Permitted</string>
|
||||
<string name="pwd_verifi_fail">Password verification failed</string>
|
||||
<string name="unlocked">Unlocked</string>
|
||||
<string name="Locked">Locked</string>
|
||||
<string name="reset_pin">Reset Pin</string>
|
||||
<string name="version">Version</string>
|
||||
<string name="lock_app">Lock %s</string>
|
||||
<string name="unlock_app">UnLock %s</string>
|
||||
<string name="reset_success">Password reset successful</string>
|
||||
<string name="app_v">V%s</string>
|
||||
<string name="ok">OK</string>
|
||||
</resources>
|
||||
16
app/src/main/res/values/themes.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Base.Theme.AppLock" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<!-- Customize your light theme here. -->
|
||||
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
|
||||
</style>
|
||||
|
||||
<style name="Theme.AppLock" parent="Base.Theme.AppLock" >
|
||||
<item name="android:statusBarColor">@color/rgb_67b19c</item>
|
||||
</style>
|
||||
|
||||
<style name="TabLayoutStyle">
|
||||
<item name="android:textSize">@dimen/tab_text_size</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
13
app/src/main/res/xml/backup_rules.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample backup rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/guide/topics/data/autobackup
|
||||
for details.
|
||||
Note: This file is ignored for devices older that API 31
|
||||
See https://developer.android.com/about/versions/12/backup-restore
|
||||
-->
|
||||
<full-backup-content>
|
||||
<!--
|
||||
<include domain="sharedpref" path="."/>
|
||||
<exclude domain="sharedpref" path="device.xml"/>
|
||||
-->
|
||||
</full-backup-content>
|
||||
19
app/src/main/res/xml/data_extraction_rules.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample data extraction rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||
for details.
|
||||
-->
|
||||
<data-extraction-rules>
|
||||
<cloud-backup>
|
||||
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
-->
|
||||
</cloud-backup>
|
||||
<!--
|
||||
<device-transfer>
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
</device-transfer>
|
||||
-->
|
||||
</data-extraction-rules>
|
||||
@ -0,0 +1,17 @@
|
||||
package com.moretool.free.applock.watcher;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit watcher, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
BIN
app/testAppLock.jks
Normal file
12
build.gradle.kts
Normal file
@ -0,0 +1,12 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id("com.android.application") version "8.1.3" apply false
|
||||
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
|
||||
id("com.google.gms.google-services") version "4.3.15" apply false
|
||||
id ("com.google.firebase.crashlytics") version "2.9.2" apply false
|
||||
}
|
||||
buildscript{
|
||||
dependencies{
|
||||
classpath("com.applovin.quality:AppLovinQualityServiceGradlePlugin:+")
|
||||
}
|
||||
}
|
||||
22
gradle.properties
Normal file
@ -0,0 +1,22 @@
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. For more details, visit
|
||||
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app's APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Enables namespacing of each library's R class so that its R class includes only the
|
||||
# resources declared in the library itself and none from the library's dependencies,
|
||||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
||||
android.nonFinalResIds=false
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
#Tue May 14 16:27:06 CST 2024
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
21
settings.gradle.kts
Normal file
@ -0,0 +1,21 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven{url = uri("https://artifacts.applovin.com/android")}
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven { url = uri("https://artifact.bytedance.com/repository/pangle") }
|
||||
maven { url = uri("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea") }
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "AppLock"
|
||||
include(":app")
|
||||
|
||||