Rename to *Screen
This commit is contained in:
1 parent
800e09adad
commit
9d38520b85
16 files changed
+60
-77
No files matched your search
@@ -35,7 +35,7 @@ import com.hippo.ehviewer.client.EhUtils
|
||||
import com.hippo.ehviewer.client.data.BaseGalleryInfo
|
||||
import com.hippo.ehviewer.dao.DownloadInfo
|
||||
import com.hippo.ehviewer.ui.MainActivity
|
||||
import com.hippo.ehviewer.ui.scene.DownloadsFragment
|
||||
import com.hippo.ehviewer.ui.screen.DownloadsFragment
|
||||
import com.hippo.ehviewer.util.FileUtils
|
||||
import com.hippo.ehviewer.util.ReadableTime
|
||||
import com.hippo.ehviewer.util.SimpleHandler
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.hippo.ehviewer.client.EhUtils
|
||||
import com.hippo.ehviewer.client.data.GalleryDetail
|
||||
import com.hippo.ehviewer.client.data.GalleryInfo.Companion.LOCAL_FAVORITED
|
||||
import com.hippo.ehviewer.client.thumbUrl
|
||||
import com.hippo.ehviewer.ui.scene.navWithUrl
|
||||
import com.hippo.ehviewer.ui.screen.navWithUrl
|
||||
import com.hippo.ehviewer.util.addTextToClipboard
|
||||
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
|
||||
|
||||
|
||||
@@ -108,9 +108,9 @@ import com.hippo.ehviewer.ui.destinations.SubscriptionScreenDestination
|
||||
import com.hippo.ehviewer.ui.destinations.ToplistScreenDestination
|
||||
import com.hippo.ehviewer.ui.destinations.WhatshotScreenDestination
|
||||
import com.hippo.ehviewer.ui.legacy.BaseDialogBuilder
|
||||
import com.hippo.ehviewer.ui.scene.TokenArgs
|
||||
import com.hippo.ehviewer.ui.scene.navWithUrl
|
||||
import com.hippo.ehviewer.ui.scene.navigate
|
||||
import com.hippo.ehviewer.ui.screen.TokenArgs
|
||||
import com.hippo.ehviewer.ui.screen.navWithUrl
|
||||
import com.hippo.ehviewer.ui.screen.navigate
|
||||
import com.hippo.ehviewer.ui.settings.showNewVersion
|
||||
import com.hippo.ehviewer.ui.tools.LocalDialogState
|
||||
import com.hippo.ehviewer.ui.tools.LocalTouchSlopProvider
|
||||
|
||||
@@ -58,7 +58,7 @@ import com.hippo.ehviewer.collectAsState
|
||||
import com.hippo.ehviewer.icons.EhIcons
|
||||
import com.hippo.ehviewer.icons.big.SadAndroid
|
||||
import com.hippo.ehviewer.ui.WebViewActivity
|
||||
import com.hippo.ehviewer.ui.scene.collectDetailSizeAsState
|
||||
import com.hippo.ehviewer.ui.screen.collectDetailSizeAsState
|
||||
import com.hippo.ehviewer.ui.tools.FastScrollLazyVerticalGrid
|
||||
import com.hippo.ehviewer.ui.tools.FastScrollLazyVerticalStaggeredGrid
|
||||
import com.hippo.ehviewer.ui.tools.LocalDialogState
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.hippo.ehviewer.ui.scene
|
||||
|
||||
import androidx.annotation.MainThread
|
||||
import androidx.navigation.NavController
|
||||
import com.hippo.ehviewer.client.parser.GalleryDetailUrlParser
|
||||
import com.hippo.ehviewer.client.parser.GalleryListUrlParser
|
||||
import com.hippo.ehviewer.client.parser.GalleryPageUrlParser
|
||||
import com.hippo.ehviewer.ui.destinations.GalleryDetailScreenDestination
|
||||
import com.hippo.ehviewer.ui.destinations.GalleryListScreenDestination
|
||||
import com.hippo.ehviewer.ui.destinations.ProgressScreenDestination
|
||||
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
|
||||
import com.ramcosta.composedestinations.spec.Direction
|
||||
|
||||
@MainThread
|
||||
fun DestinationsNavigator.navWithUrl(url: String): Boolean {
|
||||
if (url.isEmpty()) return false
|
||||
GalleryListUrlParser.parse(url)?.let {
|
||||
navigate(GalleryListScreenDestination(it))
|
||||
return true
|
||||
}
|
||||
|
||||
GalleryDetailUrlParser.parse(url)?.apply {
|
||||
navigate(GalleryDetailScreenDestination(TokenArgs(gid, token)))
|
||||
return true
|
||||
}
|
||||
|
||||
GalleryPageUrlParser.parse(url)?.apply {
|
||||
navigate(ProgressScreenDestination(gid, pToken, page))
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@MainThread
|
||||
fun NavController.navWithUrl(url: String): Boolean {
|
||||
if (url.isEmpty()) return false
|
||||
GalleryListUrlParser.parse(url)?.let {
|
||||
navigate(GalleryListScreenDestination(it))
|
||||
return true
|
||||
}
|
||||
|
||||
GalleryDetailUrlParser.parse(url)?.apply {
|
||||
navigate(GalleryDetailScreenDestination(TokenArgs(gid, token)))
|
||||
return true
|
||||
}
|
||||
|
||||
GalleryPageUrlParser.parse(url)?.apply {
|
||||
navigate(ProgressScreenDestination(gid, pToken, page))
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@MainThread
|
||||
fun NavController.navigate(direction: Direction) = navigate(direction.route)
|
||||
+5
-7
@@ -1,4 +1,4 @@
|
||||
package com.hippo.ehviewer.ui.scene
|
||||
package com.hippo.ehviewer.ui.screen
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.compose.animation.core.animateDpAsState
|
||||
@@ -521,10 +521,8 @@ fun DownloadsScreen(navigator: DestinationsNavigator) {
|
||||
}
|
||||
}
|
||||
|
||||
class DownloadsFragment {
|
||||
companion object {
|
||||
const val KEY_GID = "gid"
|
||||
const val KEY_ACTION = "action"
|
||||
const val ACTION_CLEAR_DOWNLOAD_SERVICE = "clear_download_service"
|
||||
}
|
||||
object DownloadsFragment {
|
||||
const val KEY_GID = "gid"
|
||||
const val KEY_ACTION = "action"
|
||||
const val ACTION_CLEAR_DOWNLOAD_SERVICE = "clear_download_service"
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.hippo.ehviewer.ui.scene
|
||||
package com.hippo.ehviewer.ui.screen
|
||||
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Column
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.hippo.ehviewer.ui.scene
|
||||
package com.hippo.ehviewer.ui.screen
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.hippo.ehviewer.ui.scene
|
||||
package com.hippo.ehviewer.ui.screen
|
||||
|
||||
import android.Manifest
|
||||
import android.app.Dialog
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.hippo.ehviewer.ui.scene
|
||||
package com.hippo.ehviewer.ui.screen
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.material.icons.Icons
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.hippo.ehviewer.ui.scene
|
||||
package com.hippo.ehviewer.ui.screen
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.net.Uri
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.hippo.ehviewer.ui.scene
|
||||
package com.hippo.ehviewer.ui.screen
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.padding
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.hippo.ehviewer.ui.scene
|
||||
package com.hippo.ehviewer.ui.screen
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.hippo.ehviewer.ui.screen
|
||||
|
||||
import androidx.annotation.MainThread
|
||||
import androidx.navigation.NavController
|
||||
import com.hippo.ehviewer.client.parser.GalleryDetailUrlParser
|
||||
import com.hippo.ehviewer.client.parser.GalleryListUrlParser
|
||||
import com.hippo.ehviewer.client.parser.GalleryPageUrlParser
|
||||
import com.hippo.ehviewer.ui.destinations.GalleryDetailScreenDestination
|
||||
import com.hippo.ehviewer.ui.destinations.GalleryListScreenDestination
|
||||
import com.hippo.ehviewer.ui.destinations.ProgressScreenDestination
|
||||
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
|
||||
import com.ramcosta.composedestinations.spec.Direction
|
||||
|
||||
private fun urlToDestination(url: String): Direction? {
|
||||
if (url.isEmpty()) return null
|
||||
val ret1 = GalleryListUrlParser.parse(url)
|
||||
if (ret1 != null) return GalleryListScreenDestination(ret1)
|
||||
val ret2 = GalleryDetailUrlParser.parse(url)
|
||||
if (ret2 != null) return GalleryDetailScreenDestination(TokenArgs(ret2.gid, ret2.token))
|
||||
val ret3 = GalleryPageUrlParser.parse(url)
|
||||
if (ret3 != null) return ProgressScreenDestination(ret3.gid, ret3.pToken, ret3.page)
|
||||
return null
|
||||
}
|
||||
|
||||
@MainThread
|
||||
fun DestinationsNavigator.navWithUrl(url: String): Boolean {
|
||||
val dest = urlToDestination(url) ?: return false
|
||||
navigate(dest)
|
||||
return true
|
||||
}
|
||||
|
||||
@MainThread
|
||||
fun NavController.navWithUrl(url: String): Boolean {
|
||||
val dest = urlToDestination(url) ?: return false
|
||||
navigate(dest)
|
||||
return false
|
||||
}
|
||||
|
||||
@MainThread
|
||||
fun NavController.navigate(direction: Direction) = navigate(direction.route)
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.hippo.ehviewer.ui.scene
|
||||
package com.hippo.ehviewer.ui.screen
|
||||
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.hippo.ehviewer.ui.scene
|
||||
package com.hippo.ehviewer.ui.screen
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import androidx.compose.animation.core.animateFloatAsState
|
||||
Reference in new issue
Block a user