Use pointerInput instead of combinedClickable
because it's fucking laggy
This commit is contained in:
parent
6e411e9555
commit
e55ab9116b
@ -9,6 +9,7 @@ import androidx.compose.animation.core.LinearEasing
|
|||||||
import androidx.compose.animation.core.animateFloatAsState
|
import androidx.compose.animation.core.animateFloatAsState
|
||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.foundation.*
|
import androidx.compose.foundation.*
|
||||||
|
import androidx.compose.foundation.gestures.detectTapGestures
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
@ -31,6 +32,7 @@ import androidx.compose.ui.graphics.Color
|
|||||||
import androidx.compose.ui.graphics.drawscope.drawIntoCanvas
|
import androidx.compose.ui.graphics.drawscope.drawIntoCanvas
|
||||||
import androidx.compose.ui.graphics.drawscope.scale
|
import androidx.compose.ui.graphics.drawscope.scale
|
||||||
import androidx.compose.ui.graphics.drawscope.withTransform
|
import androidx.compose.ui.graphics.drawscope.withTransform
|
||||||
|
import androidx.compose.ui.input.pointer.pointerInput
|
||||||
import androidx.compose.ui.platform.LocalDensity
|
import androidx.compose.ui.platform.LocalDensity
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
@ -91,13 +93,12 @@ fun ShapedLauncherIcon(
|
|||||||
clip = currentIcon?.backgroundLayer !is TransparentLayer
|
clip = currentIcon?.backgroundLayer !is TransparentLayer
|
||||||
this.shape = shape
|
this.shape = shape
|
||||||
}
|
}
|
||||||
.combinedClickable(
|
.pointerInput(null) {
|
||||||
enabled = onClick != null || onLongClick != null,
|
detectTapGestures(
|
||||||
onClick = {
|
onLongPress = { onLongClick?.invoke() },
|
||||||
onClick?.invoke()
|
onTap = { onClick?.invoke() },
|
||||||
},
|
)
|
||||||
onLongClick = onLongClick,
|
},
|
||||||
),
|
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
currentIcon?.let {
|
currentIcon?.let {
|
||||||
@ -123,13 +124,12 @@ fun ShapedLauncherIcon(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(size * 0.33f)
|
.size(size * 0.33f)
|
||||||
.align(Alignment.BottomEnd)
|
.align(Alignment.BottomEnd)
|
||||||
.combinedClickable(
|
.pointerInput(null) {
|
||||||
enabled = onClick != null || onLongClick != null,
|
detectTapGestures(
|
||||||
onClick = {
|
onLongPress = { onLongClick?.invoke() },
|
||||||
onClick?.invoke()
|
onTap = { onClick?.invoke() },
|
||||||
},
|
)
|
||||||
onLongClick = onLongClick,
|
},
|
||||||
),
|
|
||||||
color = MaterialTheme.colorScheme.secondary,
|
color = MaterialTheme.colorScheme.secondary,
|
||||||
shape = CircleShape
|
shape = CircleShape
|
||||||
) {
|
) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user