Splashscreen - getActionBar().hide still flashes for a second - android

I am trying to implement a splashcreen and I dont want to use a new activity for the splashscreen,
So I set visibility=gone on my listview, hide actionbar, leave the logo visibility=visible, sleep for a certain period and then show the actionbar again and set the listview visibility back to visible
This works, however there is a brief moment at the start when the actionbar is still visible before it gets hidden
Is there a way to fix this and have the actionbar be gone from the beginning?
I am using ActionBarSherlock and Galaxy S3 with 4.1 Jelly Bean.
Thanks

No. There is no way to do this without using two separate activities.
The action bar is initialized as part of the decor view which happens much earlier than your onCreate method. This means there will be the noticeable lag that you describe before it can be hidden. If you wanted to permanently hide it you could do so using a theme or window flag but once you do that there is no way to get it to appear.

Related

How to create custom status bar in Android KIOSK app

We are creating a KIOSK app on API 22. We want to have custom status bar. And with two finger swipe from the top, options menu is opened where we can edit sound, wifi etc. just like regular swipe from top on android phones.
One option would be to edit Android source code, but we are wondering if there is something we can do on application level since we need to have some strings and buttons from app in that status bar, besides WiFi signal and battery.
What we have done is we added a fragment on top of the screen which acts as a status bar, and below it is a fragment container for other fragments.
Problem here is we need to have a transparent background of the fragments in fragment container, so when user opens multiple fragments, whole fragment stack is visible in the background.
Only way we could achieve this is by using fullscreen dialog fragments, but then we had to make multiple instances of our "status bar" which overlap and only looks like one view to the user:
This leads to maintaining multiple views instead of just one. Also the problem is since we are using Navigation library, when Fragment 1 changes in the background it also pops all dialog fragments, which throws the user to screen he was not on.
One thing we tried is to set dialog fragments window to be (size of screen - status bar) but then we could not click on status bar, since it is behind our dialog fragment.
We are considering of using activities instead of fragments, since then we can have transparent background and we don't need to use dialog fragments, but to have activates everywhere instead of fragments doesn't sound like a good idea.
Are there some other options?

Strange behavior of a bottom navigation view when is set visible

I try to make an app using one activity multiple fragments pattern. I handle navigation with Navigation architecture component using a bottom navigation view. In one of the fragment I have a Recyclerview which displays a list of custom cards. On item click it navigates to another fragment where I need to hide the bottom navigation view.
The problem appears when I navigate back and set the bottom navigation view visible again. The bar seems to appear in two steps giving the feeling of lag. (first time appears just 60% of the bottom navigation view).
The behavior seems to be related with the status bar. When I change the theme to full screen or I set windowTranslucentStatus=true, everything behaves okay. In addition, first time the nav bar seems to be with exactly 24dp smaller, that is the dimension of status bar.
Have you any idea what can I do?
PS. I'm new on stackoverflow and this is my first question. I'm glad to join this wonderful community.
Delay is one way to go, but I wouldn't suggest that.
I am assuming that the your navigation view is rendered before the entire activity is rendered, which is causing it to be rendered again after the UI is rendered. Why don't you try setting the visibility after the UI is rendered, like here

GridView removing row too soon

I'm using a GridView that fills the whole of my main activity. To make it look nicer I'm using a transparent action bar. I'm using these values on my grid view so that the content doesn't start in the action bar but still scrolls through it:
android:paddingTop="?android:attr/actionBarSize"
android:clipToPadding="false"
The only problem is once the bottom of the row enters the action bar it disappears. I'm assuming because Android thinks it is no longer visible so it's safe to remove.
I'd like a way for it to not disappear, even past the status bar as I'll probably make that transparent on KitKat too. Either a different approach or a simple solution would be great.
Turns out this was a problem with the TwoWayGridView library I was using (https://github.com/jess-anders/two-way-gridview). Switched back to a normal GridView and it works fine.

Smooth transition between full-screen-activity and one with notification-bar and action bar

Background
I have an app that has 2 activities :
splash activity, which is shown in full screen (no action bar, no notification bar)
main activity, which has both an action bar (uses actionBarSherlock) and a notification bar.
The problem
For some reason, when going from the first activity to the second, there is a "jumpy" layout process, which shows the content of the second activity without the action bar and notification bar, and a moment later it shows them both.
This causes the content below to move too, which is very noticeable.
Possible solution
As I've seen, a possible solution would be to hide the action bar and show it a bit later (500ms later), but this seems like a bad solution (making it slower and hiding for no reason), plus I need to get the actionBar items positions for another purpose (for showing a tutorial).
The question
Is it possible to avoid the "jumpiness"? One that doesn't involve such a weird workaround?
I've solved my problem doing the following:
1.- I have to optimize all the screens where the AB was shown. In some cases I used ListViews which weren't correctly implemented and that caused a noticeable load time in the activity.
2.- I have shown the status bar BEFORE starting the new activity. I mean: I've shown the status bar in the fullscreen activity just before starting the non-fullscreen one. With that I achieved that the layout of the second activity (non-fullscreen) was never resized.
With this two little changes now the AB transition is much more smoother.
You can find the complete post with my answer at: Smoother transition from fullscreen activity using ActionBarSherlock
Why don't you use some other animation slide transitions rather than default popping one?
something like this?
overridePendingTransition(android.R.anim.accelerate_interpolator, android.R.anim.slide_out_right);
Here is the Animation lists that you can use
http://developer.android.com/reference/android/R.anim.html

Dismiss or remove System Navigation Bar

I want to dismiss bottom Navigation bar for one particular screen.
I tried using
setSystemUiVisibility(HorizontalScrollView.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
I have put this in Onscroll of my scrollView, ontouch of my views.
but the issue is its comes back and the screen gets resize.
Any suggestions by which I can completely remove the NAVIGATION BAR.
Check out SYSTEM_UI_FLAG_HIDE_NAVIGATION, this flag hides the navigation bar until the user interacts with the device. It's new in Android 4.0. You can enable this flag for example like this:
getWindow().getDecorView()
.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
Note that the navigation won't disappear again automatically, you have to set it every time after the user interacted with the device.
Alternatively you can make the navigation less obtrusive by using SYSTEM_UI_FLAG_LOW_PROFILE, this changes the buttons into small dots (e.g. like the camera app).

Categories

Resources