Android Progressbar not allowing to switch tab - android

I have two tabs in my app.First tab displays the details of user and the second tab displays the applications that are installed on his device.I have used Package manager for getting the installed apps and it is running ins background thread. If the user clicked the second tab before the background thread completes I want to show a progressdialog.But the problem is if progressdialog is displayed on the screen user can't switch to next tab.Is there any way to solve this issue.Thanks in advance.

Progress dialogue by default works in dialogue mode and freezes any operations until the progress bar is gone.
I had faced issues with controlling progress bar (though my requirements were more than yours like customizing looks and showing/ hiding/ freezing bar at will), so I ended up creating a custom progress bar.
It is pretty simple
Create 2 straight straight bars, one black and other of any color (if you want something more fancy, it is upto you)
Add the bars to drawable and then to your layout xml in hidden mode. The colored bar exactly on top (superimpose) of black bar
Now where you want to show the progress bar, make the black bar visible first, and adjust the width of colored bar (on top of black bar) as per the progress.
This will give you proper functionality of the progress bar.
As you are playing around only with imageviews, you have full control over when to show or hide the bar. Also by default it will not freeze the view. You can freeze at will by capturing onTouch event.

Related

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

ActionBar Sherlock Progress Bar in Icon space

I am using an Action bar in my project. I am displaying a progress bar via the below approach.
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setProgressBarIndeterminateVisibility(true);
However, what I'd really like to do is replace the left most image icon with the progress indicator when arbitrary background processes run and then returns the usual icon when complete.
Can anyone tell me the steps needed to replace this icon with a functional Progress indicator. It only needs to be an intermediate one.
Looks like you can find some suggestions here: Android: dynamically change ActionBar icon?.
Specifically, you can access the icon by using
Activity.findViewById(android.R.id.home)
And then just set and re-set the icon as needed.
You need to build a custom layout for this and use actionbar.setCustomView(yourcustomlayout);
In your custom layout have an imageView(which is your app icon) and progress bar(initially which is set to invisible).
When running the background process just set the visibility between image view and progress bar.

Android Layout does not allow user to pull down notification bar

I am writing an App using MonoDroid and for some reason I cannot pull down the notification bar from the top of the screen. I am thinking this has to do with my layout, but I am not sure. I also notice that when my App is running I do not have the bar at the top showing the battery, time, signal strength, etc.
So, my question is, what do I need to do to allow the user to pull the notification bar down? And how to show the info at the top of the screen?
I suspect you have done something to make your app appear in "Full Screen" mode (this will turn the home, menu and back buttons on the bottom of the screen to dots, and hide the navigation bar.
I believe this is called "lights out mode". Here is one SO question asking how to turn it on (maybe it will help you turn it off as well): Hide ICS back home task switcher buttons
Maybe your theme is
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" ?
It hides the notification bar. Change to a non-fullscreen theme to make the the notification bar visible.

Download Progress Bar as LinearLayout Background

I have an app where students at my school can download course content that professors upload. Everything works great, except I have no progress bar dialog. I recently switched the app over to using fragments, so the old dialog I was using broke.
Anyway, I was thinking that instead of having a dialog display the progress bar, I could use the background of the item that was clicked as the progress bar.
Here is a screenshot of the app:
http://dl.dropbox.com/u/4439149/Screenshot_2012-09-27-15-06-43.png
And here is a mocup of how I imagine it working:
http://dl.dropbox.com/u/4439149/42an8-CTWBJpw391zDSBs5MAiuIhibcsRWhZGwdvmTE%20copy.png
I cannot for the life of me think of how this should be done. I am hoping someone could just give me a push in the right direction.
Thanks,
David
Check out Clip Drawable. You can set the background of your row to a ClipDrawable that holds the color or another drawable that you want to show for progress, then set the level (progress) while downloading.
Have you tried changing your row.xml to be a frame layout and just have a ProgressBar that fills the entire row? You can then put this behind the layout you currently have in your row.xml.

How to show a webview progress bar at the bottom of the app?

Is there a way to show, only while loading, a webview's progress bar, at the bottom of the app ?
Currently, my progress bar is showed in the title bar. But I don't want it there. I want it at the botton of the app.
Is there a way to do it ?
Thanks!
A solution is to hide the title bar (not necessary but it will save screen space), and add your own progress bar at the bottom of your layout.
But it goes against the normal user interface standards and could be confusing to users so I wouldn't recommend to change the progress bar location.

Categories

Resources