Implement theme customization
Implement the ability to change the theme to auto/light/dark.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorPrimary">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M20,8.69L20,4h-4.69L12,0.69 8.69,4L4,4v4.69L0.69,12 4,15.31L4,20h4.69L12,23.31 15.31,20L20,20v-4.69L23.31,12 20,8.69zM12,18c-3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6 6,2.69 6,6 -2.69,6 -6,6zM12,8c-2.21,0 -4,1.79 -4,4s1.79,4 4,4 4,-1.79 4,-4 -1.79,-4 -4,-4z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/song_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/actionBarSize"
|
||||
android:background="?android:attr/windowBackground"
|
||||
android:elevation="@dimen/elevation_normal"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:title="@string/label_settings"
|
||||
app:titleTextAppearance="@style/TextAppearance.Toolbar.Header" />
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/settings_list_fragment"
|
||||
android:name="org.oxycblt.auxio.settings.SettingListFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView
|
||||
android:id="@android:id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:fontFamily="@font/inter_semibold"
|
||||
android:paddingStart="@dimen/padding_medium"
|
||||
android:paddingTop="@dimen/padding_small"
|
||||
android:paddingEnd="@dimen/padding_small"
|
||||
android:paddingBottom="@dimen/padding_small"
|
||||
android:textSize="19sp"
|
||||
android:background="@drawable/ui_header_dividers"
|
||||
android:text="@{header.name}"
|
||||
tools:text="UI"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools" />
|
||||
@@ -8,4 +8,8 @@
|
||||
android:id="@+id/songs_fragment"
|
||||
android:title="@string/label_songs"
|
||||
android:icon="@drawable/ic_song" />
|
||||
<item
|
||||
android:id="@+id/settings_fragment"
|
||||
android:title="@string/label_settings"
|
||||
android:icon="@drawable/ic_settings" />
|
||||
</menu>
|
||||
@@ -88,4 +88,9 @@
|
||||
android:name="org.oxycblt.auxio.songs.SongsFragment"
|
||||
android:label="fragment_songs"
|
||||
tools:layout="@layout/fragment_songs" />
|
||||
<fragment
|
||||
android:id="@+id/settings_fragment"
|
||||
android:name="org.oxycblt.auxio.settings.SettingsFragment"
|
||||
android:label="SettingsFragment"
|
||||
tools:layout="@layout/fragment_settings" />
|
||||
</navigation>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<array name="theme_entries">
|
||||
<item>@string/label_settings_theme_auto</item>
|
||||
<item>@string/label_settings_theme_light</item>
|
||||
<item>@string/label_settings_theme_dark</item>
|
||||
</array>
|
||||
<array name="theme_values">
|
||||
<item>AUTO</item>
|
||||
<item>LIGHT</item>
|
||||
<item>DARK</item>
|
||||
</array>
|
||||
</resources>
|
||||
@@ -28,6 +28,12 @@
|
||||
<string name="label_channel">Music Playback</string>
|
||||
<string name="label_service_playback">The music playback service for Auxio.</string>
|
||||
<string name="label_settings">Settings</string>
|
||||
<string name="label_settings_ui">Appearance</string>
|
||||
<string name="label_settings_theme">Theme</string>
|
||||
<string name="label_settings_theme_auto">Auto</string>
|
||||
<string name="label_settings_theme_light">Light</string>
|
||||
<string name="label_settings_theme_dark">Dark</string>
|
||||
<string name="label_settings_theme_choose">Choose theme</string>
|
||||
|
||||
<!-- Debug Namespace | Debug labels -->
|
||||
<string name="debug_state_saved">State saved</string>
|
||||
|
||||
@@ -5,12 +5,14 @@
|
||||
<item name="android:windowBackground">@color/background</item>
|
||||
<item name="android:statusBarColor">@android:color/black</item>
|
||||
<item name="android:fontFamily">@font/inter</item>
|
||||
<item name="indicatorFastScrollerStyle">@style/FastScrollTheme</item>
|
||||
<item name="android:textCursorDrawable">@drawable/ui_cursor</item>
|
||||
<item name="android:fitsSystemWindows">true</item>
|
||||
<item name="android:scrollbars">none</item>
|
||||
|
||||
<item name="popupMenuStyle">@style/Widget.CustomPopup</item>
|
||||
<item name="colorControlNormal">@color/control_color</item>
|
||||
<item name="alertDialogTheme">@style/Theme.CustomDialog</item>
|
||||
<item name="indicatorFastScrollerStyle">@style/FastScrollTheme</item>
|
||||
</style>
|
||||
|
||||
<!-- Hack to fix the weird icon/underline with LibraryFragment's SearchView -->
|
||||
@@ -48,6 +50,19 @@
|
||||
<item name="android:popupBackground">@color/background</item>
|
||||
</style>
|
||||
|
||||
<!-- Custom Dialog Theme -->
|
||||
<style name="Theme.CustomDialog" parent="Theme.MaterialComponents.DayNight.Dialog">
|
||||
<item name="colorBackgroundFloating">@color/background</item>
|
||||
<item name="android:windowTitleStyle">@style/TextAppearance.Dialog.Title</item>
|
||||
<item name="colorPrimary">@color/control_color</item>
|
||||
<item name="colorSecondary">@color/control_color</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.Dialog.Title" parent="@android:style/TextAppearance.Material.Title">
|
||||
<item name="android:fontFamily">@font/inter_black</item>
|
||||
</style>
|
||||
|
||||
<!-- Fast scroll theme -->
|
||||
<style name="FastScrollTheme" parent="Widget.IndicatorFastScroll.FastScroller">
|
||||
<item name="android:textColor">@color/ui_state_color</item>
|
||||
<item name="android:textAppearance">@style/TextAppearance.FastScroll</item>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<PreferenceCategory
|
||||
android:title="@string/label_settings_ui"
|
||||
android:layout="@layout/item_prefs_header">
|
||||
<ListPreference
|
||||
app:key="KEY_THEME"
|
||||
android:title="@string/label_settings_theme"
|
||||
android:icon="@drawable/ic_day"
|
||||
android:entries="@array/theme_entries"
|
||||
android:entryValues="@array/theme_values"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
Reference in New Issue
Block a user