From ffc6c2d9b90a1b11103762a7830ddd32eca9c08f Mon Sep 17 00:00:00 2001 From: Levin Li Date: Mon, 19 Dec 2022 17:34:50 +0800 Subject: [PATCH] Remove show destination in fallback help --- app/src/main/AndroidManifest.xml | 2 +- .../space/celestia/mobilecelestia/MainActivity.kt | 8 -------- .../favorite/FavoriteItemRecyclerViewAdapter.kt | 14 +++++++++++++- .../celestia/mobilecelestia/help/HelpFragment.kt | 4 +--- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 421ea9b4..845c5487 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,7 +13,7 @@ diff --git a/app/src/main/java/space/celestia/mobilecelestia/MainActivity.kt b/app/src/main/java/space/celestia/mobilecelestia/MainActivity.kt index 11107f26..89ad3483 100644 --- a/app/src/main/java/space/celestia/mobilecelestia/MainActivity.kt +++ b/app/src/main/java/space/celestia/mobilecelestia/MainActivity.kt @@ -1208,9 +1208,6 @@ class MainActivity : AppCompatActivity(R.layout.activity_main), HelpAction.RunDemo -> { renderer.enqueueTask { appCore.charEnter(CelestiaAction.RunDemo.value) } } - HelpAction.ShowDestinations -> { - showDestinations() - } } } @@ -1812,11 +1809,6 @@ class MainActivity : AppCompatActivity(R.layout.activity_main), showBottomSheetFragment(FavoriteFragment.newInstance(FavoriteRoot())) } - private fun showDestinations() { - updateCurrentDestinations(appCore.destinations) - showBottomSheetFragment(FavoriteFragment.newInstance(FavoriteTypeItem(FavoriteType.Destination))) - } - private fun showSettings() { showBottomSheetFragment(SettingsFragment.newInstance()) } diff --git a/app/src/main/java/space/celestia/mobilecelestia/favorite/FavoriteItemRecyclerViewAdapter.kt b/app/src/main/java/space/celestia/mobilecelestia/favorite/FavoriteItemRecyclerViewAdapter.kt index c1c8642f..f5cab895 100644 --- a/app/src/main/java/space/celestia/mobilecelestia/favorite/FavoriteItemRecyclerViewAdapter.kt +++ b/app/src/main/java/space/celestia/mobilecelestia/favorite/FavoriteItemRecyclerViewAdapter.kt @@ -41,6 +41,8 @@ interface FavoriteBaseItem : RecyclerViewItem, Serializable { val supportedItemActions: List get() = listOf() + + val hasFullPageRepresentation: Boolean } interface MutableFavoriteBaseItem : FavoriteBaseItem { @@ -72,6 +74,8 @@ class FavoriteRoot : FavoriteBaseItem { get() = CelestiaString("Favorites", "") override val isLeaf: Boolean get() = false + override val hasFullPageRepresentation: Boolean + get() = false } class FavoriteTypeItem(val type: FavoriteType) : FavoriteBaseItem { @@ -97,6 +101,8 @@ class FavoriteTypeItem(val type: FavoriteType) : FavoriteBaseItem { } override val isLeaf: Boolean get() = false + override val hasFullPageRepresentation: Boolean + get() = false } class FavoriteScriptItem(val script: Script) : FavoriteBaseItem { @@ -106,6 +112,8 @@ class FavoriteScriptItem(val script: Script) : FavoriteBaseItem { get() = script.title override val isLeaf: Boolean get() = true + override val hasFullPageRepresentation: Boolean + get() = false } class FavoriteDestinationItem(val destination: Destination): FavoriteBaseItem { @@ -115,6 +123,8 @@ class FavoriteDestinationItem(val destination: Destination): FavoriteBaseItem { get() = destination.name override val isLeaf: Boolean get() = true + override val hasFullPageRepresentation: Boolean + get() = true } open class FavoriteBookmarkItem(val bookmark: BookmarkNode) : MutableFavoriteBaseItem { @@ -125,6 +135,8 @@ open class FavoriteBookmarkItem(val bookmark: BookmarkNode) : MutableFavoriteBas get() = bookmark.isLeaf override val supportedItemActions: List get() = listOf(FavoriteItemAction.Delete, FavoriteItemAction.Rename, FavoriteItemAction.Share) + override val hasFullPageRepresentation: Boolean + get() = false override fun insert(newItem: FavoriteBaseItem, index: Int) { if (newItem !is FavoriteBookmarkItem) @@ -210,7 +222,7 @@ class FavoriteItemRecyclerViewAdapter( override fun bindVH(holder: RecyclerView.ViewHolder, item: RecyclerViewItem) { if (holder is BaseTextItemHolder && item is FavoriteBaseItem) { holder.title.text = item.title - holder.accessory.visibility = if (item.isLeaf) View.GONE else View.VISIBLE + holder.accessory.visibility = if (item.isLeaf && !item.hasFullPageRepresentation) View.GONE else View.VISIBLE if (holder is CommonReorderableTextViewHolder) { // Can reorder holder.dragView.setOnLongClickListener { diff --git a/app/src/main/java/space/celestia/mobilecelestia/help/HelpFragment.kt b/app/src/main/java/space/celestia/mobilecelestia/help/HelpFragment.kt index de3311d3..f19e36a8 100644 --- a/app/src/main/java/space/celestia/mobilecelestia/help/HelpFragment.kt +++ b/app/src/main/java/space/celestia/mobilecelestia/help/HelpFragment.kt @@ -24,8 +24,7 @@ import space.celestia.mobilecelestia.R import space.celestia.mobilecelestia.utils.CelestiaString enum class HelpAction { - RunDemo, - ShowDestinations; + RunDemo; } private val staticHelpDescriptionItems: List by lazy { listOf( @@ -44,7 +43,6 @@ private val staticHelpURLItems: List by lazy { listOf( private val staticHelpActionItems: List by lazy { listOf( ActionItem(CelestiaString("Run Demo", ""), HelpAction.RunDemo), - ActionItem(CelestiaString("Show Destinations", ""), HelpAction.ShowDestinations) ) }