Widget moved visually, but responds to touch in the old location only - android

I'm implementing a sliding from top drawer custom widget from some source code (AFAIR, from sephiroth). It works well as is, but I need a small layout (i.e. 3 buttons) in the handle of the drawer. So, I had to modify the code a little. I'm using dispatchTouchEvent in the main onTouchEvent of the widget, to propagate the necessary events down to the children of the handle view.
It works well when the drawer is closed (the handle and its buttons are on the top of the screen), but when it is open all the way down handle buttons stop working. I have a proper response on touch from the handle layout frame (its color changing and I can close the drawer) though.
By an accident I've realized that handle buttons can be triggered by touching their old locations near the top of the screen! But their images are properly shown at the bottom, and react to the setText() properly. What's happening? And how to fix that?

Related

Overlay layout that go over Navigation Bar Android 7+

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 to disable Android touch

There are some application that disables all the touch inputs, including the touch events that occur on the navigation bar.
Examples are Touch Lock or UnTouch. How one can do that?
By analyzing the second linked app seems that there is a hidden layout that capture the touch events (like an empty onClickListener).
Initially I tried to draw a transparent foreground using the SYSTEM_ALERT_WINDOW permission and by assigning an empty touch listener. However in this way I cannot draw on the navigation bar, so the user can touch the home button and the back button.
Another way that I tried is to launch an Activity with transparent background and in fullscreen mode. In this way I can capture all the events. This works, but obviously this causes other activities to go in pause state.
So my question is, how can one reach the goal? Alternatively is possible to use some root/system commands?
Thanks!
Try this link. If you want to do it on just 1 view then edit out the iteration in the methods given.

Sliding menu: closed, half-opened and opened

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

Scrolling / sticky FAB floating action button android

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.

Android: SlidingDrawer like the one in the Android main window

I implemented a SlidingDrawer in my app and everything works fine so far.
Then I made an invisible handle, just like the one in the Android main window.
Now I want, that it is possible to grab the handle (and make it visible) just by moving the finger over the handle. I mean the same behaviour like the one in the Android main window.
But i donĀ“t know how to mange that.
(At the moment it only works when you tap at the handle, and not if you tap somewhere else and move the finger above the handle)
Sounds like a bad idea. There will be no way to distinquish between the system's drawer and your app's drawer.
You want to detect a swipe motion that starts on the top bezel.
You want to use MotionEvent's getEdgeFlags() to detect whether a swipe gesture starts on the bezel.

Categories

Resources