Visual effects, and Activity redraw after pressing home button and come back - android

I am programming an Android app and it seems to work well, but when the user presses the 'home' button, and after returns to the app, the activity has changed his position some pixels, and due to this some buttons are hidden.
It only happens in some phone models , and only with visual effects enabled on the operating system.
It seems that the activity is drawn before the top bar of Android dissapears (the bar with the battery info, wifi... etc), and the activity starts to draw under the place of this bar.
What can be happening? how can I solve it?
Thank you very much!
PD: I am using a relative layout on this activity, and some layouts inside placed at top and bottom.
PD2: I forgot to tell that the app is in "no tittle bar and fullscreen".

Related

Android 11, keyboard bottom area is not working after app launched via Custom launcher and then back from app Recent List

In Android-11, I enabled the Gesture navigation in the Android System Settings and launched a sample application(which contains only one editText on the Screen) using my custom App Launcher. you can see in the below screenshot,
Gesture Navigation means there is no 3-button navigation, similar behavior of iPhones behavior,
You can see in the above image at the keyboard bottom, that there is some additional space available, so in order to remove the space, I used the below code to hide that
WindowInsetsController wcon = getWindow().getInsetsController();
wcon.hide(WindowInsets.Type.navigationBars());
wcon.setSystemBarsBehavior(WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
So, after I used the code, I got the expected behavior as below, in this stage everything is working fine, (the additional area is hided)
But,
Once I moved this from recent apps like below and again moved back from the normal stage, the Bottom keyboard area touch is not working, I highlight using the Red Color,
This only happens, when I launched the app using Custom App
What went wrong with this behavior, Why is the bottom area not working?

How to prevent user from clicking Navigation buttons in Android

I have encountered a problem where user will exit my application accidentally. I know Android is preventing to block use of these buttons, because you should always be able to exit your app somehow but I am creating an app for blind and visually impaired people and I will implement a special exit the app so they won't close it when they will be using it.
Here are some things I gathered:
I can block the onBackPressed() function and prevent going back.
I can't use onKeyEvent() since it won't grab the home click
Good example is MX Player where you can "lock" your screen but it just draws over the whole screen, thus preventing user to click on anything.
Ok, so I would like to grab the same thing as MX Player, except, I would like for user, to still have interaction with the screen.
I tried using Immersive full screen that Google has introduced for full screen apps, but whenever user slides his finger on the screen, Navigation Menu popus up. Can I keep this hidden at all times? Also, can I prevent the slide from Status Bar to display the buttons? I would like to have full control of how the user is moving their finger over the screen.
So if I go back to the MX Player solution - drawing over the screen. Can I create like a Canvas that doesn't have focus and it's just there to prevent the clicks on the buttons?
Any help is very much appreciated. Thanks.

Kindle Fire status bar and soft key bar bug

I am developing a magazine reader application aimed at the Kindle Fire. In landscape mode the built in softkey bar and status bar in the Kindle's operating system leave little room for my content so I have opted to run the activity in fullscreen mode using the following theme for the activity:
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
This works fine, the status bar is hidden and the softbar is minimized like so:
I can bring up the menu bar by dragging it up like so:
The bug arises when I then click somewhere on screen to dismiss the softkey bar. The bottom bar slides back away, the top one does too but the space that it took up becomes a black void and my app is pushed down underneath it so my tab bar at the bottom of the app is now unusable:
I am using a tabhost activity here and the tab I am on in these screenshots is the actual reader section of the app. This subactivity uses a PDF viewer widget which is written using native code and this bug only happens on this tab. If I switch to one of the other tabs which contain no JNI code this bug does not happen so I'm pretty sure its the combination of the Kindle Fire OS, the fullscreen activity and the use of JNI code.
Has anyone else experience this issue?
Any help much appreciated!
Thanks
There are a couple of fullscreen modes for the Fire (at least the new ICS based ones) - check out https://developer.amazon.com/sdk/fire/cx-guidelines.html#Fullscreen for the options. I suspect the ICS Full Screen mode will be what you need
Also it's probably worth trapping the onOrientationChanged and onSizeChanged events to make sure you re-draw the screen correctly when the menu/toolbars appear and disappear per the screen layout sample at https://developer.amazon.com/sdk/fire/samples.html

Android Navigation bar appearing when in full screen

In my application, I have set it up in the XML so it is in full screen using
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
Now this works fine when the app opens, however if while using the app, I use the home button to back out of the app, and then open it again, when it opens, a black navigation bar will appear for a second or two before disappearing. This does not occur if I exit the app using the back button, just the home button.
Does anyone know why this happens? I have tried doing it from code instead using
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
//Remove notification bar
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
However, what this does is removes the title bar, but the black bar is there at the top, just nothing is in it.
I.e. this bar
I tried combining the code, by putting the full screen line of code in the XML and also adding the code I showed above into the app, but same thing happens. If I back out of the app with home button and enter it again, that black bar will appear for two seconds temporarily pushing the app and its contents down before righting itself again.
How do I go about fixing this? I have been trying loads of different solutions, but nothing seems to work.
Thanks in advance
Seems to a bug with Android OS. Only way to fix it is go to device, settings animation, and disable animations.
try to remove animation by setting->brightness->animation
set no animation there

Misplaced Layout after "home"-button and/or powersave screen

I have an app which also includes a service with a Notification.
Right now I am experiencing the foillowing problem :
I start my app which will work fine
after couple of minutes the powersave kicks in and I get a black screen
I (or hte user) click the Menu-button to dismiss the black screen and to unlock the screenlock
Now my (fullscreen) app will have "moved" like 30-40 pixels downwards, creating an ugly black border or hole. When I move the scrollwheel it will move up and down, and when I press the Menu button (showing my ap''s menu) it will "fix" the view...
or
I start my app which will work fine
I press the Home button exiting the app, my service though will (correctly) keep running
when selecting my service from the notification-bar I will get once again :
-Now my (fullscreen) app will have "moved" like 30-40 pixels downwards, creating an ugly black border or hole. When I move the scrollwheel it will move up and down, and when I press the Menu button (showing my ap''s menu) it will "fix" the view...
Any idea what the problem is ? The app is running on a ADP2 with Android 1.6
Thanks in advance !
Ok, after some testing I noticed that if I don't run the Activity on Fullscreen, but just leave the TtileBar away this won't happen...
Still this is no solution to me, I want it to be fullscreen...
Noticed siomething else, when I have the View with the black bar, and I press the home button it will "refresh" the View correctly just before actually going to the Home Screen :(

Categories

Resources