File tree Expand file tree Collapse file tree
app/src/main/java/org/schabi/newpipe/ui/emptystate Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33package org.schabi.newpipe.ui.emptystate
44
5- import androidx.annotation.StringRes
6- import androidx.compose.runtime.MutableState
7- import androidx.compose.runtime.State
85import androidx.compose.ui.platform.ComposeView
96import androidx.compose.ui.platform.ViewCompositionStrategy
10- import androidx.compose.ui.res.stringResource
117import org.schabi.newpipe.ui.theme.AppTheme
12- import androidx.compose.runtime.mutableStateOf as composeRuntimeMutableStateOf
138
149@JvmOverloads
1510fun ComposeView.setEmptyStateComposable (
@@ -25,40 +20,3 @@ fun ComposeView.setEmptyStateComposable(
2520 }
2621 }
2722}
28-
29- @JvmOverloads
30- fun ComposeView.setEmptyStateComposable (
31- spec : State <EmptyStateSpec >,
32- strategy : ViewCompositionStrategy = ViewCompositionStrategy .DisposeOnViewTreeLifecycleDestroyed ,
33- ) = apply {
34- setViewCompositionStrategy(strategy)
35- setContent {
36- AppTheme {
37- EmptyStateComposable (
38- spec = spec.value,
39- )
40- }
41- }
42- }
43-
44- /* *
45- * Used in Java land to bridge the [MutableState] API.
46- */
47- fun <T > mutableStateOf (param : T ): MutableState <T > {
48- return composeRuntimeMutableStateOf(param)
49- }
50-
51- /* *
52- * Used in Java land to modify [EmptyStateSpec] properties.
53- * TODO: remove after Kotlin migration
54- */
55- class EmptyStateSpecBuilder (private var spec : EmptyStateSpec ) {
56-
57- fun descriptionText (@StringRes stringRes : Int ) = apply {
58- spec = spec.copy(
59- descriptionText = { stringResource(id = stringRes) }
60- )
61- }
62-
63- fun build () = spec
64- }
You can’t perform that action at this time.
0 commit comments