aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2021-11-03 14:22:31 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2021-11-03 15:51:46 +0530
commit88c9a0d487cae916477ad733cea6786d442cfa5e (patch)
tree9d82f927325a7cc21a186973b90b22565ab93158 /app/src/main
parentf8ad1c97fdcc850c8bc592e17b80108a3fc661e8 (diff)
app: refactor M3 themes and styles
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/AndroidManifest.xml22
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/dialogs/ItemCreationBottomSheet.kt7
-rw-r--r--app/src/main/res/values-night/themes_material3.xml5
-rw-r--r--app/src/main/res/values/styles_material3.xml12
-rw-r--r--app/src/main/res/values/themes_material3.xml47
5 files changed, 61 insertions, 32 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 99301d11..c3ff6302 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -28,7 +28,7 @@
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
- android:theme="@style/APSThemeM3"
+ android:theme="@style/AppThemeM3"
tools:ignore="GoogleAppIndexingWarning">
<activity
@@ -51,7 +51,7 @@
android:name=".ui.main.LaunchActivity"
android:configChanges="orientation|screenSize"
android:exported="true"
- android:theme="@style/NoBackgroundTheme">
+ android:theme="@style/NoBackgroundThemeM3">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@@ -87,7 +87,7 @@
<activity
android:name=".ui.settings.DirectorySelectionActivity"
- android:theme="@style/NoBackgroundTheme" />
+ android:theme="@style/NoBackgroundThemeM3" />
<activity
android:name=".ui.crypto.PasswordCreationActivity"
@@ -105,7 +105,7 @@
<activity
android:name=".ui.crypto.GetKeyIdsActivity"
- android:theme="@style/NoBackgroundTheme" />
+ android:theme="@style/NoBackgroundThemeM3" />
<service
android:name=".util.services.ClipboardService"
@@ -128,7 +128,7 @@
<activity android:name=".ui.folderselect.SelectFolderActivity" />
<activity
android:name=".ui.sshkeygen.SshKeyImportActivity"
- android:theme="@style/NoBackgroundTheme"
+ android:theme="@style/NoBackgroundThemeM3"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".ui.sshkeygen.SshKeyGenActivity"
@@ -136,27 +136,27 @@
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".ui.autofill.AutofillDecryptActivity"
- android:theme="@style/NoBackgroundTheme" />
+ android:theme="@style/NoBackgroundThemeM3" />
<activity
android:name=".ui.autofill.AutofillDecryptActivityV2"
- android:theme="@style/NoBackgroundTheme" />
+ android:theme="@style/NoBackgroundThemeM3" />
<activity
android:name=".ui.autofill.AutofillFilterView"
android:configChanges="orientation|keyboardHidden"
- android:theme="@style/DialogLikeTheme"
+ android:theme="@style/DialogLikeThemeM3"
android:windowSoftInputMode="adjustNothing" />
<activity
android:name=".ui.autofill.AutofillSaveActivity"
- android:theme="@style/NoBackgroundTheme" />
+ android:theme="@style/NoBackgroundThemeM3" />
<activity
android:name=".autofill.oreo.ui.AutofillSmsActivity"
android:configChanges="orientation"
- android:theme="@style/DialogLikeTheme"
+ android:theme="@style/DialogLikeThemeM3"
android:windowSoftInputMode="adjustNothing" />
<activity
android:name=".ui.autofill.AutofillPublisherChangedActivity"
android:configChanges="orientation|keyboardHidden"
- android:theme="@style/DialogLikeTheme"
+ android:theme="@style/DialogLikeThemeM3"
android:windowSoftInputMode="adjustNothing" />
</application>
diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/dialogs/ItemCreationBottomSheet.kt b/app/src/main/java/dev/msfjarvis/aps/ui/dialogs/ItemCreationBottomSheet.kt
index cb693d28..af2a5f19 100644
--- a/app/src/main/java/dev/msfjarvis/aps/ui/dialogs/ItemCreationBottomSheet.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/ui/dialogs/ItemCreationBottomSheet.kt
@@ -4,7 +4,6 @@
*/
package dev.msfjarvis.aps.ui.dialogs
-import android.graphics.drawable.GradientDrawable
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
@@ -21,7 +20,6 @@ import dev.msfjarvis.aps.ui.passwords.PasswordFragment.Companion.ACTION_FOLDER
import dev.msfjarvis.aps.ui.passwords.PasswordFragment.Companion.ACTION_KEY
import dev.msfjarvis.aps.ui.passwords.PasswordFragment.Companion.ACTION_PASSWORD
import dev.msfjarvis.aps.ui.passwords.PasswordFragment.Companion.ITEM_CREATION_REQUEST_KEY
-import dev.msfjarvis.aps.util.extensions.resolveAttribute
class ItemCreationBottomSheet : BottomSheetDialogFragment() {
@@ -70,11 +68,6 @@ class ItemCreationBottomSheet : BottomSheetDialogFragment() {
}
}
)
- val gradientDrawable =
- GradientDrawable().apply {
- setColor(requireContext().resolveAttribute(android.R.attr.windowBackground))
- }
- view.background = gradientDrawable
}
override fun dismiss() {
diff --git a/app/src/main/res/values-night/themes_material3.xml b/app/src/main/res/values-night/themes_material3.xml
index 6f56863a..a06aefe8 100644
--- a/app/src/main/res/values-night/themes_material3.xml
+++ b/app/src/main/res/values-night/themes_material3.xml
@@ -32,10 +32,5 @@
<item name="colorOnSurfaceInverse">@color/md_theme_dark_inverseOnSurface</item>
<item name="colorSurfaceInverse">@color/md_theme_dark_inverseSurface</item>
<item name="colorPrimaryInverse">@color/md_theme_dark_primaryInverse</item>
- <item name="fontFamily">@font/manrope</item>
- <item name="android:windowLightStatusBar">@bool/light_status_bar</item>
- <item name="android:statusBarColor">?android:colorBackground</item>
- <item name="android:navigationBarColor">?android:colorBackground</item>
- <item name="toolbarStyle">@style/APSThemeM3.Toolbar</item>
</style>
</resources>
diff --git a/app/src/main/res/values/styles_material3.xml b/app/src/main/res/values/styles_material3.xml
new file mode 100644
index 00000000..f855b826
--- /dev/null
+++ b/app/src/main/res/values/styles_material3.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ ~ Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
+ ~ SPDX-License-Identifier: GPL-3.0-only
+ -->
+
+<resources>
+
+ <style name="APSThemeM3.Toolbar" parent="Widget.Material3.Toolbar">
+ <item name="android:background">?android:colorBackground</item>
+ </style>
+
+</resources>
diff --git a/app/src/main/res/values/themes_material3.xml b/app/src/main/res/values/themes_material3.xml
index 19ee0fc1..428a4699 100644
--- a/app/src/main/res/values/themes_material3.xml
+++ b/app/src/main/res/values/themes_material3.xml
@@ -5,6 +5,44 @@
<resources>
+ <style name="AppThemeM3" parent="APSThemeM3">
+ <item name="fontFamily">@font/manrope</item>
+ <item name="android:windowLightStatusBar">@bool/light_status_bar</item>
+ <item name="android:statusBarColor">?android:colorBackground</item>
+ <item name="android:navigationBarColor">?android:colorBackground</item>
+ <item name="toolbarStyle">@style/APSThemeM3.Toolbar</item>
+ <item name="bottomSheetDialogTheme">@style/APSThemeM3.BottomSheetDialog</item>
+ </style>
+
+ <style name="NoBackgroundThemeM3" parent="@style/AppThemeM3">
+ <item name="android:background">@android:color/transparent</item>
+ <item name="android:backgroundDimEnabled">true</item>
+ <item name="android:navigationBarColor">@android:color/transparent</item>
+ <item name="android:statusBarColor">@android:color/transparent</item>
+ <item name="android:windowIsTranslucent">true</item>
+ <item name="android:windowContentOverlay">@null</item>
+ <item name="android:windowActionBar">false</item>
+ <item name="android:windowBackground">@android:color/transparent</item>
+ <item name="android:windowEnterAnimation">@android:anim/fade_in</item>
+ <item name="android:windowExitAnimation">@android:anim/fade_out</item>
+ <item name="colorPrimaryDark">@android:color/transparent</item>
+ <item name="windowNoTitle">true</item>
+ </style>
+
+ <style name="DialogLikeThemeM3" parent="AppThemeM3">
+ <item name="android:windowActionBar">false</item>
+ <item name="android:windowIsFloating">true</item>
+ <item name="android:backgroundDimEnabled">true</item>
+ <!-- Needs to be set without android: prefix as per https://stackoverflow.com/a/33417456 -->
+ <item name="windowNoTitle">true</item>
+ </style>
+
+ <style name="APSThemeM3.BottomSheetDialog" parent="ThemeOverlay.Material3.BottomSheetDialog">
+ <item name="android:windowIsFloating">false</item>
+ <item name="android:statusBarColor">@android:color/transparent</item>
+ <item name="android:navigationBarColor">@android:color/transparent</item>
+ </style>
+
<style name="APSThemeM3" parent="Theme.Material3.DayNight">
<item name="colorPrimary">@color/md_theme_light_primary</item>
<item name="colorOnPrimary">@color/md_theme_light_onPrimary</item>
@@ -32,14 +70,5 @@
<item name="colorOnSurfaceInverse">@color/md_theme_light_inverseOnSurface</item>
<item name="colorSurfaceInverse">@color/md_theme_light_inverseSurface</item>
<item name="colorPrimaryInverse">@color/md_theme_light_primaryInverse</item>
- <item name="fontFamily">@font/manrope</item>
- <item name="android:windowLightStatusBar">@bool/light_status_bar</item>
- <item name="android:statusBarColor">?android:colorBackground</item>
- <item name="android:navigationBarColor">?android:colorBackground</item>
- <item name="toolbarStyle">@style/APSThemeM3.Toolbar</item>
- </style>
-
- <style name="APSThemeM3.Toolbar" parent="Widget.Material3.Toolbar">
- <item name="android:background">?android:colorBackground</item>
</style>
</resources>