I need to add a FAB to a scrolling page, however, I need, at a specific point on the screen, to have the FAB continue and scroll up with it, as it is not related to the content at the bottom of the page.
I'm thinking it will kind of work in reverse of a sticky view, which keeps scrolling until it hits the top, then stays there, this will stay at the bottom until a certain point in which it will scroll upwards and off screen.
I can't find this googling, and am thinking I'm going to have to somehow reverse one of the many sticky libraries out there, but they're pretty daunting for someone with limited custom view experience.
Looks like your effect is against Google's guidelines:
the floating action button should not exit the screen in the same
direction as the screen exits ... it incorrectly implies that the
floating action button is at the same the z-level as the content,
rather than at the level of the primary UI elements at the root level.
Related
I'm already testing my apps on emulator with targetSdkVersion 29 to test the new swipe back gesture with Android Q.
I'm facing an issue when I have an animation transition between fragments from bottom to top (enter) and from top to bottom (exit).
The swipe back is always from left-to-right but in this case this is not really intuitive.
In the near future, it will be possible to have a swipe back from top-to-bottom ?
At this time, is there a way to solve this kind of problem?
Imho, even if there would be a way to set a custom system swipe back gesture for your app (but which is fortunately not possible), you would:
confuse your users (if you for example block the default swipe back gesture and provide another custom one in your app. You would also have to imitate the system's back animation which I would definitely not recommend to do.)
set a new gesture which is not intuitive, since it's different than the system back gesture and which is also ergonomically not efficient (e.g. try to perform a swipe back from top (border) to-bottom with your thumb; you could also accidentally trigger the status bar.)
Therefore, I don't think that there will be a top-to-bottom swipe back system gesture.
The goal is to obtain views that can be interacted with instantly (that can be clicked right now and something would happen). If the view is visible and clickable in general but hovered by another view/menu/side panel, it should be omitted.
Voice Access do that. And it seems to use Accessibility API.
The perfect example is the bottom menu in Google Maps. When it expands, "Search along the route" button underneath is still visible but it's not highlighted by the app.
So what do we have?
There is a stream of AccessibilityEvent. The most useful is
AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED, so we can be notified when something is happening.
With getSource() we can get an instance of AccessibilityNodeInfo that triggered the event.
Or we can get a root of a window with AccessibilityService.getRootInActiveWindow(). And having that we are able to traverse the whole hierarchy within an app.
AccessibilityNodeInfo doesn't provide any information about z-order of views, so it's not possible to understand what is above and what is beneath.
The bottom menu is in the same window (it's not modal).
If you try to click "Search along the route" button while the bottom menu is expanded, the bottom menu collapses. So you can't actually click it, it's beneath the menu.
I've looked through all parameters of the AccessibilityNodeInfo, like isVisibleToUser(), isClickable(), isContextClickable(), isSelected(), isFocusable(), isFocused(), isAccessibilityFocused() and the button has the same parameters when the bottom menu is collapsed/expanded. It's visible to the user, focusable and clickable.
I've looked into hidden APIs and don't see anything that can be useful.
What I'm missing?
The key point is that in an AccessibilityService.onAccessibilityEvent() the tree hierarchy is not final. To get views that are interactable at the moment, AccessibilityService.getRootInActiveWindow() should be called with a delay.
AccessibilityNodeInfo#getDrawingOrder() will probably help you. Note that you need to do tree traversal to determine what is on top of what.
There are still corner cases with transparent views that will give you trouble, but that should get you 95% of the way there. We're working on a better answer for that case.
I have a collapsing toolbar with scroll|exitUntilCollapsed set as scroll flags. I like this behaviour overall, however I dislike how it re-expands when I reach the top of the page. If I hit the top and keep scrolling, it expands, which I want, however if I scroll quickly and let the scroll inertia carry it to the top, the toolbar doesn't expand (and the top padding leaves an ugly blank area). I feel like this is how I've seen most apps behave out in the wild, so I'm worried that the answer will be "not possible without some weird hacks", but am I missing something simple to fix this issue?
in an android application, I need to do the following:
I have a view, that acts like a menu, I can slide it from the bottom-up.
However I want to have 3 states: closed, half-opened and opened.
Please refer to this pic:
The blue section is the Handle, the user will use it to slide up/down or fling...
This is a bit similar to the android 5 notification bar, where you drag down to reveal half the view, then another drag down will reveal the whole view.
I can start implementing it in the onTouch of the blue section but that would require me to handle a lot of cases, especially the ones where the user flings vs slowly drag....
Is there any easier way or library that can help?
Thank you very much
Background
on Firefox and Chrome apps for Android, if the user scrolls down, the upper actionBar starts to disappear.
if the scrolling is fast enough , it starts an animation to finish the disappearing, but if not, it returns to its normal state.
and there is a similar effect for showing the action bar, only that it's for scrolling up.
The problem
I need to have the same ability to make a customized view that is on the top of the screen (looks a bit like an action bar but it's not).
a part of the view will always be visible, but a part of it will shrink like in the effect of chrome and firefox.
I've looked for libraries that allow such a thing but without any luck.
The question
How can I achieve this behavior?
My guess is that I need to use the scrolling listener of the adapterView , but then what?
I think this library can help, in the inner sample of "animation" :
https://github.com/LarsWerkman/QuickReturnListView
sadly i also use a customized pinterest-like listView, which doesn't report about scrolling (not states, but the real positions as you scroll). in fact it doesn't even extend from AdapterView.