mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-04 20:30:36 +00:00
Add lockscreen overhaul
This commit is contained in:
parent
95d5b4afa1
commit
4f6035dc49
9 changed files with 174 additions and 54 deletions
|
@ -59,7 +59,8 @@
|
|||
<activity
|
||||
android:name=".ui.IntroActivity"
|
||||
android:theme="@style/Theme.Intro" />
|
||||
<activity android:name=".ui.AuthActivity" />
|
||||
<activity android:name=".ui.AuthActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ui.PreferencesActivity"
|
||||
android:label="@string/title_activity_preferences" />
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.beemdevelopment.aegis.ui;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
|
@ -14,6 +15,7 @@ import android.widget.Button;
|
|||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
@ -24,6 +26,7 @@ import com.beemdevelopment.aegis.AegisApplication;
|
|||
import com.beemdevelopment.aegis.CancelAction;
|
||||
import com.beemdevelopment.aegis.Preferences;
|
||||
import com.beemdevelopment.aegis.R;
|
||||
import com.beemdevelopment.aegis.Theme;
|
||||
import com.beemdevelopment.aegis.crypto.KeyStoreHandle;
|
||||
import com.beemdevelopment.aegis.crypto.KeyStoreHandleException;
|
||||
import com.beemdevelopment.aegis.crypto.MasterKey;
|
||||
|
@ -68,7 +71,7 @@ public class AuthActivity extends AegisActivity {
|
|||
_textPassword = findViewById(R.id.text_password);
|
||||
LinearLayout boxBiometricInfo = findViewById(R.id.box_biometric_info);
|
||||
Button decryptButton = findViewById(R.id.button_decrypt);
|
||||
Button biometricsButton = findViewById(R.id.button_biometrics);
|
||||
TextView biometricsButton = findViewById(R.id.button_biometrics);
|
||||
|
||||
_textPassword.setOnEditorActionListener((v, actionId, event) -> {
|
||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
|
||||
|
@ -126,6 +129,7 @@ public class AuthActivity extends AegisActivity {
|
|||
// display a help message if a matching invalidated keystore entry was found
|
||||
if (invalidated) {
|
||||
boxBiometricInfo.setVisibility(View.VISIBLE);
|
||||
biometricsButton.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,6 +148,34 @@ public class AuthActivity extends AegisActivity {
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setPreferredTheme(Theme theme) {
|
||||
if (theme == Theme.SYSTEM || theme == Theme.SYSTEM_AMOLED) {
|
||||
// set the theme based on the system theme
|
||||
int currentNightMode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
switch (currentNightMode) {
|
||||
case Configuration.UI_MODE_NIGHT_NO:
|
||||
theme = Theme.LIGHT;
|
||||
break;
|
||||
case Configuration.UI_MODE_NIGHT_YES:
|
||||
theme = theme == Theme.SYSTEM_AMOLED ? Theme.AMOLED : Theme.DARK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (theme) {
|
||||
case LIGHT:
|
||||
setTheme(R.style.AppTheme_Light_NoActionBar);
|
||||
break;
|
||||
case DARK:
|
||||
setTheme(R.style.AppTheme_Dark_NoActionBar);
|
||||
break;
|
||||
case AMOLED:
|
||||
setTheme(R.style.AppTheme_TrueBlack_NoActionBar);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void selectPassword() {
|
||||
_textPassword.selectAll();
|
||||
|
||||
|
|
11
app/src/main/res/drawable/button_rounded_corners.xml
Normal file
11
app/src/main/res/drawable/button_rounded_corners.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/auth_button"/>
|
||||
<stroke android:color="@color/auth_button" android:width="1dp" />
|
||||
<!--corners allow us to make the rounded corners button-->
|
||||
<corners android:radius="4dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
BIN
app/src/main/res/drawable/ic_aegis_iconx.png
Normal file
BIN
app/src/main/res/drawable/ic_aegis_iconx.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
|
@ -7,37 +7,44 @@
|
|||
android:fitsSystemWindows="true"
|
||||
android:background="?attr/background"
|
||||
tools:context="com.beemdevelopment.aegis.ui.AuthActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/linearLayout2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="32dp"
|
||||
tools:layout_editor_absoluteY="8dp"
|
||||
tools:layout_editor_absoluteX="8dp">
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="48dp"
|
||||
android:orientation="vertical"
|
||||
tools:layout_editor_absoluteX="8dp"
|
||||
tools:layout_editor_absoluteY="8dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
app:srcCompat="@drawable/ic_aegis_iconx" />
|
||||
|
||||
<TextView
|
||||
android:text="@string/authentication"
|
||||
android:textColor="?attr/primaryText"
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="24sp"
|
||||
android:id="@+id/textView2" />
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:singleLine="false"
|
||||
android:text="@string/authentication_multiline"
|
||||
android:textColor="?attr/authText"
|
||||
android:textFontWeight="500"
|
||||
android:textSize="46sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="12dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/authentication_enter_password"
|
||||
android:textColor="?attr/secondaryText" />
|
||||
android:layout_marginTop="12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="25dp"
|
||||
app:hintEnabled="false"
|
||||
app:passwordToggleEnabled="true"
|
||||
app:passwordToggleTint="#949494">
|
||||
|
@ -46,48 +53,72 @@
|
|||
android:id="@+id/text_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textPassword" />
|
||||
android:hint="@string/password"
|
||||
android:inputType="textPassword"
|
||||
android:textColor="?attr/primaryText"
|
||||
android:textColorHint="?attr/authText"
|
||||
app:backgroundTint="?attr/authText" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="25dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_decrypt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/button_rounded_corners"
|
||||
android:minWidth="125dp"
|
||||
android:text="@string/unlock" />
|
||||
<Button
|
||||
android:id="@+id/button_biometrics"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="125dp"
|
||||
android:text="@string/biometrics"
|
||||
android:visibility="gone" />
|
||||
android:text="@string/unlock"
|
||||
android:textColor="@color/primary_text_inverted"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/box_biometric_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="12dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
<TextView
|
||||
android:id="@+id/button_biometrics"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_info_outline_black_24dp"
|
||||
android:layout_marginEnd="15dp"/>
|
||||
android:layout_gravity="center"
|
||||
android:minWidth="125dp"
|
||||
android:text="@string/auth_use_biometrics"
|
||||
android:textColor="?attr/authText"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
<LinearLayout
|
||||
android:id="@+id/box_biometric_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/invalidated_biometrics"/>
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ic_info_outline_black_24dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/invalidated_biometrics" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center"
|
||||
android:textStyle="bold"
|
||||
android:textAllCaps="true"
|
||||
android:text="@string/app_name_full"
|
||||
android:paddingBottom="50dp"
|
||||
android:textColor="@color/divider" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<resources>
|
||||
<attr name="primaryText" format="color" />
|
||||
<attr name="secondaryText" format="color" />
|
||||
<attr name="authText" format="color" />
|
||||
<attr name="backgroundColor" format="color" />
|
||||
<attr name="cardBackground" format="color" />
|
||||
<attr name="cardBackgroundFocused" format="color" />
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
<color name="colorAccentPressed">#FF5252</color>
|
||||
<color name="primary_text">#212121</color>
|
||||
<color name="secondary_text">#A0A0A0</color>
|
||||
<color name="auth_text">#4c4c4c</color>
|
||||
<color name="auth_button">#0d86c1</color>
|
||||
<color name="icon_about">#757575</color>
|
||||
<color name="extra_info_text">#8e8e8e</color>
|
||||
<color name="primary_text_inverted">#ffffff</color>
|
||||
|
@ -34,6 +36,7 @@
|
|||
<color name="hint_text_dark">#a7a7a7</color>
|
||||
<color name="secondary_text_dark">#FF5252</color>
|
||||
<color name="background_dark">#212121</color>
|
||||
<color name="background_dark_statusbar">#101010</color>
|
||||
<color name="background_true_dark">#000000</color>
|
||||
|
||||
<color name="warning_color">#f4511e</color>
|
||||
|
|
|
@ -72,6 +72,11 @@
|
|||
<string name="authentication_method_set_password">Password</string>
|
||||
<string name="authentication_enter_password">Enter your password</string>
|
||||
<string name="authentication">Unlock the vault</string>
|
||||
|
||||
<!-- The newline (\n) on the following line is just for aesthetic purposes !-->
|
||||
<string name="authentication_multiline">Unlock\nthe vault</string>
|
||||
|
||||
<string name="auth_use_biometrics">Or tap here to use <font fgcolor='#FF0D86C1'>biometrics</font></string>
|
||||
<string name="set_password">Please enter a password</string>
|
||||
<string name="set_group">Please enter a group name</string>
|
||||
<string name="set_number">Please enter a number</string>
|
||||
|
|
|
@ -41,6 +41,47 @@
|
|||
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Light.NoActionBar" parent="AppTheme">
|
||||
<item name="android:statusBarColor">@color/background</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="primaryText">@color/primary_text</item>
|
||||
<item name="background">@color/card_background</item>
|
||||
<item name="authText">@color/auth_text</item>
|
||||
|
||||
<item name="android:navigationBarColor" tools:targetApi="o_mr1">@color/background</item>
|
||||
<item name="android:windowLightStatusBar" tools:targetApi="o_mr1">true</item>
|
||||
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Dark.NoActionBar" parent="AppTheme">
|
||||
<item name="android:statusBarColor">@color/background_dark_statusbar</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="primaryText">@color/primary_text_dark</item>
|
||||
<item name="background">@color/background_dark</item>
|
||||
<item name="authText">@color/primary_text_inverted</item>
|
||||
|
||||
<item name="android:navigationBarColor" tools:targetApi="o_mr1">@color/background_dark</item>
|
||||
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.TrueBlack.NoActionBar" parent="AppTheme">
|
||||
<item name="android:statusBarColor">@color/background_true_dark</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="primaryText">@color/primary_text_dark</item>
|
||||
<item name="background">@color/background_true_dark</item>
|
||||
<item name="authText">@color/primary_text_inverted</item>
|
||||
|
||||
<item name="android:navigationBarColor" tools:targetApi="lollipop">@color/background_true_dark</item>
|
||||
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">false</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="ActionModeStyle" parent="@style/Widget.AppCompat.Light.ActionMode.Inverse">
|
||||
<item name="background">@color/colorPrimary</item>
|
||||
<item name="titleTextStyle">@style/ActionModeTitleTextStyle</item>
|
||||
|
@ -125,11 +166,6 @@
|
|||
<item name="android:windowBackground">@color/background_true_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Dark.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Dark.TransparentActionBar">
|
||||
<item name="android:actionBarStyle">@style/ThemeActionBar</item>
|
||||
<item name="android:windowActionBarOverlay">true</item>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue