22
33package com.dede.android_eggs.views.main.compose
44
5- import android.view.HapticFeedbackConstants
65import androidx.compose.animation.AnimatedContent
76import androidx.compose.animation.animateContentSize
87import androidx.compose.animation.core.animate
@@ -54,12 +53,13 @@ import androidx.compose.runtime.setValue
5453import androidx.compose.ui.Alignment
5554import androidx.compose.ui.Modifier
5655import androidx.compose.ui.draw.clip
56+ import androidx.compose.ui.hapticfeedback.HapticFeedbackType
5757import androidx.compose.ui.layout.onSizeChanged
5858import androidx.compose.ui.platform.LocalConfiguration
5959import androidx.compose.ui.platform.LocalContext
60+ import androidx.compose.ui.platform.LocalHapticFeedback
6061import androidx.compose.ui.platform.LocalInspectionMode
6162import androidx.compose.ui.platform.LocalLayoutDirection
62- import androidx.compose.ui.platform.LocalView
6363import androidx.compose.ui.res.stringResource
6464import androidx.compose.ui.text.SpanStyle
6565import androidx.compose.ui.text.buildAnnotatedString
@@ -274,13 +274,13 @@ private fun EasterEggItemSwipe(
274274 }
275275 }
276276
277- val view = LocalView .current
278277 Box (
279278 contentAlignment = Alignment .Center ,
280279 ) {
281280 if (offsetX != 0f ) {
282281 floor()
283282 }
283+ val hapticFeedback = LocalHapticFeedback .current
284284 Box (
285285 modifier = Modifier
286286 .onSizeChanged { triggerOffsetX = it.width / 5f * 2 }
@@ -300,7 +300,7 @@ private fun EasterEggItemSwipe(
300300 if (supportShortcut) {
301301 if (! needTrigger && (- offsetX) >= triggerOffsetX) {
302302 needTrigger = true
303- view .performHapticFeedback(HapticFeedbackConstants . CLOCK_TICK )
303+ hapticFeedback .performHapticFeedback(HapticFeedbackType . SegmentTick )
304304 }
305305 callbackSwipeProgress(offsetX)
306306 }
0 commit comments