Skip to content

Commit 4a00f0e

Browse files
fix(detekt): fix detekt issues
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
1 parent 97d0454 commit 4a00f0e

3 files changed

Lines changed: 14 additions & 7 deletions

File tree

app/src/main/java/com/nextcloud/talk/conversationlist/ui/ConversationList.kt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,12 @@ private enum class SwipeValue { Settled, StartToEnd, EndToStart }
227227

228228
private const val POP_SCALE_PEAK = 1.35f
229229

230+
private const val DESTRUCTIVE_SWIPE_THRESHOLD = 0.40f
231+
232+
private const val NON_DESTRUCTIVE_SWIPE_THRESHOLD = 0.20f
233+
234+
private const val NON_DESTRUCTIVE_SWIPE_END_LIMIT = 0.3f
235+
230236
@Suppress("LongMethod")
231237
@Composable
232238
private fun SwipeableConversationItem(
@@ -259,13 +265,13 @@ private fun SwipeableConversationItem(
259265
}
260266
val startToEndProgress by remember {
261267
derivedStateOf {
262-
val threshold = itemWidth * 0.20f
268+
val threshold = itemWidth * NON_DESTRUCTIVE_SWIPE_THRESHOLD
263269
if (threshold > 0f) (offsetX.value / threshold).coerceIn(0f, 1f) else 0f
264270
}
265271
}
266272
val endToStartProgress by remember {
267273
derivedStateOf {
268-
val threshold = itemWidth * 0.40f
274+
val threshold = itemWidth * DESTRUCTIVE_SWIPE_THRESHOLD
269275
if (threshold > 0f) (-offsetX.value / threshold).coerceIn(0f, 1f) else 0f
270276
}
271277
}
@@ -276,9 +282,9 @@ private fun SwipeableConversationItem(
276282
.onSizeChanged { size -> itemWidth = size.width }
277283
.pointerInput(Unit) {
278284
awaitEachGesture {
279-
val startToEndThreshold = itemWidth * 0.20f
280-
val startToEndLimit = itemWidth * 0.3f
281-
val endToStartThreshold = -itemWidth * 0.40f
285+
val startToEndThreshold = itemWidth * NON_DESTRUCTIVE_SWIPE_THRESHOLD
286+
val startToEndLimit = itemWidth * NON_DESTRUCTIVE_SWIPE_END_LIMIT
287+
val endToStartThreshold = -itemWidth * DESTRUCTIVE_SWIPE_THRESHOLD
282288
val endToStartLimit = -itemWidth.toFloat()
283289

284290
val down = awaitFirstDown(requireUnconsumed = false)

app/src/main/java/com/nextcloud/talk/conversationlist/ui/LeaveIcon.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ private const val LEAVE_ARROW_MAX_DX = 2f
2424
internal fun LeaveIcon(progress: Float, popScale: Float, color: Color, modifier: Modifier = Modifier) {
2525
val doorPath = remember {
2626
PathParser().parsePathString(
27-
"M19,3H5c-1.11,0 -2,0.9 -2,2v4h2V5h14v14H5v-4H3v4c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2z"
27+
"M19,3H5c-1.11,0 -2,0.9 -2,2v4h2V5h14v14H5v-4H3v4c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2V5c0," +
28+
"-1.1 -0.9,-2 -2,-2z"
2829
).toPath()
2930
}
3031
val arrowPath = remember {

detekt.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-FileCopyrightText: 2017-2026 Nextcloud GmbH and Nextcloud contributors
22
# SPDX-License-Identifier: GPL-3.0-or-later
33
build:
4-
maxIssues: 95
4+
maxIssues: 96
55
weights:
66
# complexity: 2
77
# LongParameterList: 1

0 commit comments

Comments
 (0)