版本V1.0.0

This commit is contained in:
denghaina 2024-07-26 15:59:08 +08:00
commit 92f48dd2af
115 changed files with 3282 additions and 0 deletions

17
.gitignore vendored Normal file
View File

@ -0,0 +1,17 @@
*.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
.idea/
image.zip

1
app/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

BIN
app/SoftWare Lock.jks Normal file

Binary file not shown.

58
app/build.gradle.kts Normal file
View File

@ -0,0 +1,58 @@
plugins {
id("com.android.application")
id("kotlin-kapt")
id("org.jetbrains.kotlin.android")
}
android {
namespace = "com.example.applock"
compileSdk = 34
defaultConfig {
applicationId = "com.soft.ware.lock.hd"
minSdk = 23
targetSdk = 34
versionCode = 4
versionName = "1.0.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
dataBinding{
enable=true;
}
buildFeatures {
viewBinding = true
}
}
dependencies {
implementation(libs.appcompat)
implementation(libs.material)
implementation(libs.activity)
implementation(libs.constraintlayout)
implementation(libs.drawerlayout)
testImplementation(libs.junit)
androidTestImplementation(libs.ext.junit)
androidTestImplementation(libs.espresso.core)
implementation ("androidx.work:work-runtime:2.9.0")
implementation("androidx.room:room-ktx:2.6.1")
implementation("androidx.room:room-runtime:2.6.1")
kapt("androidx.room:room-compiler:2.6.1")
implementation ("androidx.work:work-runtime:2.9.0")
}

5
app/info Normal file
View File

@ -0,0 +1,5 @@
包名com.soft.ware.lock.hd
应用名SoftWare Lock
签名文件SoftWare Lock.jks
别名SoftWare Lockkey0
密码SoftWare Lock

21
app/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,21 @@
# 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

BIN
app/release/app-release.aab Normal file

Binary file not shown.

BIN
app/release/app-release.apk Normal file

Binary file not shown.

View File

@ -0,0 +1,20 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.soft.ware.lock.hd",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 4,
"versionName": "1.0.0",
"outputFile": "app-release.apk"
}
],
"elementType": "File"
}

Binary file not shown.

View File

@ -0,0 +1,26 @@
package com.example.applock;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.applock", appContext.getPackageName());
}
}

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission
android:name="android.permission.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions" />
<queries>
<intent>
<action android:name="android.intent.action.MAIN" />
</intent>
</queries>
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name=".application.SoftWareLockApplication"
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=".activity.KeyWordActivity"
android:screenOrientation="portrait"
android:exported="false" />
<activity
android:name=".activity.MainActivity"
android:exported="false"
android:screenOrientation="portrait">
</activity>
<activity
android:name=".activity.IntoActivity"
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".allmanager.MySoftWareLockService"/>
</application>
</manifest>

View File

@ -0,0 +1,92 @@
package com.example.applock.DrawView;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.applock.R;
import com.example.applock.click.ButtomKeyClick;
import com.example.applock.listener.InputKeyListener;
import com.example.applock.lockadapter.ButtomAdapter;
import com.example.applock.lockadapter.TopAdapter;
public class InPutKeyView extends FrameLayout {
private RecyclerView recyclerView_bottom;
private RecyclerView recyclerView_top;
private StringBuilder my_top_key;
private int keylength = 4;
private Context mycontext;
private InputKeyListener inputKeyListener;
private ButtomAdapter buttomAdapter;
private TopAdapter topAdapter;
public InPutKeyView(Context context) {
super(context);
initKeyBoard(context);
}
public InPutKeyView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
initKeyBoard(context);
}
public void setInputKeyListener(InputKeyListener inputKeyListener) {
this.inputKeyListener = inputKeyListener;
}
private void initKeyBoard(Context context) {
my_top_key = new StringBuilder();
mycontext = context;
View inflate = LayoutInflater.from(context).inflate(R.layout.key_input_view, null);
recyclerView_bottom = inflate.findViewById(R.id.recyclerView_bottom);
recyclerView_top = inflate.findViewById(R.id.recyclerView_top);
addView(inflate);
topAdapter = new TopAdapter();
recyclerView_top.setAdapter(topAdapter);
recyclerView_top.setLayoutManager(new LinearLayoutManager(mycontext,RecyclerView.HORIZONTAL,false));
buttomAdapter = new ButtomAdapter();
recyclerView_bottom.setAdapter(buttomAdapter);
recyclerView_bottom.setLayoutManager(new GridLayoutManager(mycontext,3));
buttomAdapter.setBottomKeyClick(new ButtomKeyClick() {
@Override
public void OnKeyClick(String bottomkey) {
if (my_top_key.length() >= keylength) {
my_top_key.delete(0, my_top_key.length());
}
my_top_key.append(bottomkey);
topAdapter.updateItem(my_top_key.toString());
if (my_top_key.length() == keylength) {
inputKeyListener.onInputComplete(my_top_key.toString());
}else {
inputKeyListener.onInputUnComplete(my_top_key.toString());
}
}
@Override
public void OnDelete() {
if (my_top_key.length() >= 1) {
my_top_key.deleteCharAt(my_top_key.length() - 1);
}
topAdapter.updateItem(my_top_key.toString());
if (my_top_key.length() < keylength) {
inputKeyListener.onInputUnComplete(my_top_key.toString());
}
}
});
}
public void clearTopKey(){
my_top_key.delete(0, my_top_key.length());
topAdapter.updateItem(my_top_key.toString());
}
}

View File

@ -0,0 +1,53 @@
package com.example.applock.activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import androidx.appcompat.app.AppCompatActivity;
import com.example.applock.R;
import com.example.applock.allmanager.Datamanager;
public class IntoActivity extends AppCompatActivity {
private CountDownTimer countDownTimer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_into);
countDownTimer = new CountDownTimer(1000,500) {
@Override
public void onTick(long millisUntilFinished) {
}
@Override
public void onFinish() {
intoActivity();
}
};
gocount();
}
private void gocount() {
countDownTimer.start();
}
public void intoActivity() {
String firstkey = Datamanager.getTopKey();
if (firstkey.isEmpty()) {
Intent intent = new Intent(IntoActivity.this, KeyWordActivity.class);
startActivity(intent);
} else {
startActivity(new Intent(IntoActivity.this, MainActivity.class));
}
finish();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
}

View File

@ -0,0 +1,151 @@
package com.example.applock.activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import com.example.applock.DrawView.InPutKeyView;
import com.example.applock.R;
import com.example.applock.allmanager.Datamanager;
import com.example.applock.listener.InputKeyListener;
import com.example.applock.value.MyAllValues;
import java.util.Objects;
public class KeyWordActivity extends AppCompatActivity {
private TextView text_key_btn;
private ImageView image_back;
private TextView text_page;
private String fistkey;
private InPutKeyView inPutKeyView;
private int MyKeyPage;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MyKeyPage = getIntent().getIntExtra(MyAllValues.PASS_KEY_WORD,0);
setContentView(R.layout.activity_key_word);
text_page = findViewById(R.id.text_page);
text_key_btn = findViewById(R.id.text_key_btn);
image_back = findViewById(R.id.image_back);
inPutKeyView = findViewById(R.id.input_view);
gotoKyePage();
}
private void gotoKyePage() {
if(MyKeyPage == 0){
image_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog alertDialog2 = new AlertDialog.Builder(KeyWordActivity.this)
.setTitle("Alert")
.setMessage(getString(R.string.alert_worn))
.setIcon(R.mipmap.logo)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {//添加"Yes"按钮
@Override
public void onClick(DialogInterface dialogInterface, int i) {
finish();
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {//添加取消
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
})
.create();
alertDialog2.show();
}
});
text_page.setText(getString(R.string.set_key));
text_key_btn.setText(getString(R.string.next));
image_back.setVisibility(View.VISIBLE);
text_key_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(KeyWordActivity.this, KeyWordActivity.class);
intent.putExtra(MyAllValues.PASS_KEY_WORD, 1);
intent.putExtra(MyAllValues.PASS_WORD_TOP_KEY, fistkey);
startActivity(intent);
}
});
}else if(MyKeyPage == 1) {
text_page.setText(getString(R.string.confirm));
text_key_btn.setText(getString(R.string.go_on));
image_back.setVisibility(View.VISIBLE);
String setPin = getIntent().getStringExtra(MyAllValues.PASS_WORD_TOP_KEY);
text_key_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (Objects.equals(setPin, fistkey)) {
Datamanager.setTopKey(fistkey);
Intent intent = new Intent(KeyWordActivity.this, MainActivity.class);
startActivity(intent);
finish();
} else {
Toast.makeText(KeyWordActivity.this, getString(R.string.set_key_file), Toast.LENGTH_SHORT).show();
inPutKeyView.clearTopKey();
text_key_btn.setVisibility(View.GONE);
}
}
});
image_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
} else if (MyKeyPage == 2) {
image_back.setVisibility(View.VISIBLE);
text_page.setText(getString(R.string.reset_my_key));
text_key_btn.setText(getString(R.string.next));
text_key_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
resetPin();
}
});
image_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
inPutKeyView.setInputKeyListener(new InputKeyListener() {
@Override
public void onInputComplete(String lockkey) {
text_key_btn.setVisibility(View.VISIBLE);
fistkey = lockkey;
}
@Override
public void onInputUnComplete(String lockkey) {
text_key_btn.setVisibility(View.GONE);
fistkey = lockkey;
}
});
}
private void resetPin(){
Datamanager.setTopKey(fistkey);
Toast.makeText(KeyWordActivity.this, getString(R.string.reset_success), Toast.LENGTH_SHORT).show();
finish();
}
}

View File

@ -0,0 +1,165 @@
package com.example.applock.activity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.activity.EdgeToEdge;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import androidx.work.WorkManager;
import com.example.applock.R;
import com.example.applock.allmanager.AppManager;
import com.example.applock.allmanager.SoftLockPermission;
import com.example.applock.allmanager.SoftWarePerssionDialog;
import com.example.applock.lockadapter.ViewPaperAdapter;
import com.example.applock.value.MyAllValues;
import com.google.android.material.tabs.TabLayout;
import com.example.applock.allmanager.MySoftWareLockService;
import com.example.applock.listener.PermissionBtnListener;
import java.util.ArrayList;
import java.util.List;
import com.example.applock.fragment.SoftWareLockFragment;
public class MainActivity extends AppCompatActivity implements PermissionBtnListener{
private TextView textview_softlock;
private TextView reset_key;
private TextView version;
private TextView text_version;
private ViewPager viewPager;
private TabLayout tabLayout;
private String[] tabTitle;
private ImageView image_setting;
private WorkManager workManager;
private RelativeLayout reset_key_lay;
private DrawerLayout main_draw;
private SoftWarePerssionDialog dialog;
@SuppressLint("MissingInflatedId")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
text_version = findViewById(R.id.text_version);
workManager = WorkManager.getInstance(this);
viewPager = findViewById(R.id.view_page_main);
main_draw = findViewById(R.id.main_draw);
tabLayout = findViewById(R.id.app_table);
image_setting = findViewById(R.id.image_set);
reset_key_lay = findViewById(R.id.reset_key_lay);
image_setting.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
main_draw.openDrawer(Gravity.RIGHT);
}
});
startService(new Intent(this,MySoftWareLockService.class));
initTableLayoutViewPaper();
getPermission();
reset_key_lay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
gotoReset();
}
});
String appVersions = AppManager.getAppVersions(this);
if (appVersions == null) {
text_version.setText("V1.0.0");
} else {
String format = String.format(getString(R.string.app_lock_version), appVersions);
text_version.setText(format);
}
}
private void gotoReset() {
Intent intent = new Intent(MainActivity.this, KeyWordActivity.class);
intent.putExtra(MyAllValues.PASS_KEY_WORD, 2);
startActivity(intent);
}
private void initTableLayoutViewPaper() {
tabTitle = new String[]{getString(R.string.unlocked), getString(R.string.locked)};
List<Fragment> fragmentList = new ArrayList<>();
fragmentList.add(SoftWareLockFragment.newInstancePage(false));
fragmentList.add(SoftWareLockFragment.newInstancePage(true));
ViewPaperAdapter viewPaperAdapter= new ViewPaperAdapter(getSupportFragmentManager(), fragmentList, tabTitle);
viewPager.setAdapter(viewPaperAdapter);
Log.d("-------","----tabtitle"+tabTitle);
tabLayout.setupWithViewPager(viewPager);
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
SoftWareLockFragment fragment = (SoftWareLockFragment) fragmentList.get(position);
fragment.refresh();
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
}
private void getPermission() {
boolean getUsagePermission = SoftLockPermission.isGetUsagePermission(this);
boolean overlays = SoftLockPermission.isOverlays(this);
if (getUsagePermission && overlays) {
} else {
if (dialog == null) {
dialog = new SoftWarePerssionDialog(this);
dialog.setPermissionBtnListener(this);
}
dialog.show(getSupportFragmentManager(), "");
}
}
@Override
public void onClickUsage() {
SoftLockPermission.requestUsage(this, MyAllValues.request_code_usage);
}
@Override
public void onClickOverlay() {
SoftLockPermission.requestOverlays(this, MyAllValues.request_code_overlay);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case MyAllValues.request_code_usage, MyAllValues.request_code_overlay:
hideDialog();
break;
}
}
private void hideDialog() {
if (SoftLockPermission.allAllowPermission(this)) {
if (dialog != null) {
dialog.dismiss();
}
}
}
}

View File

@ -0,0 +1,99 @@
package com.example.applock.allmanager;
import android.app.Service;
import android.app.usage.UsageEvents;
import android.app.usage.UsageStatsManager;
import android.content.Context;
import android.content.Entity;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.drawable.Drawable;
import android.media.tv.interactive.AppLinkInfo;
import android.os.Vibrator;
import android.text.TextUtils;
import android.util.ArraySet;
import com.example.applock.roombase.AppEntity;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
public class AppManager {
public static Set<AppEntity> QueryPhoneApp(Context context){
Set<AppEntity> applist = new ArraySet<>();
Intent intent = new Intent(Intent.ACTION_MAIN,null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
PackageManager packageManager = context.getPackageManager();
List<ResolveInfo> resolveInfolist = packageManager.queryIntentActivities(intent,PackageManager.MATCH_ALL);
for (ResolveInfo info : resolveInfolist){
String appPackageName = info.activityInfo.packageName;
if(appPackageName == context.getPackageName()){
continue;
}
AppEntity appEntity = new AppEntity();
appEntity.setApppackageName(appPackageName);
try {
ApplicationInfo applicationInfo = packageManager.getApplicationInfo(appPackageName,PackageManager.GET_UNINSTALLED_PACKAGES);
CharSequence applicationLabel = packageManager.getApplicationLabel(applicationInfo);//获取应用程序的名称
appEntity.setApplabel(applicationLabel.toString());
applist.add(appEntity);
} catch (PackageManager.NameNotFoundException e) {
throw new RuntimeException(e);
}
}
return applist;
}
public static String getAppVersions(Context context){
String appversions = "";
try {
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(),0);
appversions = ((PackageInfo)packageInfo).versionName;
} catch (PackageManager.NameNotFoundException e) {
throw new RuntimeException(e);
}
return appversions;
}
public static String getUsage(Context context) {
UsageStatsManager usageStatsManager = (UsageStatsManager) context.getSystemService(Context.USAGE_STATS_SERVICE);
long lastTime = System.currentTimeMillis();
long startTime = lastTime - 10000;
String result = "";
UsageEvents.Event event = new UsageEvents.Event();
UsageEvents usageEvents = usageStatsManager.queryEvents(startTime, lastTime);
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 void startVibrator(Context context) {
Vibrator vib = (Vibrator) context.getSystemService(Service.VIBRATOR_SERVICE);
vib.vibrate(400);
}
public static Drawable getIcon(Context context, String packageName) {
PackageManager packageManager = context.getPackageManager();
Drawable icon;
try {
icon = packageManager.getApplicationIcon(packageManager.getApplicationInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES));
} catch (PackageManager.NameNotFoundException e) {
return null;
}
return icon;
}
}

View File

@ -0,0 +1,46 @@
package com.example.applock.allmanager;
import android.content.Context;
import android.content.SharedPreferences;
import com.example.applock.value.MyAllValues;
public class Datamanager {
private static SharedPreferences sharedPreferences;
private static SharedPreferences.Editor shareditor;
public static void init(Context context){
if(sharedPreferences == null){
sharedPreferences = context.getSharedPreferences(MyAllValues.OWN_NAME,Context.MODE_PRIVATE);
}
if (shareditor == null){
shareditor = sharedPreferences.edit();
}
}
public static void setTopKey(String topKey){
shareditor.putString(MyAllValues.SP_TOP_KEY,topKey);
shareditor.apply();
}
public static String getTopKey(){
return sharedPreferences.getString(MyAllValues.SP_TOP_KEY,"");
}
public static void resetKeyCount() {
MyAllValues.OP_COUNT = 0;
shareditor.putInt(MyAllValues.SP_KEY_COUNT, MyAllValues.OP_COUNT);
shareditor.apply();
}
public static void setOpCount() {
MyAllValues.OP_COUNT = MyAllValues.OP_COUNT + 1;
shareditor.putInt(MyAllValues.SP_KEY_OP_COUNT, MyAllValues.OP_COUNT);
shareditor.apply();
}
public static void resetOpCount() {
MyAllValues.OP_COUNT = 0;
shareditor.putInt(MyAllValues.SP_KEY_OP_COUNT, MyAllValues.OP_COUNT);
shareditor.apply();
}
public static int getOpCount() {
return sharedPreferences.getInt(MyAllValues.SP_KEY_OP_COUNT, MyAllValues.OP_COUNT);
}
}

View File

@ -0,0 +1,94 @@
package com.example.applock.allmanager;
import android.content.Context;
import android.graphics.PixelFormat;
import android.os.Build;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Toast;
import com.example.applock.R;
import com.example.applock.databinding.LockActionViewBinding;
import com.example.applock.listener.InputKeyListener;
public class LockAction {
private Context context;
private LockActionViewBinding lockActionViewBinding;
private WindowManager manager;
private static LockAction lockAction;
private WindowManager.LayoutParams layParams;
public LockAction(Context context) {
this.context = context;
manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
lockActionViewBinding = LockActionViewBinding.inflate(LayoutInflater.from(context), null, false);
setLocation();
lockActionViewBinding.inputView.setInputKeyListener(new InputKeyListener() {
@Override
public void onInputComplete(String pin) {
String curPin = Datamanager.getTopKey();
if (curPin.equals(pin)) {
HideLockView();
} else {
Toast.makeText(context, context.getString(R.string.not_key), Toast.LENGTH_SHORT).show();
AppManager.startVibrator(context);
lockActionViewBinding.inputView.clearTopKey();
}
}
@Override
public void onInputUnComplete(String pin) {
}
});
}
private void setLocation() {
int type = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
} else {
type = WindowManager.LayoutParams.TYPE_PHONE;
}
DisplayMetrics displayMetrics = new DisplayMetrics();
manager.getDefaultDisplay().getMetrics(displayMetrics);
int flag = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_FULLSCREEN |
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS |
WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
layParams = new WindowManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, type, flag, PixelFormat.RGBA_8888);
}
public static LockAction getActionInstance(Context context) {
if (lockAction == null) {
lockAction = new LockAction(context);
}
return lockAction;
}
public void showLockView() {
lockActionViewBinding.inputView.clearTopKey();
if (lockActionViewBinding.getRoot().getWindowToken() == null) {
manager.addView(lockActionViewBinding.getRoot(), layParams);
}
}
public void HideLockView() {
if (lockActionViewBinding.getRoot().getWindowToken() != null) {
manager.removeView(lockActionViewBinding.getRoot());
}
}
}

View File

@ -0,0 +1,62 @@
package com.example.applock.allmanager;
import android.app.IntentService;
import android.content.Intent;
import android.util.Log;
import androidx.annotation.Nullable;
import com.example.applock.roombase.AppDataBase;
import com.example.applock.roombase.AppEntity;
import com.example.applock.roombase.SoftWareLockRoom;
import java.util.Objects;
public class MySoftWareLockService extends IntentService {
private String lastLockPackName = "";
private LockAction lockAction;
private Boolean isLock = true;
public MySoftWareLockService() {
super("name");
}
@Override
public void onDestroy() {
super.onDestroy();
}
@Override
protected void onHandleIntent(@Nullable Intent intent) {
lockAction = LockAction.getActionInstance(this);
while (isLock) {
String packageName = AppManager.getUsage(this);
if (Objects.equals(packageName, "")) {
continue;
}
AppEntity entityApp = AppDataBase.getDatabaseInstance().getAppEntityDao().queryByPagName(packageName);
if (entityApp == null) {
lockAction.HideLockView();
lastLockPackName = packageName;
continue;
}
if (Objects.equals(packageName, lastLockPackName)) {
continue;
}
if (entityApp.isApplocked()) {
if (!Objects.equals(packageName, lastLockPackName)) {
SoftWareLockRoom.onRunMain(() -> {
lockAction.showLockView();
});
} else {
}
} else {
SoftWareLockRoom.onRunMain(() -> {
lockAction.HideLockView();
});
}
lastLockPackName = packageName;
}
}
}

View File

@ -0,0 +1,59 @@
package com.example.applock.allmanager;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.core.app.JobIntentService;
import com.example.applock.roombase.AppDataBase;
import com.example.applock.roombase.AppEntity;
import com.example.applock.roombase.SoftWareLockRoom;
import java.util.Objects;
public class MyWorker extends JobIntentService {
private String lastLockPackName = "";
private LockAction lockAction;
private Boolean isTop = true;
public static void enqueueWork(Context context, Intent work) {
enqueueWork(context, MyWorker.class, 23, work);
}
@Override
protected void onHandleWork(@NonNull Intent intent) {
lockAction = LockAction.getActionInstance(this);
while (isTop) {
String packageName = AppManager.getUsage(this);
if (Objects.equals(packageName, "")) {
continue;
}
AppEntity entityApp = AppDataBase.getDatabaseInstance().getAppEntityDao().queryByPagName(packageName);
if (entityApp == null) {
lockAction.HideLockView();
lastLockPackName = packageName;
continue;
}
if (Objects.equals(packageName, lastLockPackName)) {
continue;
}
if (entityApp.isApplocked()) {
if (!Objects.equals(packageName, lastLockPackName)) {
SoftWareLockRoom.onRunMain(() -> {
lockAction.showLockView();
});
} else {
}
} else {
SoftWareLockRoom.onRunMain(() -> {
lockAction.HideLockView();
});
}
lastLockPackName = packageName;
}
}
}

View File

@ -0,0 +1,45 @@
package com.example.applock.allmanager;
import android.app.Activity;
import android.app.AppOpsManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.provider.Settings;
import android.widget.ImageView;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout;
public class SoftLockPermission {
public static boolean isGetUsagePermission(Context context) {
AppOpsManager opsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);//应用操作权限
int mode = opsManager.checkOpNoThrow("android:get_usage_stats", android.os.Process.myUid(), context.getPackageName());//检查是否有某项权限
return mode == AppOpsManager.MODE_ALLOWED;//允许访问铭感权限
}
public static void requestOverlays(Activity activity, int requestCode) {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + activity.getPackageName()));
activity.startActivityForResult(intent, requestCode);
}
public static void requestUsage(Activity context, int requestCode) {
Intent intent = new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS);
context.startActivityForResult(intent, requestCode);
}
public static boolean isOverlays(Context context) {
return Settings.canDrawOverlays(context);
}//打开悬浮窗权限
public static boolean allAllowPermission(Context context) {
boolean getUsagePermission = SoftLockPermission.isGetUsagePermission(context);
boolean overlays = SoftLockPermission.isOverlays(context);
return getUsagePermission && overlays;
}
}

View File

@ -0,0 +1,88 @@
package com.example.applock.allmanager;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import com.example.applock.R;
import com.example.applock.activity.MainActivity;
import com.example.applock.databinding.DialogPermissionBinding;
import com.example.applock.listener.PermissionBtnListener;
public class SoftWarePerssionDialog extends DialogFragment {
private DialogPermissionBinding dialogPermissionBinding;
private PermissionBtnListener permissionBtnListener;
private Context mContext;
public SoftWarePerssionDialog(Context context) {
mContext = context;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
dialogPermissionBinding = DialogPermissionBinding.inflate(inflater, null, false);
init();
return dialogPermissionBinding.getRoot();
}
public void setPermissionBtnListener(PermissionBtnListener permissionBtnListener) {
this.permissionBtnListener = permissionBtnListener;
}
@Override
public void onResume() {
super.onResume();
refreshBtnStatus(mContext);
}
public void refreshBtnStatus(Context context) {
boolean getUsagePermission = SoftLockPermission.isGetUsagePermission(context);
boolean isOverlay = SoftLockPermission.isOverlays(context);
dialogPermissionBinding.tvUsageButton.setSelected(getUsagePermission);
dialogPermissionBinding.tvOverlayButton.setSelected(isOverlay);
}
private void init() {
setCancelable(false);
Window window = getDialog().getWindow();
window.setBackgroundDrawableResource(R.color.nobackground);
window.getDecorView().setPadding(0, 0, 0, 0);
WindowManager.LayoutParams wlp = window.getAttributes();
wlp.gravity = Gravity.CENTER;
wlp.width = WindowManager.LayoutParams.MATCH_PARENT;
wlp.height = WindowManager.LayoutParams.WRAP_CONTENT;
window.setAttributes(wlp);
dialogPermissionBinding.tvUsageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!dialogPermissionBinding.tvUsageButton.isSelected()) {
permissionBtnListener.onClickUsage();
}
}
});
dialogPermissionBinding.tvOverlayButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!dialogPermissionBinding.tvOverlayButton.isSelected()) {
permissionBtnListener.onClickOverlay();
}
}
});
}
}

View File

@ -0,0 +1,66 @@
package com.example.applock.allmanager;
import android.content.Context;
import android.graphics.Typeface;
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.example.applock.databinding.DialogSuccessBinding;
import com.example.applock.listener.LockListener;
import com.example.applock.listener.PermissionBtnListener;
import com.example.applock.R;
import com.example.applock.listener.SwitchListener;
public class SuccessDialog extends DialogFragment {
private DialogSuccessBinding successBinding;
private Context mContext;
private String msg;
public SuccessDialog(Context context, String message) {
mContext = context;
msg = message;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
successBinding = DialogSuccessBinding.inflate(inflater, null, false);
init();
return successBinding.getRoot();
}
private void init() {
setCancelable(true);
Window window = getDialog().getWindow();
window.setBackgroundDrawableResource(R.color.nobackground);
window.getDecorView().setPadding(0, 0, 0, 0);
WindowManager.LayoutParams lockwin = window.getAttributes();
lockwin.gravity = Gravity.CENTER;
lockwin.width = WindowManager.LayoutParams.MATCH_PARENT;
lockwin.height = WindowManager.LayoutParams.WRAP_CONTENT;
window.setAttributes(lockwin);
successBinding.title.setText(msg);
successBinding.okBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
}
}

View File

@ -0,0 +1,31 @@
package com.example.applock.application;
import android.app.Application;
import android.content.Intent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.example.applock.allmanager.Datamanager;
import com.example.applock.roombase.AppEntity;
import com.example.applock.roombase.SoftWareLockRoom;
import com.example.applock.value.MyAllValues;
import com.example.applock.allmanager.AppManager;
import org.w3c.dom.Entity;
import java.util.Set;
public class SoftWareLockApplication extends Application {
public static boolean isPass = false;
@Override
public void onCreate() {
super.onCreate();
MyAllValues.softWareLockApplication = this;
isPass = true;
Datamanager.init(this);
Datamanager.resetKeyCount();
Set<AppEntity> entityApps = AppManager.QueryPhoneApp(this);
SoftWareLockRoom.insertRoom(entityApps);
}
}

View File

@ -0,0 +1,6 @@
package com.example.applock.click;
public interface ButtomKeyClick {
void OnKeyClick(String bottomkey);
void OnDelete();
}

View File

@ -0,0 +1,92 @@
package com.example.applock.fragment;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Bundle;
import androidx.annotation.LongDef;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleEventObserver;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.applock.R;
import com.example.applock.allmanager.SuccessDialog;
import com.example.applock.listener.LockListener;
import com.example.applock.listener.SwitchListener;
import com.example.applock.lockadapter.SoftWareAdapter;
import com.example.applock.value.MyAllValues;
import com.example.applock.viewmodel.SoftWareLockVM;
import org.jetbrains.annotations.NotNull;
public class SoftWareLockFragment extends Fragment {
private SoftWareLockVM mViewModel;
private RecyclerView recyclerView;
private SoftWareAdapter softAdapter;
private boolean isLocked;
private SuccessDialog successDialog;
public static SoftWareLockFragment newInstancePage(boolean locked) {
SoftWareLockFragment softWareLockFragment = new SoftWareLockFragment();
Bundle bundle = new Bundle();
bundle.putBoolean(MyAllValues.FRAGMENT_TYPE,locked);
softWareLockFragment.setArguments(bundle);
return softWareLockFragment;
}
@SuppressLint("MissingInflatedId")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_soft_ware_lock, container, false);
recyclerView = view.findViewById(R.id.recyclerView_apps);
return view;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mViewModel = new ViewModelProvider(this).get(SoftWareLockVM.class);
Bundle arguments = getArguments();
if (arguments != null)
isLocked = getArguments().getBoolean(MyAllValues.FRAGMENT_TYPE);
mViewModel.UpDataAppLock(isLocked);
initAppRecycle();
mViewModel.getMutableLiveDataApp().observe(requireActivity(), list -> {
softAdapter.setEntityApps(list);
});
}
public void refresh() {
mViewModel.UpDataAppLock(isLocked);
}
private void initAppRecycle() {
softAdapter = new SoftWareAdapter(requireContext(), isLocked);
softAdapter.setLockListener(new LockListener() {
@Override
public void onSwitch(String msg) {
successDialog = new SuccessDialog(requireContext(),msg);
successDialog.show(getChildFragmentManager(), "");
}
});
recyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
recyclerView.setAdapter(softAdapter);
}
}

View File

@ -0,0 +1,7 @@
package com.example.applock.listener;
public interface InputKeyListener {
void onInputComplete(String lockkey);
void onInputUnComplete(String lockkey);
}

View File

@ -0,0 +1,6 @@
package com.example.applock.listener;
public interface LockListener {
void onSwitch(String msg);
}

View File

@ -0,0 +1,8 @@
package com.example.applock.listener;
public interface PermissionBtnListener {
void onClickUsage();
void onClickOverlay();
}

View File

@ -0,0 +1,10 @@
package com.example.applock.listener;
import com.example.applock.roombase.AppEntity;
import java.util.List;
public interface QuerySoftListener {
void QueryResult(List<AppEntity> list);
}

View File

@ -0,0 +1,5 @@
package com.example.applock.listener;
public interface SwitchListener {
boolean onSwitchisLock(boolean lock);
}

View File

@ -0,0 +1,71 @@
package com.example.applock.lockadapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.applock.click.ButtomKeyClick;
import com.example.applock.databinding.ButtomKeyViewBinding;
import java.util.Objects;
public class ButtomAdapter extends RecyclerView.Adapter<ButtomAdapter.ButtomViewHolder> {
private ButtomKeyClick buttomKeyClick;
public void setBottomKeyClick(ButtomKeyClick buttomKeyClick){
this.buttomKeyClick = buttomKeyClick;
}
private String[] bottomkeys = new String[]{"1","2","3","4","5","6","7","8","9","-10","0","-12"};
public static class ButtomViewHolder extends RecyclerView.ViewHolder{
private ButtomKeyViewBinding buttomKeyViewBinding;
public ButtomViewHolder(ButtomKeyViewBinding buttomBinding) {
super(buttomBinding.getRoot());
buttomKeyViewBinding = buttomBinding;
}
}
@NonNull
@Override
public ButtomViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
ButtomKeyViewBinding buttomKeyViewBinding = ButtomKeyViewBinding.inflate(LayoutInflater.from(parent.getContext()),parent,false);
return new ButtomViewHolder(buttomKeyViewBinding);
}
@Override
public void onBindViewHolder(@NonNull ButtomViewHolder holder, int position) {
String bottomkey = bottomkeys[position];
if(position == 9&& Objects.equals(bottomkey, "-10")){
holder.buttomKeyViewBinding.bottomKeyLinear.setVisibility(View.GONE);
}else if (position == 11){
holder.buttomKeyViewBinding.bottomKeyLinear.setVisibility(View.VISIBLE);
holder.buttomKeyViewBinding.textKeyNumber.setVisibility(View.GONE);
holder.buttomKeyViewBinding.imageDelete.setVisibility(View.VISIBLE);
}else {
holder.buttomKeyViewBinding.bottomKeyLinear.setVisibility(View.VISIBLE);
holder.buttomKeyViewBinding.textKeyNumber.setText(bottomkeys[position]);
holder.buttomKeyViewBinding.imageDelete.setVisibility(View.GONE);
}
holder.buttomKeyViewBinding.textKeyNumber.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
buttomKeyClick.OnKeyClick(bottomkey);
}
});
holder.buttomKeyViewBinding.imageDelete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
buttomKeyClick.OnDelete();
}
});
}
@Override
public int getItemCount() {
return bottomkeys.length;
}
}

View File

@ -0,0 +1,142 @@
package com.example.applock.lockadapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.RecyclerView;
import com.example.applock.activity.KeyWordActivity;
import com.example.applock.allmanager.AppManager;
import com.example.applock.allmanager.Datamanager;
import com.example.applock.databinding.ItemAppBinding;
import com.example.applock.listener.InputKeyListener;
import com.example.applock.listener.LockListener;
import com.example.applock.listener.SwitchListener;
import com.example.applock.roombase.AppEntity;
import com.example.applock.roombase.SoftWareLockRoom;
import java.util.ArrayList;
import java.util.List;
import com.example.applock.R;
public class SoftWareAdapter extends RecyclerView.Adapter<SoftWareAdapter.SoftWareViewHolder> {
private List<AppEntity> entityApp1 = new ArrayList<>();
private Context mCon;
private boolean mLockList;
private boolean lock;
private LockListener lockListener;
private SwitchListener switchListener;
public SoftWareAdapter(Context context, boolean lock) {
this.mCon = context;
this.mLockList = lock;
}
public void setLockListener(LockListener lockListener) {
this.lockListener = lockListener;
}
public void setSwitchListener(SwitchListener switchListener){
this.switchListener = switchListener;
}
@NonNull
@Override
public SoftWareViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
ItemAppBinding itemAppBinding = ItemAppBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
return new SoftWareViewHolder(itemAppBinding);
}
@Override
public void onBindViewHolder(@NonNull SoftWareViewHolder holder, @SuppressLint("RecyclerView") int position) {
AppEntity entityApp = entityApp1.get(position);
String label = entityApp.getApplabel();
holder.itemAppBinding.appLabel.setText(label);
Drawable icon = AppManager.getIcon(mCon, entityApp.getApppackageName());
if (icon != null) {
holder.itemAppBinding.appLogo.setImageDrawable(icon);
}
holder.itemAppBinding.appLocked.setSelected(entityApp.isApplocked());
holder.itemAppBinding.appLocked.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Datamanager.setOpCount();
AlertDialog alertDialog2 = new AlertDialog.Builder(mCon)
.setTitle("Prompt")
.setMessage("Are you sure "+label+"?")
.setIcon(R.mipmap.intologo)
.setPositiveButton("Sure", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
boolean selected = holder.itemAppBinding.appLocked.isSelected();
holder.itemAppBinding.appLocked.setSelected(!selected);
boolean selectedNew = holder.itemAppBinding.appLocked.isSelected();
entityApp.setApplocked(selectedNew);
SoftWareLockRoom.updateRoom(entityApp);
String name2;
if (selectedNew) {
if (!mLockList) {
entityApp1.remove(entityApp);
notifyItemRemoved(position);
}else {
}
name2 = String.format(mCon.getString(R.string.lock_app), label);
setbacklistener(name2);
} else {
name2 = String.format(mCon.getString(R.string.unlock_app), label);
setbacklistener(name2);
if (mLockList) {
entityApp1.remove(entityApp);
notifyItemRemoved(position);
}
}
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
//holder.itemAppBinding.appLocked.setSelected(!selected);
}
})
.create();
alertDialog2.show();
}
});
}
private void setbacklistener(String softname) {
if(lockListener!= null){
lockListener.onSwitch(softname);
}
}
@Override
public int getItemCount() {
return entityApp1.size();
}
public void setEntityApps(List<AppEntity> apps) {
entityApp1 = apps;
notifyDataSetChanged();
}
static class SoftWareViewHolder extends RecyclerView.ViewHolder {
private ItemAppBinding itemAppBinding;
public SoftWareViewHolder(@NonNull ItemAppBinding itemView) {
super(itemView.getRoot());
itemAppBinding = itemView;
}
}
}

View File

@ -0,0 +1,55 @@
package com.example.applock.lockadapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.applock.databinding.TopKeyViewBinding;
public class TopAdapter extends RecyclerView.Adapter<TopAdapter.TopViewHolder> {
private String mytopkey = "";
@NonNull
@Override
public TopViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
TopKeyViewBinding topKeyViewBinding = TopKeyViewBinding.inflate(LayoutInflater.from(parent.getContext()),parent,false);
return new TopViewHolder(topKeyViewBinding);
}
@Override
public void onBindViewHolder(@NonNull TopViewHolder holder, int position) {
if(position ==0){
holder.topKeyViewBinding.topView.setVisibility(View.GONE);
}else {
holder.topKeyViewBinding.topView.setVisibility(View.VISIBLE);
holder.topKeyViewBinding.topImageKey.setVisibility(View.VISIBLE);
}
if(position > mytopkey.length()-1){
holder.topKeyViewBinding.topImageKey.setSelected(true);
}else {
holder.topKeyViewBinding.topImageKey.setSelected(false);
}
}
public void updateItem(String pin) {
mytopkey = pin;
notifyDataSetChanged();
}
@Override
public int getItemCount() {
return 4;
}
public class TopViewHolder extends RecyclerView.ViewHolder{
private TopKeyViewBinding topKeyViewBinding;
public TopViewHolder(@NonNull TopKeyViewBinding topKeyBinding){
super(topKeyBinding.getRoot());
topKeyViewBinding = topKeyBinding;
}
}
}

View File

@ -0,0 +1,38 @@
package com.example.applock.lockadapter;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import java.util.List;
public class ViewPaperAdapter extends FragmentPagerAdapter {
private List<Fragment> fmlist;
private String[] tabtitle;
public ViewPaperAdapter(FragmentManager supportFragmentManager, List<Fragment> fragmentList, String[] tabTitle) {
super(supportFragmentManager);
fmlist = fragmentList;
tabtitle = tabTitle;
}
@NonNull
@Override
public Fragment getItem(int position) {
return fmlist.get(position);
}
@Override
public int getCount() {
return fmlist.size();
}
@Nullable
@Override
public CharSequence getPageTitle(int position) {
return tabtitle[position];
}
}

View File

@ -0,0 +1,24 @@
package com.example.applock.roombase;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;
import com.example.applock.value.MyAllValues;
@Database(
entities = {AppEntity.class},
version = MyAllValues.DBVersion,
exportSchema = false
)
public abstract class AppDataBase extends RoomDatabase {
private static AppDataBase appDataBaseInstance;
public abstract AppEntityDao getAppEntityDao();
public static synchronized AppDataBase getDatabaseInstance(){
if(appDataBaseInstance == null){
appDataBaseInstance = Room.databaseBuilder(MyAllValues.softWareLockApplication,AppDataBase.class,MyAllValues.DBName).build();
}
return appDataBaseInstance;
}
}

View File

@ -0,0 +1,51 @@
package com.example.applock.roombase;
import androidx.room.Entity;
import androidx.room.Index;
import androidx.room.PrimaryKey;
import com.example.applock.value.MyAllValues;
@Entity(tableName = MyAllValues.APP_TABLE_NAME,indices = {@Index(value = {"apppackageName"}, unique = true)})
public class AppEntity {
@PrimaryKey(autoGenerate = true)
private int appid;
private String apppackageName;
private String applabel;
private boolean applocked;
public int getAppid() {
return appid;
}
public void setAppid(int appid) {
this.appid = appid;
}
public String getApppackageName() {
return apppackageName;
}
public void setApppackageName(String apppackageName) {
this.apppackageName = apppackageName;
}
public String getApplabel() {
return applabel;
}
public void setApplabel(String applabel) {
this.applabel = applabel;
}
public boolean isApplocked() {
return applocked;
}
public void setApplocked(boolean applocked) {
this.applocked = applocked;
}
}

View File

@ -0,0 +1,25 @@
package com.example.applock.roombase;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;
import java.util.List;
@Dao
public interface AppEntityDao {
@Query("select * from app_table_name where apppackageName=:apppackageName")
AppEntity queryByPagName(String apppackageName);
@Update
void updateData(AppEntity entityApp);
@Insert(onConflict = OnConflictStrategy.IGNORE)
void insertData(AppEntity entityApp);
@Query("select * from app_table_name where applocked=:isLock")
List<AppEntity> queryApp(boolean isLock);
}

View File

@ -0,0 +1,66 @@
package com.example.applock.roombase;
import android.os.Handler;
import android.os.Looper;
import com.example.applock.listener.QuerySoftListener;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class SoftWareLockRoom {
private static ExecutorService myUIServicePool;
private static Handler myHandler;
private static ExecutorService getMyUIServicePool(){
if (myUIServicePool == null){
myUIServicePool = Executors.newSingleThreadExecutor();
}
return myUIServicePool;
}
private static Handler getMyHandler() {
if (myHandler == null) {
myHandler = new Handler(Looper.getMainLooper());
}
return myHandler;
}
public static void QuerySoftRoom(boolean islock, QuerySoftListener listener){
getMyUIServicePool().execute(new Runnable() {
@Override
public void run() {
List<AppEntity> applist = AppDataBase.getDatabaseInstance().getAppEntityDao().queryApp(islock);
getMyHandler().post(()->{
listener.QueryResult(applist);
});
}
});
}
public static void insertRoom(Set<AppEntity> list) {
getMyUIServicePool().execute(new Runnable() {
@Override
public void run() {
for (AppEntity entityApp : list) {
AppDataBase.getDatabaseInstance().getAppEntityDao().insertData(entityApp);
}
}
});
}
public static void onRunMain(Runnable runnable){
getMyHandler().post(runnable);
}
public static void updateRoom(AppEntity entityApp) {
getMyUIServicePool().execute(new Runnable() {
@Override
public void run() {
AppDataBase.getDatabaseInstance().getAppEntityDao().updateData(entityApp);
}
});
}
}

View File

@ -0,0 +1,23 @@
package com.example.applock.value;
import com.example.applock.application.SoftWareLockApplication;
public class MyAllValues {
public static final String OWN_NAME = "own_name";
public static final String DBName = "app_room";
public static final int DBVersion=1;
public static String SP_TOP_KEY = "sp_top_key";
public static SoftWareLockApplication softWareLockApplication;
public static int OP_COUNT = 0;
public static String SP_KEY_OP_COUNT = "sp_key_op_count";
public static String SP_KEY_COUNT = "sp_key_count";
public static final String APP_TABLE_NAME = "app_table_name";
public static String PASS_KEY_WORD = "pass_key_word";
public static String PASS_WORD_TOP_KEY ="pass_word_top_key";
public static String FRAGMENT_TYPE = "fragment_type";
public static final int request_code_usage = 1;
public static final int request_code_overlay = 2;
public static String SELECTED = "selected";
public static String SELECTEDNEW = "selectednew";
}

View File

@ -0,0 +1,29 @@
package com.example.applock.viewmodel;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.example.applock.listener.QuerySoftListener;
import com.example.applock.roombase.AppEntity;
import com.example.applock.roombase.SoftWareLockRoom;
import java.util.List;
public class SoftWareLockVM extends ViewModel {
private MutableLiveData<List<AppEntity>> mutableLiveDataApp = new MutableLiveData<>();
public MutableLiveData<List<AppEntity>> getMutableLiveDataApp() {
return mutableLiveDataApp;
}
public void UpDataAppLock(boolean lock){
SoftWareLockRoom.QuerySoftRoom(lock, new QuerySoftListener() {
@Override
public void QueryResult(List<AppEntity> list) {
mutableLiveDataApp.setValue(list);
}
});
}
}

View 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>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/text"/>
</shape>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#FFffffff"
android:pathData="M431.5,1024c-12.8,0 -25.6,-4.9 -35.3,-14.6 -19.5,-19.5 -19.5,-51.2 0,-70.7l426.7,-426.7L396.2,85.3c-19.5,-19.5 -19.5,-51.2 0,-70.7 19.5,-19.5 51.2,-19.5 70.7,0L928.9,476.7c19.5,19.5 19.5,51.2 0,70.7l-462,462c-9.8,9.8 -22.6,14.6 -35.3,14.6z"/>
</vector>

View File

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

View 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>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M395.2,513.6l323.1,-312.4c19.1,-18.4 19.1,-48.3 0,-66.7 -19.1,-18.4 -49.9,-18.4 -69,0L291.8,480.3c-19.1,18.4 -19.1,48.3 0,66.7l357.6,345.7c9.5,9.2 22,13.8 34.5,13.8 12.5,0 25,-4.6 34.5,-13.8 19.1,-18.4 19.1,-48.2 0,-66.7L395.2,513.6z"
android:fillColor="@color/black"/>
</vector>

View File

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M768,416h-32v-96c0,-59.6 -23.4,-115.8 -65.8,-158.2S571.6,96 512,96s-115.8,23.4 -158.2,65.8S288,260.4 288,320v96h-32c-70.4,0 -128,57.6 -128,128v256c0,70.4 57.6,128 128,128h512c70.4,0 128,-57.6 128,-128L896,544c0,-70.4 -57.6,-128 -128,-128zM352,320c0,-42.5 16.7,-82.6 47,-113s70.4,-47 113,-47 82.6,16.7 113,47 47,70.4 47,113v96L352,416v-96zM832,800c0,17 -6.7,33 -18.9,45.1S785,864 768,864L256,864c-17,0 -33,-6.7 -45.1,-18.9S192,817 192,800L192,544c0,-17 6.7,-33 18.9,-45.1S239,480 256,480h512c17,0 33,6.7 45.1,18.9S832,527 832,544v256z"
android:fillColor="@color/text"/>
<path
android:pathData="M512,576c-26.5,0 -48,21.5 -48,48 0,14.2 6.2,27 16,35.8V736c0,17.6 14.4,32 32,32s32,-14.4 32,-32v-76.2c9.8,-8.8 16,-21.6 16,-35.8 0,-26.5 -21.5,-48 -48,-48z"
android:fillColor="@color/text"/>
</vector>

View 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/lock_main"/>
</shape>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/lock_main" />
<corners android:radius="10dp" />
</shape>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#6E6868" />
<corners android:radius="10dp" />
</shape>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@drawable/lock"/>
<item android:drawable="@drawable/unlock"/>
</selector>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@drawable/permssion_selected"/>
<item android:drawable="@drawable/permssion_normal"/>
</selector>

View 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="15dp"/>
<solid android:color="@color/lock_main"/>
</shape>

View 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/text"/>
</shape>

View 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/top_image_key_prassed" android:state_selected="false" />
<item android:drawable="@drawable/top_image_key_current" />
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke android:width="1dp" android:color="@color/black"/>
<solid android:color="#00000000"/>
<size
android:width="20dp"
android:height="20dp" />
</shape>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/lock_main"/>
<size
android:width="35dp"
android:height="35dp"/>
</shape>

View File

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M768,416L352,416v-96c0,-42.5 16.7,-82.6 47,-113s70.4,-47 113,-47c37.9,0 74.7,13.6 103.6,38.4 28.7,24.5 47.9,58.2 54.1,95 3,17.4 19.5,29.2 36.9,26.2s29.2,-19.5 26.2,-36.9c-8.7,-51.5 -35.6,-98.7 -75.7,-132.9C616.7,115.1 565.1,96 512,96c-59.6,0 -115.8,23.4 -158.2,65.8S288,260.4 288,320v96h-32c-70.4,0 -128,57.6 -128,128v256c0,70.4 57.6,128 128,128h512c70.4,0 128,-57.6 128,-128L896,544c0,-70.4 -57.6,-128 -128,-128zM832,800c0,17 -6.7,33 -18.9,45.1S785,864 768,864L256,864c-17,0 -33,-6.7 -45.1,-18.9S192,817 192,800L192,544c0,-17 6.7,-33 18.9,-45.1S239,480 256,480h512c17,0 33,6.7 45.1,18.9S832,527 832,544v256z"
android:fillColor="#DCDCDC"/>
<path
android:pathData="M512,576c-26.5,0 -48,21.5 -48,48 0,14.2 6.2,27 16,35.8V736c0,17.6 14.4,32 32,32s32,-14.4 32,-32v-76.2c9.8,-8.8 16,-21.6 16,-35.8 0,-26.5 -21.5,-48 -48,-48z"
android:fillColor="#DCDCDC"/>
</vector>

View File

@ -0,0 +1,36 @@
<?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:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.IntoActivity">
<ImageView
android:id="@+id/lock_logo"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="200dp"
android:src="@mipmap/intologo"/>
<TextView
android:id="@+id/lock_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textSize="40sp"
android:layout_below="@id/lock_logo"
android:layout_centerHorizontal="true"
android:textStyle="italic"
android:textColor="@color/text"
android:layout_marginTop="30dp"/>
<ProgressBar
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_below="@id/lock_name"
android:layout_marginTop="36dp"
android:indeterminateTint="@color/text" />
</RelativeLayout>

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.KeyWordActivity">
<ImageView
android:id="@+id/image_back"
android:layout_width="43dp"
android:layout_height="43dp"
android:src="@drawable/image_back"
android:padding="10dp"
android:layout_marginTop="10dp"
android:layout_marginStart="10dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/key_page_logo"
android:layout_width="83dp"
android:layout_height="83dp"
android:layout_marginTop="70dp"
android:src="@mipmap/logo"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/text_page"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="33dp"
android:text="@string/set_key"
android:textColor="@color/black"
android:textSize="30sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/key_page_logo" />
<com.example.applock.DrawView.InPutKeyView
android:id="@+id/input_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
app:layout_constraintTop_toBottomOf="@id/text_page" />
<TextView
android:id="@+id/text_key_btn"
android:layout_width="160dp"
android:layout_height="40dp"
android:layout_below="@id/input_view"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:background="@drawable/text_key_button"
android:gravity="center"
android:text="@string/crate"
android:visibility="gone"
android:textColor="@color/white"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/input_view" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,141 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_draw"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/top_lay"
android:layout_width="match_parent"
android:layout_height="70dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="10dp"
app:srcCompat="@mipmap/logo" />
<TextView
android:id="@+id/textview_softlock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="9dp"
android:layout_gravity="center_vertical"
android:text="@string/app_name"
android:textColor="@color/text"
android:textSize="23sp"
android:textStyle="bold|italic" />
<ImageView
android:id="@+id/image_set"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
app:srcCompat="@mipmap/setting" />
</LinearLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_page_main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/top_lay"
android:layout_above="@id/table"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:id="@+id/table"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<com.google.android.material.tabs.TabLayout
android:id="@+id/app_table"
android:layout_width="260dp"
android:layout_height="40dp"
android:layout_gravity="center"
app:tabSelectedTextColor="@color/white"
app:tabTextColor="@color/little_black"
android:background="@drawable/table_bg"
app:tabIndicatorHeight="0dp" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="@color/white">
<ImageView
android:id="@+id/right_logo"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp"
android:src="@mipmap/logo"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/right_logo"
android:layout_marginTop="50dp">
<RelativeLayout
android:id="@+id/reset_key_lay"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@drawable/menu_background"
android:orientation="horizontal">
<TextView
android:id="@+id/reset_key"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/re_key"
android:layout_centerVertical="true"
android:layout_marginStart="20dp"
android:textColor="@color/white"
android:textSize="20sp"
android:layout_gravity="center"/>
<ImageView
android:id="@+id/version_key"
android:layout_width="30dp"
android:layout_height="25dp"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:src="@drawable/go_reset"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_below="@id/reset_key_lay"
android:background="@drawable/menu_background"
android:layout_marginTop="60dp"
android:orientation="horizontal">
<TextView
android:id="@+id/version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_version"
android:layout_centerVertical="true"
android:layout_marginStart="20dp"
android:textColor="@color/white"
android:textSize="20sp"
android:layout_gravity="center"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:textColor="@color/white"
android:layout_centerHorizontal="true"
android:textSize="18sp"
android:id="@+id/text_version"/>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</androidx.drawerlayout.widget.DrawerLayout>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:id="@+id/bottom_key_linear"
android:gravity="center"
android:layout_marginTop="20dp"
android:layout_height="wrap_content">
<TextView
android:id="@+id/text_key_number"
android:layout_width="55dp"
android:layout_height="55dp"
android:background="@drawable/buttom_key_number"
android:gravity="center"
android:text="1"
android:textColor="@color/white"
android:textSize="19sp" />
<ImageView
android:id="@+id/image_delete"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:src="@mipmap/delete_key" />
</LinearLayout>

View File

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".activity.MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:background="@drawable/bg_permiasion_dialog"
android:padding="20dp">
<ImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:id="@+id/logo"
android:layout_centerHorizontal="true"
android:src="@mipmap/logo"/>
<TextView
android:id="@+id/title"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_below="@id/logo"
android:layout_marginTop="24dp"
android:layout_centerHorizontal="true"
android:text="@string/permission_required"
android:textColor="@color/black"
android:textSize="20sp" />
<LinearLayout
android:id="@+id/top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_centerHorizontal="true"
android:layout_below="@+id/title"
android:layout_marginTop="30dp">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@mipmap/show"
android:layout_gravity="center"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_usage_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/show"
android:textColor="@color/black"
android:textSize="20sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/show_detail"/>
<TextView
android:id="@+id/tv_overlay_button"
android:layout_width="150dp"
android:layout_height="40dp"
android:paddingStart="8dp"
android:layout_marginTop="10dp"
android:paddingEnd="8dp"
android:background="@drawable/selector_permssion"
android:gravity="center"
android:text="@string/permit"
android:textSize="16dp"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_centerHorizontal="true"
android:layout_below="@+id/top"
android:layout_marginTop="30dp">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@mipmap/detect"
android:layout_gravity="center"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView
android:id="@+id/tv_overlay_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/detect"
android:textColor="@color/black"
android:textSize="20sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/detect_detail"/>
<TextView
android:id="@+id/tv_usage_button"
android:layout_width="150dp"
android:layout_height="40dp"
android:paddingStart="8dp"
android:layout_marginTop="10dp"
android:paddingEnd="8dp"
android:gravity="center"
android:textSize="16dp"
android:background="@drawable/selector_permssion"
android:text="@string/permit" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</FrameLayout>

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".activity.MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:background="@drawable/bg_permiasion_dialog"
android:padding="20dp">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/logo"
android:src="@mipmap/intologo"/>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/logo"
android:layout_marginTop="25dp"
android:layout_centerHorizontal="true"
android:text="@string/app_name"
android:textSize="22sp" />
<TextView
android:id="@+id/ok_btn"
android:layout_width="80dp"
android:layout_height="40dp"
android:layout_alignParentEnd="true"
android:layout_below="@id/title"
android:layout_marginTop="30dp"
android:background="@drawable/selector_permssion"
android:gravity="center"
android:text="@string/ok" />
</RelativeLayout>
</FrameLayout>

View File

@ -0,0 +1,12 @@
<?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=".fragment.SoftWareLockFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView_apps"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="65dp"
android:paddingStart="28dp"
android:paddingEnd="28dp">
<ImageView
android:id="@+id/app_logo"
android:layout_width="38dp"
android:layout_height="38dp"
android:layout_centerVertical="true" />
<TextView
android:id="@+id/app_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="28dp"
android:layout_toEndOf="@id/app_logo"
android:text="@string/overlay"
android:textColor="@color/black"
android:textSize="15sp" />
<ImageView
android:id="@+id/app_locked"
android:layout_width="27dp"
android:layout_height="27dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="16dp"
android:src="@drawable/selector_app_lock" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="@color/white" />
</RelativeLayout>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:id="@+id/recyclerView_top"
/>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@id/recyclerView_top"
android:layout_marginTop="20dp"
android:id="@+id/recyclerView_bottom"/>
</RelativeLayout>

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".activity.KeyWordActivity">
<ImageView
android:id="@+id/imLogo"
android:layout_width="83dp"
android:layout_height="83dp"
android:layout_marginTop="80dp"
android:src="@mipmap/logo"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="33dp"
android:text="@string/set_key"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/imLogo" />
<com.example.applock.DrawView.InPutKeyView
android:id="@+id/input_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
app:layout_constraintTop_toBottomOf="@id/tv_hint" />
<TextView
android:id="@+id/tv_button"
android:layout_width="160dp"
android:layout_height="40dp"
android:layout_below="@id/input_view"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:background="@drawable/buttom_key_number"
android:gravity="center"
android:text="@string/go_on"
android:visibility="gone"
android:textColor="@color/white"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/input_view" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,16 @@
<?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">
<View
android:layout_width="20dp"
android:layout_height="1dp"
android:id="@+id/top_view"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/top_image_key"
android:src="@drawable/top_image_key"/>
</LinearLayout>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

@ -0,0 +1,7 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.AppLock" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your dark theme here. -->
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
</style>
</resources>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="black">#535151</color>
<color name="white">#FFFFFFFF</color>
<color name="little_black">#B5B3B3</color>
<color name="text">#4584FF</color>
<color name="lock_main">#77A1F3</color>
<color name="nobackground">#00000000</color>
</resources>

View File

@ -0,0 +1,32 @@
<resources>
<string name="app_name">SoftWare Lock</string>
<string name="re_key">Reset Password</string>
<string name="app_version">Version</string>
<string name="set_key">Set Key</string>
<string name="crate">crate</string>
<string name="alert_worn"> If you not enter the password, It will not use. Are you sure quit it? </string>
<string name="next">Next</string>
<string name="confirm">Double-confirm</string>
<string name="go_on">Go On</string>
<string name="set_key_file">The passwords are not the same,set key kiled.</string>
<string name="app_lock_version">V%s</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="permission_required">Permissions. For normal use App Lock, please grant the following</string>
<string name="show">Show Over Other Apps</string>
<string name="show_detail">Allow lock screen to show over other apps.</string>
<string name="detect_detail">Permit to detect which app is launched bygranting access to usage statistics</string>
<string name="permit">PERMIT</string>
<string name="detect">Detect Launched App</string>
<string name="lock_app">The %s is Locked</string>
<string name="unlock_app">The %s is Unlocked</string>
<string name="not_key">Sorry,The password is not right!</string>
<string name="reset_my_key">reset your key</string>
<string name="save">Save</string>
<string name="ok">OK</string>
<string name="no">NO</string>
<string name="overlay">overlay</string>
<string name="locked">Locked</string>
<string name="reset_success">Reset successful</string>
<string name="unlocked">Unlocked</string>
</resources>

View File

@ -0,0 +1,12 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.AppLock" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your light theme here. -->
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
</style>
<style name="Theme.AppLock" parent="Base.Theme.AppLock">
<item name="android:statusBarColor">@color/lock_main</item>
<item name="colorOnSecondary">@color/white</item>
</style>
</resources>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
</full-backup-content>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!-- TODO: Use <include> and <exclude> to control what is backed up.
<include .../>
<exclude .../>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>

View File

@ -0,0 +1,17 @@
package com.example.applock;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

5
build.gradle.kts Normal file
View File

@ -0,0 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.1.3" apply false
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
}

21
gradle.properties Normal file
View File

@ -0,0 +1,21 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. For more details, visit
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true

24
gradle/libs.versions.toml Normal file
View File

@ -0,0 +1,24 @@
[versions]
agp = "8.4.0"
junit = "4.13.2"
junitVersion = "1.1.5"
espressoCore = "3.5.1"
appcompat = "1.7.0"
material = "1.12.0"
activity = "1.9.0"
constraintlayout = "2.1.4"
drawerlayout = "1.2.0"
[libraries]
junit = { group = "junit", name = "junit", version.ref = "junit" }
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
drawerlayout = { group = "androidx.drawerlayout", name = "drawerlayout", version.ref = "drawerlayout" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More