* For https://github.com/mozilla-mobile/fenix/issues/3008 - Adjust orientation of collections menu based on view location

* For https://github.com/mozilla-mobile/fenix/issues/2162 - Add simple menu orientation logic to bookmark menu
pull/600/head
Emily Kager 5 years ago committed by Colin Lee
parent 17668831d0
commit ad2e70df60

@ -57,9 +57,16 @@ class CollectionViewHolder(
collection_overflow_button.run {
increaseTapArea(buttonIncreaseDps)
setOnClickListener {
val location = IntArray(2)
it.getLocationInWindow(location)
collectionMenu.menuBuilder
.build(view.context)
.show(anchor = it, orientation = BrowserMenu.Orientation.DOWN)
.show(
anchor = it,
orientation = if (location[1] > (rootView.measuredHeight / 2))
BrowserMenu.Orientation.UP else
BrowserMenu.Orientation.DOWN
)
}
}

@ -176,9 +176,13 @@ class BookmarkAdapter(val emptyView: View, val actionEmitter: Observer<BookmarkA
bookmark_overflow.increaseTapArea(bookmarkOverflowExtraDips)
bookmark_overflow.setOnClickListener {
val location = IntArray(2)
it.getLocationInWindow(location)
bookmarkItemMenu.menuBuilder.build(containerView.context).show(
anchor = it,
orientation = BrowserMenu.Orientation.DOWN
orientation = if (location[1] > (it.rootView.measuredHeight / 2))
BrowserMenu.Orientation.UP else
BrowserMenu.Orientation.DOWN
)
}
bookmark_title.text = if (item.title.isNullOrBlank()) item.url else item.title

Loading…
Cancel
Save