Skip to content

Commit

Permalink
Closes mozilla-mobile#2435 Change edit icon to share icon on the book… (
Browse files Browse the repository at this point in the history
mozilla-mobile#6137)

* Closes mozilla-mobile#2435 Change edit icon to share icon on the bookmark toolbar

* Closes mozilla-mobile#2435 Changed raw string to string resources

* Pass bookmark arguments to share fragment

* Closes mozilla-mobile#2435 add orEmpty
  • Loading branch information
obarzpaw authored and mcarare committed Oct 29, 2019
1 parent 01339ff commit 9fe3ec2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import org.mozilla.fenix.ext.minus
import org.mozilla.fenix.ext.nav
import org.mozilla.fenix.ext.urlToTrimmedHost
import org.mozilla.fenix.library.LibraryPageFragment
import org.mozilla.fenix.share.ShareTab
import org.mozilla.fenix.utils.allowUndo

@Suppress("TooManyFunctions", "LargeClass")
Expand Down Expand Up @@ -164,7 +165,7 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), BackHandler {
inflater.inflate(R.menu.bookmarks_select_multi, menu)
}

menu.findItem(R.id.edit_bookmark_multi_select)?.isVisible = mode.selectedItems.size == 1
menu.findItem(R.id.share_bookmark_multi_select)?.isVisible = mode.selectedItems.size == 1
}
}
}
Expand Down Expand Up @@ -197,11 +198,13 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), BackHandler {
metrics?.track(Event.OpenedBookmarksInPrivateTabs)
true
}
R.id.edit_bookmark_multi_select -> {
R.id.share_bookmark_multi_select -> {
val bookmark = bookmarkStore.state.mode.selectedItems.first()
navigate(
BookmarkFragmentDirections.actionBookmarkFragmentToBookmarkEditFragment(
bookmark.guid
BookmarkFragmentDirections.actionBookmarkFragmentToShareFragment(
url = bookmark.url,
title = bookmark.title,
tabs = arrayOf(ShareTab(bookmark.url.orEmpty(), bookmark.title.orEmpty()))
)
)
true
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/menu/bookmarks_select_multi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/edit_bookmark_multi_select"
android:icon="@drawable/ic_edit"
android:id="@+id/share_bookmark_multi_select"
android:icon="@drawable/ic_hollow_share"
app:iconTint="@color/white_color"
android:title="@string/bookmark_edit"
android:title="@string/browser_menu_share"
app:showAsAction="ifRoom" />
<item
android:id="@+id/open_bookmarks_in_new_tabs_multi_select"
Expand Down

0 comments on commit 9fe3ec2

Please sign in to comment.