Skip to content

Instantly share code, notes, and snippets.

View EfeBudak's full-sized avatar
learn->work->learn->work

Efe Budak EfeBudak

learn->work->learn->work
View GitHub Profile
val builder = NotificationCompat.Builder(this, CHANNEL_ID)
.setSmallIcon(R.drawable.ic_launcher_foreground)
.setContentTitle("Interactive Notification Title")
.setContentText("Interactive Notification Text")
.setContentIntent(InteractiveNotificationBroadcastReceiver.newPendingIntent(this))
val soCloseInteractiveNotification = builder.build()
override fun onReceive(context: Context?, intent: Intent?) {
context?.let {
Log.d("InteractiveNotificationBroadcastReceiver", "onReceive")
val notification = NotificationCompat.Builder(context, CHANNEL_ID)
.setSmallIcon(R.drawable.ic_launcher_foreground)
.setContentTitle("Interactive Notification Title")
.setContentText("MODIFIED text")
.setContentIntent(newPendingIntent(context))
.build()
NotificationManagerCompat.from(context)
@EfeBudak
EfeBudak / ObservingTheCurrentOffset.kt
Created August 7, 2024 19:28
Collect current offset of the bottom sheet
fun SomeComposable(){
val bottomSheetState = rememberStandardBottomSheetState()
val scaffoldState = rememberBottomSheetScaffoldState(bottomSheetState)
var currentOffset by remember { mutableFloatStateOf(0f) }
runCatching {
LaunchedEffect(bottomSheetState.requireOffset()) {
snapshotFlow { bottomSheetState.requireOffset() }
.collect { currentOffset = it }
val bottomSheetState = rememberStandardBottomSheetState()
val scaffoldState = rememberBottomSheetScaffoldState(bottomSheetState)
BottomSheetScaffold(
modifier = Modifier.fillMaxSize(),
scaffoldState = scaffoldState,
sheetContainerColor = Color.Transparent,
sheetContent = {
// Put whatever the sheet you want in here
}