BaseGalleryInfo.asDestination()
This commit is contained in:
1 parent
395a48ddeb
commit
e0b65184e2
5 files changed
+10
-10
No files matched your search
@@ -81,7 +81,6 @@ import com.hippo.ehviewer.ui.LocalSideSheetState
|
||||
import com.hippo.ehviewer.ui.LockDrawer
|
||||
import com.hippo.ehviewer.ui.MainActivity
|
||||
import com.hippo.ehviewer.ui.confirmRemoveDownloadRange
|
||||
import com.hippo.ehviewer.ui.destinations.GalleryDetailScreenDestination
|
||||
import com.hippo.ehviewer.ui.main.DownloadCard
|
||||
import com.hippo.ehviewer.ui.main.FabLayout
|
||||
import com.hippo.ehviewer.ui.navToReader
|
||||
@@ -455,7 +454,7 @@ fun DownloadsScreen(navigator: DestinationsNavigator) {
|
||||
}
|
||||
},
|
||||
onThumbClick = {
|
||||
navigator.navigate(GalleryDetailScreenDestination(GalleryInfoArgs(info.galleryInfo)))
|
||||
navigator.navigate(info.galleryInfo.asDestination())
|
||||
},
|
||||
onLongClick = {
|
||||
checkedInfoMap[info.gid] = info
|
||||
|
||||
@@ -69,7 +69,6 @@ import com.hippo.ehviewer.icons.filled.GoTo
|
||||
import com.hippo.ehviewer.ui.LocalSideSheetState
|
||||
import com.hippo.ehviewer.ui.LockDrawer
|
||||
import com.hippo.ehviewer.ui.MainActivity
|
||||
import com.hippo.ehviewer.ui.destinations.GalleryDetailScreenDestination
|
||||
import com.hippo.ehviewer.ui.main.FAB_ANIMATE_TIME
|
||||
import com.hippo.ehviewer.ui.main.FabLayout
|
||||
import com.hippo.ehviewer.ui.main.GalleryInfoGridItem
|
||||
@@ -280,7 +279,7 @@ fun FavouritesScreen(navigator: DestinationsNavigator) {
|
||||
checkedInfoMap[info.gid] = info
|
||||
}
|
||||
} else {
|
||||
navigator.navigate(GalleryDetailScreenDestination(GalleryInfoArgs(info)))
|
||||
navigator.navigate(info.asDestination())
|
||||
}
|
||||
},
|
||||
onLongClick = {
|
||||
@@ -305,7 +304,7 @@ fun FavouritesScreen(navigator: DestinationsNavigator) {
|
||||
checkedInfoMap[info.gid] = info
|
||||
}
|
||||
} else {
|
||||
navigator.navigate(GalleryDetailScreenDestination(GalleryInfoArgs(info)))
|
||||
navigator.navigate(info.asDestination())
|
||||
}
|
||||
},
|
||||
onLongClick = {
|
||||
@@ -344,7 +343,7 @@ fun FavouritesScreen(navigator: DestinationsNavigator) {
|
||||
onClick(Icons.Default.Shuffle) {
|
||||
val random = EhDB.randomLocalFav()
|
||||
withUIContext {
|
||||
navigator.navigate(GalleryDetailScreenDestination(GalleryInfoArgs(random)))
|
||||
navigator.navigate(random.asDestination())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -698,7 +698,7 @@ fun GalleryListScreen(lub: ListUrlBuilder, navigator: DestinationsNavigator) {
|
||||
detailItemContent = { info ->
|
||||
GalleryInfoListItem(
|
||||
onClick = {
|
||||
navigator.navigate(GalleryDetailScreenDestination(GalleryInfoArgs(info)))
|
||||
navigator.navigate(info.asDestination())
|
||||
},
|
||||
onLongClick = {
|
||||
coroutineScope.launch {
|
||||
@@ -715,7 +715,7 @@ fun GalleryListScreen(lub: ListUrlBuilder, navigator: DestinationsNavigator) {
|
||||
thumbItemContent = { info ->
|
||||
GalleryInfoGridItem(
|
||||
onClick = {
|
||||
navigator.navigate(GalleryDetailScreenDestination(GalleryInfoArgs(info)))
|
||||
navigator.navigate(info.asDestination())
|
||||
},
|
||||
onLongClick = {
|
||||
coroutineScope.launch {
|
||||
|
||||
@@ -41,7 +41,6 @@ import com.hippo.ehviewer.R
|
||||
import com.hippo.ehviewer.icons.EhIcons
|
||||
import com.hippo.ehviewer.icons.big.History
|
||||
import com.hippo.ehviewer.ui.LocalNavDrawerState
|
||||
import com.hippo.ehviewer.ui.destinations.GalleryDetailScreenDestination
|
||||
import com.hippo.ehviewer.ui.doGalleryInfoAction
|
||||
import com.hippo.ehviewer.ui.main.GalleryInfoListItem
|
||||
import com.hippo.ehviewer.ui.tools.Deferred
|
||||
@@ -128,7 +127,7 @@ fun HistoryScreen(navigator: DestinationsNavigator) {
|
||||
) {
|
||||
GalleryInfoListItem(
|
||||
onClick = {
|
||||
navigator.navigate(GalleryDetailScreenDestination(GalleryInfoArgs(info)))
|
||||
navigator.navigate(info.asDestination())
|
||||
},
|
||||
onLongClick = {
|
||||
coroutineScope.launchIO {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.hippo.ehviewer.ui.screen
|
||||
|
||||
import androidx.annotation.MainThread
|
||||
import androidx.navigation.NavController
|
||||
import com.hippo.ehviewer.client.data.BaseGalleryInfo
|
||||
import com.hippo.ehviewer.client.parser.GalleryDetailUrlParser
|
||||
import com.hippo.ehviewer.client.parser.GalleryListUrlParser
|
||||
import com.hippo.ehviewer.client.parser.GalleryPageUrlParser
|
||||
@@ -44,3 +45,5 @@ fun NavController.navWithUrl(url: String): Boolean {
|
||||
|
||||
@MainThread
|
||||
fun NavController.navigate(direction: Direction) = navigate(direction.route)
|
||||
|
||||
fun BaseGalleryInfo.asDestination() = GalleryDetailScreenDestination(GalleryInfoArgs(this))
|
||||
Reference in new issue
Block a user