mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 14:27:57 +01:00 
			
		
		
		
	Maybe fix extensions list crash
Also fix weird animation of last updated text in Updates
This commit is contained in:
		| @@ -164,10 +164,9 @@ fun UpdateScreen( | ||||
|                         contentPadding = contentPaddingWithNavBar, | ||||
|                     ) { | ||||
|                         if (presenter.lastUpdated > 0L) { | ||||
|                             item(key = "last_updated") { | ||||
|                                 UpdatesLastUpdatedItem(presenter.lastUpdated) | ||||
|                             } | ||||
|                             updatesLastUpdatedItem(presenter.lastUpdated) | ||||
|                         } | ||||
|  | ||||
|                         updatesUiItems( | ||||
|                             uiModels = presenter.uiModels, | ||||
|                             selectionMode = presenter.selectionMode, | ||||
|   | ||||
| @@ -49,24 +49,26 @@ import eu.kanade.tachiyomi.ui.recent.updates.UpdatesItem | ||||
| import java.text.DateFormat | ||||
| import java.util.Date | ||||
|  | ||||
| @Composable | ||||
| fun UpdatesLastUpdatedItem( | ||||
| fun LazyListScope.updatesLastUpdatedItem( | ||||
|     lastUpdated: Long, | ||||
| ) { | ||||
|     val time = remember(lastUpdated) { | ||||
|         DateUtils.getRelativeTimeSpanString(lastUpdated, Date().time, DateUtils.MINUTE_IN_MILLIS) | ||||
|     } | ||||
|     item(key = "last_updated") { | ||||
|         val time = remember(lastUpdated) { | ||||
|             DateUtils.getRelativeTimeSpanString(lastUpdated, Date().time, DateUtils.MINUTE_IN_MILLIS) | ||||
|         } | ||||
|  | ||||
|     Box( | ||||
|         modifier = Modifier | ||||
|             .padding(horizontal = horizontalPadding, vertical = 8.dp), | ||||
|     ) { | ||||
|         Text( | ||||
|             text = stringResource(R.string.updates_last_update_info, time), | ||||
|             style = LocalTextStyle.current.copy( | ||||
|                 fontStyle = FontStyle.Italic, | ||||
|             ), | ||||
|         ) | ||||
|         Box( | ||||
|             modifier = Modifier | ||||
|                 .animateItemPlacement() | ||||
|                 .padding(horizontal = horizontalPadding, vertical = 8.dp), | ||||
|         ) { | ||||
|             Text( | ||||
|                 text = stringResource(R.string.updates_last_update_info, time), | ||||
|                 style = LocalTextStyle.current.copy( | ||||
|                     fontStyle = FontStyle.Italic, | ||||
|                 ), | ||||
|             ) | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -202,16 +202,16 @@ sealed interface ExtensionUiModel { | ||||
|         data class Resource(@StringRes val textRes: Int) : Header | ||||
|         data class Text(val text: String) : Header | ||||
|     } | ||||
|  | ||||
|     data class Item( | ||||
|         val extension: Extension, | ||||
|         val installStep: InstallStep, | ||||
|     ) : ExtensionUiModel { | ||||
|  | ||||
|         fun key(): String { | ||||
|             return when (extension) { | ||||
|                 is Extension.Installed -> | ||||
|                     if (extension.hasUpdate) "update_${extension.pkgName}" else extension.pkgName | ||||
|                 else -> extension.pkgName | ||||
|             return when { | ||||
|                 extension is Extension.Installed && extension.hasUpdate -> "${extension.pkgName}_update" | ||||
|                 else -> "${extension.pkgName}_${installStep.name}" | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user