Lift Compose theme to abstract controller

This commit is contained in:
arkon 2022-04-21 22:58:28 -04:00
parent 7c8e8317a8
commit 032aa64195
2 changed files with 29 additions and 33 deletions

View File

@ -46,7 +46,6 @@ import eu.kanade.domain.history.model.HistoryWithRelations
import eu.kanade.presentation.components.EmptyScreen
import eu.kanade.presentation.components.MangaCover
import eu.kanade.presentation.components.MangaCoverAspect
import eu.kanade.presentation.theme.TachiyomiTheme
import eu.kanade.presentation.util.horizontalPadding
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
@ -61,12 +60,6 @@ import java.text.DecimalFormat
import java.text.DecimalFormatSymbols
import java.util.Date
val chapterFormatter = DecimalFormat(
"#.###",
DecimalFormatSymbols()
.apply { decimalSeparator = '.' },
)
@Composable
fun HistoryScreen(
composeView: ComposeView,
@ -76,7 +69,6 @@ fun HistoryScreen(
onClickDelete: (HistoryWithRelations, Boolean) -> Unit,
) {
val nestedScrollInterop = rememberNestedScrollInteropConnection(composeView)
TachiyomiTheme {
val state by presenter.state.collectAsState()
val history = state.list?.collectAsLazyPagingItems()
when {
@ -99,7 +91,6 @@ fun HistoryScreen(
}
}
}
}
@Composable
fun HistoryContent(
@ -146,10 +137,7 @@ fun HistoryContent(
}
}
item {
Spacer(
modifier = Modifier
.navigationBarsPadding()
)
Spacer(Modifier.navigationBarsPadding())
}
}
@ -302,3 +290,8 @@ fun RemoveHistoryDialog(
},
)
}
private val chapterFormatter = DecimalFormat(
"#.###",
DecimalFormatSymbols().apply { decimalSeparator = '.' },
)

View File

@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.base.controller
import android.view.LayoutInflater
import android.view.View
import androidx.compose.runtime.Composable
import eu.kanade.presentation.theme.TachiyomiTheme
import eu.kanade.tachiyomi.databinding.ComposeControllerBinding
import nucleus.presenter.Presenter
@ -15,9 +16,11 @@ abstract class ComposeController<P : Presenter<*>> : NucleusController<ComposeCo
super.onViewCreated(view)
binding.root.setContent {
TachiyomiTheme {
ComposeContent()
}
}
}
@Composable abstract fun ComposeContent()
}