override fun buildSlice()

in InteractiveSliceProviderKotlin/app/src/main/java/com/example/android/interactivesliceprovider/slicebuilders/WeatherSliceBuilder.kt [39:103]


    override fun buildSlice(): Slice {
        val action = SliceAction.create(
            SliceActionsBroadcastReceiver.getIntent(
                context,
                InteractiveSliceProvider.ACTION_TOAST,
                "open weather app"
            ),
            IconCompat.createWithResource(context, drawable.ic_location),
            ListBuilder.ICON_IMAGE,
            "Weather is happening!"
        )
        return list(context, sliceUri, ListBuilder.INFINITY) {
            header {
                title = "Weather"
                subtitle = "Weather Slice Example"
                primaryAction = action
            }
            gridRow {
                primaryAction = action
                cell {
                    addImage(
                        IconCompat.createWithResource(context, drawable.weather_1),
                        ListBuilder.SMALL_IMAGE
                    )
                    addText("MON")
                    addTitleText("69\u00B0")
                }
                cell {
                    addImage(
                        IconCompat.createWithResource(context, drawable.weather_2),
                        ListBuilder.SMALL_IMAGE
                    )
                    addText("TUE")
                    addTitleText("71\u00B0")
                }
                cell {
                    addImage(
                        IconCompat.createWithResource(context, drawable.weather_3),
                        ListBuilder.SMALL_IMAGE
                    )
                    addText("WED")
                    addTitleText("76\u00B0")
                }
                cell {
                    addImage(
                        IconCompat.createWithResource(context, drawable.weather_4),
                        ListBuilder.SMALL_IMAGE
                    )
                    addText("THU")
                    addTitleText("72\u00B0")
                }
                cell {
                    addImage(
                        IconCompat.createWithResource(
                            context,
                            drawable.weather_1
                        ),
                        ListBuilder.SMALL_IMAGE
                    )
                    addText("FRI")
                    addTitleText("68\u00B0")
                }
            }
        }
    }