Skip to content

Commit 00fe65b

Browse files
authored
Merge pull request #59 from superus8r/develop
Prepare release 0.9.87
2 parents 5d977d4 + 24be5d9 commit 00fe65b

File tree

9 files changed

+80
-15
lines changed

9 files changed

+80
-15
lines changed

app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ android {
3737
applicationId = "org.kabiri.android.usbterminal"
3838
minSdk = 24
3939
targetSdk = 35
40-
versionCode = System.getenv("CIRCLE_BUILD_NUM")?.toIntOrNull() ?: 16
41-
versionName = "0.9.86${System.getenv("CIRCLE_BUILD_NUM") ?: ""}"
40+
versionCode = System.getenv("CIRCLE_BUILD_NUM")?.toIntOrNull() ?: 17
41+
versionName = "0.9.87${System.getenv("CIRCLE_BUILD_NUM") ?: ""}"
4242
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
4343
}
4444

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
android:label="@string/app_name"
1616
android:roundIcon="@mipmap/ic_launcher_round"
1717
android:supportsRtl="true"
18-
android:theme="@style/AppTheme"
18+
android:theme="@style/UsbTerminalTheme"
1919
android:dataExtractionRules="@xml/data_extraction_rules"
2020
tools:targetApi="s">
2121

app/src/main/java/org/kabiri/android/usbterminal/MainActivity.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,21 @@ class MainActivity : AppCompatActivity() {
3636
viewModel.startObservingUsbDevice()
3737
setContentView(R.layout.activity_main)
3838

39-
// avoid system navbar or soft keyboard overlapping the content.
4039
val rootView = findViewById<View>(R.id.root_view)
40+
val toolbar = findViewById<com.google.android.material.appbar.MaterialToolbar>(R.id.toolbar)
41+
setSupportActionBar(toolbar)
42+
4143
ViewCompat.setOnApplyWindowInsetsListener(rootView) { view, insets ->
4244
val systemBarsInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
4345
val imeInsets = insets.getInsets(WindowInsetsCompat.Type.ime())
46+
47+
// Toolbar consumes status bar space; content avoids bottom system bars
48+
toolbar.setPadding(
49+
toolbar.paddingLeft,
50+
systemBarsInsets.top,
51+
toolbar.paddingRight,
52+
toolbar.paddingBottom,
53+
)
4454
view.setPadding(0, 0, 0, maxOf(systemBarsInsets.bottom, imeInsets.bottom))
4555
insets
4656
}

app/src/main/java/org/kabiri/android/usbterminal/ui/common/CustomBottomSheetDialogFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ open class CustomBottomSheetDialogFragment(
1212
private val canUserDragToCancel: Boolean = true,
1313
): BottomSheetDialogFragment() {
1414

15-
override fun getTheme(): Int = R.style.ModalBottomSheetTheme
15+
override fun getTheme(): Int = R.style.SettingModalBottomSheetTheme
1616

1717
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog =
1818
BottomSheetDialog(requireContext(), theme)

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

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,26 @@
88
android:layout_height="match_parent"
99
tools:context=".MainActivity">
1010

11+
<com.google.android.material.appbar.AppBarLayout
12+
android:id="@+id/app_bar"
13+
android:layout_width="0dp"
14+
android:layout_height="wrap_content"
15+
android:background="?attr/colorPrimary"
16+
app:layout_constraintTop_toTopOf="parent"
17+
app:layout_constraintStart_toStartOf="parent"
18+
app:layout_constraintEnd_toEndOf="parent">
19+
20+
<com.google.android.material.appbar.MaterialToolbar
21+
android:id="@+id/toolbar"
22+
style="@style/Widget.MaterialComponents.Toolbar"
23+
android:layout_width="match_parent"
24+
android:layout_height="wrap_content"
25+
android:background="?attr/colorPrimary"
26+
app:titleTextColor="@android:color/white"
27+
app:navigationIconTint="@android:color/white" />
28+
29+
</com.google.android.material.appbar.AppBarLayout>
30+
1131
<TextView
1232
android:id="@+id/tvOutput"
1333
android:layout_width="0dp"
@@ -22,7 +42,7 @@
2242
app:layout_constraintLeft_toLeftOf="parent"
2343
app:layout_constraintRight_toRightOf="parent"
2444
app:layout_constraintStart_toStartOf="parent"
25-
app:layout_constraintTop_toTopOf="parent" />
45+
app:layout_constraintTop_toBottomOf="@id/app_bar" />
2646

2747
<Button
2848
android:id="@+id/btEnter"
@@ -49,4 +69,4 @@
4969
app:layout_constraintStart_toStartOf="parent"
5070
android:imeOptions="actionSend"/>
5171

52-
</androidx.constraintlayout.widget.ConstraintLayout>
72+
</androidx.constraintlayout.widget.ConstraintLayout>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<resources xmlns:tools="http://schemas.android.com/tools">
2+
<!-- Night: nav bar icons should be light -->
3+
<style name="SettingModalBottomSheetTheme" parent="@style/ModalBottomSheetTheme.Base">
4+
<item name="android:windowLightNavigationBar" tools:targetApi="27">false</item>
5+
</style>
6+
</resources>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<resources>
2+
<!-- API 23+: control status bar icon contrast (dark icons vs light icons) -->
3+
<style name="UsbTerminalTheme" parent="@style/AppTheme.Base">
4+
<!-- Turquoise status bar needs light icons for readability -->
5+
<item name="android:windowLightStatusBar">false</item>
6+
</style>
7+
8+
<style name="SettingModalBottomSheetTheme" parent="@style/ModalBottomSheetTheme.Base">
9+
<!-- Keep light icons on the turquoise status bar in the modal as well -->
10+
<item name="android:windowLightStatusBar">false</item>
11+
</style>
12+
</resources>
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: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
<resources xmlns:tools="http://schemas.android.com/tools">
22

33
<!-- Base application theme. -->
4-
<style name="AppTheme" 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>
7-
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
7+
<!-- Ensure status bar tone matches app bar exactly -->
8+
<item name="colorPrimaryDark">@color/colorPrimary</item>
89
<item name="colorAccent">@color/colorAccent</item>
910

1011
<item name="android:textColorPrimary">@color/textColorPrimary</item>
1112
<item name="android:textColorSecondary">@color/textColorSecondary</item>
1213
</style>
1314

14-
<style name="ModalBottomSheet" parent="@style/Widget.Design.BottomSheet.Modal">
15-
<item name="android:background">@drawable/bg_modal_bottom_sheet</item>
15+
<!-- App theme alias; v23 will override this to add icon contrast -->
16+
<style name="UsbTerminalTheme" parent="@style/AppTheme.Base" />
17+
18+
<!-- Common items for the bottom sheet theme -->
19+
<style name="ModalBottomSheetTheme.Base" parent="Theme.Material3.DayNight.BottomSheetDialog">
20+
<!-- Edge-to-edge for modal as well; host handles coloring -->
21+
<item name="android:navigationBarColor">@color/bg_modal_bottom_sheet</item>
22+
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
1623
</style>
1724

18-
<style name="ModalBottomSheetTheme" parent="Theme.Design.BottomSheetDialog">
19-
<item name="android:statusBarColor">@android:color/transparent</item>
25+
<!-- Day variant adds light nav bar icons -->
26+
<style name="SettingModalBottomSheetTheme" parent="@style/ModalBottomSheetTheme.Base">
2027
<item name="android:windowLightNavigationBar" tools:targetApi="27">true</item>
21-
<item name="android:windowIsFloating">false</item>
22-
<item name="bottomSheetStyle">@style/ModalBottomSheet</item>
2328
</style>
2429

2530
</resources>

0 commit comments

Comments
 (0)