Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Set up Day/Night mode for system-compatible optional dark theme #8660

Merged
merged 2 commits into from
Mar 24, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Android: Set up Day/Night mode for system-compatible optional dark theme
  • Loading branch information
TheRealPSV committed Mar 17, 2020
commit 5446e7b7d67bf6dab0e8da86c771a670e133737f
2 changes: 1 addition & 1 deletion Source/Android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ dependencies {
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.android.material:material:1.1.0'

// Android TV UI libraries.
implementation 'androidx.leanback:leanback:1.0.0'
Expand Down
3 changes: 2 additions & 1 deletion Source/Android/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_main"
android:background="?colorPrimary"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
app:popupTheme="@style/ThemeOverlay.AppCompat.DayNight"/>

<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs_platforms"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_settings"
android:background="@android:color/white"
android:background="?android:attr/colorBackground"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="FilePickerBaseTheme" parent="NNF_BaseTheme" />
</resources>
14 changes: 7 additions & 7 deletions Source/Android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<resources>

<!-- Inherit from the material theme -->
<style name="DolphinBase" parent="Theme.AppCompat.Light.NoActionBar">
<style name="DolphinBase" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Main theme colors -->
<!-- Branding color for the app bar -->
<item name="colorPrimary">@color/dolphin_blue</item>
Expand All @@ -19,7 +19,7 @@
</style>

<!-- Same as above, but use default action bar, and mandate margins. -->
<style name="DolphinSettingsBase" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="DolphinSettingsBase" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/dolphin_blue</item>
<item name="colorPrimaryDark">@color/dolphin_blue_dark</item>
<item name="colorAccent">@color/dolphin_purple</item>
Expand All @@ -29,7 +29,7 @@

<!-- Inherit from the Base Dolphin Dialog Theme -->

<style name="DolphinEmulationBase" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="DolphinEmulationBase" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/dolphin_blue</item>
<item name="colorPrimaryDark">@color/dolphin_blue_dark</item>
<item name="colorAccent">@color/dolphin_purple</item>
Expand All @@ -43,7 +43,7 @@
<item name="android:windowAllowReturnTransitionOverlap">true</item>
</style>

<style name="DolphinEmulationTvBase" parent="Theme.AppCompat.Light.NoActionBar">
<style name="DolphinEmulationTvBase" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/dolphin_blue</item>
<item name="colorPrimaryDark">@color/dolphin_blue_dark</item>
<item name="colorAccent">@color/dolphin_purple</item>
Expand Down Expand Up @@ -94,8 +94,8 @@
<item name="android:textColor">@color/button_text_color</item>
</style>

<!-- You can also inherit from NNF_BaseTheme.Light -->
<style name="FilePickerTheme" parent="NNF_BaseTheme.Light">
<!-- Inherit from a base file picker theme that handles day/night -->
<style name="FilePickerTheme" parent="FilePickerBaseTheme">
<item name="colorPrimary">@color/dolphin_blue</item>
<item name="colorPrimaryDark">@color/dolphin_blue_dark</item>
<item name="colorAccent">@color/dolphin_accent_gamecube</item>
Expand All @@ -111,7 +111,7 @@
<item name="nnf_toolbarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
</style>

<style name="FilePickerAlertDialogTheme" parent="Theme.AppCompat.Dialog.Alert">
<style name="FilePickerAlertDialogTheme" parent="Theme.AppCompat.DayNight.Dialog.Alert">
<item name="colorPrimary">@color/dolphin_blue</item>
<item name="colorPrimaryDark">@color/dolphin_blue_dark</item>
<item name="colorAccent">@color/dolphin_accent_gamecube</item>
Expand Down
4 changes: 4 additions & 0 deletions Source/Android/app/src/main/res/values/styles_filepicker.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="FilePickerBaseTheme" parent="NNF_BaseTheme.Light" />
</resources>