I am developing an app which the Location of Caller on Incoming call Screen.
To show that I used Toast, But I came to about ann App which does this but not using Toast.
It uses something else to show something on Incoming Call Screen. I want to know what is that control.
The screen shot is attached here
As you can see in the image. I want to know about the control or View (that is in red Line Center).
This particular contriol can be dragged up and down and can be closed on clicking cross button
How to create this control.
you can use system overlays to put a view on top of all the screens..
check out following post for more info:
Creating a system overlay window (always on top)
Creating a system overlay where the home buttons still work?
AirCalc is one more proof of concept...
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.
When there are multiple Fragments on the screen, how do I tell when the user interacts in ANY way with a specific one of the Fragments? Perhaps they tap a button, scroll a list, tab through fields, anything.
I had thought perhaps I would get an onClick/onTouch/onFocusChanged listener on the Fragment/FrameLayout containing the Fragment/root Layout of the Fragment UI, but they don't fire.
I'll try setting a variety of manual triggers, like "if the user clicks this button or scrolls this view or this field gains focus, then the user has interacted with this Fragment" but obviously that's more complex and highly prone to inaccurate behavior.
Not sure why I need this? Here's the use case:
Think of Gmail on a tablet: in landscape, the inbox is shown on the left and the first message on the right. If I tap a different message, it is displayed on the right. If I rotate to portrait, it will show the message I had last selected.
If I start in portrait, it will show the inbox.
Now here's the real trick: let's say I start in landscape, showing inbox on the left, the first message on the right. If I immediately rotate the device to portrait. But if I interact with the pane on the right (say, scrolling the email message) and then rotate the device, it will show that first message. Gmail guesses whether I was more interested in the inbox or the email and shows that.
My challenge is doing something similar in an app. When I'm rotating from landscape (showing two panes) to portrait (showing one pane) I'm not sure whether to show the list view or the default detail view. If I could tell if the user interacted with the detail view in some way (via keyboard or touchscreen) then I know to show that.
In the end, I could not find any good, clean way to work this.
Instead, for every individual way the user could interact with the Fragment--touching a ListView, clicking a Button and so on--I would fire off a message to the Activity (using a Listener interface the Activity implements, of course).
Then the Activity tracks whether or not the user has interacted with the default Fragment, making sure to save and restore that value.
It's messy, but it's all I could come up with. :/
I'm working on a lockscreen widget(not trying to be specific here, but Nexus 7 ) . The widget has a button which would trigger an activity.When the user clicks the button, the unlock slide symbol get's highlighted hinting the user has to slide-unlock his screen before he wants to see the button's activity. Since now, the device is locked,is there a way to bypass this and just display the activity on top of the lock screen? (not in the case of pin/pattern obviously, but only just slide)
Was searching a lot for a way to do it. We need to use flags in while giving an intent to the widget button. More information here.
Android Lock Screen Widget
I have an app that works in the following way:
Upper part of the screen is the 'primary' part of the app, the actual content that the user can interact with is displayed here.
Lower part of the screen (maybe 1/4 of the screen height or so) is a navigation wheel. The user can turn this wheel to change the upper part of the display. When turned the entire upper part is replaced by something else.
These two part are implemented using fragments. The lower part (navigation wheel) is just a static fragment that displays a view hierarchy that can be rotated. The upper part (content display area) is a fragment as well, but it can be switched to other fragments when the wheel is turned.
Now what I want is that when the app starts, we are displaying a free content section, however when the user turns the wheel to one of the other content sections a window pops up to block the content display area, saying "buy this mode on Google Play." This popup should obviously block the content area behind it, so the user can see some of the display area behind the popup, but he/she cannot interact with it before he/she has completed the Google Play transaction. It would be nice if the views of the content area could be greyed out as well. The navigation wheel in the bottom of the screen however should not be blocked so that the user is able to navigate back to where he/she came from or further on to another content section. How can I make a popup that blocks the top view hierarchy from interaction but leaves the lower one intact?
As far as I know it is not possible to use the PopupWindow class to create a popup that will only block some of the screen behind it. It seems to always block it all.
Here is an of illustration the design. 'P' for paid and 'F' for free. On the second screen the app should ignore any press on the content section (behind the grey window), but the navigation wheel should still be able to turn.
Thank you.
On the second screen the app should ignore any press on the content
section (behind the grey window), but the navigation wheel should
still be able to turn.
You could make an overlay and set it up to eat all touch events(either by setting a OnTouchListener on it or by using a custom layout with the onTouch() method overriden to return true) and put it on top of your normal fragment content. This way the actual content will be visible underneath but will not receive any touch events. You could also add some content to your overlay right like in your image.
Also, as the overlay will only cover the paid fragment the wheel at the bottom will be touchable by the user(I don't know how that wheel actually interacts with your fragments so the approach above might not work).
I've made a small rudimentary sample as an example(you can find it here).
It would be nice if the views of the content area could be greyed out
as well.
You could make a recursive method to traverse the view hierarchy of your paid fragment and call View.setEnabled(false) on the views it meets.
Seems overly complicated to me.. I cannot imagine the design..
I would create a different fragment to be triggered if the user has purchased the item, with a different interaction, like a Dialog to be shown at every click, or something like that.
In pseudocode:
if wheel.position == 4
if itemPurchased
showFullFragment
else
showMockFragment
Create a default fragment with one button, that opens the right page of Google Play to buy the content. Then, every time the navigation wheel is turned, you decide in your code if you show the fragment with content (when user has finished the Google Play transaction) or you show the default fragment with just the button to Google Play.
Only one thing: Google Play is asynchronous. There might be some time when the user actually has finished the transaction but Google Play didn't inform your App, yet.
If the transaction was initiated you must decide if you show the content without having to 100% clarity that the user actually paid, or if you show a blank fragment. In any way, you should not show the button again, because that would confuse the user ("I paid! Why do I need to go to Google Play again???")
I want to create a button which will be shown on top of all apps.
something like this
as you can see, there is a button at top left corner. it can receive touch events and touch events can be received outside it by other apps.
I tried to use Theme.Translucent.NoTitleBar to my activity but it does not helped. I also set size to my button to [100, 100] but other activity behind it can not receive touch events. I think that the problem is in activity's window. it's size does not equel activity's size.
any help please
UPD
solved
hatcyl in Create a UI or a widget that sees on top of all Application in Android? says:
If you want something to be clickable, you can display it on top of
anything except the lockscreen.
You would to use a service and WindowManager to show a button on every App.