ActionBar-PulltoRefresh, wrong header offset when setting the activity to fullscreen - android

I am using ActionBar-PulltoRefresh by Chris Banes, it is a great libary to have.
However, I run into a weird problem when I set my activity to fullscreen. I set auto-refresh in the onResume() function, where I also show the progress bar animation.
However, sometimes(esp. when come back from the screen lock) the status bar take some time to hide(there is a short animation), and the header and the progress bar were overlaid in wrong location, i.e. below the real location of the action bar. The offset seems to be exact the size of the status bar.
However, if I trigger the refresh a few seconds later after the activity is fully shown, there is no problem. But I don't want to add a fix delay to the auto-refresh operation in onResume().
Any better fix for this problem?

Related

How to get EnabledSystemUIMode (i.e. system status/nav bar appearing or not), or get notified when the mode is changed in Flutter?

In Flutter, we can SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive); to make the app fullscreen (i.e. hide Android system status bar and nav bar).
However, I observed that, if the user manually swipes from bottom of screen upwards, the system bars will re-appear again. The big problem is, Flutter code has no way to notice that. If we can get notified that this is changed, we can, for example, make the "go fullscreen" button appear again, such that users can go fullscreen again when they want.
Therefore, is there any approaches to get the current status of whether the status bar or nav bar is showing? Or even better, can we get a callback fired when it changes?
Thanks for any suggestions!
Oops I find the answer after digging into source code: setSystemUIChangeCallback.
It is a bit weird that I did not find it by googling... So anyway I just leave this question here, in case anyone has the same question as me he can find this StackOverflow answer.

android full screen mode(ICS), first touch shows the navigation bar

In my video play app, I use this flag: SYSTEM_UI_FLAG_HIDE_NAVIGATION to make the navigation bar disappear, but when I touch the screen, the navigation bar appears, after the first touch, my touch events and other events work fine.
My question is how can I take over the first touch?
You can't really take over the first event. You could implement View.OnSystemUiVisibilityChangeListener and be notified when the navigation bar is shown or hidden again, and then depending on its current state do what you wanted on the first touch, if possible.
However, there is no way you can completely take over the first touch, as stated in the documentation for SYSTEM_UI_FLAG_HIDE_NAVIGATION:
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.
For anyone coming across this post, if your intention is to hide the navigation/status bar and not have it come back up when you touch the screen, take a look at the different "immersive" configurations as described here: https://developer.android.com/training/system-ui/immersive
for example:
currentActivity?.window?.decorView?.systemUiVisibility = View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY or
View.SYSTEM_UI_FLAG_FULLSCREEN or
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
That would effectively put your screen in "Full Screen" Mode regardless of any interaction the user has with the screen
To show the navigation/status bar again, simply change it back to:
currentActivity?.window?.decorView?.systemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE

Disable Android Notification Bar in Full Screen (in SGIII)

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.

How to let status bar not to be pulled in my activity?

I want to let status bar visible but can not be pulled in my activity, is it possible?
If use getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
the status bar is invisible.
Don't do this.
I've been there before - you think you have an interaction that requires overriding some default system behavior (back button, home button, etc).
User expect those buttons (and the status bar) to behave in a certain way and will get annoyed if you override it.
Could you tell us why would you want to block StatusBar from being pulled?
As rightly pointed out by theelfismike, this isn't a best practice to follow.
I suspect you are trying to achieve something which can be gracefully done otherwise.

android 4.0 FullScreen

i want make Fullscreen in android 4.0, i use android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
the action bar is disappear, but the status bar isn't appear
i use
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
before "setContentView()"
OK, FullScreen!! however, when the dialog or popupwindow show, the status bar appear again,
i read the source code and find the word :
There is a limitation: because navigation controls are so important,
the least user interaction will cause them to reappear immediately.
can i make fullscreen anytime? help me!
There is a limitation: because navigation controls are so important, the least user * interaction will cause them to reappear immediately.
In other words, Android is telling you that the limitation exists because it would be a bad idea to prevent the user from accessing the navigation controls. Doing so would surely disrupt the user experience and would probably piss off a lot of users. That said, unless you have a very good reason for doing so, you should leave it the way it is.

Categories

Resources