commit 92f48dd2af4e479105b406298c71884986dfc474 Author: denghaina Date: Fri Jul 26 15:59:08 2024 +0800 版本V1.0.0 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f00cd16 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/SoftWare Lock.jks b/app/SoftWare Lock.jks new file mode 100644 index 0000000..1f38efa Binary files /dev/null and b/app/SoftWare Lock.jks differ diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..46d134e --- /dev/null +++ b/app/build.gradle.kts @@ -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") +} \ No newline at end of file diff --git a/app/info b/app/info new file mode 100644 index 0000000..6a334dc --- /dev/null +++ b/app/info @@ -0,0 +1,5 @@ +包名:com.soft.ware.lock.hd +应用名:SoftWare Lock +签名文件:SoftWare Lock.jks +别名:SoftWare Lockkey0 +密码:SoftWare Lock \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -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 \ No newline at end of file diff --git a/app/release/app-release.aab b/app/release/app-release.aab new file mode 100644 index 0000000..bb6deb4 Binary files /dev/null and b/app/release/app-release.aab differ diff --git a/app/release/app-release.apk b/app/release/app-release.apk new file mode 100644 index 0000000..2c750ab Binary files /dev/null and b/app/release/app-release.apk differ diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json new file mode 100644 index 0000000..8bcd270 --- /dev/null +++ b/app/release/output-metadata.json @@ -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" +} \ No newline at end of file diff --git a/app/relese/SoftWare Locktest.jks b/app/relese/SoftWare Locktest.jks new file mode 100644 index 0000000..1e4bba7 Binary files /dev/null and b/app/relese/SoftWare Locktest.jks differ diff --git a/app/src/androidTest/java/com/example/applock/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/applock/ExampleInstrumentedTest.java new file mode 100644 index 0000000..b5739be --- /dev/null +++ b/app/src/androidTest/java/com/example/applock/ExampleInstrumentedTest.java @@ -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 Testing documentation + */ +@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()); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..336e2f0 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/applock/DrawView/InPutKeyView.java b/app/src/main/java/com/example/applock/DrawView/InPutKeyView.java new file mode 100644 index 0000000..3d244e2 --- /dev/null +++ b/app/src/main/java/com/example/applock/DrawView/InPutKeyView.java @@ -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()); + } +} diff --git a/app/src/main/java/com/example/applock/activity/IntoActivity.java b/app/src/main/java/com/example/applock/activity/IntoActivity.java new file mode 100644 index 0000000..cbbcfdd --- /dev/null +++ b/app/src/main/java/com/example/applock/activity/IntoActivity.java @@ -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(); + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/applock/activity/KeyWordActivity.java b/app/src/main/java/com/example/applock/activity/KeyWordActivity.java new file mode 100644 index 0000000..d836844 --- /dev/null +++ b/app/src/main/java/com/example/applock/activity/KeyWordActivity.java @@ -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(); + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/applock/activity/MainActivity.java b/app/src/main/java/com/example/applock/activity/MainActivity.java new file mode 100644 index 0000000..bf07936 --- /dev/null +++ b/app/src/main/java/com/example/applock/activity/MainActivity.java @@ -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 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(); + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/applock/allmanager/AppManager.java b/app/src/main/java/com/example/applock/allmanager/AppManager.java new file mode 100644 index 0000000..924042a --- /dev/null +++ b/app/src/main/java/com/example/applock/allmanager/AppManager.java @@ -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 QueryPhoneApp(Context context){ + Set applist = new ArraySet<>(); + Intent intent = new Intent(Intent.ACTION_MAIN,null); + intent.addCategory(Intent.CATEGORY_LAUNCHER); + + PackageManager packageManager = context.getPackageManager(); + + List 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; + } +} diff --git a/app/src/main/java/com/example/applock/allmanager/Datamanager.java b/app/src/main/java/com/example/applock/allmanager/Datamanager.java new file mode 100644 index 0000000..af5e300 --- /dev/null +++ b/app/src/main/java/com/example/applock/allmanager/Datamanager.java @@ -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); + } +} diff --git a/app/src/main/java/com/example/applock/allmanager/LockAction.java b/app/src/main/java/com/example/applock/allmanager/LockAction.java new file mode 100644 index 0000000..6e8e8e3 --- /dev/null +++ b/app/src/main/java/com/example/applock/allmanager/LockAction.java @@ -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()); + } + } +} diff --git a/app/src/main/java/com/example/applock/allmanager/MySoftWareLockService.java b/app/src/main/java/com/example/applock/allmanager/MySoftWareLockService.java new file mode 100644 index 0000000..3547a27 --- /dev/null +++ b/app/src/main/java/com/example/applock/allmanager/MySoftWareLockService.java @@ -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; + } + } +} diff --git a/app/src/main/java/com/example/applock/allmanager/MyWorker.java b/app/src/main/java/com/example/applock/allmanager/MyWorker.java new file mode 100644 index 0000000..89f2fe2 --- /dev/null +++ b/app/src/main/java/com/example/applock/allmanager/MyWorker.java @@ -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; + } + + + } +} diff --git a/app/src/main/java/com/example/applock/allmanager/SoftLockPermission.java b/app/src/main/java/com/example/applock/allmanager/SoftLockPermission.java new file mode 100644 index 0000000..02dbab5 --- /dev/null +++ b/app/src/main/java/com/example/applock/allmanager/SoftLockPermission.java @@ -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; + } + + +} diff --git a/app/src/main/java/com/example/applock/allmanager/SoftWarePerssionDialog.java b/app/src/main/java/com/example/applock/allmanager/SoftWarePerssionDialog.java new file mode 100644 index 0000000..45bb1c1 --- /dev/null +++ b/app/src/main/java/com/example/applock/allmanager/SoftWarePerssionDialog.java @@ -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(); + } + } + }); + } + +} diff --git a/app/src/main/java/com/example/applock/allmanager/SuccessDialog.java b/app/src/main/java/com/example/applock/allmanager/SuccessDialog.java new file mode 100644 index 0000000..a3c39c3 --- /dev/null +++ b/app/src/main/java/com/example/applock/allmanager/SuccessDialog.java @@ -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(); + } + }); + + } + +} diff --git a/app/src/main/java/com/example/applock/application/SoftWareLockApplication.java b/app/src/main/java/com/example/applock/application/SoftWareLockApplication.java new file mode 100644 index 0000000..8451446 --- /dev/null +++ b/app/src/main/java/com/example/applock/application/SoftWareLockApplication.java @@ -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 entityApps = AppManager.QueryPhoneApp(this); + SoftWareLockRoom.insertRoom(entityApps); + } +} diff --git a/app/src/main/java/com/example/applock/click/ButtomKeyClick.java b/app/src/main/java/com/example/applock/click/ButtomKeyClick.java new file mode 100644 index 0000000..f7c7249 --- /dev/null +++ b/app/src/main/java/com/example/applock/click/ButtomKeyClick.java @@ -0,0 +1,6 @@ +package com.example.applock.click; + +public interface ButtomKeyClick { + void OnKeyClick(String bottomkey); + void OnDelete(); +} diff --git a/app/src/main/java/com/example/applock/fragment/SoftWareLockFragment.java b/app/src/main/java/com/example/applock/fragment/SoftWareLockFragment.java new file mode 100644 index 0000000..517360a --- /dev/null +++ b/app/src/main/java/com/example/applock/fragment/SoftWareLockFragment.java @@ -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); + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/applock/listener/InputKeyListener.java b/app/src/main/java/com/example/applock/listener/InputKeyListener.java new file mode 100644 index 0000000..1cca1cd --- /dev/null +++ b/app/src/main/java/com/example/applock/listener/InputKeyListener.java @@ -0,0 +1,7 @@ +package com.example.applock.listener; + +public interface InputKeyListener { + void onInputComplete(String lockkey); + + void onInputUnComplete(String lockkey); +} diff --git a/app/src/main/java/com/example/applock/listener/LockListener.java b/app/src/main/java/com/example/applock/listener/LockListener.java new file mode 100644 index 0000000..aad0448 --- /dev/null +++ b/app/src/main/java/com/example/applock/listener/LockListener.java @@ -0,0 +1,6 @@ +package com.example.applock.listener; + +public interface LockListener { + void onSwitch(String msg); + +} diff --git a/app/src/main/java/com/example/applock/listener/PermissionBtnListener.java b/app/src/main/java/com/example/applock/listener/PermissionBtnListener.java new file mode 100644 index 0000000..e322310 --- /dev/null +++ b/app/src/main/java/com/example/applock/listener/PermissionBtnListener.java @@ -0,0 +1,8 @@ +package com.example.applock.listener; + +public interface PermissionBtnListener { + + void onClickUsage(); + + void onClickOverlay(); +} diff --git a/app/src/main/java/com/example/applock/listener/QuerySoftListener.java b/app/src/main/java/com/example/applock/listener/QuerySoftListener.java new file mode 100644 index 0000000..be35616 --- /dev/null +++ b/app/src/main/java/com/example/applock/listener/QuerySoftListener.java @@ -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 list); + +} diff --git a/app/src/main/java/com/example/applock/listener/SwitchListener.java b/app/src/main/java/com/example/applock/listener/SwitchListener.java new file mode 100644 index 0000000..42d116f --- /dev/null +++ b/app/src/main/java/com/example/applock/listener/SwitchListener.java @@ -0,0 +1,5 @@ +package com.example.applock.listener; + +public interface SwitchListener { + boolean onSwitchisLock(boolean lock); +} diff --git a/app/src/main/java/com/example/applock/lockadapter/ButtomAdapter.java b/app/src/main/java/com/example/applock/lockadapter/ButtomAdapter.java new file mode 100644 index 0000000..f56e665 --- /dev/null +++ b/app/src/main/java/com/example/applock/lockadapter/ButtomAdapter.java @@ -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 { + 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; + } + + +} diff --git a/app/src/main/java/com/example/applock/lockadapter/SoftWareAdapter.java b/app/src/main/java/com/example/applock/lockadapter/SoftWareAdapter.java new file mode 100644 index 0000000..0633dea --- /dev/null +++ b/app/src/main/java/com/example/applock/lockadapter/SoftWareAdapter.java @@ -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 { + private List 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 apps) { + entityApp1 = apps; + notifyDataSetChanged(); + + } + static class SoftWareViewHolder extends RecyclerView.ViewHolder { + private ItemAppBinding itemAppBinding; + + public SoftWareViewHolder(@NonNull ItemAppBinding itemView) { + super(itemView.getRoot()); + itemAppBinding = itemView; + } + } +} diff --git a/app/src/main/java/com/example/applock/lockadapter/TopAdapter.java b/app/src/main/java/com/example/applock/lockadapter/TopAdapter.java new file mode 100644 index 0000000..b739499 --- /dev/null +++ b/app/src/main/java/com/example/applock/lockadapter/TopAdapter.java @@ -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 { + 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; + + } + + } +} diff --git a/app/src/main/java/com/example/applock/lockadapter/ViewPaperAdapter.java b/app/src/main/java/com/example/applock/lockadapter/ViewPaperAdapter.java new file mode 100644 index 0000000..73d1e76 --- /dev/null +++ b/app/src/main/java/com/example/applock/lockadapter/ViewPaperAdapter.java @@ -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 fmlist; + private String[] tabtitle; + public ViewPaperAdapter(FragmentManager supportFragmentManager, List 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]; + } +} diff --git a/app/src/main/java/com/example/applock/roombase/AppDataBase.java b/app/src/main/java/com/example/applock/roombase/AppDataBase.java new file mode 100644 index 0000000..f16c89b --- /dev/null +++ b/app/src/main/java/com/example/applock/roombase/AppDataBase.java @@ -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; + } + } diff --git a/app/src/main/java/com/example/applock/roombase/AppEntity.java b/app/src/main/java/com/example/applock/roombase/AppEntity.java new file mode 100644 index 0000000..6294b92 --- /dev/null +++ b/app/src/main/java/com/example/applock/roombase/AppEntity.java @@ -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; + } +} diff --git a/app/src/main/java/com/example/applock/roombase/AppEntityDao.java b/app/src/main/java/com/example/applock/roombase/AppEntityDao.java new file mode 100644 index 0000000..a09f7a9 --- /dev/null +++ b/app/src/main/java/com/example/applock/roombase/AppEntityDao.java @@ -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 queryApp(boolean isLock); +} diff --git a/app/src/main/java/com/example/applock/roombase/SoftWareLockRoom.java b/app/src/main/java/com/example/applock/roombase/SoftWareLockRoom.java new file mode 100644 index 0000000..6652542 --- /dev/null +++ b/app/src/main/java/com/example/applock/roombase/SoftWareLockRoom.java @@ -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 applist = AppDataBase.getDatabaseInstance().getAppEntityDao().queryApp(islock); + getMyHandler().post(()->{ + listener.QueryResult(applist); + }); + } + }); + } + public static void insertRoom(Set 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); + } + }); + } + +} diff --git a/app/src/main/java/com/example/applock/value/MyAllValues.java b/app/src/main/java/com/example/applock/value/MyAllValues.java new file mode 100644 index 0000000..cbf6e70 --- /dev/null +++ b/app/src/main/java/com/example/applock/value/MyAllValues.java @@ -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"; + +} diff --git a/app/src/main/java/com/example/applock/viewmodel/SoftWareLockVM.java b/app/src/main/java/com/example/applock/viewmodel/SoftWareLockVM.java new file mode 100644 index 0000000..95e910b --- /dev/null +++ b/app/src/main/java/com/example/applock/viewmodel/SoftWareLockVM.java @@ -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> mutableLiveDataApp = new MutableLiveData<>(); + + public MutableLiveData> getMutableLiveDataApp() { + + return mutableLiveDataApp; + } + public void UpDataAppLock(boolean lock){ + SoftWareLockRoom.QuerySoftRoom(lock, new QuerySoftListener() { + @Override + public void QueryResult(List list) { + mutableLiveDataApp.setValue(list); + } + }); + + + } +} diff --git a/app/src/main/res/drawable/bg_permiasion_dialog.xml b/app/src/main/res/drawable/bg_permiasion_dialog.xml new file mode 100644 index 0000000..0221b83 --- /dev/null +++ b/app/src/main/res/drawable/bg_permiasion_dialog.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/buttom_key_number.xml b/app/src/main/res/drawable/buttom_key_number.xml new file mode 100644 index 0000000..4e93eae --- /dev/null +++ b/app/src/main/res/drawable/buttom_key_number.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/go_reset.xml b/app/src/main/res/drawable/go_reset.xml new file mode 100644 index 0000000..15ccc1d --- /dev/null +++ b/app/src/main/res/drawable/go_reset.xml @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/image_back.xml b/app/src/main/res/drawable/image_back.xml new file mode 100644 index 0000000..18f5789 --- /dev/null +++ b/app/src/main/res/drawable/image_back.xml @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/lock.xml b/app/src/main/res/drawable/lock.xml new file mode 100644 index 0000000..3df7086 --- /dev/null +++ b/app/src/main/res/drawable/lock.xml @@ -0,0 +1,12 @@ + + + + diff --git a/app/src/main/res/drawable/menu_background.xml b/app/src/main/res/drawable/menu_background.xml new file mode 100644 index 0000000..a5745b7 --- /dev/null +++ b/app/src/main/res/drawable/menu_background.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/permssion_normal.xml b/app/src/main/res/drawable/permssion_normal.xml new file mode 100644 index 0000000..3e4c2a0 --- /dev/null +++ b/app/src/main/res/drawable/permssion_normal.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/permssion_selected.xml b/app/src/main/res/drawable/permssion_selected.xml new file mode 100644 index 0000000..788c071 --- /dev/null +++ b/app/src/main/res/drawable/permssion_selected.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/selector_app_lock.xml b/app/src/main/res/drawable/selector_app_lock.xml new file mode 100644 index 0000000..e5d6aac --- /dev/null +++ b/app/src/main/res/drawable/selector_app_lock.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/selector_permssion.xml b/app/src/main/res/drawable/selector_permssion.xml new file mode 100644 index 0000000..7e08e7d --- /dev/null +++ b/app/src/main/res/drawable/selector_permssion.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/table_bg.xml b/app/src/main/res/drawable/table_bg.xml new file mode 100644 index 0000000..76d18e5 --- /dev/null +++ b/app/src/main/res/drawable/table_bg.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/text_key_button.xml b/app/src/main/res/drawable/text_key_button.xml new file mode 100644 index 0000000..40e98df --- /dev/null +++ b/app/src/main/res/drawable/text_key_button.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/top_image_key.xml b/app/src/main/res/drawable/top_image_key.xml new file mode 100644 index 0000000..d4ac122 --- /dev/null +++ b/app/src/main/res/drawable/top_image_key.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/top_image_key_current.xml b/app/src/main/res/drawable/top_image_key_current.xml new file mode 100644 index 0000000..527e08b --- /dev/null +++ b/app/src/main/res/drawable/top_image_key_current.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/top_image_key_prassed.xml b/app/src/main/res/drawable/top_image_key_prassed.xml new file mode 100644 index 0000000..332c454 --- /dev/null +++ b/app/src/main/res/drawable/top_image_key_prassed.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/unlock.xml b/app/src/main/res/drawable/unlock.xml new file mode 100644 index 0000000..411241b --- /dev/null +++ b/app/src/main/res/drawable/unlock.xml @@ -0,0 +1,12 @@ + + + + diff --git a/app/src/main/res/layout/activity_into.xml b/app/src/main/res/layout/activity_into.xml new file mode 100644 index 0000000..5550369 --- /dev/null +++ b/app/src/main/res/layout/activity_into.xml @@ -0,0 +1,36 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_key_word.xml b/app/src/main/res/layout/activity_key_word.xml new file mode 100644 index 0000000..f014bb4 --- /dev/null +++ b/app/src/main/res/layout/activity_key_word.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..1a8211e --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/buttom_key_view.xml b/app/src/main/res/layout/buttom_key_view.xml new file mode 100644 index 0000000..01b3cf0 --- /dev/null +++ b/app/src/main/res/layout/buttom_key_view.xml @@ -0,0 +1,26 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_permission.xml b/app/src/main/res/layout/dialog_permission.xml new file mode 100644 index 0000000..e9faac7 --- /dev/null +++ b/app/src/main/res/layout/dialog_permission.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_success.xml b/app/src/main/res/layout/dialog_success.xml new file mode 100644 index 0000000..0509bbe --- /dev/null +++ b/app/src/main/res/layout/dialog_success.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_soft_ware_lock.xml b/app/src/main/res/layout/fragment_soft_ware_lock.xml new file mode 100644 index 0000000..8194e2d --- /dev/null +++ b/app/src/main/res/layout/fragment_soft_ware_lock.xml @@ -0,0 +1,12 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_app.xml b/app/src/main/res/layout/item_app.xml new file mode 100644 index 0000000..6df15ba --- /dev/null +++ b/app/src/main/res/layout/item_app.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/key_input_view.xml b/app/src/main/res/layout/key_input_view.xml new file mode 100644 index 0000000..cfdd1f0 --- /dev/null +++ b/app/src/main/res/layout/key_input_view.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/lock_action_view.xml b/app/src/main/res/layout/lock_action_view.xml new file mode 100644 index 0000000..d94ce61 --- /dev/null +++ b/app/src/main/res/layout/lock_action_view.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/top_key_view.xml b/app/src/main/res/layout/top_key_view.xml new file mode 100644 index 0000000..08e360c --- /dev/null +++ b/app/src/main/res/layout/top_key_view.xml @@ -0,0 +1,16 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/delete_key.png b/app/src/main/res/mipmap-hdpi/delete_key.png new file mode 100644 index 0000000..604eeaf Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/delete_key.png differ diff --git a/app/src/main/res/mipmap-hdpi/detect.png b/app/src/main/res/mipmap-hdpi/detect.png new file mode 100644 index 0000000..61e3687 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/detect.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..c209e78 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..b2dfe3d Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-hdpi/intologo.png b/app/src/main/res/mipmap-hdpi/intologo.png new file mode 100644 index 0000000..cf35325 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/intologo.png differ diff --git a/app/src/main/res/mipmap-hdpi/logo.png b/app/src/main/res/mipmap-hdpi/logo.png new file mode 100644 index 0000000..ca03051 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/logo.png differ diff --git a/app/src/main/res/mipmap-hdpi/setting.png b/app/src/main/res/mipmap-hdpi/setting.png new file mode 100644 index 0000000..b0c75fc Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/setting.png differ diff --git a/app/src/main/res/mipmap-hdpi/show.png b/app/src/main/res/mipmap-hdpi/show.png new file mode 100644 index 0000000..4481e82 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/show.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..4f0f1d6 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..62b611d Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..948a307 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..1b9a695 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..28d4b77 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9287f50 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..aa7d642 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9126ae3 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..cf58ff1 --- /dev/null +++ b/app/src/main/res/values-night/themes.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..708cd6d --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,9 @@ + + + #535151 + #FFFFFFFF + #B5B3B3 + #4584FF + #77A1F3 + #00000000 + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..0f7a1fb --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,32 @@ + + SoftWare Lock + Reset Password + Version + Set Key + crate + If you not enter the password, It will not use. Are you sure quit it? + Next + Double-confirm + Go On + The passwords are not the same,set key kiled. + V%s + + Hello blank fragment + Permissions. For normal use App Lock, please grant the following + Show Over Other Apps + Allow lock screen to show over other apps. + Permit to detect which app is launched bygranting access to usage statistics + PERMIT + Detect Launched App + The %s is Locked + The %s is Unlocked + Sorry,The password is not right! + reset your key + Save + OK + NO + overlay + Locked + Reset successful + Unlocked + \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..320dbbe --- /dev/null +++ b/app/src/main/res/values/themes.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/backup_rules.xml b/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 0000000..fa0f996 --- /dev/null +++ b/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/data_extraction_rules.xml b/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 0000000..9ee9997 --- /dev/null +++ b/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/test/java/com/example/applock/ExampleUnitTest.java b/app/src/test/java/com/example/applock/ExampleUnitTest.java new file mode 100644 index 0000000..ccaa86e --- /dev/null +++ b/app/src/test/java/com/example/applock/ExampleUnitTest.java @@ -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 Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..1bc1d16 --- /dev/null +++ b/build.gradle.kts @@ -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 +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..4387edc --- /dev/null +++ b/gradle.properties @@ -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 \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..72ff5af --- /dev/null +++ b/gradle/libs.versions.toml @@ -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" } + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..e708b1c Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..aa1b2d7 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jun 21 17:17:49 CST 2024 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..4f906e0 --- /dev/null +++ b/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/image/1.png b/image/1.png new file mode 100644 index 0000000..8a07f61 Binary files /dev/null and b/image/1.png differ diff --git a/image/10.png b/image/10.png new file mode 100644 index 0000000..48c4a30 Binary files /dev/null and b/image/10.png differ diff --git a/image/2.png b/image/2.png new file mode 100644 index 0000000..c9a9e7a Binary files /dev/null and b/image/2.png differ diff --git a/image/3.png b/image/3.png new file mode 100644 index 0000000..9846653 Binary files /dev/null and b/image/3.png differ diff --git a/image/4.png b/image/4.png new file mode 100644 index 0000000..268dc87 Binary files /dev/null and b/image/4.png differ diff --git a/image/5.png b/image/5.png new file mode 100644 index 0000000..04e7ad7 Binary files /dev/null and b/image/5.png differ diff --git a/image/6.png b/image/6.png new file mode 100644 index 0000000..7491d69 Binary files /dev/null and b/image/6.png differ diff --git a/image/7.png b/image/7.png new file mode 100644 index 0000000..7eb1124 Binary files /dev/null and b/image/7.png differ diff --git a/image/8.png b/image/8.png new file mode 100644 index 0000000..cca4899 Binary files /dev/null and b/image/8.png differ diff --git a/image/9.png b/image/9.png new file mode 100644 index 0000000..0f86e81 Binary files /dev/null and b/image/9.png differ diff --git a/image/logo.png b/image/logo.png new file mode 100644 index 0000000..ca03051 Binary files /dev/null and b/image/logo.png differ diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..e74e259 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,24 @@ +pluginManagement { + repositories { + google { + content { + includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google.*") + includeGroupByRegex("androidx.*") + } + } + mavenCentral() + gradlePluginPortal() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} + +rootProject.name = "SoftWare Lock" +include(":app") + \ No newline at end of file