* Apply content padding to empty screen except the empty screens in browse * compose-ify EmptyScreen * center face when action show * fix padding * apply content padding to browse tabs * fix duplicate bottom insets (cherry picked from commit 8500add09f475093e4e861f42508496e0f1fd68c) # Conflicts: # app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt # app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt # app/src/main/java/eu/kanade/presentation/library/LibraryScreen.kt # app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourcesTab.kt # app/src/main/res/layout/common_view_empty.xml
48 lines
1.4 KiB
Kotlin
Executable File
48 lines
1.4 KiB
Kotlin
Executable File
package eu.kanade.tachiyomi.widget
|
|
|
|
import android.content.Context
|
|
import android.util.AttributeSet
|
|
import androidx.annotation.StringRes
|
|
import androidx.compose.material3.LocalContentColor
|
|
import androidx.compose.material3.MaterialTheme
|
|
import androidx.compose.runtime.Composable
|
|
import androidx.compose.runtime.CompositionLocalProvider
|
|
import androidx.compose.runtime.getValue
|
|
import androidx.compose.runtime.mutableStateOf
|
|
import androidx.compose.runtime.setValue
|
|
import androidx.compose.ui.platform.AbstractComposeView
|
|
import androidx.core.view.isVisible
|
|
import eu.kanade.presentation.components.EmptyScreen
|
|
import eu.kanade.presentation.theme.TachiyomiTheme
|
|
|
|
class EmptyView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
|
AbstractComposeView(context, attrs) {
|
|
|
|
var message by mutableStateOf("")
|
|
|
|
/**
|
|
* Hide the information view
|
|
*/
|
|
fun hide() {
|
|
this.isVisible = false
|
|
}
|
|
|
|
/**
|
|
* Show the information view
|
|
* @param textResource text of information view
|
|
*/
|
|
fun show(@StringRes textResource: Int) {
|
|
message = context.getString(textResource)
|
|
this.isVisible = true
|
|
}
|
|
|
|
@Composable
|
|
override fun Content() {
|
|
TachiyomiTheme {
|
|
CompositionLocalProvider(LocalContentColor provides MaterialTheme.colorScheme.onBackground) {
|
|
EmptyScreen(message = message)
|
|
}
|
|
}
|
|
}
|
|
}
|