OSDN Git Service

When reverting the voice title bar, display the url.
[android-x86/packages-apps-Browser.git] / src / com / android / browser / BrowserActivity.java
index df80e99..2469408 100644 (file)
@@ -306,6 +306,14 @@ public class BrowserActivity extends Activity
         PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
         mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Browser");
 
+        // Find out if the network is currently up.
+        ConnectivityManager cm = (ConnectivityManager) getSystemService(
+                Context.CONNECTIVITY_SERVICE);
+        NetworkInfo info = cm.getActiveNetworkInfo();
+        if (info != null) {
+            mIsNetworkUp = info.isAvailable();
+        }
+
         /* enables registration for changes in network status from
            http stack */
         mNetworkStateChangedFilter = new IntentFilter();
@@ -755,8 +763,8 @@ public class BrowserActivity extends Activity
         mTitleBar.setInVoiceMode(false);
         mFakeTitleBar.setInVoiceMode(false);
 
-        mTitleBar.setDisplayTitle(mTitle);
-        mFakeTitleBar.setDisplayTitle(mTitle);
+        mTitleBar.setDisplayTitle(mUrl);
+        mFakeTitleBar.setDisplayTitle(mUrl);
     }
     /* package */ static String fixUrl(String inUrl) {
         // FIXME: Converting the url to lower case
@@ -2827,12 +2835,19 @@ public class BrowserActivity extends Activity
                     hideFakeTitleBar();
                 }
             }
-        } else if (!mInLoad) {
-            // onPageFinished may have already been called but a subframe is
-            // still loading and updating the progress. Reset mInLoad and update
-            // the menu items.
-            mInLoad = true;
-            updateInLoadMenuItems();
+        } else {
+            if (!mInLoad) {
+                // onPageFinished may have already been called but a subframe is
+                // still loading and updating the progress. Reset mInLoad and
+                // update the menu items.
+                mInLoad = true;
+                updateInLoadMenuItems();
+            }
+            // When the page first begins to load, the Activity may still be
+            // paused, in which case showFakeTitleBar will do nothing.  Call
+            // again as the page continues to load so that it will be shown.
+            // (Calling it will the fake title bar is already showing will also
+            // do nothing.
             if (!mOptionsMenuOpen || mIconView) {
                 // This page has begun to load, so show the title bar
                 showFakeTitleBar();