Bug 698042: Spinner style progress bar for browser toolbar (part 2) [r=mfinkle]
authorSriram Ramasubramanian <sriram@mozilla.com>
Fri, 28 Oct 2011 11:08:47 -0700
changeset 83319 ef30c6eb723a8b3425cb65ff92204f2d274495be
parent 83318 218853bf4af1ef6195458f02a9755040f264cb88
child 83320 a9fb813f816effdf27596a7ebb091d4375166a6b
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 2) [r=mfinkle]
embedding/android/BrowserToolbar.java
embedding/android/GeckoApp.java
--- a/embedding/android/BrowserToolbar.java
+++ b/embedding/android/BrowserToolbar.java
@@ -101,21 +101,16 @@ 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) {
-        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);
     }
--- a/embedding/android/GeckoApp.java
+++ b/embedding/android/GeckoApp.java
@@ -730,23 +730,16 @@ abstract public class GeckoApp
                     if ((state & GeckoAppShell.WPL_STATE_START) != 0) {
                         Log.i(LOG_NAME, "Got a document start");
                         handleDocumentStart(tabId);
                     } else if ((state & GeckoAppShell.WPL_STATE_STOP) != 0) {
                         Log.i(LOG_NAME, "Got a document stop");
                         handleDocumentStop(tabId);
                     }
                 }
-            } else if (event.equals("onProgressChange")) {
-                final int tabId = message.getInt("tabID");
-                final int current = message.getInt("current");
-                final int total = message.getInt("total");
-            
-                handleProgressChange(tabId, current, total);
-                Log.i(LOG_NAME, "progress - " + current + "/" + total);
             } else if (event.equals("onCameraCapture")) {
                 //GeckoApp.mAppContext.doCameraCapture(message.getString("path"));
                 doCameraCapture();
             } else if (event.equals("Tab:Added")) {
                 Log.i(LOG_NAME, "Created a new tab");
                 int tabId = message.getInt("tabID");
                 String uri = message.getString("uri");
                 handleAddTab(tabId, uri);
@@ -866,17 +859,16 @@ abstract public class GeckoApp
         });
 
         if (!Tabs.getInstance().isSelectedTab(tab))
             return;
 
         mMainHandler.post(new Runnable() { 
             public void run() {
                 mBrowserToolbar.setProgressVisibility(true);
-                mBrowserToolbar.updateProgress(-1, -1);
             }
         });
     }
 
     void handleDocumentStop(final int tabId) {
         Tab tab = Tabs.getInstance().getTab(tabId);
 
         if (tab == null)
@@ -896,31 +888,16 @@ abstract public class GeckoApp
         mMainHandler.post(new Runnable() { 
             public void run() {
                 mBrowserToolbar.setProgressVisibility(false);
                 surfaceView.hideStartupBitmap();
             }
         });
     }
 
-    void handleProgressChange(final int tabId, final int current, final int total) {
-        Tab tab = Tabs.getInstance().getTab(tabId);
-        if (tab == null)
-            return;
-
-        if (!Tabs.getInstance().isSelectedTab(tab))
-            return;
-        
-        mMainHandler.post(new Runnable() { 
-            public void run() {
-                mBrowserToolbar.updateProgress(current, total);
-            }
-        });
-    }
-
     void handleShowToast(final String message, final String duration) {
         mMainHandler.post(new Runnable() {
             public void run() {
                 Toast toast;
                 if (duration.equals("long"))
                     toast = Toast.makeText(mAppContext, message, Toast.LENGTH_LONG);
                 else
                     toast = Toast.makeText(mAppContext, message, Toast.LENGTH_SHORT);
@@ -1163,17 +1140,16 @@ abstract public class GeckoApp
 
         //register for events
         GeckoAppShell.registerGeckoEventListener("DOMContentLoaded", GeckoApp.mAppContext);
         GeckoAppShell.registerGeckoEventListener("DOMTitleChanged", GeckoApp.mAppContext);
         GeckoAppShell.registerGeckoEventListener("DOMLinkAdded", GeckoApp.mAppContext);
         GeckoAppShell.registerGeckoEventListener("log", GeckoApp.mAppContext);
         GeckoAppShell.registerGeckoEventListener("onLocationChange", GeckoApp.mAppContext);
         GeckoAppShell.registerGeckoEventListener("onStateChange", GeckoApp.mAppContext);
-        GeckoAppShell.registerGeckoEventListener("onProgressChange", GeckoApp.mAppContext);
         GeckoAppShell.registerGeckoEventListener("onCameraCapture", GeckoApp.mAppContext);
         GeckoAppShell.registerGeckoEventListener("Tab:Added", GeckoApp.mAppContext);
         GeckoAppShell.registerGeckoEventListener("Tab:Closed", GeckoApp.mAppContext);
         GeckoAppShell.registerGeckoEventListener("Tab:Selected", GeckoApp.mAppContext);
         GeckoAppShell.registerGeckoEventListener("Doorhanger:Add", GeckoApp.mAppContext);
         GeckoAppShell.registerGeckoEventListener("Menu:Add", GeckoApp.mAppContext);
         GeckoAppShell.registerGeckoEventListener("Menu:Remove", GeckoApp.mAppContext);
         GeckoAppShell.registerGeckoEventListener("Preferences:Data", GeckoApp.mAppContext);
@@ -1362,17 +1338,16 @@ abstract public class GeckoApp
         }
         
         GeckoAppShell.unregisterGeckoEventListener("DOMContentLoaded", GeckoApp.mAppContext);
         GeckoAppShell.unregisterGeckoEventListener("DOMTitleChanged", GeckoApp.mAppContext);
         GeckoAppShell.unregisterGeckoEventListener("DOMLinkAdded", GeckoApp.mAppContext);
         GeckoAppShell.unregisterGeckoEventListener("log", GeckoApp.mAppContext);
         GeckoAppShell.unregisterGeckoEventListener("onLocationChange", GeckoApp.mAppContext);
         GeckoAppShell.unregisterGeckoEventListener("onStateChange", GeckoApp.mAppContext);
-        GeckoAppShell.unregisterGeckoEventListener("onProgressChange", GeckoApp.mAppContext);
         GeckoAppShell.unregisterGeckoEventListener("onCameraCapture", GeckoApp.mAppContext);
         GeckoAppShell.unregisterGeckoEventListener("Tab:Added", GeckoApp.mAppContext);
         GeckoAppShell.unregisterGeckoEventListener("Tab:Closed", GeckoApp.mAppContext);
         GeckoAppShell.unregisterGeckoEventListener("Tab:Selected", GeckoApp.mAppContext);
         GeckoAppShell.unregisterGeckoEventListener("Doorhanger:Add", GeckoApp.mAppContext);
         GeckoAppShell.unregisterGeckoEventListener("Menu:Add", GeckoApp.mAppContext);
         GeckoAppShell.unregisterGeckoEventListener("Menu:Remove", GeckoApp.mAppContext);
         GeckoAppShell.unregisterGeckoEventListener("Preferences:Data", GeckoApp.mAppContext);
@@ -1637,17 +1612,16 @@ abstract public class GeckoApp
             }
             break;
         case AWESOMEBAR_REQUEST:
             if (data != null) {
                 String url = data.getStringExtra(AwesomeBar.URL_KEY);
                 AwesomeBar.Type type = AwesomeBar.Type.valueOf(data.getStringExtra(AwesomeBar.TYPE_KEY));
                 if (url != null && url.length() > 0) {
                     mBrowserToolbar.setProgressVisibility(true);
-                    mBrowserToolbar.updateProgress(-1, -1);
                     loadUrl(url, type);
                 }
             }
             break;
         case CAMERA_CAPTURE_REQUEST:
             Log.i(LOG_NAME, "Returning from CAMERA_CAPTURE_REQUEST: " + resultCode);
             File file = new File(Environment.getExternalStorageDirectory(), "cameraCapture-" + Integer.toString(kCaptureIndex) + ".jpg");
             kCaptureIndex++;