Skip to content

Commit 4055ea2

Browse files
committed
#1612 move new group and new constraint buttons to the end
1 parent e0272ba commit 4055ea2

File tree

2 files changed

+48
-27
lines changed

2 files changed

+48
-27
lines changed

app/src/main/java/io/github/sds100/keymapper/groups/GroupConstraintRow.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,6 @@ fun GroupConstraintRow(
6969
horizontalArrangement = Arrangement.spacedBy(8.dp),
7070
itemVerticalAlignment = Alignment.CenterVertically,
7171
) {
72-
NewConstraintButton(
73-
onClick = onNewConstraintClick,
74-
showText = constraints.isEmpty(),
75-
enabled = enabled,
76-
)
77-
7872
for ((index, constraint) in constraints.withIndex()) {
7973
when (constraint) {
8074
is ComposeChipModel.Normal ->
@@ -148,6 +142,12 @@ fun GroupConstraintRow(
148142
style = MaterialTheme.typography.labelMedium,
149143
)
150144
}
145+
146+
NewConstraintButton(
147+
onClick = onNewConstraintClick,
148+
showText = constraints.isEmpty(),
149+
enabled = enabled,
150+
)
151151
}
152152
}
153153
}

app/src/main/java/io/github/sds100/keymapper/groups/GroupRow.kt

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,36 @@ fun GroupRow(
7777
},
7878
overflow = FlowRowOverflow.expandOrCollapseIndicator(
7979
expandIndicator = {
80-
// Some padding is required on the end to stop it overflowing the screen.
81-
TextGroupButton(
82-
modifier = Modifier.padding(end = 16.dp),
83-
onClick = { viewAllState = true },
84-
text = stringResource(R.string.home_new_view_all_groups_button),
85-
enabled = enabled,
86-
)
80+
// Show new group button in the expand indicator if the new group button
81+
// in the flow row has overflowed.
82+
Row {
83+
NewGroupButton(
84+
onClick = onNewGroupClick,
85+
text = if (isSubgroups) {
86+
stringResource(R.string.home_new_subgroup_button)
87+
} else {
88+
stringResource(R.string.home_new_group_button)
89+
},
90+
icon = {
91+
Icon(imageVector = Icons.Rounded.Add, null)
92+
},
93+
showText = groups.isEmpty(),
94+
enabled = enabled,
95+
)
96+
97+
Spacer(Modifier.width(8.dp))
98+
99+
// Some padding is required on the end to stop it overflowing the screen.
100+
TextGroupButton(
101+
modifier = Modifier.padding(end = 16.dp),
102+
onClick = { viewAllState = true },
103+
text = stringResource(R.string.home_new_view_all_groups_button),
104+
enabled = enabled,
105+
)
106+
}
87107
},
88108
collapseIndicator = {
109+
// Some padding is required on the end to stop it overflowing the screen.
89110
TextGroupButton(
90111
modifier = Modifier.padding(end = 16.dp),
91112
onClick = { viewAllState = false },
@@ -96,20 +117,6 @@ fun GroupRow(
96117
minRowsToShowCollapse = 3,
97118
),
98119
) {
99-
NewGroupButton(
100-
onClick = onNewGroupClick,
101-
text = if (isSubgroups) {
102-
stringResource(R.string.home_new_subgroup_button)
103-
} else {
104-
stringResource(R.string.home_new_group_button)
105-
},
106-
icon = {
107-
Icon(imageVector = Icons.Rounded.Add, null)
108-
},
109-
showText = groups.isEmpty(),
110-
enabled = enabled,
111-
)
112-
113120
if (showThisGroupButton) {
114121
TextGroupButton(
115122
onClick = onThisGroupClick,
@@ -152,6 +159,20 @@ fun GroupRow(
152159
},
153160
)
154161
}
162+
163+
NewGroupButton(
164+
onClick = onNewGroupClick,
165+
text = if (isSubgroups) {
166+
stringResource(R.string.home_new_subgroup_button)
167+
} else {
168+
stringResource(R.string.home_new_group_button)
169+
},
170+
icon = {
171+
Icon(imageVector = Icons.Rounded.Add, null)
172+
},
173+
showText = groups.isEmpty(),
174+
enabled = enabled,
175+
)
155176
}
156177
}
157178
}

0 commit comments

Comments
 (0)