fix: 依赖更新导致的多选时重复触感反馈
This commit is contained in:
parent
fa1bf678d0
commit
d0acd1448e
5 changed files with 12 additions and 18 deletions
|
|
@ -34,7 +34,7 @@ android {
|
|||
applicationId = "cn.super12138.todo"
|
||||
minSdk = 24
|
||||
targetSdk = 36
|
||||
versionCode = 657
|
||||
versionCode = 658
|
||||
versionName = "2.1.2"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
|
|
|||
|
|
@ -142,9 +142,7 @@ fun MainPage(
|
|||
viewModel.toggleTodoSelection(item)
|
||||
}
|
||||
},
|
||||
onItemLongClick = { item ->
|
||||
viewModel.toggleTodoSelection(item)
|
||||
},
|
||||
onItemLongClick = { viewModel.toggleTodoSelection(it) },
|
||||
onItemChecked = { item ->
|
||||
item.apply {
|
||||
viewModel.updateTodo(
|
||||
|
|
@ -187,9 +185,7 @@ fun MainPage(
|
|||
viewModel.toggleTodoSelection(item)
|
||||
}
|
||||
},
|
||||
onItemLongClick = { item ->
|
||||
viewModel.toggleTodoSelection(item)
|
||||
},
|
||||
onItemLongClick = { viewModel.toggleTodoSelection(it) },
|
||||
onItemChecked = { item ->
|
||||
item.apply {
|
||||
viewModel.updateTodo(
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ package cn.super12138.todo.ui.pages.main
|
|||
import androidx.compose.animation.AnimatedVisibilityScope
|
||||
import androidx.compose.animation.ExperimentalSharedTransitionApi
|
||||
import androidx.compose.animation.SharedTransitionScope
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.LazyListState
|
||||
import androidx.compose.foundation.lazy.items
|
||||
|
|
@ -39,6 +39,7 @@ fun ManagerFragment(
|
|||
animatedVisibilityScope: AnimatedVisibilityScope
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
|
||||
LazyColumnCustomScrollBar(
|
||||
state = state,
|
||||
modifier = modifier
|
||||
|
|
@ -50,7 +51,7 @@ fun ManagerFragment(
|
|||
bottom = TodoDefaults.toDoCardHeight / 2,
|
||||
end = TodoDefaults.screenPadding
|
||||
),
|
||||
//verticalArrangement = Arrangement.spacedBy(5.dp)
|
||||
verticalArrangement = Arrangement.spacedBy(10.dp)
|
||||
) {
|
||||
if (list.isEmpty()) {
|
||||
item {
|
||||
|
|
@ -85,7 +86,7 @@ fun ManagerFragment(
|
|||
sharedTransitionScope = sharedTransitionScope,
|
||||
animatedVisibilityScope = animatedVisibilityScope,
|
||||
modifier = Modifier
|
||||
.padding(vertical = 5.dp)
|
||||
//.padding(vertical = 5.dp)
|
||||
.animateItem() // TODO: 设置动画时间
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package cn.super12138.todo.ui.pages.main.components
|
||||
|
||||
import android.view.HapticFeedbackConstants
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.AnimatedVisibilityScope
|
||||
import androidx.compose.animation.ExperimentalSharedTransitionApi
|
||||
|
|
@ -76,13 +75,9 @@ fun TodoCard(
|
|||
VibrationUtils.performHapticFeedback(view)
|
||||
onCardClick()
|
||||
},
|
||||
onLongClick = {
|
||||
VibrationUtils.performHapticFeedback(
|
||||
view,
|
||||
HapticFeedbackConstants.LONG_PRESS
|
||||
)
|
||||
onCardLongClick()
|
||||
}
|
||||
// 不再需要使用:VibrationUtils.performHapticFeedback(view, HapticFeedbackConstants.LONG_PRESS)
|
||||
// 因为 combinedClickable 在更新的 Compose 里已经处理好了触感反馈
|
||||
onLongClick = onCardLongClick
|
||||
)
|
||||
.padding(horizontal = 15.dp)
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@ fun RowSettingsItem(
|
|||
// 渲染到离屏缓冲区是为了确保边缘淡出的 alpha 效果仅应用于文本本身,而不影响该可组合项下方绘制的内容(例如窗口背景)。
|
||||
.graphicsLayer { compositingStrategy = CompositingStrategy.Offscreen }
|
||||
.drawWithContent {
|
||||
// 需要调用 drawContent,因为它用于将内容绘制到布局中的接收器作用域,允许内容穿插在其他画布操作之间绘制。
|
||||
// 如果未调用 drawContent,则不会绘制该布局的内容。
|
||||
drawContent()
|
||||
drawFadedEdge(
|
||||
edgeWidth = fadedEdgeWidth,
|
||||
|
|
|
|||
Loading…
Reference in a new issue