1
0
Fork 0

Closes #2435 Change edit icon to share icon on the book… (#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
master
Pawel Obarzanek 2019-10-22 23:34:05 +02:00 committed by Sawyer Blatz
parent cbc449d3b6
commit 40cda1d758
2 changed files with 10 additions and 7 deletions

View File

@ -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")
@ -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
}
}
}
@ -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

View File

@ -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"