I want to show a draggable view floating on my activities.
I do not want to ask user for permission like
User should be able to interact with activity while the draggable view is open.
The draggable view should not disappear user go to next activities.
Instead, user can manually close the view(eg: by clicking on the cross icon on the view).
I am able to create a draggable view and able to interact with it, at the same time with the activity which is in foreground. but when I go to the other activity, the view closes.
Related
I have a activity themed like a dialog and I have it setup so that it finishes when the user click outside.
this.setFinishOnTouchOutside(true);
As expected when the user clicks outside, it finishes. The activity is marked as floating activity and is only shown on top of the phone.
Now, if the user click on any other part of screen like the phone button/contact button on home screen, then the activity gets finished, but the user has to click on phone/contact app icon again to open phone/conatct app.
What I want is that if user click outside my activity, then the action must be performed as if the activity is not at all present on screen. Something like notification, which does not prevent user from doing other other tasks.
The only way you might be able to do this is by using a hidden WindowManager.LayoutParams flag, FLAG_SLIPPERY.
This allows touches starting on your View to continue to whatever View is below when the touch leaves your View but remains on the screen. However, I don't think this will work.
Android prevents you from touching "through" a touchable Window because it assumes that Window should be receiving the TouchEvent. Android also prevents you from programmatically "touching" the screen (without root or system access), most likely for security reasons.
I dug through AOSP for a while and found this.
Reading the comments, it's possible to infer that, while what you see doesn't take up the whole screen, the Activity's Window does. So, while nothing in your Activity is clicked, the Window is still overlaying everything, just with a transparent background, and is dealing with the touches that aren't passed to your Activity's UI. This brings us back to the "touching through" issue.
I need the image button to be visible when the user opens another app, you know, i need it like the floating button that is visible to the user when the user opens any other app.
i have a switch button the controls if the image button is visible or not
Have a look at this question.
Essentially you need to use the SYSTEM_ALERT_WINDOW permission which allows you to draw over other apps, make a custom layout file which contains the button that you want to show and use the WindowManager to insert it into the view.
I am developing an android camera app that allow popup of page upon pressing a button (besides the shoot button)in the view of the photo capture activity for accessing twitter services, including login(of coz with button), view tweets(listview or list fragment) of bookmarked users and posting tweets.
I am considering the approach to build the layout for the popup stuff. What come across my mind are dialog fragment, popupwindow and simply another activity.
Considering my case, what view is recommended for the popup component?
Depends on the content of your popup:
If popup contains only a list of items use PopupWindow.
If popup contains only a few buttons like ok/cancel some text etc. Use DialogFragment.
If you have more stuff, you should probably use Activity.
I have to show a floating button that will be added in WindowManager so it remain on the top of all Activities. (I have done this part using https://github.com/marshallino16/FloatingView)
When that button is tapped I have to open screen and show detail view and navigate between other views. To achieve this thing I can do following things either adding
1 - PopUpWindow
2 - Dialog
But I cannot provide navigation using either of them. So my questions is.
What is the best way to add multiple views and providing navigation between them while keeping everything above the application that is running it.
How can we add Activity so that it won't pause user application?
You should open Activity and implement all navigation inside it.
Android may pause activities behind, so make your Activity only for part of the screen.
Inside Activity hide floating button and show it again on exit.
I am having an android activity with FLAG_NOT_TOUCH_MODALset.
My activity is translucent and not full screen.
I just want to by-pass the touch events outside my activity window boundary to the underlying activity.
I am able to by-pass the event successfully so that i can scroll the underlying activity when my activity is on top of it.
My problem is, When my activity is on top of the "Applications List" Screen, i am not able to launch any application from the list. But I can scroll the list and the icon of the selected application is getting highlighted when selected. But it is not getting launched.
But when my activity with FLAG_NOT_TOUCH_MODAL is on top of the home screen (where we see wallpaper) the applications can be launched when user clicks on the shortcut icons
Please help me with this issue.
Thanks in advance.
Pragadeesh