diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 0b52bd6..6899bf0 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -1,5 +1,5 @@
version: 2
-update_configs:
+updates:
- package-ecosystem: "pip"
directory: "/null"
schedule:
diff --git a/build.gradle b/build.gradle
index e1c46d5..a5a5d49 100644
--- a/build.gradle
+++ b/build.gradle
@@ -39,12 +39,4 @@ ext {
versionCode = 1
versionName = "1.0.0"
- androidx = [
- appcompat: 'androidx.appcompat:appcompat:1.0.0',
- ]
-
- zeoflow = [
- password_strength: 'com.zeoflow:password-strength:1.0.0'
- ]
-
}
diff --git a/password-strength/build.gradle b/password-strength/build.gradle
index e54e12d..458ba77 100644
--- a/password-strength/build.gradle
+++ b/password-strength/build.gradle
@@ -22,7 +22,7 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation "androidx.core:core-ktx:+"
+ implementation "androidx.core:core-ktx:1.3.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
diff --git a/password-strength/src/main/java/com/zeoflow/password/strength/PasswordModel.kt b/password-strength/src/main/java/com/zeoflow/password/strength/PasswordModel.kt
index 1bcd9ee..8570963 100644
--- a/password-strength/src/main/java/com/zeoflow/password/strength/PasswordModel.kt
+++ b/password-strength/src/main/java/com/zeoflow/password/strength/PasswordModel.kt
@@ -1,3 +1,3 @@
package com.zeoflow.password.strength
-class PasswordModel internal constructor(var passwordType: PasswordType, var content: String, var color: Int)
\ No newline at end of file
+class PasswordModel internal constructor(var passwordType: PasswordType, var currentScore: Int)
\ No newline at end of file
diff --git a/password-strength/src/main/java/com/zeoflow/password/strength/PasswordStrength.java b/password-strength/src/main/java/com/zeoflow/password/strength/PasswordStrength.java
index cacc968..0f3495d 100644
--- a/password-strength/src/main/java/com/zeoflow/password/strength/PasswordStrength.java
+++ b/password-strength/src/main/java/com/zeoflow/password/strength/PasswordStrength.java
@@ -8,13 +8,12 @@
public class PasswordStrength
{
- //--------REQUIREMENTS--------
- static int REQUIRED_LENGTH = 8;
- static int MAXIMUM_LENGTH = 15;
- static boolean REQUIRE_SPECIAL_CHARACTERS = true;
- static boolean REQUIRE_DIGITS = true;
- static boolean REQUIRE_LOWER_CASE = true;
- static boolean REQUIRE_UPPER_CASE = false;
+ int REQUIRED_LENGTH = 8;
+ int MAXIMUM_LENGTH = 50;
+ boolean REQUIRE_SPECIAL_CHARACTERS = true;
+ boolean REQUIRE_DIGITS = true;
+ boolean REQUIRE_LOWER_CASE = true;
+ boolean REQUIRE_UPPER_CASE = false;
PasswordStrength()
{
@@ -26,7 +25,37 @@ public static PasswordStrength initializePassChecker()
return new PasswordStrength();
}
- public PasswordType calculateStrength(String password)
+ public PasswordStrength withRequiredLength(int requiredLength) {
+ this.REQUIRED_LENGTH = requiredLength;
+ return this;
+ }
+
+ public PasswordStrength withMaximumLength(int maximumLength) {
+ this.MAXIMUM_LENGTH = maximumLength;
+ return this;
+ }
+
+ public PasswordStrength requireSpecialCharacters(boolean requireSpecialCharacters) {
+ this.REQUIRE_SPECIAL_CHARACTERS = requireSpecialCharacters;
+ return this;
+ }
+
+ public PasswordStrength requireDigits(boolean requireDigits) {
+ this.REQUIRE_DIGITS = requireDigits;
+ return this;
+ }
+
+ public PasswordStrength requireLowerCase(boolean requireLowerCase) {
+ this.REQUIRE_LOWER_CASE = requireLowerCase;
+ return this;
+ }
+
+ public PasswordStrength requireUpperCase(boolean requireUpperCase) {
+ this.REQUIRE_UPPER_CASE = requireUpperCase;
+ return this;
+ }
+
+ public PasswordModel calculateStrength(String password)
{
int currentScore = 0;
boolean sawUpper = false;
@@ -88,17 +117,17 @@ public PasswordType calculateStrength(String password)
switch (currentScore)
{
case 0:
- return WEAK;
+ return new PasswordModel(WEAK, currentScore);
case 1:
- return MEDIUM;
+ return new PasswordModel(MEDIUM, currentScore);
case 2:
- return STRONG;
+ return new PasswordModel(STRONG, currentScore);
case 3:
- return VERY_STRONG;
+ return new PasswordModel(VERY_STRONG, currentScore);
default:
}
- return VERY_STRONG;
+ return new PasswordModel(VERY_STRONG, currentScore);
}
}
diff --git a/sample/.gitignore b/sample/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/sample/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/sample/build.gradle b/sample/build.gradle
new file mode 100644
index 0000000..1f39e0e
--- /dev/null
+++ b/sample/build.gradle
@@ -0,0 +1,54 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion rootProject.ext.compileSdkVersion
+ buildToolsVersion rootProject.ext.buildToolsVersion
+ defaultConfig {
+ applicationId "com.zeoflow.password.strength"
+ minSdkVersion rootProject.ext.minSdkVersion
+ targetSdkVersion rootProject.ext.targetSdkVersion
+ versionCode rootProject.ext.versionCode
+ versionName rootProject.ext.versionName
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+ dataBinding {
+ enabled = true;
+ }
+
+ lintOptions {
+ abortOnError false
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: "libs", include: ["*.jar"])
+
+ implementation 'androidx.annotation:annotation:1.1.0'
+ implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation 'androidx.browser:browser:1.2.0'
+ implementation 'androidx.cardview:cardview:1.0.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
+ implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
+ implementation 'androidx.core:core:1.3.1'
+ implementation 'androidx.exifinterface:exifinterface:1.3.0'
+ implementation 'androidx.annotation:annotation-experimental:1.0.0'
+ implementation 'androidx.fragment:fragment:1.2.5'
+ implementation 'androidx.lifecycle:lifecycle-runtime:2.2.0'
+ implementation 'androidx.recyclerview:recyclerview:1.1.0'
+ implementation 'androidx.recyclerview:recyclerview-selection:1.0.0'
+ implementation 'androidx.transition:transition:1.4.0-beta01'
+ implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
+ implementation 'androidx.viewpager2:viewpager2:1.0.0'
+
+ implementation project(':password-strength')
+
+}
diff --git a/sample/proguard-rules.pro b/sample/proguard-rules.pro
new file mode 100644
index 0000000..45ecb69
--- /dev/null
+++ b/sample/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /Users/jakubkinst/Library/Android/sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# 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 *;
+#}
diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..55cefb2
--- /dev/null
+++ b/sample/src/main/AndroidManifest.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sample/src/main/java/com/zeoflow/anidero/sample/MainActivity.java b/sample/src/main/java/com/zeoflow/anidero/sample/MainActivity.java
new file mode 100644
index 0000000..199b134
--- /dev/null
+++ b/sample/src/main/java/com/zeoflow/anidero/sample/MainActivity.java
@@ -0,0 +1,29 @@
+package com.zeoflow.anidero.sample;
+
+import android.os.Bundle;
+import android.util.Log;
+
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+
+import com.zeoflow.password.strength.PasswordModel;
+import com.zeoflow.password.strength.PasswordType;
+
+import static com.zeoflow.password.strength.PasswordStrength.initializePassChecker;
+
+public class MainActivity extends AppCompatActivity
+{
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ PasswordModel zPasswordStrength = initializePassChecker()
+ .requireDigits(true)
+ .requireUpperCase(true)
+ .calculateStrength("3454g36v5!?n4vt45j6");
+
+ }
+}
diff --git a/sample/src/main/res/drawable/ic_launcher_background.xml b/sample/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000..844943b
--- /dev/null
+++ b/sample/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sample/src/main/res/drawable/ic_launcher_foreground.xml b/sample/src/main/res/drawable/ic_launcher_foreground.xml
new file mode 100644
index 0000000..a71b813
--- /dev/null
+++ b/sample/src/main/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..83f2d01
--- /dev/null
+++ b/sample/src/main/res/layout/activity_main.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..eca70cf
--- /dev/null
+++ b/sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/sample/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/sample/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 0000000..eca70cf
--- /dev/null
+++ b/sample/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/sample/src/main/res/mipmap-hdpi/ic_launcher.png b/sample/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..a571e60
Binary files /dev/null and b/sample/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png b/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..61da551
Binary files /dev/null and b/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/sample/src/main/res/mipmap-mdpi/ic_launcher.png b/sample/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c41dd28
Binary files /dev/null and b/sample/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png b/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..db5080a
Binary files /dev/null and b/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/sample/src/main/res/mipmap-xhdpi/ic_launcher.png b/sample/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..6dba46d
Binary files /dev/null and b/sample/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..da31a87
Binary files /dev/null and b/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png b/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..15ac681
Binary files /dev/null and b/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..b216f2d
Binary files /dev/null and b/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..f25a419
Binary files /dev/null and b/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..e96783c
Binary files /dev/null and b/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/sample/src/main/res/values-w820dp/dimens.xml b/sample/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..827b9a0
--- /dev/null
+++ b/sample/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/sample/src/main/res/values/colors.xml b/sample/src/main/res/values/colors.xml
new file mode 100644
index 0000000..789777f
--- /dev/null
+++ b/sample/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #F44336
+ #F44336
+ #FFFFFF
+
diff --git a/sample/src/main/res/values/dimens.xml b/sample/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..2d6feab
--- /dev/null
+++ b/sample/src/main/res/values/dimens.xml
@@ -0,0 +1,3 @@
+
+ 16dp
+
diff --git a/sample/src/main/res/values/strings.xml b/sample/src/main/res/values/strings.xml
new file mode 100644
index 0000000..8c406b4
--- /dev/null
+++ b/sample/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ Password Strength
+
diff --git a/sample/src/main/res/values/styles.xml b/sample/src/main/res/values/styles.xml
new file mode 100644
index 0000000..8124c3c
--- /dev/null
+++ b/sample/src/main/res/values/styles.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/settings.gradle b/settings.gradle
index 852b84d..d275c0c 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,3 +1,2 @@
-
-include ':app'
+include ':sample'
include ':password-strength'