app: refactor M3 themes and styles

This commit is contained in:
Harsh Shandilya 2021-11-03 14:22:31 +05:30
parent f8ad1c97fd
commit 88c9a0d487
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
5 changed files with 61 additions and 32 deletions

View file

@ -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>

View file

@ -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() {

View file

@ -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>

View file

@ -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>

View file

@ -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>