-
Notifications
You must be signed in to change notification settings - Fork 98
1152: Toast placement for copy, create, delete #1166
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm conflicted about this. If we land this patch as is, we're incurring some avoidable technical debt.
However, I'm not sure that toast notification is going to be used more than we have it, and I don't think that this is going to cause enough friction to development as to have something done about it.
I have left two paths forward in the comment; decide if and which you want to do, and then let's conflab.
app/src/main/java/mozilla/lockbox/model/ToastNotificationViewModel.kt
Outdated
Show resolved
Hide resolved
Addressed comments, the easy way ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there. I won't make you do another review cycle, but I'd like you to make the changes as suggested.
@@ -122,7 +122,18 @@ abstract class RoutePresenter( | |||
val layoutInflater = LayoutInflater.from(activity) | |||
|
|||
toast.view = layoutInflater.inflate(R.layout.toast_view, container, false) | |||
toast.setGravity(Gravity.FILL_HORIZONTAL or Gravity.BOTTOM, 0, 216) | |||
|
|||
val bottomMargin = if (action is ToastNotificationAction.ShowDeleteToast) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Easy: choose the bottom margin based on whether or not the current destination is the ItemList.
val bottomMargin = if (navController.currentDestination?.id == R.id.fragment_item_list) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This way we can make all toasts that are displayed on the Item List avoid the +
button, not just the delete one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that makes perfect sense. Done.
toast.setGravity( | ||
Gravity.FILL_HORIZONTAL or Gravity.BOTTOM, | ||
0, | ||
activity.resources.getDimension(bottomMargin).toInt() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good.
52116b6
to
3068823
Compare
Fixes #1152
Specify each bottom margin for the toast notifications. The
bottomMargin
value set based on the nav location: toasts on the item list will appear above the+
create button, and other toasts will have the normal bottom margin at the bottom of the screen.Testing and Review Notes
+
button on the item listScreenshots or Videos
(save gif tbd on #1163)
To Do