Skip to content

Commit e21ccff

Browse files
committed
#1989 center the "Trigger and actions" and "Constraint and more" tabs
1 parent 863b7c6 commit e21ccff

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- [#1983](https://github.com/keymapperorg/KeyMapper/issues/1983) Inputting a modifier key and another key as actions through Expert mode applies the correct key character map.
2020
- [#1990](https://github.com/keymapperorg/KeyMapper/issues/1990) Passthrough the device id of the trigger to the key event action if one is not manually specified
2121
- [#1982](https://github.com/keymapperorg/KeyMapper/issues/1982) Text action does not need Key Mapper input method on Android 13+.
22+
- [#1989](https://github.com/keymapperorg/KeyMapper/issues/1989) center the "Trigger and actions" and "Constraint and more" tabs.
2223
- Bugs with expert mode auto starting time.
2324

2425
## [4.0.0 Beta 6](https://github.com/sds100/KeyMapper/releases/tag/v4.0.0-beta.06)

base/src/main/java/io/github/sds100/keymapper/base/keymaps/BaseConfigKeyMapScreen.kt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import androidx.compose.foundation.background
77
import androidx.compose.foundation.layout.Arrangement
88
import androidx.compose.foundation.layout.BoxWithConstraints
99
import androidx.compose.foundation.layout.Column
10+
import androidx.compose.foundation.layout.IntrinsicSize
1011
import androidx.compose.foundation.layout.Row
1112
import androidx.compose.foundation.layout.Spacer
1213
import androidx.compose.foundation.layout.displayCutoutPadding
@@ -32,7 +33,6 @@ import androidx.compose.material3.IconButton
3233
import androidx.compose.material3.MaterialTheme
3334
import androidx.compose.material3.OutlinedCard
3435
import androidx.compose.material3.PrimaryScrollableTabRow
35-
import androidx.compose.material3.PrimaryTabRow
3636
import androidx.compose.material3.Scaffold
3737
import androidx.compose.material3.SnackbarHost
3838
import androidx.compose.material3.SnackbarHostState
@@ -200,19 +200,24 @@ fun BaseConfigKeyMapScreen(
200200
}
201201
}
202202

203-
if (this@BoxWithConstraints.maxWidth < 500.dp) {
203+
if (tabs.size == 2) {
204+
// If only two tabs are showing then center them
204205
PrimaryScrollableTabRow(
206+
modifier = Modifier
207+
.align(Alignment.CenterHorizontally)
208+
.width(IntrinsicSize.Max),
209+
edgePadding = 0.dp,
205210
selectedTabIndex = pagerState.targetPage,
206211
divider = {},
207-
edgePadding = 16.dp,
208212
contentColor = MaterialTheme.colorScheme.onSurface,
209213
) {
210214
Tabs()
211215
}
212216
} else {
213-
PrimaryTabRow(
217+
PrimaryScrollableTabRow(
214218
selectedTabIndex = pagerState.targetPage,
215219
divider = {},
220+
edgePadding = 16.dp,
216221
contentColor = MaterialTheme.colorScheme.onSurface,
217222
) {
218223
Tabs()
@@ -226,9 +231,13 @@ fun BaseConfigKeyMapScreen(
226231
) { pageIndex ->
227232
when (tabs[pageIndex]) {
228233
ConfigKeyMapTab.TRIGGER -> triggerScreen()
234+
229235
ConfigKeyMapTab.ACTIONS -> actionsScreen()
236+
230237
ConfigKeyMapTab.CONSTRAINTS -> constraintsScreen()
238+
231239
ConfigKeyMapTab.OPTIONS -> optionsScreen()
240+
232241
ConfigKeyMapTab.TRIGGER_AND_ACTIONS -> {
233242
if (isVerticalTwoScreen) {
234243
VerticalTwoScreens(

0 commit comments

Comments
 (0)