Skip to content

Commit 0127b53

Browse files
committed
Fix status bar a nav bar theming
1 parent 8964cb8 commit 0127b53

File tree

7 files changed

+92
-20
lines changed

7 files changed

+92
-20
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
android:theme="@style/Theme.MySoothe">
3333
<activity
3434
android:name="net.opatry.speedrun.emea.MainActivity"
35-
android:label="@string/app_name"
36-
android:theme="@style/Theme.MySoothe.NoActionBar">
35+
android:label="@string/app_name">
3736
<intent-filter>
3837
<action android:name="android.intent.action.MAIN" />
3938

app/src/main/java/net/opatry/speedrun/emea/ui/home/HomeScreen.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ package net.opatry.speedrun.emea.ui.home
2525
import androidx.annotation.StringRes
2626
import androidx.compose.foundation.ExperimentalFoundationApi
2727
import androidx.compose.foundation.layout.Column
28+
import androidx.compose.foundation.layout.Spacer
29+
import androidx.compose.foundation.layout.height
2830
import androidx.compose.foundation.layout.padding
2931
import androidx.compose.foundation.layout.size
3032
import androidx.compose.foundation.rememberScrollState
@@ -50,6 +52,8 @@ import androidx.compose.ui.graphics.vector.ImageVector
5052
import androidx.compose.ui.res.stringResource
5153
import androidx.compose.ui.tooling.preview.Preview
5254
import androidx.compose.ui.unit.dp
55+
import dev.chrisbanes.accompanist.insets.navigationBarsHeight
56+
import dev.chrisbanes.accompanist.insets.navigationBarsPadding
5357
import net.opatry.speedrun.emea.R
5458
import net.opatry.speedrun.emea.data.mySootheBodyActivities
5559
import net.opatry.speedrun.emea.data.mySootheCollections
@@ -92,6 +96,7 @@ fun HomeScreen() {
9296
isFloatingActionButtonDocked = true,
9397
bottomBar = {
9498
BottomNavigation(
99+
Modifier.navigationBarsHeight(additional = 56.dp),
95100
backgroundColor = MaterialTheme.colors.background,
96101
elevation = 8.dp
97102
) {
@@ -106,6 +111,7 @@ fun HomeScreen() {
106111
selected = selectedTab == navItem,
107112
selectedContentColor = MaterialTheme.colors.onBackground,
108113
unselectedContentColor = MaterialTheme.colors.onBackground.copy(alpha = ContentAlpha.medium),
114+
modifier = Modifier.navigationBarsPadding(),
109115
onClick = { /*setSelectedTab(navItem)*/ }
110116
)
111117
}
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!--
1+
<?xml version="1.0" encoding="utf-8"?><!--
22
Copyright (c) 2021 Olivier Patry
33
44
Permission is hereby granted, free of charge, to any person obtaining
@@ -20,9 +20,6 @@
2020
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2121
-->
2222

23-
<resources xmlns:tools="http://schemas.android.com/tools">
24-
<style name="Theme.MySoothe" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
25-
<item name="android:statusBarColor" tools:targetApi="l">@android:color/transparent</item>
26-
<item name="android:windowTranslucentStatus">true</item>
27-
</style>
23+
<resources>
24+
<bool name="light_status_bar">false</bool>
2825
</resources>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?><!--
2+
Copyright (c) 2021 Olivier Patry
3+
4+
Permission is hereby granted, free of charge, to any person obtaining
5+
a copy of this software and associated documentation files (the "Software"),
6+
to deal in the Software without restriction, including without limitation
7+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
and/or sell copies of the Software, and to permit persons to whom the Software
9+
is furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in
12+
all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
20+
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
-->
22+
23+
<resources>
24+
<color name="nav_bar">@android:color/transparent</color>
25+
</resources>

app/src/main/res/values/bools.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?><!--
2+
Copyright (c) 2021 Olivier Patry
3+
4+
Permission is hereby granted, free of charge, to any person obtaining
5+
a copy of this software and associated documentation files (the "Software"),
6+
to deal in the Software without restriction, including without limitation
7+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
and/or sell copies of the Software, and to permit persons to whom the Software
9+
is furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in
12+
all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
20+
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
-->
22+
23+
<resources>
24+
<bool name="light_status_bar">true</bool>
25+
</resources>

app/src/main/res/values/colors.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8"?><!--
2+
Copyright (c) 2021 Olivier Patry
3+
4+
Permission is hereby granted, free of charge, to any person obtaining
5+
a copy of this software and associated documentation files (the "Software"),
6+
to deal in the Software without restriction, including without limitation
7+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
and/or sell copies of the Software, and to permit persons to whom the Software
9+
is furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in
12+
all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
20+
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
-->
22+
23+
<resources>
24+
<color name="immersive_sys_ui">#00000000</color>
25+
<color name="nav_bar">@color/immersive_sys_ui</color>
26+
</resources>

app/src/main/res/values/themes.xml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,11 @@
2121
-->
2222

2323
<resources xmlns:tools="http://schemas.android.com/tools">
24-
<style name="Theme.MySoothe" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
25-
<item name="android:statusBarColor" tools:targetApi="l">@android:color/transparent</item>
26-
<item name="android:windowTranslucentStatus">true</item>
24+
<style name="Theme.MySoothe" parent="Theme.MaterialComponents.DayNight.NoActionBar">
25+
<item name="android:colorPrimary">#ff00ff</item>
26+
<item name="android:colorAccent">#ff00ff</item>
27+
<item name="android:statusBarColor">@color/immersive_sys_ui</item>
28+
<item name="android:navigationBarColor">@color/nav_bar</item>
29+
<item name="android:windowLightStatusBar">@bool/light_status_bar</item>
2730
</style>
28-
29-
<style name="Theme.MySoothe.NoActionBar">
30-
<item name="windowActionBar">false</item>
31-
<item name="windowNoTitle">true</item>
32-
</style>
33-
34-
<style name="Theme.MySoothe.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
35-
36-
<style name="Theme.MySoothe.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
3731
</resources>

0 commit comments

Comments
 (0)