Skip to content

Instantly share code, notes, and snippets.

Avatar
😭
Student

Anaf Naufalian kafri8889

😭
Student
View GitHub Profile
@kafri8889
kafri8889 / BubbleNotification.kt
Last active Sep 19, 2022
BubbleNotification, similar to Snackbar, is on top with enter/exit slide animation
View BubbleNotification.kt
@Composable
fun BubbleNotificationHost(
hostState: BubbleNotificationHostState,
modifier: Modifier = Modifier,
animationSpec: FiniteAnimationSpec<IntOffset> = tween(300),
bubbleNotification: @Composable (BubbleNotificationData) -> Unit = { BubbleNotification(it) },
content: @Composable () -> Unit
) {
val currentBubbleNotificationData = hostState.currentBubbleNotificationData
@kafri8889
kafri8889 / transformationExmpl.kt
Last active Aug 14, 2022
Remove audio from video with ExoPlayer
View transformationExmpl.kt
// inside the composable function
val context = LocalContext.current
var exoPlayer by remember { mutableStateOf<ExoPlayer?>(null) }
val transformerListener = remember {
object : Transformer.Listener {
override fun onTransformationCompleted(inputMediaItem: MediaItem, transformationResult: TransformationResult) {
super.onTransformationCompleted(inputMediaItem, transformationResult)
@kafri8889
kafri8889 / PickerManager.kt
Last active Jul 22, 2022
class for picker dialog
View PickerManager.kt
/**
@author kafri8889
**/
class PickerManager(
private val context: FragmentActivity,
private val listener: PickerListener
) {
fun datePicker(
data: Any? = null,
View SettingPreference.kt
@Composable
fun SettingPreference(
preference: Preference,
onClick: (Any) -> Unit
) {
when (preference) {
is BasicPreference -> {
BasicPreference(
preference = preference,
onClick = onClick
@kafri8889
kafri8889 / DateTextField.kt
Last active Jun 26, 2022
Date format in TextField Jetpack Compose
View DateTextField.kt
@Composable
fun Screen() {
var date by remember {
mutableStateOf(
TextFieldValue(
text = "dd-MM-yyyy"
)
)
}
@kafri8889
kafri8889 / DashedDivider.kt
Created Jun 12, 2022
Dashed divider in Jetpack Compose
View DashedDivider.kt
@Preview
@Composable
private fun DashedDividerPreview() {
DashedDivider(
color = Color.Black,
thickness = 1.dp,
modifier = Modifier
.fillMaxWidth()
.padding(16.dp)
)