Skip to content
Snippets Groups Projects
Commit 90379594 authored by cypherpunks1's avatar cypherpunks1 Committed by morgan
Browse files

fixup! [android] Modify UI/UX

Bug 43223: Hide option to open bookmarks in non-private tabs on Android
parent 1370d5e6
Branches
No related tags found
1 merge request!1260Bug 43223: Hide option to open bookmarks in non-private tabs on Android
......@@ -55,6 +55,7 @@ import org.mozilla.fenix.ext.getRootView
import org.mozilla.fenix.ext.nav
import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.setTextColor
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.library.LibraryPageFragment
import org.mozilla.fenix.tabstray.Page
import org.mozilla.fenix.utils.allowUndo
......@@ -179,6 +180,10 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
} else {
inflater.inflate(R.menu.bookmarks_select_multi, menu)
menu.findItem(R.id.open_bookmarks_in_new_tabs_multi_select)?.apply {
isVisible = !requireContext().settings().shouldDisableNormalMode
}
menu.findItem(R.id.delete_bookmarks_multi_select).title =
SpannableString(getString(R.string.bookmark_menu_delete_button)).apply {
setTextColor(requireContext(), R.attr.textCritical)
......
......
......@@ -14,6 +14,7 @@ import mozilla.components.concept.storage.BookmarkNodeType
import mozilla.components.support.ktx.android.content.getColorFromAttr
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.bookmarkStorage
import org.mozilla.fenix.ext.settings
class BookmarkItemMenu(
private val context: Context,
......@@ -37,6 +38,7 @@ class BookmarkItemMenu(
@SuppressWarnings("LongMethod")
internal suspend fun menuItems(itemType: BookmarkNodeType, itemId: String): List<TextMenuCandidate> {
val hasAtLeastOneChild = !context.bookmarkStorage.getTree(itemId, false)?.children.isNullOrEmpty()
val shouldDisableNormalMode = context.settings().shouldDisableNormalMode
return listOfNotNull(
if (itemType != BookmarkNodeType.SEPARATOR) {
......@@ -66,7 +68,7 @@ class BookmarkItemMenu(
} else {
null
},
if (itemType == BookmarkNodeType.ITEM) {
if (!shouldDisableNormalMode && itemType == BookmarkNodeType.ITEM) {
TextMenuCandidate(
text = context.getString(R.string.bookmark_menu_open_in_new_tab_button),
) {
......@@ -84,7 +86,7 @@ class BookmarkItemMenu(
} else {
null
},
if (hasAtLeastOneChild && itemType == BookmarkNodeType.FOLDER) {
if (!shouldDisableNormalMode && hasAtLeastOneChild && itemType == BookmarkNodeType.FOLDER) {
TextMenuCandidate(
text = context.getString(R.string.bookmark_menu_open_all_in_tabs_button),
) {
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment