Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ import com.materialkolor.ktx.blend
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.CancellationException
import sh.calvin.reorderable.ReorderableColumn

@Composable
fun ChatInputLayout(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import androidx.compose.material3.Text
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.key
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
Expand All @@ -44,6 +45,7 @@ import com.flxrs.dankchat.preferences.appearance.InputAction
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
import sh.calvin.reorderable.ReorderableColumn
import sh.calvin.reorderable.ReorderableItem

private const val MAX_INPUT_ACTIONS = 4

Expand Down Expand Up @@ -91,41 +93,45 @@ internal fun InputActionConfigSheet(
},
modifier = Modifier.fillMaxWidth(),
) { _, action, isDragging ->
val elevation by animateDpAsState(if (isDragging) 8.dp else 0.dp)
key(action) {
ReorderableItem {
val elevation by animateDpAsState(if (isDragging) 8.dp else 0.dp)

Surface(
shadowElevation = elevation,
color = if (isDragging) MaterialTheme.colorScheme.surfaceContainerHighest else Color.Transparent,
) {
Row(
modifier =
Modifier
.fillMaxWidth()
.longPressDraggableHandle()
.padding(horizontal = 16.dp, vertical = 8.dp)
.height(40.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
imageVector = Icons.Default.DragHandle,
contentDescription = null,
modifier = Modifier.size(24.dp),
)
Spacer(Modifier.width(16.dp))
Icon(
imageVector = action.icon,
contentDescription = null,
modifier = Modifier.size(24.dp),
)
Spacer(Modifier.width(16.dp))
Text(
text = stringResource(action.labelRes),
modifier = Modifier.weight(1f),
)
Checkbox(
checked = true,
onCheckedChange = { localEnabled.remove(action) },
)
Surface(
shadowElevation = elevation,
color = if (isDragging) MaterialTheme.colorScheme.surfaceContainerHighest else Color.Transparent,
) {
Row(
modifier =
Modifier
.fillMaxWidth()
.longPressDraggableHandle()
.padding(horizontal = 16.dp, vertical = 8.dp)
.height(40.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
imageVector = Icons.Default.DragHandle,
contentDescription = null,
modifier = Modifier.size(24.dp),
)
Spacer(Modifier.width(16.dp))
Icon(
imageVector = action.icon,
contentDescription = null,
modifier = Modifier.size(24.dp),
)
Spacer(Modifier.width(16.dp))
Text(
text = stringResource(action.labelRes),
modifier = Modifier.weight(1f),
)
Checkbox(
checked = true,
onCheckedChange = { localEnabled.remove(action) },
)
}
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ processPhoenix = "3.0.0"

colorPicker = "3.1.0"
materialKolor = "4.1.1"
reorderable = "2.4.3"
reorderable = "3.0.0"

spotless = "8.4.0"
ktlint = "1.8.0"
Expand Down