Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
prashasth-nair committed Oct 16, 2021
1 parent a7b001d commit d1ed565
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 29 deletions.
5 changes: 4 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

# PassGen
![PassGen](app/src/main/res/raw/logo_size_invert.jpg?raw=true)

PassGen is a Modern Password Generator App for android written in java.

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@raw/logo_size"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@raw/logo_size"
android:supportsRtl="true"
android:theme="@style/Theme.PasswordGenrator">
<activity
Expand Down
26 changes: 14 additions & 12 deletions app/src/main/java/com/example/passwordgenrator/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.example.passwordgenrator;

import android.content.res.Configuration;
import android.graphics.PorterDuff;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
Expand All @@ -12,6 +13,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;

import com.google.android.material.slider.Slider;
import com.google.android.material.switchmaterial.SwitchMaterial;
Expand Down Expand Up @@ -42,7 +44,6 @@ protected void onCreate(Bundle savedInstanceState) {
symbols = (SwitchMaterial) findViewById(R.id.symbols);
slider = (Slider) findViewById(R.id.seekBar);
result = (TextView) findViewById(R.id.textView);
// uppercase.setEnabled(false);

final Handler handler = new Handler();
final int delay = 100; // 100 milliseconds == 0.1 second
Expand All @@ -51,6 +52,7 @@ protected void onCreate(Bundle savedInstanceState) {
public void run() {
if (!lowercase.isChecked() && !numbers.isChecked() && !symbols.isChecked()) {
uppercase.setChecked(true);

uppercase.setEnabled(false);
} else {
uppercase.setEnabled(true);
Expand Down Expand Up @@ -82,17 +84,17 @@ public void onClick(View view) {
});
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);

// Checks the orientation of the screen
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show();
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
Toast.makeText(this, "portrait", Toast.LENGTH_SHORT).show();
}
}
// @Override
// public void onConfigurationChanged(Configuration newConfig) {
// super.onConfigurationChanged(newConfig);
//
// // Checks the orientation of the screen
//// if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
//// Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show();
//// } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
//// Toast.makeText(this, "portrait", Toast.LENGTH_SHORT).show();
//// }
// }


public static String generateRandomPassword(int max_length, boolean upperCase, boolean lowerCase, boolean numbers, boolean specialCharacters) {
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/drawable/bg_switch_states.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_checked="true" android:color="@color/main_color"/>
<item android:state_checked="false" android:color="@color/secondary"/>

</selector>
19 changes: 9 additions & 10 deletions app/src/main/res/layout-land/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="20dp"
android:layout_gravity="center"
android:text="@string/password_generator"
android:textColor="@color/white"
android:textSize="24sp"
Expand All @@ -41,7 +41,7 @@
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_height="60dp"
android:layout_marginStart="5dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
Expand All @@ -55,7 +55,7 @@
android:textColor="@color/white"
android:textColorHint="#414E71"
android:textIsSelectable="true"
android:textSize="17sp" />
android:textSize="15sp" />

<TextView
android:id="@+id/textView3"
Expand Down Expand Up @@ -90,7 +90,7 @@

<com.google.android.material.slider.Slider
android:id="@+id/seekBar"
android:layout_width="350dp"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:stepSize="1"
android:value="8"
Expand Down Expand Up @@ -148,8 +148,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:padding="5dp"
android:theme="@style/SwitchTheme"
app:trackTint="@drawable/bg_switch_states"
app:thumbTint="@color/white"

app:track="@drawable/switch_background" />
Expand Down Expand Up @@ -185,8 +184,8 @@
android:id="@+id/lowercase"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:theme="@style/SwitchTheme"
app:trackTint="@drawable/bg_switch_states"
app:thumbTint="@color/white"
app:track="@drawable/switch_background" />
</LinearLayout>
Expand Down Expand Up @@ -221,8 +220,8 @@
android:id="@+id/numbers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:theme="@style/SwitchTheme"
app:trackTint="@drawable/bg_switch_states"
app:thumbTint="@color/white"
app:track="@drawable/switch_background" />
</LinearLayout>
Expand Down Expand Up @@ -257,18 +256,18 @@
android:id="@+id/symbols"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:theme="@style/SwitchTheme"
app:thumbTint="@color/white"
app:trackTint="@drawable/bg_switch_states"
app:track="@drawable/switch_background" />
</LinearLayout>

<Button
android:id="@+id/button"
android:layout_width="300dp"
android:background="@drawable/button_background"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/button_background"
android:text="@string/generate_password" />

</LinearLayout>
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:theme="@style/SwitchTheme"
app:trackTint="@drawable/bg_switch_states"
app:thumbTint="@color/white"

app:track="@drawable/switch_background" />
Expand Down Expand Up @@ -185,6 +185,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:theme="@style/SwitchTheme"
app:trackTint="@drawable/bg_switch_states"
app:thumbTint="@color/white"
app:track="@drawable/switch_background" />
</LinearLayout>
Expand Down Expand Up @@ -220,6 +221,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:theme="@style/SwitchTheme"
app:trackTint="@drawable/bg_switch_states"
app:thumbTint="@color/white"
app:track="@drawable/switch_background" />
</LinearLayout>
Expand Down Expand Up @@ -256,6 +258,7 @@
android:layout_height="wrap_content"
android:theme="@style/SwitchTheme"
app:thumbTint="@color/white"
app:trackTint="@drawable/bg_switch_states"
app:track="@drawable/switch_background" />
</LinearLayout>

Expand Down
Binary file added app/src/main/res/raw/logo_size.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/raw/logo_size_invert.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="main_color">#6200EE</color>
<color name="secondary">#14244C</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<string name="app_name">password generator</string>
<string name="password_generator">Password Generator</string>
<string name="app_name">PassGen</string>
<string name="password_generator">PassGen</string>
<string name="generated_password">GENERATED PASSWORD</string>
<string name="click_generate">Click Generate</string>
<string name="length">LENGTH</string>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
maven { url "https://www.jitpack.io" }
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.2"
classpath 'com.android.tools.build:gradle:7.0.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down

0 comments on commit d1ed565

Please sign in to comment.