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
Related
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?
I recently added the following code to my app to remove the navigation bar (soft buttons) from some phones. This caused some resizing issues with my app so getting rid of the navigation bar was ideal.
getWindow().requestFeature(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
See more: https://developer.android.com/training/system-ui/navigation.html
This does exactly what I wanted. The soft buttons are no longer present on devices such as the Nexus 5. However, this caused the side effect of disabling and touch or gestures until there is at least one touch event first. For example, I have some buttons on the home screen. With the above code, tapping on the button the first time does nothing. From the second time onwards, the app behaves like normal. My app also uses a viewpager, and swiping to other tabs or selecting another tab from the action bar also has no effect until I tap somewhere on the screen first.
Obviously, this behaviour is not wanted. When the user opens the app and selects one of the buttons, they expect the button to be clicked. Instead, they'd have to tap the button twice (and then everything works fine from that point on).
I'm testing this on the Samsung Galaxy S3 (which does not have the navigation bar along the bottom) and the Nexus 5 (which does have the navigation bar along the bottom).
Edit: Further research - Hiding the navigation bar is only temporary. The navigation bar is requesting focus for the first touch event, since the navigation bar is meant to pop back up as soon as there is any kind of ui event. So even on the Galaxy S3, which has no navigation bar in the first place, the touch event is being sucked up by the navigation bar. For devices that really do have a navigation bar, the bar will reappear on every interaction and you must tell the device to hide it again. As far as I can tell, there is no way to permanently hide the navigation bar.
My next question is to find out how it is possible to query the device to see if there is a navigation bar. If I know that the device does not have the navigation bar, then there is no need to try to hide it and have the OS absorb the first touch event.
SYSTEM_UI_FLAG_HIDE_NAVIGATION is designed for passive activities like watching videos and maybe reading books. For your purposes, immersive mode is a better choice. https://developer.android.com/training/system-ui/immersive.html
More specifically you may want to add the SYSTEM_UI_FLAG_IMMERSIVE_STICKY flag together with SYSTEM_UI_FLAG_HIDE_NAVIGATION, so that the navigation bar is hidden and will stay hidden until user swipes from top or bottom.
Note that a "reminder bubble" will appear the first time a user enters this mode in your app.
I'm currently working on an app for blind people. What I need is to prevent users from accidentally going outside of my app, so I'm trying to overlay/replace/hide soft buttons in Android 4. I know this must be possible because it is used for example in MXPlayer (you can "lock" screen when playing video).
I've tried to override all three buttons (back,home,recent apps). No problem with back and home, but I couldn't figure out how to override(disable) recent apps. I've tried solution described here without success.
Next idea was to overlay the entire screen. I've successfully created system overlay mentioned in this question, but I didn't find out how to overlay my soft buttons.
Do you have any idea how to solve this problem without rooting the phone and using custom ROM?
edit: I've also tried hiding the buttons with SYSTEM_UI_FLAG_LOW_PROFILE(turns buttons into dots) and SYSTEM_UI_FLAG_HIDE_NAVIGATION(hides buttons till next touch). Unfortunately this also doesn't solve my problem because after touch buttons work as usual. Maybe there's a way how to catch "unhiding" a override showing them again?
From Android docs :
The SYSTEM_UI_FLAG_LOW_PROFILE flag replaces the STATUS_BAR_HIDDEN flag. When set, this flag enables “low profile" mode for the system bar or navigation bar. Navigation buttons dim and other elements in the system bar also hide. Enabling this is useful for creating more immersive games without distraction for the system navigation buttons.
The SYSTEM_UI_FLAG_VISIBLE flag replaces the STATUS_BAR_VISIBLE flag to request the system bar or navigation bar be visible.
The SYSTEM_UI_FLAG_HIDE_NAVIGATION is a new flag that requests the navigation bar hide completely. Be aware that this works only for the navigation bar used by some handsets (it does not hide the system bar on tablets). The navigation bar returns to view as soon as the system receives user input. As such, this mode is useful primarily for video playback or other cases in which the whole screen is needed but user input is not required.
I am trying to write an app that draws a custom mouse pointer. I currently have a service that creates a class that extends ViewGroup and uses the WindowManager system service to display it as a TYPE_SYSTEM_OVERLAY with the FLAG_LAYOUT_IN_SCREEN set.
This almost works. On my tablet (Samsung Galaxy Tab 7.7) and in the emulator set to tablet mode, it is laid above everything except the bottom status bar (with the soft home, back keys and the notification area). In the emulator, there are no software buttons on screen, but it is laid on top of the notification bar.
I've also tried the solution in: TYPE_SYSTEM_OVERLAY in ICS but I got the same results.
Is there a way to truly draw on top of everything?
I have previously used System Overlays to achieve something similar, and can unfortunately tell you that it isn't possible.
You can overlay on top of the entire normal screen area, and over the notification bar if it isn't clubbed with the system bar at the bottom (as is the case in some tablets). Beyond that, it seems to be impossible to overlay on top of the System Bar software buttons.
In Samsung Galaxy S3, even though my app is set to be full screen, and this makes the notification bar not to be visible, if I swipe from the very edge of the screen side, this action will make the notification bar to appear again, allowing the user to expand it over the full screen app.
Is there any way to disable this, or to cancel the expand of the notification bar?
The problem is that I have a listview covering the whole screen, and if I swipe to scroll the items, every time I do it from the very edge due to the instinctive action of scrolling faster, then the notification bar appears again.
I've tried tricks such as creating an overlay window on the edge, but not working at all for SG3.
Thanks
If you haven't tried already, you might attempt to use the View flag for hiding navigation, SYSTEM_UI_FLAG_HIDE_NAVIGATION, documented here.
However it may be important to note this found at the bottom of their description :
There is a limitation: because navigation controls are so important, the least user interaction will cause them to reappear immediately. When this happens, both this flag and SYSTEM_UI_FLAG_FULLSCREEN will be cleared automatically, so that both elements reappear at the same time.
which is probably related to what you're seeing. I find it hard to believe there's a way around this... I just tried and every fullscreen app I have on my S3 behaves this exact same way.
I suspect that if there was a way around it (assuming the above doesn't work, which I don't expect it to), it would be considered to be a bug by the Android team, and I would advise against it.