Bug 698042: Spinner style progress bar for browser toolbar (part 1) [r=mfinkle]
authorSriram Ramasubramanian <sriram@mozilla.com>
Fri, 28 Oct 2011 11:02:57 -0700
changeset 83318 218853bf4af1ef6195458f02a9755040f264cb88
parent 83317 93a133deb97f571c6a8a408f6813bb583748fa2b
child 83319 ef30c6eb723a8b3425cb65ff92204f2d274495be
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs698042
milestone10.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 698042: Spinner style progress bar for browser toolbar (part 1) [r=mfinkle]
embedding/android/BrowserToolbar.java
embedding/android/GeckoApp.java
embedding/android/resources/layout/browser_toolbar.xml
--- a/embedding/android/BrowserToolbar.java
+++ b/embedding/android/BrowserToolbar.java
@@ -102,29 +102,23 @@ public class BrowserToolbar extends Line
     public void updateTabs(int count) {
         if (count == 1)
             mTabs.setImageResource(R.drawable.tabs_plus);
         else
             mTabs.setImageResource(R.drawable.tabs_menu);
     }
 
     public void updateProgress(int progress, int total) {
-        if (progress < 0 || total < 0) {
-            mProgressBar.setIndeterminate(true);
-        } else if (progress < total) {
-            mProgressBar.setIndeterminate(false);
-            mProgressBar.setMax(total);
-            mProgressBar.setProgress(progress);
-        } else {
-            mProgressBar.setIndeterminate(false);
-        }
+        mProgressBar.setVisibility(View.VISIBLE);
+        mFavicon.setVisibility(View.GONE);
     }
 
     public void setProgressVisibility(boolean visible) {
         mProgressBar.setVisibility(visible ? View.VISIBLE : View.GONE);
+        mFavicon.setVisibility(visible ? View.GONE : View.VISIBLE);
     }
 
     public void setTitle(CharSequence title) {
         mAwesomeBar.setText(title);
     }
 
     public void setFavicon(Drawable image) {
         if (image != null)
--- a/embedding/android/GeckoApp.java
+++ b/embedding/android/GeckoApp.java
@@ -1114,16 +1114,17 @@ abstract public class GeckoApp
 
         mDoorHanger = new DoorHanger(this);
 
         Tabs tabs = Tabs.getInstance();
         Tab tab = tabs.getSelectedTab();
         if (tab != null) {
             mBrowserToolbar.setTitle(tab.getTitle());
             mBrowserToolbar.setFavicon(tab.getFavicon());
+            mBrowserToolbar.setProgressVisibility(tab.isLoading());
             mBrowserToolbar.updateTabs(Tabs.getInstance().getCount()); 
         }
 
         tabs.setContentResolver(getContentResolver()); 
 
         if (surfaceView == null) {
             surfaceView = new GeckoSurfaceView(this);
             mGeckoLayout.addView(surfaceView);
--- a/embedding/android/resources/layout/browser_toolbar.xml
+++ b/embedding/android/resources/layout/browser_toolbar.xml
@@ -1,17 +1,11 @@
 <?xml version="1.0" encoding="utf-8"?>
 <merge xmlns:android="http://schemas.android.com/apk/res/android">
 
-    <ProgressBar android:id="@+id/progress_bar"
-                 style="@android:style/Widget.ProgressBar.Horizontal"
-                 android:layout_width="fill_parent"
-                 android:layout_height="10dip"
-                 android:visibility="gone"/>
-
     <RelativeLayout android:id="@+id/address_bar"
                     style="@style/AddressBar">
         
         <Button android:id="@+id/awesome_bar"
                 style="@style/AddressBar.Button"
                 android:layout_width="fill_parent"
                 android:layout_marginLeft="60dip"
                 android:layout_marginRight="12dip"
@@ -36,13 +30,23 @@
 
         <ImageButton android:id="@+id/favicon"
                      style="@style/AddressBar.ImageButton"
                      android:layout_width="24dip"
                      android:layout_height="24dip"
                      android:layout_marginLeft="0dip"
                      android:layout_centerVertical="true"
                      android:src="@drawable/favicon"
-                     android:layout_alignLeft="@id/awesome_bar"/>
+                     android:layout_alignLeft="@id/awesome_bar"
+                     android:visibility="gone"/>
+
+        <ProgressBar android:id="@+id/progress_bar"
+                     style="@android:style/Widget.ProgressBar.Small"
+                     android:layout_width="24dip"
+                     android:layout_height="24dip"
+                     android:layout_marginLeft="0dip"
+                     android:layout_centerVertical="true"
+                     android:layout_alignLeft="@id/awesome_bar"
+                     android:visibility="visible"/>
 
     </RelativeLayout>
 
 </merge>