1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-11-22 01:55:22 +01:00

Remove unused methods in EmptyStateUtil

This commit is contained in:
Stypox 2024-11-21 13:14:19 +01:00
parent 404d9f3fac
commit 414b1a8344
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23

View File

@ -2,14 +2,9 @@
package org.schabi.newpipe.ui.emptystate package org.schabi.newpipe.ui.emptystate
import androidx.annotation.StringRes
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.State
import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.compose.ui.res.stringResource
import org.schabi.newpipe.ui.theme.AppTheme import org.schabi.newpipe.ui.theme.AppTheme
import androidx.compose.runtime.mutableStateOf as composeRuntimeMutableStateOf
@JvmOverloads @JvmOverloads
fun ComposeView.setEmptyStateComposable( fun ComposeView.setEmptyStateComposable(
@ -25,40 +20,3 @@ fun ComposeView.setEmptyStateComposable(
} }
} }
} }
@JvmOverloads
fun ComposeView.setEmptyStateComposable(
spec: State<EmptyStateSpec>,
strategy: ViewCompositionStrategy = ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed,
) = apply {
setViewCompositionStrategy(strategy)
setContent {
AppTheme {
EmptyStateComposable(
spec = spec.value,
)
}
}
}
/**
* Used in Java land to bridge the [MutableState] API.
*/
fun <T> mutableStateOf(param: T): MutableState<T> {
return composeRuntimeMutableStateOf(param)
}
/**
* Used in Java land to modify [EmptyStateSpec] properties.
* TODO: remove after Kotlin migration
*/
class EmptyStateSpecBuilder(private var spec: EmptyStateSpec) {
fun descriptionText(@StringRes stringRes: Int) = apply {
spec = spec.copy(
descriptionText = { stringResource(id = stringRes) }
)
}
fun build() = spec
}