first commit
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
|
||||
3
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
6
.idea/compiler.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="17" />
|
||||
</component>
|
||||
</project>
|
||||
18
.idea/deploymentTargetSelector.xml
generated
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetSelector">
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2024-07-03T09:44:22.267289Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=ZX1G22QT4B" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
<DialogSelection />
|
||||
</SelectionState>
|
||||
</selectionStates>
|
||||
</component>
|
||||
</project>
|
||||
19
.idea/gradle.xml
generated
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveExternalAnnotations" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/kotlinc.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="version" value="1.9.0" />
|
||||
</component>
|
||||
</project>
|
||||
10
.idea/migrations.xml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectMigrations">
|
||||
<option name="MigrateToGradleLocalJavaHome">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
9
.idea/misc.xml
generated
Normal file
@ -0,0 +1,9 @@
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
||||
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
||||
58
app/build.gradle.kts
Normal file
@ -0,0 +1,58 @@
|
||||
import java.util.Date
|
||||
import java.text.SimpleDateFormat
|
||||
|
||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("kotlin-kapt")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.tool.app.protectorpro"
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.tool.app.protectorpro"
|
||||
minSdk = 23
|
||||
targetSdk = 34
|
||||
versionCode = 1
|
||||
versionName = "1.0.0"
|
||||
// setProperty("archivesBaseName", "AppLocker_V" + versionName + "(${versionCode})_$timestamp")
|
||||
testInstrumentationRunner = "androidx.protectorpro.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("de.hdodenhof:circleimageview:3.1.0")
|
||||
|
||||
implementation("androidx.core:core-ktx:1.9.0")
|
||||
implementation("androidx.appcompat:appcompat:1.6.1")
|
||||
implementation("com.google.android.material:material:1.11.0")
|
||||
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
||||
implementation("androidx.room:room-ktx:2.6.1")
|
||||
implementation("androidx.room:room-runtime:2.6.1")
|
||||
kapt("androidx.room:room-compiler:2.6.1")
|
||||
|
||||
|
||||
}
|
||||
33
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
# 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
|
||||
#room
|
||||
-keepclassmembers class com.tool.app.protectorpro.MyApplication{
|
||||
public static final java.lang.String DB_Name;
|
||||
public static final int DB_Version;
|
||||
}
|
||||
-keepclassmembers class *{
|
||||
@androidx.room.Query <methods>;
|
||||
}
|
||||
|
||||
-keep class com.tool.app.protectorpro.mydb.MyDataBase { *; }
|
||||
-keep class com.tool.app.protectorpro.listener.ListenerDao { *; }
|
||||
-keep class com.tool.app.protectorpro.mydb.DataApp { *; }
|
||||
57
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,57 @@
|
||||
<?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.PACKAGE_USAGE_STATS"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
<queries>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent>
|
||||
</queries>
|
||||
|
||||
<application
|
||||
android:name="com.tool.app.protectorpro.MyApplication"
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/logo"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/logo"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.AppLock"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name="com.tool.app.protectorpro.activity.ActivityMain"
|
||||
android:exported="true"
|
||||
android:excludeFromRecents="true"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<service android:name="com.tool.app.protectorpro.service.LockService" />
|
||||
<activity
|
||||
android:name="com.tool.app.protectorpro.activity.ActivityWel"
|
||||
android:screenOrientation="portrait"
|
||||
android:excludeFromRecents="true"
|
||||
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="com.tool.app.protectorpro.activity.ActivityComplete"
|
||||
android:screenOrientation="portrait"
|
||||
android:excludeFromRecents="true"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name="com.tool.app.protectorpro.activity.ActivitySetPwd"
|
||||
android:screenOrientation="portrait"
|
||||
android:excludeFromRecents="true"
|
||||
android:exported="false"/>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@ -0,0 +1,75 @@
|
||||
package com.tool.app.protectorpro;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import com.tool.app.protectorpro.mydb.DataApp;
|
||||
import com.tool.app.protectorpro.mydb.MyDataBase;
|
||||
import com.tool.app.protectorpro.tools.Common;
|
||||
import com.tool.app.protectorpro.tools.MyThread;
|
||||
|
||||
public class MyApplication extends Application {
|
||||
public static String spName = "share_name";
|
||||
|
||||
public static MyApplication appContext;
|
||||
|
||||
public static final int reqCodeUsage = 1;
|
||||
public static final int DB_Version = 1;
|
||||
public static final String Table_Name = "DataApp";
|
||||
public static final int reqCodeOverlays = 2;
|
||||
public static final String DB_Name = "app_locker";
|
||||
|
||||
|
||||
public static SharedPreferences sp;
|
||||
public static final String PWD_KEY = "locker_pwd";
|
||||
|
||||
public static SharedPreferences.Editor SpEditor;
|
||||
public static final int type_0 = 0;
|
||||
|
||||
public static final int type_1 = 1;
|
||||
|
||||
public static final int type_2 = 2;
|
||||
public static final String init_pwd_key = "pwd_type";
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
appContext = this;
|
||||
initSp();
|
||||
MyThread.runIO(() -> {
|
||||
for (DataApp dataApp : MyDataBase.getInstance().getRoomDao().findApp()) {
|
||||
Boolean needDelete = Common.delUnInstallApp(this, dataApp.getPackageName());
|
||||
if (needDelete) {
|
||||
MyDataBase.getInstance().getRoomDao().deleteData(dataApp);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
String pwd = getPwd();
|
||||
if (pwd.isEmpty()) {
|
||||
Common.getAppList(this, false);
|
||||
} else {
|
||||
Common.getAppList(this, true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void updatePwd(String pwd) {
|
||||
SpEditor.putString(PWD_KEY, pwd);
|
||||
SpEditor.apply();
|
||||
}
|
||||
|
||||
public static String getPwd() {
|
||||
return sp.getString(PWD_KEY, "");
|
||||
}
|
||||
|
||||
private void initSp() {
|
||||
sp = MyApplication.appContext.getSharedPreferences(spName, Context.MODE_PRIVATE);
|
||||
SpEditor = sp.edit();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.tool.app.protectorpro.activity
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.tool.app.protectorpro.R
|
||||
|
||||
class ActivityComplete : AppCompatActivity() {
|
||||
@SuppressLint("MissingInflatedId")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_complete)
|
||||
findViewById<View>(R.id.im_back).setOnClickListener { finish() }
|
||||
initStatusBar()
|
||||
}
|
||||
|
||||
private fun initStatusBar() {
|
||||
val decorView = window.decorView
|
||||
val flag = (View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE)
|
||||
decorView.systemUiVisibility = flag
|
||||
window.statusBarColor = Color.TRANSPARENT
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,272 @@
|
||||
package com.tool.app.protectorpro.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.tool.app.protectorpro.MyApplication;
|
||||
|
||||
import com.tool.app.protectorpro.R;
|
||||
import com.tool.app.protectorpro.databinding.ActivityMainLayoutBinding;
|
||||
import com.tool.app.protectorpro.databinding.TabViewBinding;
|
||||
import com.tool.app.protectorpro.listener.onPermssionListener;
|
||||
import com.tool.app.protectorpro.service.LockService;
|
||||
import com.tool.app.protectorpro.tools.Common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ActivityMain extends AppCompatActivity implements SearchView.OnQueryTextListener, onPermssionListener {
|
||||
private ActivityMainLayoutBinding binding;
|
||||
|
||||
private DialogPer dialogPer;
|
||||
|
||||
List<Fragment> fragmentList = new ArrayList<>();
|
||||
|
||||
private void initStatusBar() {
|
||||
View decorView = getWindow().getDecorView();
|
||||
int flag = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
|
||||
decorView.setSystemUiVisibility(flag);
|
||||
getWindow().setStatusBarColor(Color.TRANSPARENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityMainLayoutBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
binding.searchItem.setOnQueryTextListener(this);
|
||||
initStatusBar();
|
||||
openPermission();
|
||||
startService(new Intent(this, LockService.class));
|
||||
initTab();
|
||||
initClick();
|
||||
}
|
||||
|
||||
private void initTab() {
|
||||
|
||||
String[] titles = new String[]{getString(R.string.text_system), getString(R.string.text_third), getString(R.string.text_recommended)};
|
||||
Drawable[] tabIcon = new Drawable[]{getDrawable(R.drawable.bg_tab_sys), getDrawable(R.drawable.bg_tab_three), getDrawable(R.drawable.bg_tab_lock)};
|
||||
|
||||
fragmentList.add(FragmentMy.newInstance(1));
|
||||
fragmentList.add(FragmentMy.newInstance(2));
|
||||
fragmentList.add(FragmentMy.newInstance(3));
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
TabLayout.Tab tab = binding.tab.newTab();
|
||||
TabViewBinding viewBinding = TabViewBinding.inflate(getLayoutInflater());
|
||||
|
||||
viewBinding.tvTabtext.setText(titles[i]);
|
||||
viewBinding.ivTabIcon.setImageDrawable(tabIcon[i]);
|
||||
|
||||
tab.setCustomView(viewBinding.getRoot());
|
||||
binding.tab.addTab(tab);
|
||||
}
|
||||
binding.viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
|
||||
TabLayout.Tab tabAt = binding.tab.getTabAt(position);
|
||||
if (tabAt != null) {
|
||||
binding.tvAppTabname.setText(titles[position]);
|
||||
tabAt.select();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
});
|
||||
binding.viewPager.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) {
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
return fragmentList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return fragmentList.size();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
return titles[position];
|
||||
}
|
||||
});
|
||||
|
||||
TabLayout.Tab tabAt = binding.tab.getTabAt(1);
|
||||
if (tabAt != null)
|
||||
updateTab(tabAt, false);
|
||||
binding.tab.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
updateTab(tab, true);
|
||||
binding.viewPager.setCurrentItem(tab.getPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
updateTab(tab, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initClick() {
|
||||
binding.imSetPwd.setOnClickListener(v -> setBottomSheetView());
|
||||
}
|
||||
|
||||
private void setBottomSheetView() {
|
||||
if (isDestroyed())
|
||||
return;
|
||||
|
||||
BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(ActivityMain.this);
|
||||
View bottomSheetView = LayoutInflater.from(ActivityMain.this).inflate(R.layout.set_bottom_sheet_layout, null);
|
||||
bottomSheetDialog.setContentView(bottomSheetView);
|
||||
|
||||
ImageView ivClose = bottomSheetView.findViewById(R.id.ivClose);
|
||||
TextView btnOption1 = bottomSheetView.findViewById(R.id.btnOption1);
|
||||
TextView btnOption2 = bottomSheetView.findViewById(R.id.btnOption2);
|
||||
|
||||
ivClose.setOnClickListener(v -> bottomSheetDialog.dismiss());
|
||||
|
||||
// 按钮1点击事件
|
||||
btnOption1.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(ActivityMain.this, ActivitySetPwd.class);
|
||||
intent.putExtra(MyApplication.init_pwd_key, MyApplication.type_1);
|
||||
startActivity(intent);
|
||||
bottomSheetDialog.dismiss();
|
||||
});
|
||||
|
||||
// 按钮2点击事件
|
||||
btnOption2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
bottomSheetDialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
bottomSheetDialog.show();
|
||||
}
|
||||
|
||||
private void updateTab(TabLayout.Tab tab, boolean isSelected) {
|
||||
View customView = tab.getCustomView();
|
||||
if (customView == null) return;
|
||||
TextView tv = customView.findViewById(R.id.tv_tabtext);
|
||||
tv.setSelected(isSelected);
|
||||
ImageView iv = customView.findViewById(R.id.iv_tab_icon);
|
||||
|
||||
iv.setSelected(isSelected);
|
||||
|
||||
}
|
||||
|
||||
private boolean checkPermission() {
|
||||
boolean b = Common.checkPermission(this);
|
||||
boolean canDrawOverlays = Common.getCanDrawOverlays(this);
|
||||
return b && canDrawOverlays;
|
||||
}
|
||||
|
||||
private void openPermission() {
|
||||
if (!checkPermission()) {
|
||||
if (dialogPer == null) {
|
||||
dialogPer = DialogPer.newInstance();
|
||||
dialogPer.setListener(this);
|
||||
}
|
||||
dialogPer.show(getSupportFragmentManager(), "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == MyApplication.reqCodeUsage) {
|
||||
if (checkPermission()) {
|
||||
dialogPer.dismiss();
|
||||
return;
|
||||
}
|
||||
boolean canDrawOverlays = Common.getCanDrawOverlays(this);
|
||||
if (!canDrawOverlays) {
|
||||
Common.goDrawOverlays(this, MyApplication.reqCodeOverlays);
|
||||
}
|
||||
} else if (requestCode == MyApplication.reqCodeOverlays) {
|
||||
if (checkPermission()) {
|
||||
dialogPer.dismiss();
|
||||
} else {
|
||||
Toast.makeText(this, getString(R.string.text_permission_hint), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onToSetting() {
|
||||
boolean b = Common.checkPermission(this);
|
||||
boolean canDrawOverlays = Common.getCanDrawOverlays(this);
|
||||
|
||||
if (!b) {
|
||||
Common.toSetUsagePermission(ActivityMain.this, MyApplication.reqCodeUsage);
|
||||
} else {
|
||||
|
||||
if (!canDrawOverlays) {
|
||||
Common.goDrawOverlays(this, MyApplication.reqCodeOverlays);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void filterApps(String query) {
|
||||
// 获取当前显示的Fragment
|
||||
int position = binding.viewPager.getCurrentItem();
|
||||
Fragment fragment = fragmentList.get(position);
|
||||
|
||||
// 如果Fragment是FragmentMy,则调用其filter方法
|
||||
if ((fragment instanceof FragmentMy)) {
|
||||
((FragmentMy) fragment).filter(query);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
|
||||
filterApps(query);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
filterApps(newText);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,283 @@
|
||||
package com.tool.app.protectorpro.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.InputType;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.tool.app.protectorpro.MyApplication;
|
||||
import com.tool.app.protectorpro.R;
|
||||
import com.tool.app.protectorpro.customerview.MyLockView;
|
||||
import com.tool.app.protectorpro.customerview.MyPasswordInputView;
|
||||
import com.tool.app.protectorpro.databinding.ActivitySetPwdBinding;
|
||||
import com.tool.app.protectorpro.listener.ListenerLock;
|
||||
|
||||
public class ActivitySetPwd extends AppCompatActivity {
|
||||
|
||||
private static final String TAG = "ActivitySetPwd";
|
||||
|
||||
private ActivitySetPwdBinding binding;
|
||||
private int type;
|
||||
private MyPasswordInputView passwordInputView;
|
||||
private StringBuilder surePassword = new StringBuilder();
|
||||
private StringBuilder tempPassword = new StringBuilder();
|
||||
|
||||
private void initStatusBar() {
|
||||
View decorView = getWindow().getDecorView();
|
||||
int flag = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
|
||||
decorView.setSystemUiVisibility(flag);
|
||||
getWindow().setStatusBarColor(Color.TRANSPARENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivitySetPwdBinding.inflate(getLayoutInflater());
|
||||
initStatusBar();
|
||||
setContentView(binding.getRoot());
|
||||
passwordInputView = binding.layoutEt;
|
||||
type = getIntent().getIntExtra(MyApplication.init_pwd_key, MyApplication.type_0);
|
||||
initView();
|
||||
initInput();
|
||||
initClick();
|
||||
initKeyboard();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
// 0 设置 1 修改 2 确认
|
||||
switch (type) {
|
||||
case MyApplication.type_0:
|
||||
binding.imBack.setVisibility(View.GONE);
|
||||
binding.tvPassName.setText(R.string.text_original_pwd);
|
||||
// binding.tvTitle.setText(getString(R.string.text_original_pwd));
|
||||
binding.tvSub.setText(getString(R.string.text_original_pwd_describe));
|
||||
// binding.tvContinue.setText(getString(R.string.text_continue));
|
||||
break;
|
||||
case MyApplication.type_1:
|
||||
binding.imBack.setVisibility(View.VISIBLE);
|
||||
binding.tvPassName.setText(R.string.sheet_change_password);
|
||||
// binding.tvTitle.setText(getString(R.string.text_change_pwd));
|
||||
binding.tvSub.setText(getString(R.string.text_change_pwd_sub));
|
||||
// binding.tvContinue.setText(getString(R.string.text_save));
|
||||
break;
|
||||
case MyApplication.type_2:
|
||||
binding.imBack.setVisibility(View.VISIBLE);
|
||||
binding.tvPassName.setText(R.string.text_confirm_pwd);
|
||||
// binding.tvTitle.setText(getString(R.string.text_confirm_pwd));
|
||||
// binding.tvSub.setText(getString(R.string.text_change_pwd_sub));
|
||||
// binding.tvContinue.setText(getString(R.string.text_save));
|
||||
break;
|
||||
}
|
||||
updateEditText();
|
||||
}
|
||||
|
||||
private void initInput() {
|
||||
for (int i = 0; i < binding.layoutEt.getChildCount(); i++) {
|
||||
EditText editText = (EditText) binding.layoutEt.getChildAt(i);
|
||||
EditText nextEditText = null;
|
||||
if ((i + 1) < binding.layoutEt.getChildCount()) {
|
||||
nextEditText = (EditText) binding.layoutEt.getChildAt(i + 1);
|
||||
}
|
||||
|
||||
editText.setInputType(InputType.TYPE_NULL);
|
||||
|
||||
EditText finalNextEditText = nextEditText;
|
||||
editText.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (s.length() > 0 && finalNextEditText != null) {
|
||||
finalNextEditText.requestFocus();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void initKeyboard() {
|
||||
binding.lockSetPassword.setPinLockListener(new ListenerLock() {
|
||||
@Override
|
||||
public void onInPutComplete(String pin) {
|
||||
Log.d(TAG, "onInPutComplete: " + pin);
|
||||
|
||||
if (type == MyApplication.type_0 || type == MyApplication.type_1) {
|
||||
Log.d(TAG, "在设置界面");
|
||||
if (pin.length() == 4) {
|
||||
Log.d(TAG, "跳转到二次");
|
||||
type = MyApplication.type_2;
|
||||
initView();
|
||||
}
|
||||
|
||||
} else {
|
||||
initView();
|
||||
Log.d(TAG, "在二次确认界面");
|
||||
checkPassword();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNumberClickComplete(String keyValue) {
|
||||
Log.d(TAG, "onNumberClickComplete: " + keyValue);
|
||||
|
||||
if (type == MyApplication.type_0 || type == MyApplication.type_1) {
|
||||
|
||||
if (tempPassword.length() < 4) {
|
||||
tempPassword.append(keyValue);
|
||||
passwordInputView.setInput(tempPassword);
|
||||
Log.d(TAG, "tempPassword: " + tempPassword.toString());
|
||||
}
|
||||
|
||||
} else if (type == MyApplication.type_2) {
|
||||
if (surePassword.length() < 4) {
|
||||
surePassword.append(keyValue);
|
||||
passwordInputView.setInput(surePassword);
|
||||
Log.d(TAG, "passwordBuilder: " + surePassword.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyBordDelete(int pin) {
|
||||
|
||||
Log.d("fsdafsd", pin + "__dfs");
|
||||
if (pin == 1) {
|
||||
surePassword.setLength(0);
|
||||
tempPassword.setLength(0);
|
||||
initView();
|
||||
}
|
||||
|
||||
if (type == MyApplication.type_2) {
|
||||
passwordInputView.setInput(surePassword);
|
||||
// 删除 surePassword 中的字符
|
||||
if (surePassword.length() > 0) {
|
||||
surePassword.deleteCharAt(surePassword.length() - 1);
|
||||
passwordInputView.deleteLastInput();
|
||||
|
||||
|
||||
}
|
||||
// 如果 surePassword 被删完了,将 type 设置为 type_0,并重新初始化视图和更新 EditText
|
||||
if (surePassword.length() == 0) {
|
||||
type = MyApplication.type_0;
|
||||
initView();
|
||||
}
|
||||
} else if (type == MyApplication.type_0 || type == MyApplication.type_1) {
|
||||
passwordInputView.setInput(tempPassword);
|
||||
// 删除 tempPassword 中的字符
|
||||
if (tempPassword.length() > 0) {
|
||||
tempPassword.deleteCharAt(tempPassword.length() - 1);
|
||||
passwordInputView.deleteLastInput();
|
||||
|
||||
}
|
||||
}
|
||||
Log.d(TAG, "onKeyBordDelete: Deleted last input. tempPassword: " + tempPassword.toString() + ", surePassword: " + surePassword.toString());
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
Log.d(TAG, "initKeyboard: Initialized pin lock listener");
|
||||
}
|
||||
|
||||
private void initClick() {
|
||||
binding.imBack.setOnClickListener(v -> {
|
||||
finish();
|
||||
Log.d(TAG, "onClick: Back button clicked");
|
||||
});
|
||||
|
||||
binding.tvContinue.setOnClickListener(v -> {
|
||||
// Placeholder for specific logic
|
||||
Log.d(TAG, "onClick: Continue button clicked");
|
||||
});
|
||||
Log.d(TAG, "initClick: Initialized click listeners");
|
||||
}
|
||||
|
||||
private void checkPassword() {
|
||||
if (surePassword.toString().equals(tempPassword.toString())) {
|
||||
savePassword();
|
||||
Log.d(TAG, "checkPassword: Passwords matched, saving password");
|
||||
} else {
|
||||
|
||||
if ((surePassword.length() == tempPassword.length())) {
|
||||
Toast.makeText(ActivitySetPwd.this, getString(R.string.text_pass_sure), Toast.LENGTH_SHORT).show();
|
||||
|
||||
}
|
||||
Log.d(TAG, "checkPassword: Passwords do not match, showing toast");
|
||||
}
|
||||
}
|
||||
|
||||
private void savePassword() {
|
||||
String password = surePassword.toString();
|
||||
if (password.length() == 4) {
|
||||
MyApplication.updatePwd(password);
|
||||
|
||||
switch (type) {
|
||||
case MyApplication.type_0:
|
||||
case MyApplication.type_2:
|
||||
startActivity(new Intent(ActivitySetPwd.this, ActivityMain.class));
|
||||
break;
|
||||
case MyApplication.type_1:
|
||||
startActivity(new Intent(ActivitySetPwd.this, ActivityComplete.class));
|
||||
break;
|
||||
}
|
||||
finish();
|
||||
Log.d(TAG, "savePassword: Password saved successfully");
|
||||
} else {
|
||||
Toast.makeText(ActivitySetPwd.this, getString(R.string.text_hint), Toast.LENGTH_SHORT).show();
|
||||
Log.d(TAG, "savePassword: Password length is not 4, showing hint toast");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void updateEditText() {
|
||||
for (int i = 0; i < binding.layoutEt.getChildCount(); i++) {
|
||||
EditText editText = (EditText) binding.layoutEt.getChildAt(i);
|
||||
editText.setText("");
|
||||
}
|
||||
|
||||
// 根据当前的 type 决定显示哪个密码
|
||||
String displayText = "";
|
||||
if (type == MyApplication.type_0 || type == MyApplication.type_1) {
|
||||
|
||||
displayText = tempPassword.toString();
|
||||
} else if (type == MyApplication.type_2) {
|
||||
displayText = surePassword.toString();
|
||||
}
|
||||
|
||||
Log.d("dsafsdaf", tempPassword.toString() + "___" + surePassword.toString());
|
||||
// 设置 EditText 的内容
|
||||
for (int i = 0; i < displayText.length(); i++) {
|
||||
if (i < binding.layoutEt.getChildCount()) {
|
||||
EditText editText = (EditText) binding.layoutEt.getChildAt(i);
|
||||
editText.setText(String.valueOf(displayText.charAt(i)));
|
||||
}
|
||||
}
|
||||
|
||||
// 重新设置光标位置
|
||||
if (binding.layoutEt.getChildCount() > 0) {
|
||||
EditText editText = (EditText) binding.layoutEt.getChildAt(0);
|
||||
editText.requestFocus();
|
||||
}
|
||||
|
||||
Log.d(TAG, "updateEditText: Updated EditText fields");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.tool.app.protectorpro.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.tool.app.protectorpro.MyApplication;
|
||||
import com.tool.app.protectorpro.databinding.ActivityWelBinding;
|
||||
|
||||
public class ActivityWel extends AppCompatActivity {
|
||||
|
||||
private ActivityWelBinding binding;
|
||||
|
||||
|
||||
private CountDownTimer countDownTimer;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityWelBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
initBar();
|
||||
|
||||
countDownTimer = new CountDownTimer(2000L, 500L) {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
String pwd = MyApplication.getPwd();
|
||||
if (pwd.isEmpty()) {
|
||||
startActivity(new Intent(ActivityWel.this, ActivitySetPwd.class));
|
||||
} else {
|
||||
startActivity(new Intent(ActivityWel.this, ActivityMain.class));
|
||||
}
|
||||
finish();
|
||||
|
||||
}
|
||||
};
|
||||
countDownTimer.start();
|
||||
}
|
||||
|
||||
private void initBar() {
|
||||
View decorView = getWindow().getDecorView();
|
||||
int flag = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
|
||||
decorView.setSystemUiVisibility(flag);
|
||||
getWindow().setStatusBarColor(Color.TRANSPARENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
countDownTimer.cancel();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
package com.tool.app.protectorpro.activity;
|
||||
|
||||
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.tool.app.protectorpro.R;
|
||||
import com.tool.app.protectorpro.databinding.DialogPermisBinding;
|
||||
import com.tool.app.protectorpro.listener.onPermssionListener;
|
||||
import com.tool.app.protectorpro.tools.Common;
|
||||
|
||||
public class DialogPer extends DialogFragment {
|
||||
private DialogPermisBinding layoutPermissionBinding;
|
||||
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
layoutPermissionBinding = DialogPermisBinding.inflate(getLayoutInflater());
|
||||
|
||||
getDialog().setCanceledOnTouchOutside(false);
|
||||
getDialog().setCancelable(false);
|
||||
|
||||
final Window window = getDialog().getWindow();
|
||||
window.setBackgroundDrawableResource(R.color.transparent);
|
||||
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);
|
||||
|
||||
|
||||
layoutPermissionBinding.llSet1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
if (!layoutPermissionBinding.tvSelect.isSelected()) {
|
||||
listener.onToSetting();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
layoutPermissionBinding.llSet2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
listener.onToSetting();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return layoutPermissionBinding.getRoot();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
initView();
|
||||
}
|
||||
|
||||
private onPermssionListener listener;
|
||||
|
||||
public void setListener(onPermssionListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public static DialogPer newInstance() {
|
||||
return new DialogPer();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
boolean b = Common.checkPermission(getActivity());
|
||||
if (!b) {
|
||||
layoutPermissionBinding.llSet1.setSelected(false);
|
||||
layoutPermissionBinding.ivSet1.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
layoutPermissionBinding.diaCheck.setSelected(true);
|
||||
layoutPermissionBinding.llSet2.setSelected(false);
|
||||
layoutPermissionBinding.ivSet1.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
package com.tool.app.protectorpro.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.tool.app.protectorpro.databinding.FragmentMyBinding;
|
||||
import com.tool.app.protectorpro.listadapter.AdapterAllApp;
|
||||
import com.tool.app.protectorpro.mydb.DataApp;
|
||||
import com.tool.app.protectorpro.mydb.MyDataBase;
|
||||
import com.tool.app.protectorpro.tools.MyThread;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FragmentMy extends Fragment {
|
||||
private int appType;
|
||||
private FragmentMyBinding binding;
|
||||
private static final String ARG_PARAM1 = "key_data";
|
||||
private AdapterAllApp adapterAllApp;
|
||||
|
||||
public FragmentMy() {
|
||||
}
|
||||
|
||||
|
||||
public static FragmentMy newInstance(int appType) {
|
||||
FragmentMy fragment = new FragmentMy();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(ARG_PARAM1, appType);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
appType = getArguments().getInt(ARG_PARAM1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
binding = FragmentMyBinding.inflate(getLayoutInflater());
|
||||
|
||||
adapterAllApp = new AdapterAllApp(requireContext());
|
||||
binding.listApp.setAdapter(adapterAllApp);
|
||||
binding.listApp.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||
|
||||
MyThread.runIO(() -> {
|
||||
List<DataApp> data;
|
||||
if (appType == 1) {
|
||||
data = MyDataBase.getInstance().getRoomDao().findByType(true, false);
|
||||
} else if (appType == 2) {
|
||||
data = MyDataBase.getInstance().getRoomDao().findByType(false, false);
|
||||
} else if (appType == 3) {
|
||||
data = MyDataBase.getInstance().getRoomDao().findByLock(true);
|
||||
} else {
|
||||
data = new ArrayList<>();
|
||||
}
|
||||
|
||||
MyThread.runUI(() -> {
|
||||
adapterAllApp.updateSyStemApp(data);
|
||||
});
|
||||
});
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
public void filter(String query) {
|
||||
if (adapterAllApp != null) {
|
||||
adapterAllApp.filter(query);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.tool.app.protectorpro.customerview
|
||||
|
||||
import android.graphics.drawable.Drawable
|
||||
|
||||
class CustomBundle {
|
||||
@JvmField
|
||||
var textColor = 0
|
||||
@JvmField
|
||||
var textSize = 0
|
||||
|
||||
|
||||
var isShowDeleteButton = false
|
||||
@JvmField
|
||||
var buttonSize = 0
|
||||
@JvmField
|
||||
var backgroundDrawable: Drawable? = null
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
package com.tool.app.protectorpro.customerview;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class LockSpace extends RecyclerView.ItemDecoration {
|
||||
|
||||
private final int HSpace;
|
||||
|
||||
private final int mSpanCount;
|
||||
private final boolean mInclude;
|
||||
private final int mVSpace;
|
||||
|
||||
public LockSpace(int horizontalSpaceWidth, int verticalSpaceHeight, int spanCount, boolean includeEdge) {
|
||||
this.HSpace = horizontalSpaceWidth;
|
||||
this.mVSpace = verticalSpaceHeight;
|
||||
this.mSpanCount = spanCount;
|
||||
this.mInclude = includeEdge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
|
||||
|
||||
int position = parent.getChildAdapterPosition(view);
|
||||
int column = position % mSpanCount;
|
||||
|
||||
if (mInclude) {
|
||||
outRect.left = HSpace - column * HSpace / mSpanCount;
|
||||
outRect.right = (column + 1) * HSpace / mSpanCount;
|
||||
|
||||
if (position < mSpanCount) {
|
||||
outRect.top = mVSpace;
|
||||
}
|
||||
outRect.bottom = mVSpace;
|
||||
} else {
|
||||
outRect.left = column * HSpace / mSpanCount;
|
||||
outRect.right = HSpace - (column + 1) * HSpace / mSpanCount;
|
||||
if (position >= mSpanCount) {
|
||||
outRect.top = mVSpace;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
package com.tool.app.protectorpro.customerview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
import com.tool.app.protectorpro.R;
|
||||
import com.tool.app.protectorpro.tools.Common;
|
||||
|
||||
|
||||
public class MyDots extends LinearLayout {
|
||||
|
||||
|
||||
private static final int DEFAULT_PIN_LENGTH = 4;
|
||||
private int mPinLength;
|
||||
|
||||
|
||||
private int mPreviousLength;
|
||||
private int mDotDiameter;
|
||||
private int mDotSpacing;
|
||||
private int mFillDrawable;
|
||||
private int mEmptyDrawable;
|
||||
|
||||
private void initView(Context context) {
|
||||
ViewCompat.setLayoutDirection(this, ViewCompat.LAYOUT_DIRECTION_LTR);
|
||||
for (int i = 0; i < mPinLength; i++) {
|
||||
View dot = new View(context);
|
||||
emptyDot(dot);
|
||||
|
||||
LayoutParams params = new LayoutParams(mDotDiameter,
|
||||
mDotDiameter);
|
||||
params.setMargins(mDotSpacing, 0, mDotSpacing, 0);
|
||||
dot.setLayoutParams(params);
|
||||
|
||||
addView(dot);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public MyDots(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public MyDots(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public MyDots(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.MyLock);
|
||||
|
||||
try {
|
||||
mDotDiameter = (int) typedArray.getDimension(R.styleable.MyLock_dotDiameter, Common.getPx(getContext(), R.dimen.default_dot_diameter));
|
||||
mDotSpacing = (int) typedArray.getDimension(R.styleable.MyLock_dotSpacing, Common.getPx(getContext(), R.dimen.default_dot_spacing));
|
||||
mFillDrawable = typedArray.getResourceId(R.styleable.MyLock_dotFilledBackground,
|
||||
R.drawable.oval_black);
|
||||
mEmptyDrawable = typedArray.getResourceId(R.styleable.MyLock_dotEmptyBackground,
|
||||
R.drawable.pwd_bg);
|
||||
mPinLength = typedArray.getInt(R.styleable.MyLock_pinLength, DEFAULT_PIN_LENGTH);
|
||||
} finally {
|
||||
typedArray.recycle();
|
||||
}
|
||||
|
||||
initView(context);
|
||||
}
|
||||
|
||||
|
||||
private void emptyDot(View dot) {
|
||||
dot.setBackgroundResource(mEmptyDrawable);
|
||||
dot.animate().scaleX(1.0f).scaleY(1.0f).setDuration(100).start();
|
||||
}
|
||||
|
||||
private void fillDot(View dot) {
|
||||
dot.setBackgroundResource(mFillDrawable);
|
||||
dot.animate().scaleX(1.2f).scaleY(1.2f).setDuration(100).start();
|
||||
}
|
||||
|
||||
|
||||
void updateDot(int length) {
|
||||
if (length > 0) {
|
||||
if (length > mPreviousLength) {
|
||||
fillDot(getChildAt(length - 1));
|
||||
} else {
|
||||
emptyDot(getChildAt(length));
|
||||
}
|
||||
mPreviousLength = length;
|
||||
} else {
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
View v = getChildAt(i);
|
||||
emptyDot(v);
|
||||
}
|
||||
mPreviousLength = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,226 @@
|
||||
package com.tool.app.protectorpro.customerview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.tool.app.protectorpro.MyApplication;
|
||||
import com.tool.app.protectorpro.R;
|
||||
import com.tool.app.protectorpro.listadapter.AdapterLockView;
|
||||
import com.tool.app.protectorpro.listener.ListenerLock;
|
||||
import com.tool.app.protectorpro.tools.Common;
|
||||
|
||||
public class MyLockView extends RecyclerView {
|
||||
private String mPin = "";
|
||||
private int mPinLength;
|
||||
private int mHorizontalSpacing, mVerticalSpacing;
|
||||
private int mTextColor;
|
||||
private int mTextSize, mButtonSize;
|
||||
private Drawable mButtonBgDraw;
|
||||
private AdapterLockView mAdapter;
|
||||
private ListenerLock mPinLockListener;
|
||||
private CustomBundle mCustomBundle;
|
||||
|
||||
private boolean mShowDelete;
|
||||
private static final int DEFAULT_PWD_LENGTH = 4;
|
||||
private MyDots mMyDots;
|
||||
|
||||
|
||||
private AdapterLockView.OnNumberClickListener numberClickListener
|
||||
= new AdapterLockView.OnNumberClickListener() {
|
||||
@Override
|
||||
public void onNumberClicked(int keyValue) {
|
||||
|
||||
|
||||
if (mPinLockListener != null) {
|
||||
mPinLockListener.onNumberClickComplete(String.valueOf(keyValue));
|
||||
}
|
||||
|
||||
if (mPin.length() < getPinLength()) {
|
||||
mPin = mPin.concat(String.valueOf(keyValue));
|
||||
|
||||
if (isIndicatorDotsAttached()) {
|
||||
mMyDots.updateDot(mPin.length());
|
||||
|
||||
}
|
||||
|
||||
if (mPin.length() == 1) {
|
||||
mAdapter.setPinLength(mPin.length());
|
||||
mAdapter.notifyItemChanged(mAdapter.getItemCount() - 1);
|
||||
}
|
||||
|
||||
if (mPinLockListener != null) {
|
||||
if (mPin.length() == mPinLength) {
|
||||
mPinLockListener.onInPutComplete(mPin);
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!isShowDeleteButton()) {
|
||||
resetPinLockView();
|
||||
mPin = mPin.concat(String.valueOf(keyValue));
|
||||
|
||||
if (isIndicatorDotsAttached()) {
|
||||
mMyDots.updateDot(mPin.length());
|
||||
}
|
||||
|
||||
if (mPinLockListener != null) {
|
||||
// mPinLockListener.onPinChange(mPin.length(), mPin);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (mPinLockListener != null) {
|
||||
mPinLockListener.onInPutComplete(mPin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private AdapterLockView.OnDeleteClickListener mOnDeleteClickListener
|
||||
= new AdapterLockView.OnDeleteClickListener() {
|
||||
@Override
|
||||
public void onDeleteClicked() {
|
||||
Log.d("key_delete", mPin.length() + "...");
|
||||
|
||||
if (!mPin.isEmpty()) {
|
||||
mPinLockListener.onKeyBordDelete(mPin.length());
|
||||
|
||||
mPin = mPin.substring(0, mPin.length() - 1);
|
||||
|
||||
if (isIndicatorDotsAttached()) {
|
||||
mMyDots.updateDot(mPin.length());
|
||||
|
||||
}
|
||||
|
||||
if (mPin.length() == 0) {
|
||||
mAdapter.setPinLength(mPin.length());
|
||||
mAdapter.notifyItemChanged(mAdapter.getItemCount() - 1);
|
||||
}
|
||||
|
||||
if (mPinLockListener != null) {
|
||||
if (mPin.length() == 0) {
|
||||
// mPinLockListener.onEmpty();
|
||||
clearInternalPin();
|
||||
} else {
|
||||
// mPinLockListener.onPinChange(mPin.length(), mPin);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (mPinLockListener != null) {
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public MyLockView(Context context) {
|
||||
super(context);
|
||||
init(null, 0);
|
||||
}
|
||||
|
||||
public MyLockView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(attrs, 0);
|
||||
}
|
||||
|
||||
public MyLockView(Context context, @Nullable AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
init(attrs, defStyle);
|
||||
}
|
||||
|
||||
private void init(AttributeSet attributeSet, int defStyle) {
|
||||
|
||||
TypedArray typedArray = getContext().obtainStyledAttributes(attributeSet, R.styleable.MyLock);
|
||||
|
||||
try {
|
||||
mPinLength = typedArray.getInt(R.styleable.MyLock_pinLength, DEFAULT_PWD_LENGTH);
|
||||
mHorizontalSpacing = (int) typedArray.getDimension(R.styleable.MyLock_keypadHorizontalSpacing, Common.getPx(getContext(), R.dimen.default_horizontal_spacing));
|
||||
mVerticalSpacing = (int) typedArray.getDimension(R.styleable.MyLock_keypadVerticalSpacing, Common.getPx(getContext(), R.dimen.default_vertical_spacing));
|
||||
mTextColor = typedArray.getColor(R.styleable.MyLock_keypadTextColor, Common.getColor(getContext(), R.color.color_keyboard_num));
|
||||
mTextSize = (int) typedArray.getDimension(R.styleable.MyLock_keypadTextSize, Common.getPx(getContext(), R.dimen.default_text_size));
|
||||
mButtonSize = (int) typedArray.getDimension(R.styleable.MyLock_keypadButtonSize, Common.getPx(getContext(), R.dimen.default_button_size));
|
||||
mButtonBgDraw = typedArray.getDrawable(R.styleable.MyLock_keypadButtonBackgroundDrawable);
|
||||
|
||||
mShowDelete = typedArray.getBoolean(R.styleable.MyLock_keypadShowDeleteButton, true);
|
||||
} finally {
|
||||
typedArray.recycle();
|
||||
}
|
||||
|
||||
mCustomBundle = new CustomBundle();
|
||||
mCustomBundle.textColor = mTextColor;
|
||||
mCustomBundle.textSize = mTextSize;
|
||||
mCustomBundle.buttonSize = mButtonSize;
|
||||
mCustomBundle.backgroundDrawable = mButtonBgDraw;
|
||||
mCustomBundle.setShowDeleteButton(mShowDelete);
|
||||
|
||||
|
||||
initView();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
mAdapter = new AdapterLockView();
|
||||
setLayoutManager(new GridLayoutManager(getContext(), 3));
|
||||
|
||||
|
||||
mAdapter.setOnItemClickListener(numberClickListener);
|
||||
mAdapter.setOnDeleteClickListener(mOnDeleteClickListener);
|
||||
mAdapter.setCustomizationOptions(mCustomBundle);
|
||||
setAdapter(mAdapter);
|
||||
|
||||
addItemDecoration(new LockSpace(mHorizontalSpacing, mVerticalSpacing, 3, false));
|
||||
setOverScrollMode(OVER_SCROLL_NEVER);
|
||||
}
|
||||
|
||||
|
||||
public void setPinLockListener(ListenerLock pinLockListener) {
|
||||
this.mPinLockListener = pinLockListener;
|
||||
}
|
||||
|
||||
public int getPinLength() {
|
||||
return mPinLength;
|
||||
}
|
||||
|
||||
public boolean isShowDeleteButton() {
|
||||
return mShowDelete;
|
||||
}
|
||||
|
||||
private void clearInternalPin() {
|
||||
mPin = "";
|
||||
}
|
||||
|
||||
|
||||
public void resetPinLockView() {
|
||||
clearInternalPin();
|
||||
mAdapter.setPinLength(mPin.length());
|
||||
mAdapter.notifyItemChanged(mAdapter.getItemCount() - 1);
|
||||
|
||||
if (mMyDots != null) {
|
||||
mMyDots.updateDot(mPin.length());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isIndicatorDotsAttached() {
|
||||
return mMyDots != null;
|
||||
}
|
||||
|
||||
|
||||
public void setPinLength(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void attachIndicatorDots(MyDots mMyDots) {
|
||||
this.mMyDots = mMyDots;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
package com.tool.app.protectorpro.customerview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.InputFilter;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.tool.app.protectorpro.R;
|
||||
|
||||
public class MyPasswordInputView extends LinearLayout {
|
||||
|
||||
private EditText[] mEditTexts = new EditText[4];
|
||||
|
||||
public MyPasswordInputView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public MyPasswordInputView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public MyPasswordInputView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
LayoutInflater.from(context).inflate(R.layout.custom_password_input_view, this, true);
|
||||
mEditTexts[0] = findViewById(R.id.et1);
|
||||
mEditTexts[1] = findViewById(R.id.et2);
|
||||
mEditTexts[2] = findViewById(R.id.et3);
|
||||
mEditTexts[3] = findViewById(R.id.et4);
|
||||
setupEditTexts();
|
||||
}
|
||||
|
||||
private void setupEditTexts() {
|
||||
for (EditText editText : mEditTexts) {
|
||||
editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(1)});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void appendInput(String input) {
|
||||
String currentInput = getInput();
|
||||
String newInput = currentInput + input;
|
||||
|
||||
clearInput();
|
||||
|
||||
for (int i = 0; i < newInput.length() && i < mEditTexts.length; i++) {
|
||||
mEditTexts[i].setText(String.valueOf(newInput.charAt(i)));
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteLastInput() {
|
||||
for (int i = mEditTexts.length - 1; i >= 0; i--) {
|
||||
EditText editText = mEditTexts[i];
|
||||
if (editText.getText().length() > 0) {
|
||||
editText.setText("");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getInput() {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (EditText editText : mEditTexts) {
|
||||
stringBuilder.append(editText.getText().toString());
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
public void clearInput() {
|
||||
for (EditText editText : mEditTexts) {
|
||||
editText.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
// 新增一个方法来设置输入内容
|
||||
public void setInput(StringBuilder input) {
|
||||
clearInput();
|
||||
for (int i = 0; i < input.length() && i < mEditTexts.length; i++) {
|
||||
mEditTexts[i].setText(String.valueOf(input.charAt(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,134 @@
|
||||
package com.tool.app.protectorpro.listadapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.tool.app.protectorpro.R;
|
||||
import com.tool.app.protectorpro.mydb.DataApp;
|
||||
import com.tool.app.protectorpro.mydb.MyDataBase;
|
||||
import com.tool.app.protectorpro.tools.MyThread;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
public class AdapterAllApp extends RecyclerView.Adapter<AdapterAllApp.AppViewHolder> {
|
||||
|
||||
private List<DataApp> list = new ArrayList<>();
|
||||
private List<DataApp> filterList = new ArrayList<>();
|
||||
private Context mContext;
|
||||
private PackageManager packageManager;
|
||||
|
||||
public AdapterAllApp(Context context) {
|
||||
mContext = context;
|
||||
packageManager = context.getPackageManager();
|
||||
}
|
||||
|
||||
public void updateSyStemApp(List<DataApp> infoList) {
|
||||
list.clear();
|
||||
filterList.clear();
|
||||
if (infoList != null && !infoList.isEmpty()) {
|
||||
list.addAll(infoList);
|
||||
filterList.addAll(list);
|
||||
Log.d("AdapterAllApp", "List updated, size: " + list.size());
|
||||
} else {
|
||||
Log.d("AdapterAllApp", "Received empty or null list");
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void filter(String query) {
|
||||
filterList.clear();
|
||||
if (query.isEmpty()) {
|
||||
filterList.addAll(list);
|
||||
if (!list.isEmpty()) {
|
||||
Log.d("AdapterAllApp", "List size: " + list.size());
|
||||
Log.d("AdapterAllApp", "First item: " + list.get(0).getAppName());
|
||||
} else {
|
||||
Log.d("AdapterAllApp", "List is empty");
|
||||
}
|
||||
} else {
|
||||
for (DataApp item : list) {
|
||||
if (item.getAppName().toLowerCase().contains(query.toLowerCase())) {
|
||||
filterList.add(item);
|
||||
Log.d("AdapterAllApp", "Filtered item: " + item.getAppName());
|
||||
}
|
||||
}
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public AppViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
AppViewHolder appViewHolder = new AppViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_systapp, parent, false));
|
||||
return appViewHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull AppViewHolder holder, int position) {
|
||||
holder.switchCompat.setOnCheckedChangeListener(null);
|
||||
DataApp dataApp = filterList.get(position); // 使用filterList
|
||||
String appName = dataApp.getAppName();
|
||||
boolean lock = dataApp.isLock();
|
||||
holder.switchCompat.setChecked(lock);
|
||||
holder.switchCompat.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
|
||||
MyThread.runIO(() -> {
|
||||
dataApp.setLock(isChecked);
|
||||
MyDataBase.getInstance().getRoomDao().updateData(dataApp);
|
||||
});
|
||||
String format;
|
||||
if (isChecked) {
|
||||
format = String.format(mContext.getString(R.string.text_locked), appName);
|
||||
} else {
|
||||
format = String.format(mContext.getString(R.string.text_unlocked), appName);
|
||||
}
|
||||
Toast.makeText(mContext, format, Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
|
||||
try {
|
||||
Drawable appLogo = getLogo(dataApp.getPackageName());
|
||||
holder.imageView.setImageDrawable(appLogo);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
// Handle exception
|
||||
}
|
||||
|
||||
holder.textView.setText(appName);
|
||||
}
|
||||
|
||||
private Drawable getLogo(String packageName) throws PackageManager.NameNotFoundException {
|
||||
ApplicationInfo appInfo = packageManager.getApplicationInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES);
|
||||
return packageManager.getApplicationIcon(appInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return filterList.size(); // 使用filterList
|
||||
}
|
||||
|
||||
public static class AppViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private ImageView imageView;
|
||||
private TextView textView;
|
||||
private SwitchCompat switchCompat;
|
||||
|
||||
public AppViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
imageView = itemView.findViewById(R.id.logo);
|
||||
textView = itemView.findViewById(R.id.name);
|
||||
switchCompat = itemView.findViewById(R.id.app_switch);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,186 @@
|
||||
package com.tool.app.protectorpro.listadapter;
|
||||
|
||||
|
||||
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.tool.app.protectorpro.R;
|
||||
import com.tool.app.protectorpro.customerview.CustomBundle;
|
||||
import com.tool.app.protectorpro.customerview.CustomBundle;
|
||||
|
||||
public class AdapterLockView extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private static final int TYPE_NUMBER = 0;
|
||||
|
||||
private OnNumberClickListener mOnNumberListener;
|
||||
private OnDeleteClickListener mOnDeleteListener;
|
||||
|
||||
private static final int VIEW_TYPE_DELETE = 1;
|
||||
private CustomBundle mCustomBundle;
|
||||
private int mCurLength;
|
||||
|
||||
private int[] mKeyValues;
|
||||
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
RecyclerView.ViewHolder viewHolder;
|
||||
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
|
||||
|
||||
if (viewType == TYPE_NUMBER) {
|
||||
View view = inflater.inflate(R.layout.item_number, parent, false);
|
||||
viewHolder = new NumberViewHolder(view);
|
||||
} else {
|
||||
View view = inflater.inflate(R.layout.item_delete, parent, false);
|
||||
viewHolder = new DeleteViewHolder(view);
|
||||
}
|
||||
return viewHolder;
|
||||
}
|
||||
public AdapterLockView() {
|
||||
this.mKeyValues = getKeyValues(new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 0});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
||||
if (holder.getItemViewType() == TYPE_NUMBER) {
|
||||
NumberViewHolder vh1 = (NumberViewHolder) holder;
|
||||
setNumberBtn(vh1, position);
|
||||
}
|
||||
}
|
||||
|
||||
private void setNumberBtn(NumberViewHolder holder, int position) {
|
||||
if (holder != null) {
|
||||
if (position == 9) {
|
||||
holder.mNumberButton.setVisibility(View.GONE);
|
||||
} else {
|
||||
holder.mNumberButton.setText(String.valueOf(mKeyValues[position]));
|
||||
holder.mNumberButton.setVisibility(View.VISIBLE);
|
||||
holder.mNumberButton.setTag(mKeyValues[position]);
|
||||
}
|
||||
|
||||
if (mCustomBundle != null) {
|
||||
holder.mNumberButton.setTextColor(mCustomBundle.textColor);
|
||||
if (mCustomBundle.backgroundDrawable != null) {
|
||||
holder.mNumberButton.setBackground(mCustomBundle.backgroundDrawable);
|
||||
}
|
||||
holder.mNumberButton.setTextSize(TypedValue.COMPLEX_UNIT_PX,
|
||||
mCustomBundle.textSize);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
mCustomBundle.buttonSize,
|
||||
mCustomBundle.buttonSize);
|
||||
holder.mNumberButton.setLayoutParams(params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 12;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (position == getItemCount() - 1) {
|
||||
return VIEW_TYPE_DELETE;
|
||||
}
|
||||
return TYPE_NUMBER;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setPinLength(int pinLength) {
|
||||
this.mCurLength = pinLength;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private int[] getKeyValues(int[] keyValues) {
|
||||
int[] adjustedKeyValues = new int[keyValues.length + 1];
|
||||
for (int i = 0; i < keyValues.length; i++) {
|
||||
if (i < 9) {
|
||||
adjustedKeyValues[i] = keyValues[i];
|
||||
} else {
|
||||
adjustedKeyValues[i] = -1;
|
||||
adjustedKeyValues[i + 1] = keyValues[i];
|
||||
}
|
||||
}
|
||||
return adjustedKeyValues;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setOnItemClickListener(OnNumberClickListener onNumberClickListener) {
|
||||
this.mOnNumberListener = onNumberClickListener;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setOnDeleteClickListener(OnDeleteClickListener onDeleteClickListener) {
|
||||
this.mOnDeleteListener = onDeleteClickListener;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setCustomizationOptions(CustomBundle customBundle) {
|
||||
this.mCustomBundle = customBundle;
|
||||
}
|
||||
|
||||
public class NumberViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView mNumberButton;
|
||||
|
||||
public NumberViewHolder(final View itemView) {
|
||||
super(itemView);
|
||||
mNumberButton = (TextView) itemView.findViewById(R.id.deleteLayout);
|
||||
mNumberButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mOnNumberListener != null) {
|
||||
mOnNumberListener.onNumberClicked((Integer) v.getTag());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
public interface OnNumberClickListener {
|
||||
void onNumberClicked(int keyValue);
|
||||
}
|
||||
|
||||
public interface OnDeleteClickListener {
|
||||
void onDeleteClicked();
|
||||
}
|
||||
public class DeleteViewHolder extends RecyclerView.ViewHolder {
|
||||
LinearLayout mDeleteLayout;
|
||||
ImageView mDeleteImage;
|
||||
|
||||
public DeleteViewHolder(final View itemView) {
|
||||
super(itemView);
|
||||
mDeleteLayout = (LinearLayout) itemView.findViewById(R.id.deleteLayout);
|
||||
mDeleteImage = (ImageView) itemView.findViewById(R.id.deleteImage);
|
||||
|
||||
if (mCustomBundle.isShowDeleteButton() && mCurLength > 0) {
|
||||
mDeleteLayout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mOnDeleteListener != null) {
|
||||
mOnDeleteListener.onDeleteClicked();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.tool.app.protectorpro.listener
|
||||
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Delete
|
||||
import androidx.room.Insert
|
||||
import androidx.room.OnConflictStrategy
|
||||
import androidx.room.Query
|
||||
import androidx.room.Update
|
||||
import com.tool.app.protectorpro.mydb.DataApp
|
||||
|
||||
@Dao
|
||||
interface ListenerDao {
|
||||
@Delete
|
||||
fun deleteData(dataApp: DataApp)
|
||||
|
||||
@Query("select * from DataApp where packageName=:packName")
|
||||
fun findByPackName(packName: String): DataApp?
|
||||
|
||||
@Query("select * from DataApp where isSyStem=:system AND isRecommend = :recommend")
|
||||
fun findByType(system: Boolean, recommend: Boolean): List<DataApp>?
|
||||
|
||||
@Update
|
||||
fun updateData(dataApp: DataApp)
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.IGNORE)
|
||||
fun insertData(dataApp: DataApp)
|
||||
|
||||
@Query("select * from DataApp")
|
||||
fun findApp(): List<DataApp>?
|
||||
|
||||
@Query("select * from DataApp where isLock =:isLock")
|
||||
fun findByLock(isLock: Boolean): List<DataApp>?
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.tool.app.protectorpro.listener;
|
||||
|
||||
|
||||
public interface ListenerLock {
|
||||
|
||||
|
||||
void onInPutComplete(String pin);
|
||||
|
||||
void onNumberClickComplete(String keyValue);
|
||||
|
||||
void onKeyBordDelete( int pin);
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package com.tool.app.protectorpro.listener;
|
||||
|
||||
|
||||
public interface onPermssionListener {
|
||||
|
||||
void onToSetting();
|
||||
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
package com.tool.app.protectorpro.mydb;
|
||||
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.Index;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
import com.tool.app.protectorpro.MyApplication;
|
||||
|
||||
|
||||
@Entity(tableName = MyApplication.Table_Name,indices = {@Index(value = {"packageName"}, unique = true)})
|
||||
public class DataApp {
|
||||
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
private int id;
|
||||
private String packageName;
|
||||
|
||||
private String appName;
|
||||
|
||||
private boolean isLock = false;
|
||||
|
||||
private boolean isSyStem ;
|
||||
|
||||
private boolean isRecommend = false;
|
||||
|
||||
public boolean isRecommend() {
|
||||
return isRecommend;
|
||||
}
|
||||
|
||||
public void setRecommend(boolean recommend) {
|
||||
isRecommend = recommend;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setSyStem(boolean syStem) {
|
||||
isSyStem = syStem;
|
||||
}
|
||||
|
||||
public boolean isSyStem() {
|
||||
return isSyStem;
|
||||
}
|
||||
|
||||
|
||||
public void setAppName(String appName) {
|
||||
this.appName = appName;
|
||||
}
|
||||
|
||||
public void setLock(boolean lock) {
|
||||
isLock = lock;
|
||||
}
|
||||
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
|
||||
public String getAppName() {
|
||||
return appName;
|
||||
}
|
||||
|
||||
public String getPackageName() {
|
||||
return packageName;
|
||||
}
|
||||
|
||||
public boolean isLock() {
|
||||
return isLock;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.tool.app.protectorpro.mydb;
|
||||
|
||||
import androidx.room.Database;
|
||||
import androidx.room.Room;
|
||||
import androidx.room.RoomDatabase;
|
||||
|
||||
import com.tool.app.protectorpro.MyApplication;
|
||||
import com.tool.app.protectorpro.listener.ListenerDao;
|
||||
|
||||
@Database(
|
||||
entities = {DataApp.class},
|
||||
version = MyApplication.DB_Version,
|
||||
exportSchema = false
|
||||
)
|
||||
public abstract class MyDataBase extends RoomDatabase {
|
||||
|
||||
private static MyDataBase INSTANCE;
|
||||
|
||||
public static synchronized MyDataBase getInstance() {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = Room.databaseBuilder(MyApplication.appContext, MyDataBase.class, MyApplication.DB_Name).build();
|
||||
}
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public abstract ListenerDao getRoomDao();
|
||||
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
package com.tool.app.protectorpro.service;
|
||||
|
||||
import android.app.IntentService;
|
||||
import android.content.Intent;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.tool.app.protectorpro.mydb.DataApp;
|
||||
import com.tool.app.protectorpro.mydb.MyDataBase;
|
||||
import com.tool.app.protectorpro.tools.LockManager;
|
||||
import com.tool.app.protectorpro.tools.Common;
|
||||
import com.tool.app.protectorpro.tools.MyThread;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class LockService extends IntentService {
|
||||
|
||||
private String lastLockPackName = "";
|
||||
private LockManager instance;
|
||||
private Boolean checkTop = true;
|
||||
|
||||
@Override
|
||||
protected void onHandleIntent(@Nullable Intent intent) {
|
||||
instance = LockManager.getInstance(this);
|
||||
while (checkTop) {
|
||||
String packageName = Common.checkUsageStats(this);
|
||||
if(Objects.equals(packageName, "")){
|
||||
continue;
|
||||
}
|
||||
DataApp dataApp = MyDataBase.getInstance().getRoomDao().findByPackName(packageName);
|
||||
if(dataApp == null){
|
||||
MyThread.runUI(()->{
|
||||
instance.unLock();
|
||||
});
|
||||
lastLockPackName = packageName;
|
||||
|
||||
continue;
|
||||
}
|
||||
if(Objects.equals(packageName, lastLockPackName)){
|
||||
continue;
|
||||
}
|
||||
if (dataApp.isLock() ) {
|
||||
if(!Objects.equals(packageName, lastLockPackName)){
|
||||
MyThread.runUI(()->{
|
||||
instance.showLockView();
|
||||
});
|
||||
}else {
|
||||
}
|
||||
}else {
|
||||
|
||||
MyThread.runUI(()->{
|
||||
instance.unLock();
|
||||
});
|
||||
}
|
||||
lastLockPackName = packageName;
|
||||
}
|
||||
|
||||
}
|
||||
public LockService() {
|
||||
super("");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
219
app/src/main/java/com/tool/app/protectorpro/tools/Common.java
Normal file
@ -0,0 +1,219 @@
|
||||
package com.tool.app.protectorpro.tools;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AppOpsManager;
|
||||
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.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.ColorRes;
|
||||
import androidx.annotation.DimenRes;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.tool.app.protectorpro.mydb.DataApp;
|
||||
import com.tool.app.protectorpro.mydb.MyDataBase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Common {
|
||||
public static float getPx(Context context, @DimenRes int id) {
|
||||
return context.getResources().getDimension(id);
|
||||
}
|
||||
|
||||
private static void addDb(List<DataApp> list, boolean isSystem, boolean isUpdate) {
|
||||
// HashSet<Integer> randomIndex = getRandomIndex(list.size());
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
DataApp dataApp = list.get(i);
|
||||
dataApp.setSyStem(isSystem);
|
||||
if (isUpdate) {
|
||||
DataApp dataApp1 = MyDataBase.getInstance().getRoomDao().findByPackName(dataApp.getPackageName());
|
||||
if (dataApp1 == null) {
|
||||
MyDataBase.getInstance().getRoomDao().insertData(dataApp);
|
||||
|
||||
}
|
||||
} else {
|
||||
// boolean contains = randomIndex.contains(i);
|
||||
dataApp.setRecommend(false);
|
||||
MyDataBase.getInstance().getRoomDao().insertData(dataApp);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static List<DataApp> getAppList(Context context, boolean isUpdate) {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN, null);
|
||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
List<ResolveInfo> resolveInfos = packageManager.queryIntentActivities(intent, 0);
|
||||
|
||||
List<DataApp> systemAppList = new ArrayList<>();
|
||||
List<DataApp> threeAppList = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < resolveInfos.size(); i++) {
|
||||
ResolveInfo resolveInfo = resolveInfos.get(i);
|
||||
String packageName = resolveInfo.activityInfo.packageName;
|
||||
if (Objects.equals(packageName, context.getPackageName())) {
|
||||
continue;
|
||||
}
|
||||
ApplicationInfo appInfo;
|
||||
try {
|
||||
appInfo = packageManager.getApplicationInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES);
|
||||
String appName = packageManager.getApplicationLabel(appInfo).toString();
|
||||
|
||||
DataApp dataApp = new DataApp();
|
||||
dataApp.setPackageName(packageName);
|
||||
dataApp.setAppName(appName);
|
||||
boolean systemApp = checkSystemApp(context, packageName);
|
||||
if (systemApp) {
|
||||
systemAppList.add(dataApp);
|
||||
} else {
|
||||
threeAppList.add(dataApp);
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException nameNotFoundException) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
List<DataApp> uniqueSystemList = removeDuplApp(systemAppList);
|
||||
List<DataApp> uniqueThreeList = removeDuplApp(threeAppList);
|
||||
|
||||
|
||||
MyThread.runIO(() -> {
|
||||
addDb(uniqueSystemList, true, isUpdate);
|
||||
addDb(uniqueThreeList, false, isUpdate);
|
||||
|
||||
});
|
||||
|
||||
return uniqueThreeList;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static int getColor(Context context, @ColorRes int id) {
|
||||
return ContextCompat.getColor(context, id);
|
||||
}
|
||||
|
||||
|
||||
// private static HashSet<Integer> getRandomIndex(int size) {
|
||||
// Random random = new Random();
|
||||
// HashSet<Integer> uniqueNumbers = new HashSet<>();
|
||||
// while (uniqueNumbers.size() < 4) {
|
||||
// int randomNumber = random.nextInt(size + 1);
|
||||
// uniqueNumbers.add(randomNumber);
|
||||
// }
|
||||
// return uniqueNumbers;
|
||||
//
|
||||
// }
|
||||
|
||||
private static boolean checkSystemApp(Context context, String packageName) {
|
||||
|
||||
try {
|
||||
PackageInfo info = context.getPackageManager().getPackageInfo(packageName, PackageManager.GET_SIGNATURES);
|
||||
if ((info.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
|
||||
return true;
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static List<DataApp> removeDuplApp(List<DataApp> list) {
|
||||
HashMap<String, DataApp> hashMap = new HashMap<>();
|
||||
for (DataApp dataApp : list) {
|
||||
if (!hashMap.containsKey(dataApp.getPackageName())) {
|
||||
hashMap.put(dataApp.getPackageName(), dataApp);
|
||||
}
|
||||
}
|
||||
List<DataApp> data = new ArrayList<>();
|
||||
for (HashMap.Entry<String, DataApp> entry : hashMap.entrySet()) {
|
||||
data.add(entry.getValue());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
public static String checkUsageStats(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 Boolean delUnInstallApp(Context context, String packName) {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
try {
|
||||
packageManager.getApplicationInfo(packName, PackageManager.GET_UNINSTALLED_PACKAGES);
|
||||
return false;
|
||||
} catch (PackageManager.NameNotFoundException nameNotFoundException) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean checkPermission(Context context) {
|
||||
|
||||
// 检查当前应用是否具有 "android:get_usage_stats" 权限
|
||||
AppOpsManager appOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
|
||||
int mode = 0;
|
||||
mode = appOps.checkOpNoThrow("android:get_usage_stats", android.os.Process.myUid(), context.getPackageName());
|
||||
return mode == AppOpsManager.MODE_ALLOWED;
|
||||
}
|
||||
|
||||
public static void goDrawOverlays(Activity activity, int requestCode) {
|
||||
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
|
||||
|
||||
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);
|
||||
// intent.setData(Uri.parse("package:" + activity.getPackageName()));
|
||||
}
|
||||
activity.startActivityForResult(intent, requestCode);
|
||||
}
|
||||
|
||||
|
||||
public static void toSetUsagePermission(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 getCanDrawOverlays(Context context) {
|
||||
return Settings.canDrawOverlays(context);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,168 @@
|
||||
package com.tool.app.protectorpro.tools;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Point;
|
||||
import android.os.Build;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.tool.app.protectorpro.MyApplication;
|
||||
import com.tool.app.protectorpro.R;
|
||||
import com.tool.app.protectorpro.customerview.MyDots;
|
||||
import com.tool.app.protectorpro.listener.ListenerLock;
|
||||
import com.tool.app.protectorpro.customerview.MyLockView;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class LockManager {
|
||||
|
||||
private static LockManager lockManager;
|
||||
private Context mContext;
|
||||
|
||||
private View mView;
|
||||
|
||||
private WindowManager windowManager;
|
||||
|
||||
|
||||
private WindowManager.LayoutParams layoutParams;
|
||||
|
||||
private MyLockView lockView;
|
||||
|
||||
public LockManager(Context context) {
|
||||
mContext = context;
|
||||
mView = LayoutInflater.from(context).inflate(R.layout.float_view, null, false);
|
||||
windowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
|
||||
|
||||
|
||||
initView();
|
||||
|
||||
MyDots dots = mView.findViewById(R.id.indicator_dots);
|
||||
lockView = mView.findViewById(R.id.pin_lock_view);
|
||||
lockView.attachIndicatorDots(dots);
|
||||
lockView.setPinLockListener(new ListenerLock() {
|
||||
@Override
|
||||
public void onNumberClickComplete(String keyValue) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyBordDelete(int pin) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInPutComplete(String pin) {
|
||||
|
||||
String pwd = MyApplication.getPwd();
|
||||
if (Objects.equals(pin, pwd)) {
|
||||
unLock();
|
||||
} else {
|
||||
lockView.resetPinLockView();
|
||||
|
||||
// Toast.makeText(mContext,"Password error",Toast.LENGTH_SHORT).show();
|
||||
|
||||
// showCustomSnackbar(mView, "Password error", Color.argb(1, 224, 224, 224));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static LockManager getInstance(Context context) {
|
||||
if (lockManager == null) {
|
||||
lockManager = new LockManager(context);
|
||||
}
|
||||
return lockManager;
|
||||
|
||||
}
|
||||
|
||||
private void showCustomSnackbar(View view, String message, int backgroundColor) {
|
||||
Snackbar snackbar = Snackbar.make(view, "", Snackbar.LENGTH_LONG);
|
||||
|
||||
// 获取Snackbar的View
|
||||
View snackbarView = snackbar.getView();
|
||||
|
||||
// 获取Snackbar的父布局
|
||||
ViewGroup snackbarLayout = (ViewGroup) snackbarView.findViewById(com.google.android.material.R.id.snackbar_text).getParent();
|
||||
|
||||
// 移除默认的TextView
|
||||
snackbarLayout.removeAllViews();
|
||||
|
||||
// 自定义布局
|
||||
LayoutInflater inflater = LayoutInflater.from(view.getContext());
|
||||
View customView = inflater.inflate(R.layout.custom_float_snackbar, null);
|
||||
|
||||
// 设置背景颜色
|
||||
snackbarView.setBackgroundColor(backgroundColor);
|
||||
|
||||
// 设置描述文字
|
||||
TextView snackbarText = customView.findViewById(R.id.snackbar_text);
|
||||
snackbarText.setText(message);
|
||||
|
||||
// 将自定义布局添加到Snackbar的布局中
|
||||
snackbarLayout.addView(customView);
|
||||
|
||||
// 设置居中
|
||||
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) snackbarView.getLayoutParams();
|
||||
params.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||
snackbarView.setLayoutParams(params);
|
||||
|
||||
snackbar.show();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
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();
|
||||
windowManager.getDefaultDisplay().getMetrics(displayMetrics);
|
||||
layoutParams = new WindowManager.LayoutParams();
|
||||
layoutParams.type = type;
|
||||
layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
|
||||
layoutParams.format = PixelFormat.RGBA_8888;
|
||||
layoutParams.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;
|
||||
|
||||
layoutParams.gravity = Gravity.START | Gravity.TOP;
|
||||
|
||||
Point screenSize = new Point();
|
||||
windowManager.getDefaultDisplay().getRealSize(screenSize);
|
||||
layoutParams.width = screenSize.x;
|
||||
layoutParams.height = screenSize.y;
|
||||
}
|
||||
|
||||
|
||||
public void showLockView() {
|
||||
lockView.resetPinLockView();
|
||||
windowManager.addView(mView, layoutParams);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void unLock() {
|
||||
try {
|
||||
windowManager.removeView(mView);
|
||||
} catch (Exception exception) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.tool.app.protectorpro.tools;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class MyThread {
|
||||
|
||||
private static Handler mMainHandler;
|
||||
|
||||
private static ExecutorService executorService;
|
||||
|
||||
private static Handler getmMainHandler() {
|
||||
if (mMainHandler == null) {
|
||||
mMainHandler = new Handler(Looper.getMainLooper());
|
||||
}
|
||||
return mMainHandler;
|
||||
}
|
||||
public static void runIO(Runnable task) {
|
||||
getExecutorService().execute(task);
|
||||
}
|
||||
|
||||
private static ExecutorService getExecutorService() {
|
||||
if (executorService == null) {
|
||||
executorService = Executors.newSingleThreadExecutor();
|
||||
}
|
||||
return executorService;
|
||||
}
|
||||
|
||||
public static void runUI(Runnable task) {
|
||||
getmMainHandler().post(task);
|
||||
}
|
||||
}
|
||||
6
app/src/main/res/color/selector_text_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/color_f0582ef" android:state_selected="true"/>
|
||||
<item android:color="@color/color_white" android:state_selected="false"/>
|
||||
|
||||
</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="M538.3,198.6l-11.3,-11.3a16,16 0,0 0,-22.6 0L187.3,504.3a16,16 0,0 0,0 22.6L504.3,844a16,16 0,0 0,22.6 0l11.3,-11.3a16,16 0,0 0,0 -22.6l-294.4,-294.4 294.4,-294.4a16,16 0,0 0,0 -22.6z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
||||
7
app/src/main/res/drawable/bg_12_white.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>
|
||||
7
app/src/main/res/drawable/bg_30_green.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="30dp"/>
|
||||
<solid android:color="@color/color_green"/>
|
||||
|
||||
</shape>
|
||||
7
app/src/main/res/drawable/bg_36_4cd080.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="36dp"/>
|
||||
<solid android:color="@color/color_main"/>
|
||||
|
||||
</shape>
|
||||
7
app/src/main/res/drawable/bg_36_b1dbff.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="36dp" />
|
||||
<solid android:color="@color/color_main_en" />
|
||||
|
||||
</shape>
|
||||
7
app/src/main/res/drawable/bg_dia_step.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/bg_36_b1dbff" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/bg_36_4cd080" android:state_selected="false" />
|
||||
|
||||
</selector>
|
||||
7
app/src/main/res/drawable/bg_fragment.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">
|
||||
<solid android:color="@color/color_input" />
|
||||
<corners android:radius="25dp"/>
|
||||
|
||||
</shape>
|
||||
7
app/src/main/res/drawable/bg_sw.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="@mipmap/track_sw_green_ic" android:state_checked="true" />
|
||||
<item android:drawable="@mipmap/track_sw_white_ic" android:state_checked="false" />
|
||||
|
||||
</selector>
|
||||
7
app/src/main/res/drawable/bg_tab_lock.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="@mipmap/main_tab_lock_en" android:state_selected="true" />
|
||||
<item android:drawable="@mipmap/main_tab_lock_def" android:state_selected="false" />
|
||||
|
||||
</selector>
|
||||
7
app/src/main/res/drawable/bg_tab_sys.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="@mipmap/main_tab_sys_en" android:state_selected="true" />
|
||||
<item android:drawable="@mipmap/main_tab_sys_def" android:state_selected="false" />
|
||||
|
||||
</selector>
|
||||
7
app/src/main/res/drawable/bg_tab_three.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="@mipmap/main_tab_three_en" android:state_selected="true" />
|
||||
<item android:drawable="@mipmap/main_tab_three_def" android:state_selected="false" />
|
||||
|
||||
</selector>
|
||||
8
app/src/main/res/drawable/bottom_sheet_bg.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@android:color/white" />
|
||||
<corners
|
||||
android:topLeftRadius="40dp"
|
||||
android:topRightRadius="40dp" />
|
||||
|
||||
</shape>
|
||||
33
app/src/main/res/drawable/delete.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="25dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="25"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="@android:color/transparent"
|
||||
android:pathData="M8.41987,5C7.83602,5 7.28132,5.25513 6.90136,5.69842L2.61564,10.6984C1.97366,11.4474 1.97366,12.5526 2.61564,13.3016L6.90136,18.3016C7.28132,18.7449 7.83602,19 8.41987,19L19.5,19C20.6046,19 21.5,18.1046 21.5,17L21.5,7C21.5,5.89543 20.6046,5 19.5,5L8.41987,5Z"
|
||||
android:strokeColor="#292929"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round"/>
|
||||
|
||||
<path
|
||||
android:fillColor="@android:color/transparent"
|
||||
android:pathData="M15.5,10L11.5,14"
|
||||
android:strokeColor="#292929"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round"/>
|
||||
|
||||
<path
|
||||
android:fillColor="@android:color/transparent"
|
||||
android:pathData="M11.5,10L15.5,14"
|
||||
android:strokeColor="#292929"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round"/>
|
||||
|
||||
</vector>
|
||||
|
||||
|
||||
11
app/src/main/res/drawable/dia_choose.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z"/>
|
||||
</vector>
|
||||
13
app/src/main/res/drawable/main_pwd.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<group>
|
||||
<path
|
||||
android:pathData="M3 6H21M3 12H21M3 18H21"
|
||||
android:strokeColor="#3A3938"
|
||||
android:strokeWidth="2"
|
||||
/>
|
||||
</group>
|
||||
</vector>
|
||||
5
app/src/main/res/drawable/oval_black.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid android:color="@color/black" />
|
||||
</shape>
|
||||
5
app/src/main/res/drawable/oval_gray.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid android:color="@color/greyish" />
|
||||
</shape>
|
||||
5
app/src/main/res/drawable/oval_white.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?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" />
|
||||
</shape>
|
||||
7
app/src/main/res/drawable/pwd_bg.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="10dp"/>
|
||||
<solid android:color="@color/greyish"/>
|
||||
|
||||
</shape>
|
||||
7
app/src/main/res/drawable/tab_bg.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>
|
||||
16
app/src/main/res/drawable/thumb_sw.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:bottom="2dp"
|
||||
android:left="2dp"
|
||||
android:right="2dp"
|
||||
android:top="2dp">
|
||||
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="@color/white" />
|
||||
<size
|
||||
android:width="18dp"
|
||||
android:height="18dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
10
app/src/main/res/drawable/track_sw_green.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/color_green" />
|
||||
<corners android:radius="100dp" />
|
||||
<size
|
||||
android:width="36dp"
|
||||
android:height="22dp" />
|
||||
|
||||
</shape>
|
||||
10
app/src/main/res/drawable/track_sw_white.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/color_E5E5E5" />
|
||||
<corners android:radius="100dp" />
|
||||
<size
|
||||
android:width="36dp"
|
||||
android:height="22dp" />
|
||||
|
||||
</shape>
|
||||
BIN
app/src/main/res/font/inter.ttf
Normal file
41
app/src/main/res/layout/activity_complete.xml
Normal file
@ -0,0 +1,41 @@
|
||||
<?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:background="@color/color_home_bg"
|
||||
android:orientation="vertical"
|
||||
tools:context="com.tool.app.protectorpro.activity.ActivityComplete">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_back"
|
||||
android:layout_width="34dp"
|
||||
android:layout_height="34dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginTop="48dp"
|
||||
android:src="@drawable/back" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="150dp"
|
||||
android:src="@mipmap/logo" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginStart="25dp"
|
||||
android:layout_marginTop="17dp"
|
||||
android:layout_marginEnd="25dp"
|
||||
android:gravity="center"
|
||||
android:lineSpacingExtra="12dp"
|
||||
android:text="@string/text_success"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="23sp" />
|
||||
|
||||
</LinearLayout>
|
||||
76
app/src/main/res/layout/activity_main_layout.xml
Normal file
@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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/color_home_bg"
|
||||
android:orientation="vertical"
|
||||
tools:context="com.tool.app.protectorpro.activity.ActivityMain">
|
||||
|
||||
<androidx.appcompat.widget.SearchView
|
||||
android:id="@+id/search_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="25dp"
|
||||
android:layout_marginTop="45dp"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_set_pwd"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_alignTop="@id/search_item"
|
||||
android:layout_alignBottom="@id/search_item"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_gravity="center"
|
||||
android:paddingEnd="25dp"
|
||||
android:src="@drawable/main_pwd" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_app_tabname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/im_set_pwd"
|
||||
android:layout_marginStart="14dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/text_system"
|
||||
android:textColor="@color/color_ff3a3938"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/viewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/tab"
|
||||
android:layout_below="@id/tv_app_tabname"
|
||||
android:layout_marginStart="14dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="14dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@drawable/bg_fragment" />
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tab"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginTop="127dp"
|
||||
android:background="@drawable/bg_fragment"
|
||||
app:tabGravity="center"
|
||||
app:tabIndicatorHeight="0dp"
|
||||
app:tabMaxWidth="0dp"
|
||||
app:tabMode="fixed"
|
||||
app:tabPaddingBottom="0dp"
|
||||
app:tabPaddingEnd="0dp"
|
||||
app:tabPaddingStart="0dp"
|
||||
app:tabPaddingTop="0dp" />
|
||||
|
||||
|
||||
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</RelativeLayout>
|
||||
92
app/src/main/res/layout/activity_set_pwd.xml
Normal file
@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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/white"
|
||||
tools:context="com.tool.app.protectorpro.activity.ActivitySetPwd">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_back"
|
||||
android:layout_width="34dp"
|
||||
android:layout_height="34dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginTop="48dp"
|
||||
android:src="@drawable/back" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="103dp"
|
||||
android:src="@mipmap/logo" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_pass_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/im"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="38dp"
|
||||
android:text="@string/text_original_pwd"
|
||||
android:textColor="@color/color_ff3a3938"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_sub"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="10dp"
|
||||
android:layout_below="@id/tv_pass_name"
|
||||
android:layout_alignStart="@id/tv_pass_name"
|
||||
android:layout_alignEnd="@id/tv_pass_name"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="38dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/text_original_pwd_describe"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
android:visibility="invisible" />
|
||||
|
||||
|
||||
<com.tool.app.protectorpro.customerview.MyPasswordInputView
|
||||
android:id="@+id/layout_et"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tv_sub"
|
||||
android:gravity="center_horizontal"
|
||||
android:minHeight="40dp"
|
||||
android:orientation="horizontal" />
|
||||
|
||||
<com.tool.app.protectorpro.customerview.MyLockView
|
||||
android:id="@+id/lock_set_password"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/layout_et"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="38dp"
|
||||
app:keypadHorizontalSpacing="64dp"
|
||||
app:keypadShowDeleteButton="true"
|
||||
app:keypadTextColor="@color/black"
|
||||
app:keypadTextSize="36sp"
|
||||
app:keypadVerticalSpacing="24dp"
|
||||
app:pinLength="4" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_continue"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="63dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:background="@drawable/bg_36_4cd080"
|
||||
android:gravity="center"
|
||||
android:text="@string/text_continue"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
40
app/src/main/res/layout/activity_wel.xml
Normal file
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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"
|
||||
android:background="@color/color_home_bg"
|
||||
tools:context="com.tool.app.protectorpro.activity.ActivityWel">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_wel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="227dp"
|
||||
android:src="@mipmap/logo" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/im_wel"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:gravity="center"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/im_wel"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="100dp"
|
||||
android:indeterminateTint="@color/color_5aa2f1" />
|
||||
</RelativeLayout>
|
||||
23
app/src/main/res/layout/custom_float_snackbar.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?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:orientation="horizontal"
|
||||
android:padding="16dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/snackbar_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/float_snack_ic" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/snackbar_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="Your custom message"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
57
app/src/main/res/layout/custom_password_input_view.xml
Normal file
@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et1"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="42dp"
|
||||
android:background="@drawable/pwd_bg"
|
||||
android:fontFamily="@font/inter"
|
||||
android:gravity="center"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="number"
|
||||
android:maxLength="1"
|
||||
android:text=""
|
||||
android:textColor="@color/black"
|
||||
android:textSize="23sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et2"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="@drawable/pwd_bg"
|
||||
android:gravity="center"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="number"
|
||||
android:maxLength="1"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="23sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et3"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="@drawable/pwd_bg"
|
||||
android:gravity="center"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="number"
|
||||
android:maxLength="1"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="23sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et4"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="@drawable/pwd_bg"
|
||||
android:gravity="center"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="1"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="23sp" />
|
||||
|
||||
</merge>
|
||||
177
app/src/main/res/layout/dialog_permis.xml
Normal file
@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/dia_check"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/bg_12_white"
|
||||
android:paddingStart="32dp"
|
||||
android:paddingEnd="32dp"
|
||||
android:paddingBottom="12dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/search_item"
|
||||
android:layout_width="260dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="10dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:gravity="center"
|
||||
android:text="@string/text_dialog"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_step1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/search_item"
|
||||
android:layout_marginTop="52dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/ic_dia_step1" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="260dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:lineSpacingExtra="10dp"
|
||||
android:text="@string/text_dialog_step1_title"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="260dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/text_dialog_step1_text" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_step2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/ll_step1"
|
||||
android:layout_marginTop="32dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/ic_dia_step2" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="260dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:lineSpacingExtra="10dp"
|
||||
android:text="@string/text_dialog_step2_title"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="260dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/text_dialog_step2_text" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/ll_set1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="43dp"
|
||||
android:layout_below="@id/ll_step2"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginTop="40dp"
|
||||
android:background="@drawable/bg_dia_step"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_select"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_gravity="center"
|
||||
android:fontFamily="@font/inter"
|
||||
android:gravity="center|start"
|
||||
android:text="@string/text_select"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_set1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="10dp"
|
||||
|
||||
android:layout_toEndOf="@id/tv_select"
|
||||
android:src="@drawable/dia_choose" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/ll_set2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="43dp"
|
||||
android:layout_below="@id/ll_set1"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginTop="24dp"
|
||||
android:background="@drawable/bg_dia_step"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_go"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/bg_36_4cd080"
|
||||
android:fontFamily="@font/inter"
|
||||
android:gravity="center|start"
|
||||
android:text="@string/text_go"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_toEndOf="@id/tv_go"
|
||||
android:src="@drawable/dia_choose"
|
||||
android:visibility="invisible" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
56
app/src/main/res/layout/float_view.xml
Normal file
@ -0,0 +1,56 @@
|
||||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="85dp"
|
||||
android:layout_height="85dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="140dp"
|
||||
android:src="@mipmap/logo" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_password_tip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="14dp"
|
||||
android:layout_marginBottom="36dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/text_float_name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<com.tool.app.protectorpro.customerview.MyDots
|
||||
android:id="@+id/indicator_dots"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginBottom="22dp"
|
||||
android:gravity="center_vertical"
|
||||
app:dotDiameter="12dp"
|
||||
app:dotSpacing="20dp"
|
||||
app:indicatorType="fixed" />
|
||||
|
||||
<com.tool.app.protectorpro.customerview.MyLockView
|
||||
android:id="@+id/pin_lock_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="28dp"
|
||||
app:keypadHorizontalSpacing="64dp"
|
||||
app:keypadShowDeleteButton="true"
|
||||
app:keypadTextColor="@color/black"
|
||||
app:keypadTextSize="36sp"
|
||||
app:keypadVerticalSpacing="24dp"
|
||||
app:pinLength="4" />
|
||||
|
||||
</LinearLayout>
|
||||
14
app/src/main/res/layout/fragment_my.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?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="com.tool.app.protectorpro.activity.FragmentMy">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/list_app"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="10dp" />
|
||||
|
||||
</FrameLayout>
|
||||
20
app/src/main/res/layout/item_delete.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/deleteLayout"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/deleteImage"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/delete" />
|
||||
</LinearLayout>
|
||||
18
app/src/main/res/layout/item_number.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:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/deleteLayout"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:background="@drawable/oval_gray"
|
||||
android:fontFamily="@font/inter"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/color_keyboard_num" />
|
||||
|
||||
</LinearLayout>
|
||||
43
app/src/main/res/layout/item_systapp.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="17dp"
|
||||
android:paddingStart="28dp"
|
||||
android:paddingEnd="28dp">
|
||||
|
||||
<de.hdodenhof.circleimageview.CircleImageView
|
||||
android:id="@+id/logo"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/logo"
|
||||
android:layout_alignBottom="@id/logo"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_toEndOf="@id/logo"
|
||||
android:fontFamily="@font/inter"
|
||||
android:gravity="center"
|
||||
android:text="@string/app_name"
|
||||
|
||||
android:textColor="@color/color_ff3a3938"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/app_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:thumb="@drawable/bg_sw"
|
||||
app:track="@color/transparent" />
|
||||
|
||||
</RelativeLayout>
|
||||
95
app/src/main/res/layout/set_bottom_sheet_layout.xml
Normal file
@ -0,0 +1,95 @@
|
||||
<?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"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingEnd="16dp">
|
||||
|
||||
<!-- 标题部分 -->
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:fontFamily="@font/inter"
|
||||
android:gravity="center"
|
||||
android:text="@string/sheet_settings"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<!-- 关闭按钮 -->
|
||||
<ImageView
|
||||
android:id="@+id/ivClose"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_gravity="end"
|
||||
android:src="@mipmap/ic_close" />
|
||||
|
||||
<!-- 分隔线 -->
|
||||
<View
|
||||
android:id="@+id/view1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_below="@+id/tvTitle"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp" />
|
||||
|
||||
<!-- 按钮部分 -->
|
||||
<LinearLayout
|
||||
android:id="@+id/ll2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/view1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnOption1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/pwd_bg"
|
||||
android:drawableStart="@mipmap/ic_change"
|
||||
android:drawableEnd="@mipmap/ic_next"
|
||||
android:drawablePadding="20dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:gravity="start|center_vertical"
|
||||
android:paddingStart="30dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:text="@string/sheet_change_password"
|
||||
android:textColor="@color/black" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnOption2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/pwd_bg"
|
||||
android:drawableStart="@mipmap/ic_plaicy"
|
||||
android:drawableEnd="@mipmap/ic_next"
|
||||
android:drawablePadding="20dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:gravity="start|center_vertical"
|
||||
android:paddingStart="30dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:text="@string/sheet_privacy_policy"
|
||||
android:textColor="@color/black"
|
||||
android:visibility="invisible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/ll2"
|
||||
android:layout_marginTop="20dp" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
30
app/src/main/res/layout/tab_view.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<?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="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="14dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="14dp"
|
||||
android:paddingBottom="10dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_tab_icon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tabtext"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:text="@string/text_system"
|
||||
android:textColor="@color/selector_text_color"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
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/float_snack_ic.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_backspace.png
Normal file
|
After Width: | Height: | Size: 783 B |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_change.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_close.png
Normal file
|
After Width: | Height: | Size: 919 B |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_dia_step1.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_dia_step2.png
Normal file
|
After Width: | Height: | Size: 1.8 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 |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_next.png
Normal file
|
After Width: | Height: | Size: 743 B |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_plaicy.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/logo.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/main_tab_lock_def.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/main_tab_lock_en.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/main_tab_sys_def.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/main_tab_sys_en.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/main_tab_three_def.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/main_tab_three_en.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |