Skip to content

Commit

Permalink
Adjust theming of Android system bars
Browse files Browse the repository at this point in the history
  • Loading branch information
opatry committed Oct 5, 2024
1 parent e5ce33e commit 1b7020e
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 3 deletions.
25 changes: 25 additions & 0 deletions tasks-app-android/src/main/res/values-night/bools.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?><!--
Copyright (c) 2024 Olivier Patry
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->

<resources>
<bool name="light_status_bar">false</bool>
</resources>
32 changes: 32 additions & 0 deletions tasks-app-android/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?><!--
Copyright (c) 2024 Olivier Patry
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->

<resources>
<!--
To be kept in sync with Compose counterparts `Color.kt` & `Theme.kt` in `:tasks-app-shared`
-->

<!-- FIXME Material3 theme -->
<color name="primary">#FFFFFFFF</color>

<color name="surface_color">#FF222222</color>
</resources>
25 changes: 25 additions & 0 deletions tasks-app-android/src/main/res/values/bools.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?><!--
Copyright (c) 2024 Olivier Patry
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->

<resources>
<bool name="light_status_bar">true</bool>
</resources>
8 changes: 7 additions & 1 deletion tasks-app-android/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,11 @@
-->

<resources>
<color name="primary">#006B58</color>
<!--
To be kept in sync with Compose counterparts `Color.kt` & `Theme.kt` in `:tasks-app-shared`
-->

<color name="primary">#FF006B58</color>

<color name="surface_color">#FFFFFFFF</color>
</resources>
19 changes: 17 additions & 2 deletions tasks-app-android/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,26 @@
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->

<resources>
<!-- FIXME Material3 theme -->
<resources xmlns:tools="http://schemas.android.com/tools">

<!--
Use AppCompat and not Material3 to avoid retrieving a lot of useless dependencies just
by embedding `com.google.android.material:material` dependency.
There is no use of view theming except for Android system bars here anyway.
-->
<style name="Theme.TasksApp" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary</item>
<item name="colorAccent">@color/primary</item>

<item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
<item name="android:windowBackground">@color/surface_color</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">@bool/light_status_bar</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<!-- Disable window features like ActionBar, Title and Overlay. -->
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowContentOverlay">@null</item>
</style>
</resources>

0 comments on commit 1b7020e

Please sign in to comment.