[Android] Use the progress bar provided by the action bar

Ludovic Fauvet git at videolan.org
Wed Jun 20 23:44:03 CEST 2012


android | branch: master | Ludovic Fauvet <etix at videolan.org> | Wed Jun 20 20:18:58 2012 +0200| [258c0311c8d0bb767d1ef534752ba345d5fbc629] | committer: Ludovic Fauvet

Use the progress bar provided by the action bar

> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=258c0311c8d0bb767d1ef534752ba345d5fbc629
---

 vlc-android/src/org/videolan/vlc/gui/MainActivity.java |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 588e797..f8468e9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -71,6 +71,8 @@ import android.util.Log;
 import com.actionbarsherlock.view.Menu;
 import com.actionbarsherlock.view.MenuInflater;
 import com.actionbarsherlock.view.MenuItem;
+import com.actionbarsherlock.view.Window;
+
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.Button;
@@ -95,7 +97,6 @@ public class MainActivity extends SherlockFragmentActivity {
     private static final String PREF_SHOW_INFO = "show_info";
 
     private ActionBar mActionBar;
-    private ProgressBar mProgressBar;
     private TabHost mTabHost;
     private int mCurrentState = 0;
     private ImageButton mChangeTab;
@@ -111,7 +112,9 @@ public class MainActivity extends SherlockFragmentActivity {
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
+        requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
         setContentView(R.layout.main);
+
         super.onCreate(savedInstanceState);
 
         /* Get settings */
@@ -119,7 +122,6 @@ public class MainActivity extends SherlockFragmentActivity {
         LibVLC.useIOMX(this);
 
         /* Initialize variables */
-        mProgressBar = (ProgressBar) findViewById(R.id.ml_progress_bar);
         mChangeTab = (ImageButton) findViewById(R.id.change_tab);
         mInfoLayout = (View) findViewById(R.id.info_layout);
         mInfoProgress = (ProgressBar) findViewById(R.id.info_progress);
@@ -424,10 +426,10 @@ public class MainActivity extends SherlockFragmentActivity {
             String action = intent.getAction();
 
             if (action.equalsIgnoreCase(ACTION_SHOW_PROGRESSBAR)) {
-                mProgressBar.setVisibility(View.VISIBLE);
+                setProgressBarIndeterminateVisibility(Boolean.TRUE);
             }
             else if (action.equalsIgnoreCase(ACTION_HIDE_PROGRESSBAR)) {
-                mProgressBar.setVisibility(View.INVISIBLE);
+                setProgressBarIndeterminateVisibility(Boolean.FALSE);
             }
             else if (action.equalsIgnoreCase(ACTION_SHOW_TEXTINFO)) {
                 String info = intent.getStringExtra("info");



More information about the Android mailing list