@@ -2,8 +2,10 @@ package com.dessalines.thumbkey.ui.components.keyboard
2
2
import android.content.Context
3
3
import android.media.AudioManager
4
4
import androidx.compose.animation.AnimatedVisibility
5
+ import androidx.compose.animation.EnterTransition
5
6
import androidx.compose.animation.ExitTransition
6
7
import androidx.compose.animation.core.tween
8
+ import androidx.compose.animation.fadeOut
7
9
import androidx.compose.animation.slideInVertically
8
10
import androidx.compose.foundation.background
9
11
import androidx.compose.foundation.clickable
@@ -29,6 +31,7 @@ import androidx.compose.runtime.rememberCoroutineScope
29
31
import androidx.compose.runtime.setValue
30
32
import androidx.compose.ui.Alignment
31
33
import androidx.compose.ui.Modifier
34
+ import androidx.compose.ui.graphics.Color
32
35
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
33
36
import androidx.compose.ui.input.pointer.pointerInput
34
37
import androidx.compose.ui.platform.LocalContext
@@ -291,14 +294,31 @@ fun KeyboardKey(
291
294
KeyText (it, keySizeDp, hideLetters, capsLock)
292
295
}
293
296
}
294
- // The popup overlay
297
+
298
+ // The animated box that fades out.
299
+ AnimatedVisibility (
300
+ modifier = Modifier
301
+ .fillMaxSize()
302
+ .background(color = Color (0 , 0 , 0 , 0 )),
303
+ visible = releasedKey.value != null ,
304
+ enter = EnterTransition .None ,
305
+ exit = fadeOut( tween(animationSpeed) )
306
+ ) {
307
+ Box (
308
+ contentAlignment = Alignment .Center ,
309
+ modifier = Modifier .fillMaxSize()
310
+ .background(color = MaterialTheme .colorScheme.tertiaryContainer)
311
+ ) {}
312
+ }
313
+
314
+ // The animated key letter that falls downwards and then fades out.
295
315
AnimatedVisibility (
296
316
modifier = Modifier
297
317
.fillMaxSize()
298
- .background(color = MaterialTheme .colorScheme.tertiaryContainer ),
318
+ .background(color = Color ( 0 , 0 , 0 , 0 ) ),
299
319
visible = releasedKey.value != null ,
300
- enter = slideInVertically(tween(animationSpeed)),
301
- exit = ExitTransition . None
320
+ enter = slideInVertically( tween(animationSpeed) ),
321
+ exit = fadeOut( tween(animationSpeed) )
302
322
) {
303
323
Box (
304
324
contentAlignment = Alignment .Center ,
0 commit comments