Skip to content

Commit 70e4c0c

Browse files
committed
ui: use material 3
1 parent 66099e5 commit 70e4c0c

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

app/src/main/res/layout/activity_main.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
android:id="@+id/app_bar"
1313
android:layout_width="0dp"
1414
android:layout_height="wrap_content"
15+
android:background="?attr/colorPrimary"
1516
app:layout_constraintTop_toTopOf="parent"
1617
app:layout_constraintStart_toStartOf="parent"
1718
app:layout_constraintEnd_toEndOf="parent">
@@ -21,6 +22,7 @@
2122
style="@style/Widget.MaterialComponents.Toolbar"
2223
android:layout_width="match_parent"
2324
android:layout_height="wrap_content"
25+
android:background="?attr/colorPrimary"
2426
app:titleTextColor="@android:color/white"
2527
app:navigationIconTint="@android:color/white" />
2628

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<resources>
2+
<!-- API 29+: disable forced contrast scrims on system bars -->
3+
<style name="UsbTerminalTheme" parent="@style/AppTheme.Base">
4+
<item name="android:enforceStatusBarContrast">false</item>
5+
<item name="android:enforceNavigationBarContrast">false</item>
6+
</style>
7+
8+
<style name="SettingModalBottomSheetTheme" parent="@style/ModalBottomSheetTheme.Base">
9+
<item name="android:enforceStatusBarContrast">false</item>
10+
<item name="android:enforceNavigationBarContrast">false</item>
11+
</style>
12+
</resources>

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

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<resources xmlns:tools="http://schemas.android.com/tools">
22

33
<!-- Base application theme. -->
4-
<style name="AppTheme.Base" parent="Theme.AppCompat.DayNight.DarkActionBar">
4+
<style name="AppTheme.Base" parent="Theme.Material3.DayNight.NoActionBar">
55
<!-- Customize your theme here. -->
66
<item name="colorPrimary">@color/colorPrimary</item>
77
<!-- Ensure status bar tone matches app bar exactly -->
@@ -10,29 +10,16 @@
1010

1111
<item name="android:textColorPrimary">@color/textColorPrimary</item>
1212
<item name="android:textColorSecondary">@color/textColorSecondary</item>
13-
14-
<!-- Make the status bar match the app bar color -->
15-
<item name="android:statusBarColor">?attr/colorPrimary</item>
16-
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
1713
</style>
1814

1915
<!-- App theme alias; v23 will override this to add icon contrast -->
2016
<style name="UsbTerminalTheme" parent="@style/AppTheme.Base" />
2117

22-
<style name="ModalBottomSheet" parent="@style/Widget.MaterialComponents.BottomSheet.Modal">
23-
<!-- Tint ensures Material background matches day/night color -->
24-
<item name="backgroundTint">@color/bg_modal_bottom_sheet</item>
25-
<item name="android:background">@drawable/bg_modal_bottom_sheet</item>
26-
</style>
27-
2818
<!-- Common items for the bottom sheet theme -->
29-
<style name="ModalBottomSheetTheme.Base" parent="Theme.MaterialComponents.BottomSheetDialog">
30-
<!-- Match activity/app bar color for a unified look -->
31-
<item name="android:statusBarColor">?attr/colorPrimary</item>
19+
<style name="ModalBottomSheetTheme.Base" parent="Theme.Material3.DayNight.BottomSheetDialog">
20+
<!-- Edge-to-edge for modal as well; host handles coloring -->
3221
<item name="android:navigationBarColor">@color/bg_modal_bottom_sheet</item>
3322
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
34-
<item name="android:windowIsFloating">false</item>
35-
<item name="bottomSheetStyle">@style/ModalBottomSheet</item>
3623
</style>
3724

3825
<!-- Day variant adds light nav bar icons -->

0 commit comments

Comments
 (0)