mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-27 11:28:23 +01:00
Maybe fix extensions list crash
Also fix weird animation of last updated text in Updates
This commit is contained in:
parent
dc62d0ea8b
commit
4c1da1bd1d
@ -164,10 +164,9 @@ fun UpdateScreen(
|
|||||||
contentPadding = contentPaddingWithNavBar,
|
contentPadding = contentPaddingWithNavBar,
|
||||||
) {
|
) {
|
||||||
if (presenter.lastUpdated > 0L) {
|
if (presenter.lastUpdated > 0L) {
|
||||||
item(key = "last_updated") {
|
updatesLastUpdatedItem(presenter.lastUpdated)
|
||||||
UpdatesLastUpdatedItem(presenter.lastUpdated)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updatesUiItems(
|
updatesUiItems(
|
||||||
uiModels = presenter.uiModels,
|
uiModels = presenter.uiModels,
|
||||||
selectionMode = presenter.selectionMode,
|
selectionMode = presenter.selectionMode,
|
||||||
|
@ -49,16 +49,17 @@ import eu.kanade.tachiyomi.ui.recent.updates.UpdatesItem
|
|||||||
import java.text.DateFormat
|
import java.text.DateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
|
||||||
@Composable
|
fun LazyListScope.updatesLastUpdatedItem(
|
||||||
fun UpdatesLastUpdatedItem(
|
|
||||||
lastUpdated: Long,
|
lastUpdated: Long,
|
||||||
) {
|
) {
|
||||||
|
item(key = "last_updated") {
|
||||||
val time = remember(lastUpdated) {
|
val time = remember(lastUpdated) {
|
||||||
DateUtils.getRelativeTimeSpanString(lastUpdated, Date().time, DateUtils.MINUTE_IN_MILLIS)
|
DateUtils.getRelativeTimeSpanString(lastUpdated, Date().time, DateUtils.MINUTE_IN_MILLIS)
|
||||||
}
|
}
|
||||||
|
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
.animateItemPlacement()
|
||||||
.padding(horizontal = horizontalPadding, vertical = 8.dp),
|
.padding(horizontal = horizontalPadding, vertical = 8.dp),
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
@ -69,6 +70,7 @@ fun UpdatesLastUpdatedItem(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun LazyListScope.updatesUiItems(
|
fun LazyListScope.updatesUiItems(
|
||||||
uiModels: List<UpdatesUiModel>,
|
uiModels: List<UpdatesUiModel>,
|
||||||
|
@ -202,16 +202,16 @@ sealed interface ExtensionUiModel {
|
|||||||
data class Resource(@StringRes val textRes: Int) : Header
|
data class Resource(@StringRes val textRes: Int) : Header
|
||||||
data class Text(val text: String) : Header
|
data class Text(val text: String) : Header
|
||||||
}
|
}
|
||||||
|
|
||||||
data class Item(
|
data class Item(
|
||||||
val extension: Extension,
|
val extension: Extension,
|
||||||
val installStep: InstallStep,
|
val installStep: InstallStep,
|
||||||
) : ExtensionUiModel {
|
) : ExtensionUiModel {
|
||||||
|
|
||||||
fun key(): String {
|
fun key(): String {
|
||||||
return when (extension) {
|
return when {
|
||||||
is Extension.Installed ->
|
extension is Extension.Installed && extension.hasUpdate -> "${extension.pkgName}_update"
|
||||||
if (extension.hasUpdate) "update_${extension.pkgName}" else extension.pkgName
|
else -> "${extension.pkgName}_${installStep.name}"
|
||||||
else -> extension.pkgName
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user