Skip to content

Commit

Permalink
Remove show destination in fallback help
Browse files Browse the repository at this point in the history
  • Loading branch information
levinli303 committed Dec 19, 2022
1 parent 0c920c3 commit ffc6c2d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="auto"
android:versionCode="305"
android:versionCode="306"
android:versionName="1.5.14">

<uses-feature android:glEsVersion="0x00020000" android:required="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1208,9 +1208,6 @@ class MainActivity : AppCompatActivity(R.layout.activity_main),
HelpAction.RunDemo -> {
renderer.enqueueTask { appCore.charEnter(CelestiaAction.RunDemo.value) }
}
HelpAction.ShowDestinations -> {
showDestinations()
}
}
}

Expand Down Expand Up @@ -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())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ interface FavoriteBaseItem : RecyclerViewItem, Serializable {

val supportedItemActions: List<FavoriteItemAction>
get() = listOf()

val hasFullPageRepresentation: Boolean
}

interface MutableFavoriteBaseItem : FavoriteBaseItem {
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -125,6 +135,8 @@ open class FavoriteBookmarkItem(val bookmark: BookmarkNode) : MutableFavoriteBas
get() = bookmark.isLeaf
override val supportedItemActions: List<FavoriteItemAction>
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)
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<DescriptionItem> by lazy { listOf(
Expand All @@ -44,7 +43,6 @@ private val staticHelpURLItems: List<URLItem> by lazy { listOf(
private val staticHelpActionItems: List<ActionItem> by lazy {
listOf(
ActionItem(CelestiaString("Run Demo", ""), HelpAction.RunDemo),
ActionItem(CelestiaString("Show Destinations", ""), HelpAction.ShowDestinations)
)
}

Expand Down

0 comments on commit ffc6c2d

Please sign in to comment.