Does anybody know how to implement an expandable view which behaves like the status bar?
I've seen it in many apps, so I assume it's not too difficult :)
SlidingDrawer might be what you're looking for.
From official docs:
SlidingDrawer hides content out of the
screen and allows the user to drag a
handle to bring the content on screen.
SlidingDrawer can be used vertically
or horizontally. A special widget
composed of two children views: the
handle, that the users drags, and the
content, attached to the handle and
dragged with it.
I suppose that you are asking about Notification
A class that represents how a
persistent notification is to be
presented to the user using the
NotificationManager.
Related
I am working on Floating Action Bar on top of keyboard if user clicks on one of the EditText. I couldn't start on it and that's why not have any code to present.
I am confused on how to approach this problem. I am considering to use bottom sheet but I am still not getting confidence on it (I think android should have something better to use as base for this view).
I don't need any code snippet but need a direction. I am new to Android and before jumping to implementation, I needed a direction to start with.
Any suggestions? I am implementing
something similar to Outlook app.
So this floating toolbar is just a view that contains icons to press. This view should be located as the bottommost view on the screen. If you're using a ConstraintLayout use app:layout_constraintBottom_toBottomOf="parent".
And the android:windowSoftInputMode for hosting activity can be set to adjustResize (doc).
So when the keyboard opens it pushes this bottommost view up (and now this view is right above the keyboard).
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'm trying to do an Accessibility Service where the purpose it's to create some "layer" between the user when he touches the screen and the tap.
For example : when I touch the screen I when to double tap at this precise position I touch the Screen.
I think, but I'm really open to suggestion, that I will have to create an invisible layout that will cover all the screen where a would be able to activate an onTouchListener to get the position and use my accessibility service to create gesture and transfer the touch behind the layout to click anywhere.
As far I only found a solution for Android 4.1 or less.
I also want to use a kind of cursor, the app Open Sesame do it well and the cursor can go over the navigation bar and interact with.
I also found the open source project Eva facial mouse but they don't perform complex gesture and don't go over the navigation bar.
So my big question is, I am in the right way by wanting to create an invisible layout to detect touch even on the navigation bar and is there someone would help me to enlighten my search in the right direction.
I succeed in putting an overlay layout over the status bar, just add the right Flags to your LayoutParams.
For my case I use: FLAG_FULLSCREEN, FLAG_LAYOUT_IN_SCREEN and FLAG_LAYOUT_NO_LIMITS.
How would I go about creating a dynamic Gif keyboard for Android? I would like the user to scroll horizontally across the Gif's and possibly search across them via an integrated search bar in the keyboard
I've seen this link but it doesn't talk about dynamically changing the keys: How to make a Android custom keyboard?
In your InputMethodService there is a callback onCreateInputView()
You can create whatever custom view you want and return in there.
For horizontal scrolling, maybe look at view pager
For those of you who have used the Facebook app, it has an interesting way of showing more information on the home activity by having a draggable view at the bottom of the screen that, when dragged up, shows Facebook notifications. Dragging the same view back down hides the notifications. Note that this will work either by holding and dragging it to the top of the screen or simply flinging it in that direction.
I would like to do something similar for my app. I have a LinearLayout at the bottom of my activity and want to be able to drag it up to see more information. How can I go about doing this? Are there any tutorials available?
Have you checked out the sliding drawer component?
http://developer.android.com/reference/android/widget/SlidingDrawer.html
I think this might be what you are looking for.