Initial pass of Material 3 styling

Adjustments/fixes to follow.
This commit is contained in:
arkon 2021-10-19 17:41:59 -04:00
parent 41952f0215
commit a8a761aa5f
15 changed files with 45 additions and 102 deletions

View File

@ -19,7 +19,6 @@ import eu.kanade.tachiyomi.ui.library.setting.SortModeSetting
import eu.kanade.tachiyomi.ui.reader.setting.OrientationType
import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType
import eu.kanade.tachiyomi.util.system.MiuiUtil
import eu.kanade.tachiyomi.util.system.isTablet
import eu.kanade.tachiyomi.widget.ExtendedNavigationView
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.onEach

View File

@ -38,7 +38,6 @@ import eu.kanade.tachiyomi.util.preference.switchPreference
import eu.kanade.tachiyomi.util.preference.titleRes
import eu.kanade.tachiyomi.util.system.MiuiUtil
import eu.kanade.tachiyomi.util.system.isPackageInstalled
import eu.kanade.tachiyomi.util.system.isTablet
import eu.kanade.tachiyomi.util.system.powerManager
import eu.kanade.tachiyomi.util.system.toast
import uy.kohesive.injekt.injectLazy

View File

@ -15,7 +15,7 @@ import androidx.core.view.forEach
import androidx.core.view.get
import com.tfcporciuncula.flow.Preference
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.databinding.SpinnerPreferenceBinding
import eu.kanade.tachiyomi.databinding.PrefSpinnerBinding
import eu.kanade.tachiyomi.util.system.getResourceColor
class MaterialSpinnerView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
@ -46,7 +46,7 @@ class MaterialSpinnerView @JvmOverloads constructor(context: Context, attrs: Att
}
}
private val binding = SpinnerPreferenceBinding.inflate(LayoutInflater.from(context), this, false)
private val binding = PrefSpinnerBinding.inflate(LayoutInflater.from(context), this, false)
init {
addView(binding.root)

View File

@ -7,7 +7,8 @@
android:layout_height="wrap_content"
app:cardBackgroundColor="?android:attr/colorBackground"
app:cardElevation="0dp"
app:cardForegroundColor="@color/draggable_card_foreground">
app:cardForegroundColor="@color/draggable_card_foreground"
app:strokeWidth="0dp">
<LinearLayout
android:layout_width="match_parent"

View File

@ -6,7 +6,6 @@
android:paddingVertical="16dp">
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:id="@+id/text_field"
android:layout_width="match_parent"
android:layout_height="wrap_content">

View File

@ -8,7 +8,8 @@
android:layout_marginTop="8dp"
app:cardBackgroundColor="?android:attr/colorBackground"
app:cardElevation="0dp"
app:cardForegroundColor="@color/draggable_card_foreground">
app:cardForegroundColor="@color/draggable_card_foreground"
app:strokeWidth="0dp">
<LinearLayout
android:layout_width="match_parent"

View File

@ -1,57 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<eu.kanade.tachiyomi.widget.ElevationAppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@+id/downloaded_only"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorTertiary"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="4dp"
android:text="@string/label_downloaded_only"
android:textColor="?attr/colorOnTertiary" />
</FrameLayout>
<FrameLayout
android:id="@+id/incognito_mode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="4dp"
android:text="@string/pref_incognito_mode"
android:textColor="?attr/colorOnPrimary" />
</FrameLayout>
</eu.kanade.tachiyomi.widget.ElevationAppBarLayout>

View File

@ -10,7 +10,7 @@
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/nav_view_item_wrapper"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox.Dense"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"

View File

@ -10,7 +10,6 @@
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
style="@style/TextAppearance.MaterialComponents.Body2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
@ -26,7 +25,6 @@
<com.google.android.material.textview.MaterialTextView
android:id="@+id/details"
style="@style/TextAppearance.MaterialComponents.Body2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:maxLines="1"

View File

@ -121,7 +121,7 @@
android:maxLines="2"
android:layout_marginTop="4dp"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.MaterialComponents.Caption"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
tools:text="Theme Name" />
</LinearLayout>

View File

@ -14,6 +14,7 @@
android:layout_height="48dp"
app:cardBackgroundColor="#2E51A2"
app:cardElevation="0dp"
app:strokeWidth="0dp"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.MaterialCardView.Tracker">
<ImageView

View File

@ -22,6 +22,7 @@
android:layout_height="48dp"
app:cardBackgroundColor="#2E51A2"
app:cardElevation="0dp"
app:strokeWidth="0dp"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.MaterialCardView.Tracker">
<ImageView

View File

@ -30,7 +30,7 @@
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/title_input"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="12dp"

View File

@ -5,7 +5,7 @@
<!--Toolbars-->
<!--========-->
<style name="ThemeOverlay.Tachiyomi.ActionBar" parent="ThemeOverlay.MaterialComponents.ActionBar">
<style name="ThemeOverlay.Tachiyomi.ActionBar" parent="ThemeOverlay.Material3.ActionBar">
<item name="android:colorControlHighlight">?attr/rippleColorToolbar</item>
</style>
@ -30,7 +30,7 @@
<!--===========-->
<!--AlertDialog-->
<!--===========-->
<style name="ThemeOverlay.Tachiyomi.MaterialAlertDialog" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog">
<style name="ThemeOverlay.Tachiyomi.MaterialAlertDialog" parent="ThemeOverlay.Material3.MaterialAlertDialog">
<item name="android:background">?attr/colorSurface</item>
<item name="android:textColorPrimary">?attr/colorOnSurface</item>
<item name="android:textColor">?attr/colorOnSurface</item>
@ -41,12 +41,12 @@
<!--BottomSheet-->
<!--===========-->
<style name="ThemeOverlay.Tachiyomi.BottomSheetDialog" parent="ThemeOverlay.MaterialComponents.BottomSheetDialog">
<style name="ThemeOverlay.Tachiyomi.BottomSheetDialog" parent="ThemeOverlay.Material3.BottomSheetDialog">
<item name="bottomSheetStyle">@style/Widget.Tachiyomi.BottomSheet.Modal</item>
<item name="android:windowAnimationStyle">@style/Animation.Tachiyomi.BottomSheetDialog</item>
</style>
<style name="Widget.Tachiyomi.BottomSheet.Modal" parent="Widget.MaterialComponents.BottomSheet.Modal">
<style name="Widget.Tachiyomi.BottomSheet.Modal" parent="Widget.Material3.BottomSheet.Modal">
<item name="shapeAppearanceOverlay">@style/ShapeAppearanceOverlay.Tachiyomi.BottomSheet</item>
</style>
@ -67,23 +67,19 @@
<!--===============-->
<!--Text Appearance-->
<!--===============-->
<style name="TextAppearance.Widget.Button" parent="TextAppearance.MaterialComponents.Subtitle2" />
<style name="TextAppearance.Widget.Button" parent="TextAppearance.Material3.TitleSmall" />
<style name="TextAppearance.Widget.Menu" parent="TextAppearance.AppCompat.Menu">
<item name="android:textColor">?attr/colorOnBackground</item>
</style>
<style name="TextAppearance.Tachiyomi.ActionMode.Title" parent="TextAppearance.MaterialComponents.Headline6">
<style name="TextAppearance.Tachiyomi.ActionMode.Title" parent="TextAppearance.Material3.HeadlineSmall">
<item name="android:textColor">?attr/colorOnToolbar</item>
</style>
<style name="TextAppearance.Tachiyomi.Preference.Secondary" parent="TextAppearance.MaterialComponents.Body2">
<item name="android:textSize">13sp</item>
</style>
<style name="TextAppearance.Tachiyomi.Preference.Secondary" parent="TextAppearance.Material3.BodySmall" />
<style name="TextAppearance.Tachiyomi.SectionHeader" parent="TextAppearance.MaterialComponents.Subtitle2">
<item name="textAllCaps">true</item>
<item name="android:letterSpacing">0.0357142857</item>
<style name="TextAppearance.Tachiyomi.SectionHeader" parent="TextAppearance.Material3.LabelLarge">
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
@ -115,16 +111,16 @@
</style>
<style name="Widget.Tachiyomi.Snackbar" parent="Widget.MaterialComponents.Snackbar">
<style name="Widget.Tachiyomi.Snackbar" parent="Widget.Material3.Snackbar">
<item name="android:background">@drawable/snackbar_background</item>
<item name="actionTextColorAlpha">1</item>
</style>
<style name="Widget.Tachiyomi.Snackbar.TextView" parent="Widget.MaterialComponents.Snackbar.TextView">
<style name="Widget.Tachiyomi.Snackbar.TextView" parent="Widget.Material3.Snackbar.TextView">
<item name="android:textColor">?attr/colorOnSurface</item>
</style>
<style name="Widget.Tachiyomi.Chip.Action" parent="Widget.MaterialComponents.Chip.Action">
<style name="Widget.Tachiyomi.Chip.Action" parent="Widget.Material3.Chip.Suggestion">
<item name="chipBackgroundColor">?attr/chipBackgroundColor</item>
<item name="android:textColor">?attr/chipTextColor</item>
<item name="rippleColor">?attr/colorControlHighlight</item>
@ -134,7 +130,6 @@
<item name="android:focusable">true</item>
<!-- Smaller text/height -->
<item name="chipCornerRadius">12dp</item>
<item name="chipMinHeight">24dp</item>
<item name="android:textAppearance">?attr/textAppearanceCaption</item>
@ -143,7 +138,7 @@
</style>
<style name="Widget.Tachiyomi.CircularProgressIndicator.Small" parent="Widget.MaterialComponents.CircularProgressIndicator">
<style name="Widget.Tachiyomi.CircularProgressIndicator.Small" parent="Widget.Material3.CircularProgressIndicator">
<item name="indicatorSize">16dp</item>
<item name="trackThickness">2dp</item>
</style>
@ -152,7 +147,7 @@
<!--==============-->
<!--Widgets.Button-->
<!--==============-->
<style name="Widget.Tachiyomi.Button.ActionButton" parent="Widget.MaterialComponents.Button.TextButton.Icon">
<style name="Widget.Tachiyomi.Button.ActionButton" parent="Widget.Material3.Button.TextButton.Icon">
<item name="iconGravity">top</item>
<item name="iconTint">@color/button_action_selector</item>
<item name="iconPadding">4dp</item>
@ -160,7 +155,7 @@
<item name="android:textSize">12sp</item>
</style>
<style name="Widget.Tachiyomi.Button.InlineButton" parent="Widget.MaterialComponents.Button.TextButton">
<style name="Widget.Tachiyomi.Button.InlineButton" parent="Widget.Material3.Button.TextButton">
<item name="android:minHeight">0dp</item>
<item name="android:minWidth">0dp</item>
<item name="android:paddingTop">0dp</item>
@ -173,13 +168,13 @@
<item name="rippleColor">@null</item>
</style>
<style name="Widget.Tachiyomi.Button.OutlinedButton" parent="Widget.MaterialComponents.Button.OutlinedButton" />
<style name="Widget.Tachiyomi.Button.OutlinedButton" parent="Widget.Material3.Button.OutlinedButton" />
<!--=================-->
<!--Widgets.TabLayout-->
<!--=================-->
<style name="Widget.Tachiyomi.TabLayout" parent="Widget.MaterialComponents.TabLayout">
<style name="Widget.Tachiyomi.TabLayout" parent="Widget.Material3.TabLayout">
<item name="tabGravity">center</item>
<item name="tabIndicator">@drawable/tab_indicator</item>
<item name="tabIndicatorFullWidth">false</item>
@ -190,10 +185,11 @@
<item name="tabRippleColor">@color/ripple_toolbar_fainter</item>
</style>
<!--==============-->
<!--Widgets.Switch-->
<!--==============-->
<style name="Widget.Tachiyomi.Switch" parent="Widget.MaterialComponents.CompoundButton.Switch">
<style name="Widget.Tachiyomi.Switch" parent="Widget.Material3.CompoundButton.Switch">
<item name="materialThemeOverlay">@style/ThemeOverlay.Tachiyomi.Switch</item>
</style>
@ -204,7 +200,7 @@
<!--==============-->
<!--Widgets.Slider-->
<!--==============-->
<style name="Widget.Tachiyomi.Slider" parent="Widget.MaterialComponents.Slider">
<style name="Widget.Tachiyomi.Slider" parent="Widget.Material3.Slider">
<item name="labelBehavior">gone</item>
<item name="tickVisible">false</item>
</style>
@ -213,12 +209,16 @@
<!--================-->
<!--Navigation Views-->
<!--================-->
<style name="Widget.Tachiyomi.BottomNavigationView" parent="Widget.MaterialComponents.BottomNavigationView">
<style name="Widget.Tachiyomi.BottomNavigationView" parent="Widget.Material3.BottomNavigationView">
<item name="itemPaddingBottom">10dp</item>
<item name="itemPaddingTop">10dp</item>
<item name="android:minHeight">68dp</item>
<item name="itemRippleColor">@color/ripple_toolbar_fainter</item>
<item name="labelVisibilityMode">labeled</item>
</style>
<style name="Widget.Tachiyomi.NavigationRailView" parent="Widget.MaterialComponents.NavigationRailView">
<style name="Widget.Tachiyomi.NavigationRailView" parent="Widget.Material3.NavigationRailView">
<item name="itemRippleColor">@color/ripple_toolbar_fainter</item>
<item name="labelVisibilityMode">labeled</item>
</style>
@ -252,7 +252,7 @@
<item name="cornerSize">@dimen/card_radius</item>
</style>
<style name="ThemeOverlay.Tachiyomi.Dialog.Fullscreen" parent="ThemeOverlay.MaterialComponents">
<style name="ThemeOverlay.Tachiyomi.Dialog.Fullscreen" parent="ThemeOverlay.Material3">
<item name="android:windowIsFloating">false</item>
<item name="android:windowBackground">?android:attr/colorBackground</item>
<item name="android:windowAnimationStyle">@style/Animation.Tachiyomi.Dialog</item>

View File

@ -6,16 +6,17 @@
<!--============-->
<!--== Theme Base ==-->
<style name="Base.Theme.Tachiyomi" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<style name="Base.Theme.Tachiyomi" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Disallow "Force dark theme" -->
<item name="android:forceDarkAllowed" tools:targetApi="Q">false</item>
<!-- Theme Colors -->
<item name="colorPrimary">@color/accent_default</item>
<item name="colorPrimaryVariant">?attr/colorPrimary</item>
<item name="colorOnPrimary">@color/md_white_1000</item>
<item name="colorPrimaryContainer">?attr/colorPrimary</item>
<item name="colorOnPrimaryContainer">?attr/colorOnPrimary</item>
<item name="colorSecondary">?attr/colorPrimary</item>
<item name="colorSecondaryVariant">?attr/colorPrimaryVariant</item>
<item name="colorSecondaryContainer">?attr/colorPrimaryContainer</item>
<item name="colorOnSecondary">?attr/colorOnPrimary</item>
<item name="colorTertiary">@color/green</item>
<item name="colorOnTertiary">@color/md_white_1000</item>
@ -60,9 +61,9 @@
<item name="chipBackgroundColor">?android:attr/divider</item>
<item name="snackbarStyle">@style/Widget.Tachiyomi.Snackbar</item>
<item name="snackbarTextViewStyle">@style/Widget.Tachiyomi.Snackbar.TextView</item>
<item name="textInputStyle">@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox</item>
<item name="appBarLayoutStyle">@style/Widget.MaterialComponents.AppBarLayout.Surface</item>
<item name="toolbarStyle">@style/Widget.MaterialComponents.Toolbar.Surface</item>
<item name="textInputStyle">@style/Widget.Material3.TextInputLayout.OutlinedBox</item>
<item name="appBarLayoutStyle">@style/Widget.Material3.AppBarLayout</item>
<item name="toolbarStyle">@style/Widget.Material3.Toolbar.Surface</item>
<item name="tabStyle">@style/Widget.Tachiyomi.TabLayout</item>
<item name="bottomNavigationStyle">@style/Widget.Tachiyomi.BottomNavigationView</item>
<item name="navigationRailStyle">@style/Widget.Tachiyomi.NavigationRailView</item>