diff --git a/.gitignore b/.gitignore
index 4c59549..da1fae7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,5 +5,4 @@ build
release
*.iml
gradlew*
-material-elements/zflow_materialelements.gpg
-material-elements/package.properties
+password-strength/password_strength.gpg
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..600e8af
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,30 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion rootProject.ext.compileSdkVersion
+ buildToolsVersion rootProject.ext.buildToolsVersion
+ defaultConfig {
+ applicationId "com.ybs.passwordstrengthchecker"
+ minSdkVersion rootProject.ext.minSdkVersion
+ targetSdkVersion rootProject.ext.targetSdkVersion
+ versionCode rootProject.ext.versionCode
+ versionName rootProject.ext.versionName
+ testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+
+ implementation project(':password-strength')
+// implementation zeoflow.password_strength
+
+ implementation androidx.appcompat
+
+}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..5aebc51
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,25 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /home/mispc1/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 *;
+#}
+
+# 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
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..355277f
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/zeoflow/app/MainActivity.java b/app/src/main/java/com/zeoflow/app/MainActivity.java
new file mode 100644
index 0000000..be30cf6
--- /dev/null
+++ b/app/src/main/java/com/zeoflow/app/MainActivity.java
@@ -0,0 +1,28 @@
+package com.zeoflow.app;
+
+import android.os.Bundle;
+import android.widget.Toast;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import com.zeoflow.password.strength.PasswordType;
+
+import static com.zeoflow.password.strength.PasswordStrength.initializePassChecker;
+
+public class MainActivity extends AppCompatActivity
+{
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ PasswordType res = initializePassChecker()
+ .calculateStrength("3454g36v5n4vt45j6");
+ Toast.makeText(this, String.valueOf(res), Toast.LENGTH_SHORT).show();
+
+ }
+}
+
+
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..3239bb1
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,8 @@
+
+
+
+
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..cde69bc
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..9a078e3
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c133a0c
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..efc028a
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..bfa42f0
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..3af2608
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..324e72c
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..9bec2e6
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..aee44e1
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..34947cd
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..3ab3e9c
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #3F51B5
+ #303F9F
+ #FF4081
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..cd22a56
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,10 @@
+
+ PasswordStrengthChecker
+
+ Password Strength: {0}
+ Weak
+ Medium
+ Strong
+ Very Strong
+
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..5885930
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..50acc67
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,48 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ ext.kotlin_version = '1.3.72'
+
+ repositories {
+ maven {
+ url 'https://maven.google.com/'
+ name 'Google'
+ }
+ google()
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:4.0.1'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ google()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
+ext {
+ compileSdkVersion = 30
+ buildToolsVersion = '30.0.1'
+ minSdkVersion = 21
+ targetSdkVersion = 30
+ versionCode = 1
+ versionName = "1.0.0"
+
+ androidx = [
+ appcompat: 'androidx.appcompat:appcompat:1.0.0',
+ ]
+
+ zeoflow = [
+ password_strength: 'com.zeoflow:password-strength:1.1.0'
+ ]
+
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..4b8a281
--- /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=-Xmx1536m
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+
+# Jetifier is enabled for dagger in the app.
+android.useAndroidX=true
+android.enableJetifier=true
diff --git a/local.properties b/local.properties
new file mode 100644
index 0000000..60c6b0f
--- /dev/null
+++ b/local.properties
@@ -0,0 +1,8 @@
+## This file must *NOT* be checked into Version Control Systems,
+# as it contains information specific to your local configuration.
+#
+# Location of the SDK. This is only used by Gradle.
+# For customization when using a Version Control System, please read the
+# header note.
+#Mon Aug 24 22:48:52 EEST 2020
+sdk.dir=E\:\\Data\\Android\\Sdk
diff --git a/password-strength/.gitignore b/password-strength/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/password-strength/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/password-strength/build.gradle b/password-strength/build.gradle
new file mode 100644
index 0000000..df323a7
--- /dev/null
+++ b/password-strength/build.gradle
@@ -0,0 +1,26 @@
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion rootProject.ext.compileSdkVersion
+ buildToolsVersion rootProject.ext.buildToolsVersion
+ defaultConfig {
+ minSdkVersion rootProject.ext.minSdkVersion
+ targetSdkVersion rootProject.ext.targetSdkVersion
+ versionCode rootProject.ext.versionCode
+ versionName rootProject.ext.versionName
+ testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
+
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+}
+
+apply from: "${rootProject.projectDir}/password-strength/maven-push.gradle"
diff --git a/password-strength/gradle.properties b/password-strength/gradle.properties
new file mode 100644
index 0000000..7124fca
--- /dev/null
+++ b/password-strength/gradle.properties
@@ -0,0 +1,26 @@
+POM_NAME=PasswordStrength
+POM_ARTIFACT_ID=password-strength
+POM_PACKAGING=aar
+
+VERSION_NAME=1.0.0
+VERSION_CODE=1
+GROUP=com.zeoflow
+
+POM_DESCRIPTION=Password Strength is an Android Library that checks for a password strength.
+POM_URL=https://github.com/zeoflow/password-strength
+POM_SCM_URL=https://github.com/zeoflow/password-strength
+POM_SCM_CONNECTION=scm:git@github.com:zeoflow/password-strength.git
+POM_SCM_DEV_CONNECTION=scm:git@github.com:zeoflow/password-strength.git
+POM_LICENCE_NAME=The Apache Software License, Version 2.0
+POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
+POM_LICENCE_DIST=repo
+POM_DEVELOPER_ID=zeoflow
+POM_DEVELOPER_NAME=ZeoFlow
+
+org.gradle.daemon=true
+
+NEXUS_USERNAME=
+NEXUS_PASSWORD=
+signing.keyId=
+signing.password=
+signing.secretKeyRingFile=
diff --git a/password-strength/maven-push.gradle b/password-strength/maven-push.gradle
new file mode 100644
index 0000000..24dff27
--- /dev/null
+++ b/password-strength/maven-push.gradle
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2020 ZeoFlow
+ *
+ * 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
+ *
+ * http://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.
+ */
+
+apply plugin: 'maven'
+apply plugin: 'signing'
+
+def isReleaseBuild() {
+ return VERSION_NAME.contains("SNAPSHOT") == false
+}
+
+def getReleaseRepositoryUrl() {
+ return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
+ : "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
+}
+
+def getSnapshotRepositoryUrl() {
+ return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
+ : "https://oss.sonatype.org/content/repositories/snapshots/"
+}
+
+def getRepositoryUsername() {
+ return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
+}
+
+def getRepositoryPassword() {
+ return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
+}
+
+afterEvaluate { project ->
+ uploadArchives {
+ repositories {
+ mavenDeployer {
+ beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
+
+ pom.groupId = GROUP
+ pom.artifactId = POM_ARTIFACT_ID
+ pom.version = VERSION_NAME
+
+ repository(url: getReleaseRepositoryUrl()) {
+ authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
+ }
+ snapshotRepository(url: getSnapshotRepositoryUrl()) {
+ authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
+ }
+
+ pom.project {
+ name POM_NAME
+ packaging POM_PACKAGING
+ description POM_DESCRIPTION
+ url POM_URL
+
+ scm {
+ url POM_SCM_URL
+ connection POM_SCM_CONNECTION
+ developerConnection POM_SCM_DEV_CONNECTION
+ }
+
+ licenses {
+ license {
+ name POM_LICENCE_NAME
+ url POM_LICENCE_URL
+ distribution POM_LICENCE_DIST
+ }
+ }
+
+ developers {
+ developer {
+ id POM_DEVELOPER_ID
+ name POM_DEVELOPER_NAME
+ }
+ }
+ }
+ }
+ }
+ }
+
+ signing {
+ required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
+ sign configurations.archives
+ }
+
+ task androidSourcesJar(type: Jar) {
+ classifier = 'sources'
+ from android.sourceSets.main.java.sourceFiles
+ }
+
+ artifacts {
+ archives androidSourcesJar
+ }
+}
diff --git a/password-strength/proguard-rules.pro b/password-strength/proguard-rules.pro
new file mode 100644
index 0000000..5aebc51
--- /dev/null
+++ b/password-strength/proguard-rules.pro
@@ -0,0 +1,25 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /home/mispc1/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 *;
+#}
+
+# 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
diff --git a/password-strength/src/main/AndroidManifest.xml b/password-strength/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..bdff154
--- /dev/null
+++ b/password-strength/src/main/AndroidManifest.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/password-strength/src/main/java/com/zeoflow/password/strength/PasswordModel.java b/password-strength/src/main/java/com/zeoflow/password/strength/PasswordModel.java
new file mode 100644
index 0000000..19df152
--- /dev/null
+++ b/password-strength/src/main/java/com/zeoflow/password/strength/PasswordModel.java
@@ -0,0 +1,30 @@
+package com.zeoflow.password.strength;
+
+public class PasswordModel
+{
+ PasswordType mPasswordType;
+ String mContent;
+ int mColor;
+
+ PasswordModel(PasswordType mPasswordType, String mContent, int mColor)
+ {
+ this.mColor = mColor;
+ this.mContent = mContent;
+ this.mPasswordType = mPasswordType;
+ }
+
+ public int getColor()
+ {
+ return mColor;
+ }
+
+ public PasswordType getPasswordType()
+ {
+ return mPasswordType;
+ }
+
+ public String getContent()
+ {
+ return mContent;
+ }
+}
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
new file mode 100644
index 0000000..cacc968
--- /dev/null
+++ b/password-strength/src/main/java/com/zeoflow/password/strength/PasswordStrength.java
@@ -0,0 +1,104 @@
+package com.zeoflow.password.strength;
+
+import static com.zeoflow.password.strength.PasswordType.MEDIUM;
+import static com.zeoflow.password.strength.PasswordType.STRONG;
+import static com.zeoflow.password.strength.PasswordType.VERY_STRONG;
+import static com.zeoflow.password.strength.PasswordType.WEAK;
+
+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;
+
+ PasswordStrength()
+ {
+
+ }
+
+ public static PasswordStrength initializePassChecker()
+ {
+ return new PasswordStrength();
+ }
+
+ public PasswordType calculateStrength(String password)
+ {
+ int currentScore = 0;
+ boolean sawUpper = false;
+ boolean sawLower = false;
+ boolean sawDigit = false;
+ boolean sawSpecial = false;
+
+ for (int i = 0; i < password.length(); i++)
+ {
+ char c = password.charAt(i);
+
+ if (!sawSpecial && !Character.isLetterOrDigit(c))
+ {
+ currentScore += 1;
+ sawSpecial = true;
+ } else
+ {
+ if (!sawDigit && Character.isDigit(c))
+ {
+ currentScore += 1;
+ sawDigit = true;
+ } else
+ {
+ if (!sawUpper || !sawLower)
+ {
+ if (Character.isUpperCase(c))
+ sawUpper = true;
+ else
+ sawLower = true;
+ if (sawUpper && sawLower)
+ currentScore += 1;
+ }
+ }
+ }
+
+ }
+
+ if (password.length() > REQUIRED_LENGTH)
+ {
+ if ((REQUIRE_SPECIAL_CHARACTERS && !sawSpecial)
+ || (REQUIRE_UPPER_CASE && !sawUpper)
+ || (REQUIRE_LOWER_CASE && !sawLower)
+ || (REQUIRE_DIGITS && !sawDigit))
+ {
+ currentScore = 1;
+ } else
+ {
+ currentScore = 2;
+ if (password.length() > MAXIMUM_LENGTH)
+ {
+ currentScore = 3;
+ }
+ }
+ } else
+ {
+ currentScore = 0;
+ }
+
+ switch (currentScore)
+ {
+ case 0:
+ return WEAK;
+ case 1:
+ return MEDIUM;
+ case 2:
+ return STRONG;
+ case 3:
+ return VERY_STRONG;
+ default:
+ }
+
+ return VERY_STRONG;
+ }
+
+}
diff --git a/password-strength/src/main/java/com/zeoflow/password/strength/PasswordType.java b/password-strength/src/main/java/com/zeoflow/password/strength/PasswordType.java
new file mode 100644
index 0000000..8017f0c
--- /dev/null
+++ b/password-strength/src/main/java/com/zeoflow/password/strength/PasswordType.java
@@ -0,0 +1,9 @@
+package com.zeoflow.password.strength;
+
+public enum PasswordType
+{
+ WEAK,
+ MEDIUM,
+ STRONG,
+ VERY_STRONG
+}
diff --git a/password-strength/src/main/res/values/strings.xml b/password-strength/src/main/res/values/strings.xml
new file mode 100644
index 0000000..47519e4
--- /dev/null
+++ b/password-strength/src/main/res/values/strings.xml
@@ -0,0 +1,6 @@
+
+ Weak
+ Medium
+ Strong
+ Very Strong
+
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..852b84d
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,3 @@
+
+include ':app'
+include ':password-strength'