mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-06 02:35:19 +08:00
With this commit, activities will automatically change theme between day/night if `night-mode` `termux.properties` is not set or is set to `system` without requiring app restart. Dialog theming will be fully added in a later commit and may currently be in an inconsistent state or have crashes. The `uiMode` has been removed from `configChanges` of `TermuxActivity`, this may cause termux app to restart if samsung DEX mode is changed, if it does, then users should report it so that it can be fixed by re-adding the value and ignoring the change inside `TermuxActivity.onConfigurationChanged()`. The docs don't state if its necessary. Check related pull request #1446. Running `termux-reload-settings` will also restart `TermuxActivity`, the activity data should be preserved.
103 lines
4.6 KiB
XML
103 lines
4.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
|
<!--
|
|
The light themes are only for day mode and must not be defined in night/theme.xml.
|
|
https://material.io/develop/android/theming/dark
|
|
-->
|
|
|
|
<!--
|
|
BaseActivity Light DarkActionBar theme.
|
|
https://github.com/material-components/material-components-android/blob/1.4.0/lib/java/com/google/android/material/theme/res/values/themes.xml#L33
|
|
-->
|
|
<style name="Theme.BaseActivity.Light.DarkActionBar" parent="Theme.MaterialComponents.Light.DarkActionBar">
|
|
<!-- Primary brand color. -->
|
|
<item name="colorPrimary">@color/red_400</item>
|
|
<item name="colorPrimaryVariant">@color/red_800</item>
|
|
<item name="colorOnPrimary">@color/white</item>
|
|
|
|
<!-- Secondary brand color. -->
|
|
<item name="colorSecondary">@color/grey_900</item>
|
|
<item name="colorSecondaryVariant">@color/black</item>
|
|
<item name="colorOnSecondary">@color/white</item>
|
|
|
|
<!-- Status bar color. -->
|
|
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
|
<item name="colorPrimaryDark" tools:targetApi="l">?attr/colorPrimary</item>
|
|
|
|
<!-- Text color. -->
|
|
<item name="android:textColorPrimary">@color/black</item>
|
|
<item name="android:textColorLink">@color/blue_link_light</item>
|
|
|
|
<!--
|
|
Dialog Themes.
|
|
These MUST be defined for the application `android:theme` so that if dialogs
|
|
are shown from non-activity context with TYPE_SYSTEM_ALERT, the correct dialog theme is
|
|
applied, otherwise exceptions like `UnsupportedOperationException: Failed to resolve attribute
|
|
at index... TypedValue` will be thrown, since ThemeOverlay would have all the activity
|
|
theme attributes defined.
|
|
-->
|
|
<item name="alertDialogTheme">@style/ThemeOverlay.BaseDialog.DayNight</item>
|
|
<item name="materialAlertDialogTheme">@style/ThemeOverlay.BaseDialog.DayNight</item>
|
|
</style>
|
|
|
|
<!-- BaseActivity Light NoActionBar theme. -->
|
|
<style name="Theme.BaseActivity.Light.NoActionBar" parent="Theme.BaseActivity.Light.DarkActionBar">
|
|
<item name="windowActionBar">false</item>
|
|
<item name="windowNoTitle">true</item>
|
|
</style>
|
|
|
|
|
|
|
|
<!-- BaseActivity DayNight DarkActionBar theme. -->
|
|
<style name="Theme.BaseActivity.DayNight.DarkActionBar" parent="Theme.BaseActivity.Light.DarkActionBar"/>
|
|
<!-- BaseActivity DayNight NoActionBar theme. -->
|
|
<style name="Theme.BaseActivity.DayNight.NoActionBar" parent="Theme.BaseActivity.Light.NoActionBar"/>
|
|
|
|
|
|
|
|
<!-- BaseActivity extended classes Day NoActionBar themes. -->
|
|
<style name="Theme.MediaViewActivity.Light" parent="Theme.BaseActivity.Light.NoActionBar"/>
|
|
<style name="Theme.MarkdownViewActivity.Light" parent="Theme.MediaViewActivity.Light"/>
|
|
|
|
<!-- BaseActivity extended classes DayNight NoActionBar themes. -->
|
|
<style name="Theme.MediaViewActivity.DayNight" parent="Theme.BaseActivity.DayNight.NoActionBar"/>
|
|
<style name="Theme.MarkdownViewActivity.DayNight" parent="Theme.MediaViewActivity.DayNight"/>
|
|
|
|
|
|
|
|
|
|
|
|
<!--
|
|
BaseDialog Light theme.
|
|
https://github.com/material-components/material-components-android/blob/1.4.0/lib/java/com/google/android/material/dialog/res/values/themes.xml#L70
|
|
-->
|
|
<style name="ThemeOverlay.BaseDialog.Light" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog">
|
|
<!-- Primary brand color. -->
|
|
<item name="colorPrimary">@color/red_400</item>
|
|
<item name="colorPrimaryVariant">@color/red_800</item>
|
|
<item name="colorOnPrimary">@color/white</item>
|
|
|
|
<!-- Secondary brand color. -->
|
|
<item name="colorSecondary">@color/grey_900</item>
|
|
<item name="colorSecondaryVariant">@color/black</item>
|
|
<item name="colorOnSecondary">@color/white</item>
|
|
|
|
<!-- Surface color. -->
|
|
<item name="colorSurface">@color/design_default_color_surface</item>
|
|
<item name="colorOnSurface">@color/design_default_color_on_surface</item>
|
|
|
|
<!-- Dialog title panel style. -->
|
|
<item name="materialAlertDialogTitlePanelStyle">@style/BaseDialog.Title.Panel</item>
|
|
|
|
<!-- Dialog message text style. -->
|
|
<item name="materialAlertDialogBodyTextStyle">@style/BaseDialog.Message.Text.Light</item>
|
|
</style>
|
|
|
|
<!-- BaseDialog DayNight theme. -->
|
|
<style name="ThemeOverlay.BaseDialog.DayNight" parent="ThemeOverlay.BaseDialog.Light"/>
|
|
|
|
<!-- BaseDialog extended classes DayNight themes. -->
|
|
<style name="ThemeOverlay.MessageDialog.DayNight" parent="ThemeOverlay.BaseDialog.DayNight"/>
|
|
|
|
</resources>
|