style: Use colorSurface everywhere
Instead of using @color/background directly, use ?attr/colorSurface so that changes can be made to the theming easier. This also resolves some more minor issues regarding certain widget's backgrounds.
This commit is contained in:
parent
9974bd32eb
commit
804c38d7ce
17 changed files with 36 additions and 26 deletions
|
@ -25,16 +25,16 @@ class MainActivity : AppCompatActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
val binding = DataBindingUtil.setContentView<ActivityMainBinding>(
|
|
||||||
this, R.layout.activity_main
|
|
||||||
)
|
|
||||||
|
|
||||||
val settingsManager = SettingsManager.getInstance()
|
val settingsManager = SettingsManager.getInstance()
|
||||||
val newAccent = Accent.set(settingsManager.accent)
|
val newAccent = Accent.set(settingsManager.accent)
|
||||||
|
|
||||||
AppCompatDelegate.setDefaultNightMode(settingsManager.theme)
|
AppCompatDelegate.setDefaultNightMode(settingsManager.theme)
|
||||||
setTheme(newAccent.theme)
|
setTheme(newAccent.theme)
|
||||||
|
|
||||||
|
val binding = DataBindingUtil.setContentView<ActivityMainBinding>(
|
||||||
|
this, R.layout.activity_main
|
||||||
|
)
|
||||||
|
|
||||||
if (isEdgeOn()) {
|
if (isEdgeOn()) {
|
||||||
setupEdgeToEdge(binding)
|
setupEdgeToEdge(binding)
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import org.oxycblt.auxio.playback.PlaybackViewModel
|
||||||
import org.oxycblt.auxio.ui.Accent
|
import org.oxycblt.auxio.ui.Accent
|
||||||
import org.oxycblt.auxio.ui.isLandscape
|
import org.oxycblt.auxio.ui.isLandscape
|
||||||
import org.oxycblt.auxio.ui.isTablet
|
import org.oxycblt.auxio.ui.isTablet
|
||||||
|
import org.oxycblt.auxio.ui.resolveAttr
|
||||||
import org.oxycblt.auxio.ui.toColor
|
import org.oxycblt.auxio.ui.toColor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,6 +77,10 @@ class MainFragment : Fragment() {
|
||||||
navigateWithItem(controller, item)
|
navigateWithItem(controller, item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BottomNavigationView is a special little snowflake and doesn't like it when
|
||||||
|
// we set the background in XML
|
||||||
|
setBackgroundColor(R.attr.colorSurface.resolveAttr(requireContext()))
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- VIEWMODEL SETUP ---
|
// --- VIEWMODEL SETUP ---
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:tint="@color/background"
|
android:tint="?attr/colorSurface"
|
||||||
android:viewportWidth="24"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="24">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item>
|
<item>
|
||||||
<shape android:shape="rectangle">
|
<shape android:shape="rectangle">
|
||||||
<solid android:color="@color/background" />
|
<solid android:color="?attr/colorSurface" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:animateLayoutChanges="true"
|
android:animateLayoutChanges="true"
|
||||||
android:background="?android:attr/windowBackground"
|
android:background="?android:attr/colorBackground"
|
||||||
android:baselineAligned="false"
|
android:baselineAligned="false"
|
||||||
android:elevation="@dimen/elevation_normal"
|
android:elevation="@dimen/elevation_normal"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1.5"
|
android:layout_weight="1.5"
|
||||||
android:background="@color/background"
|
android:background="?android:attr/colorBackground"
|
||||||
android:elevation="0dp"
|
android:elevation="0dp"
|
||||||
app:elevation="0dp"
|
app:elevation="0dp"
|
||||||
app:menu="@menu/menu_nav" />
|
app:menu="@menu/menu_nav" />
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
android:id="@+id/playback_layout"
|
android:id="@+id/playback_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/background"
|
android:background="?attr/colorSurface"
|
||||||
android:fitsSystemWindows="true">
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
android:id="@+id/playback_layout"
|
android:id="@+id/playback_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/background"
|
android:background="?attr/colorSurface"
|
||||||
android:fitsSystemWindows="true">
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
android:id="@+id/playback_layout"
|
android:id="@+id/playback_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/background"
|
android:background="?attr/colorSurface"
|
||||||
android:fitsSystemWindows="true">
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/background"
|
android:background="?attr/colorSurface"
|
||||||
android:theme="@style/Theme.Neutral">
|
android:theme="@style/Theme.Neutral">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/background"
|
android:background="?attr/colorSurface"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingTop="@dimen/spacing_medium"
|
android:paddingTop="@dimen/spacing_medium"
|
||||||
android:theme="@style/Theme.Neutral">
|
android:theme="@style/Theme.Neutral">
|
||||||
|
|
|
@ -12,12 +12,13 @@
|
||||||
android:id="@+id/detail_appbar"
|
android:id="@+id/detail_appbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/colorSurface"
|
||||||
app:liftOnScroll="true">
|
app:liftOnScroll="true">
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
android:id="@+id/detail_toolbar"
|
android:id="@+id/detail_toolbar"
|
||||||
style="@style/Toolbar.Style.Icon"
|
style="@style/Toolbar.Style.Icon"
|
||||||
android:background="?android:attr/windowBackground"
|
android:background="?attr/colorSurface"
|
||||||
android:elevation="@dimen/elevation_normal" />
|
android:elevation="@dimen/elevation_normal" />
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:animateLayoutChanges="true"
|
android:animateLayoutChanges="true"
|
||||||
android:background="?android:attr/windowBackground"
|
|
||||||
android:elevation="@dimen/elevation_normal"
|
android:elevation="@dimen/elevation_normal"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintBottom_toBottomOf="parent">
|
app:layout_constraintBottom_toBottomOf="parent">
|
||||||
|
@ -43,7 +42,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:background="@color/background"
|
android:background="?attr/colorSurface"
|
||||||
android:elevation="0dp"
|
android:elevation="0dp"
|
||||||
app:elevation="0dp"
|
app:elevation="0dp"
|
||||||
app:menu="@menu/menu_nav" />
|
app:menu="@menu/menu_nav" />
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
android:id="@+id/playback_layout"
|
android:id="@+id/playback_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/background"
|
android:background="?attr/colorSurface"
|
||||||
android:fitsSystemWindows="true">
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:animateLayoutChanges="true"
|
android:animateLayoutChanges="true"
|
||||||
android:background="@color/background"
|
android:background="?attr/colorSurface"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
|
|
@ -11,13 +11,13 @@
|
||||||
android:id="@+id/search_appbar"
|
android:id="@+id/search_appbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/background"
|
android:background="?attr/colorSurface"
|
||||||
android:elevation="@dimen/elevation_normal">
|
android:elevation="@dimen/elevation_normal">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
android:id="@+id/search_toolbar"
|
android:id="@+id/search_toolbar"
|
||||||
style="@style/Toolbar.Style"
|
style="@style/Toolbar.Style"
|
||||||
android:elevation="@dimen/elevation_normal"
|
android:background="?attr/colorSurface"
|
||||||
app:layout_scrollFlags="scroll|enterAlways"
|
app:layout_scrollFlags="scroll|enterAlways"
|
||||||
app:menu="@menu/menu_search"
|
app:menu="@menu/menu_search"
|
||||||
app:title="@string/label_search" />
|
app:title="@string/label_search" />
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
android:id="@+id/search_edit_text"
|
android:id="@+id/search_edit_text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@android:color/transparent"
|
android:background="?attr/colorSurface"
|
||||||
android:hint="@string/hint_search_library"
|
android:hint="@string/hint_search_library"
|
||||||
android:imeOptions="actionSearch|flagNoExtractUi"
|
android:imeOptions="actionSearch|flagNoExtractUi"
|
||||||
android:inputType="textFilter"
|
android:inputType="textFilter"
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<style name="Theme.BottomSheetFix" parent="@style/Theme.Design.BottomSheetDialog">
|
<style name="Theme.BottomSheetFix" parent="@style/Theme.Design.BottomSheetDialog">
|
||||||
<item name="android:windowIsFloating">false</item>
|
<item name="android:windowIsFloating">false</item>
|
||||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
<item name="android:navigationBarColor">@color/background</item>
|
<item name="android:navigationBarColor">?attr/colorSurface</item>
|
||||||
<item name="android:windowLightStatusBar">false</item>
|
<item name="android:windowLightStatusBar">false</item>
|
||||||
<item name="bottomSheetStyle">@style/Theme.BottomSheetHeightFix</item>
|
<item name="bottomSheetStyle">@style/Theme.BottomSheetHeightFix</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
|
|
||||||
<!-- Base theme -->
|
<!-- Base theme -->
|
||||||
<style name="Theme.Base" parent="Theme.Template">
|
<style name="Theme.Base" parent="Theme.Template">
|
||||||
<item name="android:windowBackground">@color/background</item>
|
<item name="android:windowBackground">?attr/colorSurface</item>
|
||||||
|
<item name="android:colorBackground">?attr/colorSurface</item>
|
||||||
<item name="android:fontFamily">@font/inter</item>
|
<item name="android:fontFamily">@font/inter</item>
|
||||||
<item name="android:scrollbars">none</item>
|
<item name="android:scrollbars">none</item>
|
||||||
<item name="android:windowIsFloating">false</item>
|
<item name="android:windowIsFloating">false</item>
|
||||||
|
@ -23,11 +24,15 @@
|
||||||
<item name="colorControlActivated">?attr/colorPrimary</item>
|
<item name="colorControlActivated">?attr/colorPrimary</item>
|
||||||
<item name="cornerRadius">0dp</item>
|
<item name="cornerRadius">0dp</item>
|
||||||
|
|
||||||
|
<item name="colorSurface">@color/background</item>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
These exact flags, in this exact order, in this exact formatting somehow make
|
These exact flags, in this exact order, in this exact formatting somehow make
|
||||||
the dialogs use the nicer material style. Please do not touch them.
|
the dialogs use the nicer material style. Please do not touch them.
|
||||||
-->
|
-->
|
||||||
<item name="viewInflaterClass">com.google.android.material.theme.MaterialComponentsViewInflater</item>
|
<item name="viewInflaterClass">
|
||||||
|
com.google.android.material.theme.MaterialComponentsViewInflater
|
||||||
|
</item>
|
||||||
<item name="alertDialogTheme">@style/ThemeOverlay.MaterialComponents.Dialog.Alert</item>
|
<item name="alertDialogTheme">@style/ThemeOverlay.MaterialComponents.Dialog.Alert</item>
|
||||||
<item name="materialAlertDialogTheme">@style/Theme.CustomDialog</item>
|
<item name="materialAlertDialogTheme">@style/Theme.CustomDialog</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in a new issue