Merge pull request #6484 from thundernest/mdc_theme

Switch to MaterialComponents themes
This commit is contained in:
cketti 2022-11-23 19:26:08 +01:00 committed by GitHub
commit 715728bf47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 46 additions and 16 deletions

View file

@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"/>
<com.google.android.material.appbar.MaterialToolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
style="?attr/toolbarStyle"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />

View file

@ -242,7 +242,8 @@ class MessageViewFragment :
intArrayOf(R.attr.iconActionMarkAsRead)
}
requireContext().withStyledAttributes(attrs = drawableAttr) {
val toolbarContext = requireActivity().findViewById<View>(R.id.toolbar).context
toolbarContext.withStyledAttributes(attrs = drawableAttr) {
menu.findItem(R.id.toggle_unread).icon = getDrawable(0)
}
}

View file

@ -8,10 +8,9 @@
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
style="?attr/toolbarStyle"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
tools:navigationIcon="@drawable/ic_arrow_back">
<com.fsck.k9.ui.settings.account.AccountSelectionSpinner

View file

@ -148,6 +148,7 @@
android:textColor="?android:attr/textColorSecondary"
tools:text="Oct 27"/>
<!-- TODO: Replace with an ImageView. MaterialCheckBox comes with a lot of styling that we don't want. -->
<CheckBox
android:id="@+id/star"
style="@style/MessageStarStyle"

View file

@ -2,6 +2,7 @@
<resources>
<declare-styleable name="K9Styles">
<attr name="toolbarColor" format="reference|color" />
<attr name="bottomBarBackground" format="reference|color" />
<attr name="iconUnifiedInbox" format="reference" />
<attr name="iconFolder" format="reference" />

View file

@ -107,5 +107,17 @@
<item name="android:layout_width">match_parent</item>
</style>
<style name="Widget.K9.Toolbar" parent="Widget.MaterialComponents.Toolbar.Primary">
<item name="android:background">?attr/toolbarColor</item>
<item name="titleTextColor">?android:attr/textColorPrimary</item>
<item name="subtitleTextColor">?android:attr/textColorSecondary</item>
<item name="android:theme">@style/ThemeOverlay.K9.Toolbar</item>
</style>
<style name="ThemeOverlay.K9.Toolbar" parent="">
<item name="colorControlNormal">?android:attr/textColorSecondary</item>
<item name="actionMenuTextColor">?android:attr/textColorSecondary</item>
</style>
</resources>

View file

@ -6,17 +6,26 @@
</style>
<!-- Empty base themes that can be easily replaced by RRO (Runtime Resource Overlay) themes -->
<style name="Theme.K9.Light.Base" parent="Theme.MaterialComponents.Light.NoActionBar.Bridge" />
<style name="Theme.K9.Dark.Base" parent="Theme.MaterialComponents.NoActionBar.Bridge" />
<style name="Theme.K9.Light.Base" parent="Theme.MaterialComponents.Light.NoActionBar" />
<style name="Theme.K9.Dark.Base" parent="Theme.MaterialComponents.NoActionBar" />
<style name="Theme.K9.Light.Common" parent="Theme.K9.Light.Base">
<item name="windowActionModeOverlay">true</item>
<item name="android:windowLightStatusBar" tools:targetApi="23">true</item>
<item name="colorPrimary">@color/material_gray_100</item>
<item name="colorPrimaryDark">@color/material_gray_100</item>
<item name="android:statusBarColor">@color/material_gray_100</item>
<item name="toolbarColor">@color/material_gray_100</item>
<item name="colorPrimary">@color/material_blue_600</item>
<item name="colorPrimaryVariant">@color/material_blue_800</item>
<item name="colorSecondary">@color/material_pink_400</item>
<item name="colorSecondaryVariant">@color/material_pink_200</item>
<item name="bottomBarBackground">@color/material_gray_50</item>
<item name="toolbarStyle">@style/Widget.K9.Toolbar</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
<item name="textInputStyle">?attr/textInputOutlinedStyle</item>
<item name="iconUnifiedInbox">@drawable/ic_inbox_multiple</item>
<item name="iconFolder">@drawable/ic_folder</item>
<item name="iconFolderInbox">@drawable/ic_inbox</item>
@ -155,12 +164,21 @@
<style name="Theme.K9.Dark.Common" parent="Theme.K9.Dark.Base">
<item name="android:navigationBarColor">#000000</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:windowLightStatusBar" tools:targetApi="23">false</item>
<item name="colorPrimary">@color/material_gray_900</item>
<item name="colorPrimaryDark">@color/material_gray_900</item>
<item name="android:statusBarColor">@color/material_gray_900</item>
<item name="toolbarColor">@color/material_gray_900</item>
<item name="colorPrimary">@color/material_blue_400</item>
<item name="colorPrimaryVariant">@color/material_blue_600</item>
<item name="colorSecondary">@color/material_pink_300</item>
<item name="colorSecondaryVariant">@color/material_pink_500</item>
<item name="bottomBarBackground">@color/material_gray_900</item>
<item name="toolbarStyle">@style/Widget.K9.Toolbar</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
<item name="textInputStyle">?attr/textInputOutlinedStyle</item>
<item name="iconUnifiedInbox">@drawable/ic_inbox_multiple</item>
<item name="iconFolder">@drawable/ic_folder</item>
<item name="iconFolderInbox">@drawable/ic_inbox</item>