forked from Helium314/HeliBoard
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dynamic colors to settings (Helium314#454)
- Loading branch information
1 parent
2beb949
commit 9fb59ed
Showing
15 changed files
with
129 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
app/src/main/java/org/dslul/openboard/inputmethod/latin/utils/ActivityThemeUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
package org.dslul.openboard.inputmethod.latin.utils; | ||
|
||
import android.app.Activity; | ||
import android.os.Build; | ||
import android.view.View; | ||
import android.view.WindowInsetsController; | ||
|
||
public class ActivityThemeUtils { | ||
|
||
public static void setActivityTheme(final Activity activity) { | ||
final boolean isNight = ResourceUtils.isNight(activity.getResources()); | ||
|
||
// Set the icons of the status bar and the navigation bar light or dark | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { | ||
final WindowInsetsController controller = activity.getWindow().getInsetsController(); | ||
if (controller != null && !isNight) { | ||
controller.setSystemBarsAppearance(WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS, WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS); | ||
controller.setSystemBarsAppearance(WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS, WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS); | ||
} | ||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | ||
final View view = activity.getWindow().getDecorView(); | ||
view.setSystemUiVisibility(!isNight ? View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR : 0); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
SPDX-License-Identifier: GPL-3.0-only | ||
--> | ||
|
||
<resources xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<style name="platformActivityTheme" parent="Theme.AppCompat.DayNight"> | ||
<!-- Some items are duplicated from the original platform-theme file to ensure that the | ||
"android/system_accent_*" or "android/system_neutral_*" colors are used. --> | ||
|
||
<item name="android:colorAccent">@color/accent</item> | ||
<item name="colorAccent">@color/accent</item> | ||
|
||
<item name="android:statusBarColor">@color/action_bar_color</item> | ||
<item name="android:navigationBarColor">@color/setup_background</item> | ||
|
||
<item name="actionBarStyle">@style/ActionBarStyle</item> | ||
<item name="android:actionBarSize">80dp</item> | ||
<item name="actionBarSize">80dp</item> | ||
|
||
<!-- Preference list background color --> | ||
<item name="android:windowBackground">@color/setup_background</item> | ||
|
||
<item name="android:alertDialogTheme">@style/AlertDialogTheme</item> | ||
<item name="alertDialogTheme">@style/AlertDialogTheme</item> | ||
|
||
<item name="android:buttonCornerRadius">50dp</item> | ||
|
||
<item name="android:spinnerDropDownItemStyle">@style/DropDownMenuTheme</item> | ||
<item name="spinnerDropDownItemStyle">@style/DropDownMenuTheme</item> | ||
|
||
<!-- Menu background --> | ||
<item name="android:itemBackground">@color/drop_down_menu_background</item> | ||
</style> | ||
|
||
<style name="ActionBarStyle" parent="Widget.AppCompat.ActionBar"> | ||
<item name="android:background">@color/action_bar_color</item>* | ||
<item name="background">@color/action_bar_color</item> | ||
</style> | ||
|
||
<style name="AlertDialogTheme" parent="ThemeOverlay.AppCompat.Dialog.Alert"> | ||
<item name="android:colorBackgroundFloating">@color/dialog_background</item> | ||
<item name="colorBackgroundFloating">@color/dialog_background</item> | ||
<item name="android:dialogCornerRadius">28dp</item> | ||
<item name="dialogCornerRadius">28dp</item> | ||
</style> | ||
|
||
<style name="DropDownMenuTheme" parent="Widget.AppCompat.DropDownItem.Spinner"> | ||
<item name="android:background">@color/drop_down_menu_background</item> | ||
<item name="background">@color/drop_down_menu_background</item> | ||
</style> | ||
|
||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters