diff --git a/.gitignore b/.gitignore
index aa724b7..fe3b002 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,15 +1,11 @@
*.iml
.gradle
/local.properties
-/.idea/caches
-/.idea/libraries
-/.idea/modules.xml
-/.idea/workspace.xml
-/.idea/navEditor.xml
-/.idea/assetWizardSettings.xml
+/.idea
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
+/.kotlin
\ No newline at end of file
diff --git a/.idea/.name b/.idea/.name
index c4897e2..6f338b9 100644
--- a/.idea/.name
+++ b/.idea/.name
@@ -1 +1 @@
-PinLockComposeDemo
\ No newline at end of file
+PinLockComposeAndroid
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index fb7f4a8..b86273d 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,6 +1,6 @@
-🔐 Light library that is beautiful Pin Lock screen for Jetpack Compose. The library handles saving pin in Encrypted file. Integration is very easy and fast. +🔐 PinLock is a light library to display Pin Lock screen in Jetpack Compose. The library handles saving pin in Encrypted file. Integration is very easy and fast.
# Setup -Add it in your root **build.gradle** at the end of repositories: -```groovy -allprojects { +Add the maven library bucket to the `dependencyResolutionManagement.repositories` block in `settings.gradle.kts` file as follows: +```kotlin +dependencyResolutionManagement { + ... repositories { - maven { url 'https://jitpack.io' } + ... + maven("https://jitpack.io") } } -``` +``` -Include below dependency in build.gradle of application and sync it: -```groovy -implementation 'com.github.raheemadamboev:pin-lock-compose:1.0.1' +Install the library to the project in desired module's `build.gradle.kts` file. Replace `- - + +
--- @@ -81,7 +84,7 @@ ChangePinLock( Use this only if there is already saved pin. If there is no saved pin, use simple `PinLock` instead for creating pin for the first time. When using `ChangePinLock`, firstly it prompts the user to enter original pin. After user succesfully authenticates using his original pin, it prompts the user to creat a new pin:- +
--- @@ -110,16 +113,16 @@ PinManager.clearPin() You can install and try demo app. All the features are implemented in the demo from creating pin to changing pin. -Download demo +Download demo- - + +
# Projects using this library -**Notepad**: 40 000+ downloads. +**Notepad**: 100 000+ downloads. Google Play Store diff --git a/app-debug.apk b/app-debug.apk deleted file mode 100644 index 4a81bf2..0000000 Binary files a/app-debug.apk and /dev/null differ diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 5fb3d89..0000000 --- a/app/build.gradle +++ /dev/null @@ -1,76 +0,0 @@ -plugins { - id 'com.android.application' - id 'org.jetbrains.kotlin.android' -} - -android { - namespace 'xyz.teamgravity.pinlockcomposedemo' - compileSdk 33 - - defaultConfig { - applicationId "xyz.teamgravity.pinlockcomposedemo" - minSdk 21 - targetSdk 33 - versionCode 1 - versionName "1.0" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - vectorDrawables { - useSupportLibrary true - } - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = '1.8' - } - - buildFeatures { - compose true - } - - composeOptions { - kotlinCompilerExtensionVersion '1.4.2' - } - - packagingOptions { - resources { - excludes += '/META-INF/{AL2.0,LGPL2.1}' - } - } -} - -dependencies { - - // core - implementation 'androidx.core:core-ktx:1.9.0' - - // compose ui - implementation "androidx.compose.ui:ui:1.4.0-beta02" - - // compose preview - implementation "androidx.compose.ui:ui-tooling-preview:1.4.0-beta02" - - // compose activity - implementation 'androidx.activity:activity-compose:1.6.1' - - // compose material3 - implementation 'androidx.compose.material3:material3:1.1.0-alpha07' - - // lifecycle - implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1' - - // pin lock compose - implementation 'com.github.raheemadamboev:pin-lock-compose:1.0' -} \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..dd994b0 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,63 @@ +plugins { + alias(libs.plugins.android) + alias(libs.plugins.kotlin) + alias(libs.plugins.compose) +} + +android { + namespace = "xyz.teamgravity.pinlockcomposedemo" + compileSdk = libs.versions.sdk.compile.get().toInt() + + defaultConfig { + applicationId = "xyz.teamgravity.pinlockcomposedemo" + minSdk = libs.versions.sdk.min.get().toInt() + targetSdk = libs.versions.sdk.target.get().toInt() + versionCode = 1 + versionName = "1.0.0" + + vectorDrawables { + useSupportLibrary = true + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = libs.versions.java.target.get() + } + + buildFeatures { + compose = true + } + + packaging { + resources { + excludes += "/META-INF/{AL2.0,LGPL2.1}" + } + } +} + +dependencies { + + // pin lock compose + implementation(projects.pinLockCompose) + + // compose + implementation(platform(libs.compose)) + implementation(libs.compose.ui) + implementation(libs.compose.graphics) + implementation(libs.compose.preview) + implementation(libs.compose.material3) + + // compose activity + implementation(libs.compose.activity) + + // compose lifecycle + implementation(libs.compose.lifecycle) + + // core + implementation(libs.core) +} \ No newline at end of file diff --git a/app/src/main/java/xyz/teamgravity/pinlockcomposedemo/MainActivity.kt b/app/src/main/java/xyz/teamgravity/pinlockcomposedemo/MainActivity.kt index f9eb822..1bf0d8d 100644 --- a/app/src/main/java/xyz/teamgravity/pinlockcomposedemo/MainActivity.kt +++ b/app/src/main/java/xyz/teamgravity/pinlockcomposedemo/MainActivity.kt @@ -1,10 +1,14 @@ package xyz.teamgravity.pinlockcomposedemo +import android.os.Build import android.os.Bundle import android.util.Log import androidx.activity.ComponentActivity import androidx.activity.compose.setContent -import androidx.compose.foundation.layout.* +import androidx.activity.enableEdgeToEdge +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material3.Button import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface @@ -24,13 +28,19 @@ import xyz.teamgravity.pinlockcomposedemo.ui.theme.PinLockComposeDemoTheme class MainActivity : ComponentActivity() { - companion object { - private const val TAG = "Tate" + private companion object { + const val TAG = "PinLock" } override fun onCreate(savedInstanceState: Bundle?) { + enableEdgeToEdge() super.onCreate(savedInstanceState) - window.navigationBarColor = android.graphics.Color.parseColor("#6650a4") + + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM) { + @Suppress("DEPRECATION") + window.navigationBarColor = android.graphics.Color.parseColor("#6650A4") + } + setContent { PinLockComposeDemoTheme { Surface( @@ -92,25 +102,32 @@ class MainActivity : ComponentActivity() { Screen.Main -> { Column( horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.Center, + verticalArrangement = Arrangement.spacedBy( + space = 16.dp, + alignment = Alignment.CenterVertically + ), modifier = Modifier.fillMaxSize() ) { - Text(text = "You entered pin correctly!") - Spacer(modifier = Modifier.height(16.dp)) + Text( + text = "You entered pin correctly!" + ) Button( onClick = { navigation = Screen.Authenticate } ) { - Text(text = "Authenticate") + Text( + text = "Authenticate" + ) } - Spacer(modifier = Modifier.height(16.dp)) Button( onClick = { navigation = Screen.ChangePin } ) { - Text(text = "Change Pin") + Text( + text = "Change Pin" + ) } } } @@ -123,6 +140,6 @@ class MainActivity : ComponentActivity() { private enum class Screen { Authenticate, ChangePin, - Main + Main; } } \ No newline at end of file diff --git a/app/src/main/java/xyz/teamgravity/pinlockcomposedemo/ui/theme/Color.kt b/app/src/main/java/xyz/teamgravity/pinlockcomposedemo/ui/theme/Color.kt index 3143d2c..5873b3b 100644 --- a/app/src/main/java/xyz/teamgravity/pinlockcomposedemo/ui/theme/Color.kt +++ b/app/src/main/java/xyz/teamgravity/pinlockcomposedemo/ui/theme/Color.kt @@ -2,10 +2,6 @@ package xyz.teamgravity.pinlockcomposedemo.ui.theme import androidx.compose.ui.graphics.Color -val Purple80 = Color(0xFFD0BCFF) -val PurpleGrey80 = Color(0xFFCCC2DC) -val Pink80 = Color(0xFFEFB8C8) - val Purple40 = Color(0xFF6650a4) val PurpleGrey40 = Color(0xFF625b71) val Pink40 = Color(0xFF7D5260) \ No newline at end of file diff --git a/app/src/main/java/xyz/teamgravity/pinlockcomposedemo/ui/theme/Theme.kt b/app/src/main/java/xyz/teamgravity/pinlockcomposedemo/ui/theme/Theme.kt index 0429e26..f04d93c 100644 --- a/app/src/main/java/xyz/teamgravity/pinlockcomposedemo/ui/theme/Theme.kt +++ b/app/src/main/java/xyz/teamgravity/pinlockcomposedemo/ui/theme/Theme.kt @@ -1,13 +1,8 @@ package xyz.teamgravity.pinlockcomposedemo.ui.theme -import android.app.Activity import androidx.compose.material3.MaterialTheme import androidx.compose.material3.lightColorScheme import androidx.compose.runtime.Composable -import androidx.compose.runtime.SideEffect -import androidx.compose.ui.graphics.toArgb -import androidx.compose.ui.platform.LocalView -import androidx.core.view.ViewCompat private val LightColorScheme = lightColorScheme( primary = Purple40, @@ -19,14 +14,6 @@ private val LightColorScheme = lightColorScheme( fun PinLockComposeDemoTheme( content: @Composable () -> Unit, ) { - val view = LocalView.current - if (!view.isInEditMode) { - SideEffect { - (view.context as Activity).window.statusBarColor = LightColorScheme.primary.toArgb() - ViewCompat.getWindowInsetsController(view)?.isAppearanceLightStatusBars = false - } - } - MaterialTheme( colorScheme = LightColorScheme, content = content diff --git a/banner_2.gif b/banner_2.gif deleted file mode 100644 index c520fb1..0000000 Binary files a/banner_2.gif and /dev/null differ diff --git a/banner_3.gif b/banner_3.gif deleted file mode 100644 index 403f4e9..0000000 Binary files a/banner_3.gif and /dev/null differ diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 52f67d1..0000000 --- a/build.gradle +++ /dev/null @@ -1,5 +0,0 @@ -plugins { - id 'com.android.application' version '7.4.1' apply false - id 'com.android.library' version '7.4.1' apply false - id 'org.jetbrains.kotlin.android' version '1.8.10' apply false -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..9f59ae5 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,6 @@ +plugins { + alias(libs.plugins.android) apply false + alias(libs.plugins.library) apply false + alias(libs.plugins.kotlin) apply false + alias(libs.plugins.compose) apply false +} \ No newline at end of file diff --git a/extra/app-debug.apk b/extra/app-debug.apk new file mode 100644 index 0000000..020f657 Binary files /dev/null and b/extra/app-debug.apk differ diff --git a/banner_1.gif b/extra/banner_1.gif similarity index 100% rename from banner_1.gif rename to extra/banner_1.gif diff --git a/extra/banner_2.gif b/extra/banner_2.gif new file mode 100644 index 0000000..6774f88 Binary files /dev/null and b/extra/banner_2.gif differ diff --git a/extra/banner_3.gif b/extra/banner_3.gif new file mode 100644 index 0000000..8fb54d2 Binary files /dev/null and b/extra/banner_3.gif differ diff --git a/screenshot_1.jpg b/extra/screenshot_1.jpg similarity index 100% rename from screenshot_1.jpg rename to extra/screenshot_1.jpg diff --git a/screenshot_2.jpg b/extra/screenshot_2.jpg similarity index 100% rename from screenshot_2.jpg rename to extra/screenshot_2.jpg diff --git a/screenshot_3.jpg b/extra/screenshot_3.jpg similarity index 100% rename from screenshot_3.jpg rename to extra/screenshot_3.jpg diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..55f12fa --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,36 @@ +[versions] + +compose = "2024.11.00" +compose-constraintlayout = "1.1.0" +compose-activity = "1.9.3" +compose-lifecycle = "2.8.7" +core = "1.15.0" +security = "1.1.0-alpha06" + +android = "8.7.2" +kotlin = "2.0.21" + +sdk-min = "21" +sdk-compile = "35" +sdk-target = "35" +java-target = "17" + +[libraries] + +compose = { group = "androidx.compose", name = "compose-bom", version.ref = "compose" } +compose-ui = { group = "androidx.compose.ui", name = "ui" } +compose-graphics = { group = "androidx.compose.ui", name = "ui-graphics" } +compose-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } +compose-material3 = { group = "androidx.compose.material3", name = "material3" } +compose-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout-compose", version.ref = "compose-constraintlayout" } +compose-activity = { group = "androidx.activity", name = "activity-compose", version.ref = "compose-activity" } +compose-lifecycle = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "compose-lifecycle" } +core = { group = "androidx.core", name = "core-ktx", version.ref = "core" } +security = { group = "androidx.security", name = "security-crypto", version.ref = "security" } + +[plugins] + +android = { id = "com.android.application", version.ref = "android" } +library = { id = "com.android.library", version.ref = "android" } +kotlin = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 38b4785..f1989e7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Feb 24 17:26:38 UZT 2023 +#Wed Nov 27 15:26:22 UZT 2024 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/jitpack.yml b/jitpack.yml index 1bfc0d7..bcf1f6f 100644 --- a/jitpack.yml +++ b/jitpack.yml @@ -1,4 +1,4 @@ jdk: - - openjdk11 + - openjdk17 before_install: - ./scripts/prepareJitpackEnvironment.sh \ No newline at end of file diff --git a/pin_lock_compose/build.gradle b/pin_lock_compose/build.gradle deleted file mode 100644 index 8c3cd65..0000000 --- a/pin_lock_compose/build.gradle +++ /dev/null @@ -1,90 +0,0 @@ -plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' - id 'maven-publish' -} - -android { - namespace 'xyz.teamgravity.pin_lock_compose' - compileSdk 33 - - defaultConfig { - minSdk 21 - targetSdk 33 - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - consumerProguardFiles "consumer-rules.pro" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - buildFeatures { - compose true - } - - composeOptions { - kotlinCompilerExtensionVersion '1.4.2' - } - - packagingOptions { - resources { - excludes += '/META-INF/{AL2.0,LGPL2.1}' - } - } -} - -dependencies { - - // core - implementation 'androidx.core:core-ktx:1.9.0' - - // compose ui - implementation "androidx.compose.ui:ui:1.4.0-beta02" - - // compose preview - implementation "androidx.compose.ui:ui-tooling-preview:1.4.0-beta02" - - // compose activity - implementation 'androidx.activity:activity-compose:1.6.1' - - // compose material3 - implementation 'androidx.compose.material3:material3:1.1.0-alpha07' - - // compose constraint layout - implementation 'androidx.constraintlayout:constraintlayout-compose:1.0.1' - - // lifecycle - implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1' - - // security - implementation "androidx.security:security-crypto:1.1.0-alpha05" -} - -allprojects { - tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - freeCompilerArgs += [ - "-opt-in=androidx.compose.animation.ExperimentalAnimationApi" - ] - } - } -} - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release - - groupId = 'com.github.raheemadamboev' - artifactId = 'pin-lock-compose' - version = '1.0' - } - } - } -} \ No newline at end of file diff --git a/pin_lock_compose/build.gradle.kts b/pin_lock_compose/build.gradle.kts new file mode 100644 index 0000000..6f5b712 --- /dev/null +++ b/pin_lock_compose/build.gradle.kts @@ -0,0 +1,84 @@ +plugins { + alias(libs.plugins.library) + alias(libs.plugins.kotlin) + alias(libs.plugins.compose) + `maven-publish` +} + +android { + namespace = "xyz.teamgravity.pin_lock_compose" + compileSdk = libs.versions.sdk.compile.get().toInt() + + defaultConfig { + minSdk = libs.versions.sdk.min.get().toInt() + } + + lint { + targetSdk = libs.versions.sdk.target.get().toInt() + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = libs.versions.java.target.get() + } + + buildFeatures { + compose = true + } + + packaging { + resources { + pickFirsts.add("META-INF/atomicfu.kotlin_module") + } + } + + publishing { + singleVariant("release") { + withSourcesJar() + withJavadocJar() + } + } +} + +dependencies { + + // compose + implementation(platform(libs.compose)) + implementation(libs.compose.ui) + implementation(libs.compose.graphics) + implementation(libs.compose.preview) + implementation(libs.compose.material3) + + // compose constraint layout + implementation(libs.compose.constraintlayout) + + // compose activity + implementation(libs.compose.activity) + + // compose lifecycle + implementation(libs.compose.lifecycle) + + // core + implementation(libs.core) + + // security + implementation(libs.security) +} + +afterEvaluate { + publishing { + publications { + register