Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ElifBon's full-sized avatar

Elif Boncuk ElifBon

View GitHub Profile
@Composable
fun Greeting(name: String) {
Text (text = "Hello $name!", modifier = Spacing(24.dp))
}
@Composable
fun Greeting(name: String) {
Surface(color = Color.Yellow){
Text (text = "Hello $name!")
}
}
@Composable
fun Greeting(name: String) {
Text (text = "Hello $name!")
}
@Composable
fun Greeting(name: String) {
Text (text = "Hello $name!")
}
fun createSlice(sliceUri: Uri): Slice {
val activityAction = createActivityAction()
return list(context, sliceUri, INFINITY) {
row {
title = "Perform action in app"
primaryAction = activityAction
}
}
}
<provider
android:name=".MySliceProvider"
android:authorities="com.boncuk.slicesdemo"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.app.slice.category.SLICE"/>
<data
/**
* Construct the Slice and bind data if available.
*/
override fun onBindSlice(sliceUri: Uri): Slice? {
// Note: you should switch your build.gradle dependency to
// slice-builders-ktx for a nicer interface in Kotlin.
val context = context ?: return null
val activityAction = createActivityAction() ?: return null
return if (sliceUri.path == "/hello") {
// Path recognized. Customize the Slice using the androidx.slice.builders API.
<provider
android:name=".MySliceProvider"
android:authorities="com.boncuk.slicesdemo"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.app.slice.category.SLICE"/>
<data