summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/TabBar.java
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2010-10-26 19:01:24 -0700
committerJohn Reck <jreck@google.com>2010-10-29 17:09:25 -0700
commitfb3017ffd8aa3f2342380270cf468e3a68914e69 (patch)
tree8480ed9bae90628844de42d663af27e7a3093e46 /src/com/android/browser/TabBar.java
parentc54d328a499ec0c35f73e5cf57169541e8bf1cd3 (diff)
downloadandroid_packages_apps_Gello-fb3017ffd8aa3f2342380270cf468e3a68914e69.tar.gz
android_packages_apps_Gello-fb3017ffd8aa3f2342380270cf468e3a68914e69.tar.bz2
android_packages_apps_Gello-fb3017ffd8aa3f2342380270cf468e3a68914e69.zip
Fixes tab title not updating correctly
Bug: 3130982 Fixes the bug where the tab title would stay the same until a new title was received. Now the title changes to "Loading..." until a new title is received, or changes to the URL if the page finishes or is canceled without receiving a title. Change-Id: I667acbaeea5383b6a434c20337d404f49b947b0d
Diffstat (limited to 'src/com/android/browser/TabBar.java')
-rw-r--r--src/com/android/browser/TabBar.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/com/android/browser/TabBar.java b/src/com/android/browser/TabBar.java
index 26b72f7d..a939639a 100644
--- a/src/com/android/browser/TabBar.java
+++ b/src/com/android/browser/TabBar.java
@@ -67,8 +67,10 @@ public class TabBar extends LinearLayout
private boolean mUserRequestedUrlbar;
private boolean mTitleVisible;
private boolean mShowUrlMode;
+ private boolean mHasReceivedTitle;
private Drawable mGenericFavicon;
+ private String mLoadingText;
public TabBar(BrowserActivity context, TabControl tabcontrol, TitleBarXLarge titlebar) {
super(context);
@@ -89,6 +91,7 @@ public class TabBar extends LinearLayout
mNewTab = (ImageButton) findViewById(R.id.newtab);
mNewTab.setOnClickListener(this);
mGenericFavicon = res.getDrawable(R.drawable.app_web_browser_sm);
+ mLoadingText = res.getString(R.string.title_bar_loading);
// TODO: Change enabled states based on whether you can go
// back/forward. Probably should be done inside onPageStarted.
@@ -355,7 +358,7 @@ public class TabBar extends LinearLayout
if (title != null) {
mTabView.setDisplayTitle(title);
} else if (url != null) {
- mTabView.setDisplayTitle(url);
+ mTabView.setDisplayTitle(UrlUtils.stripUrl(url));
}
}
}
@@ -437,6 +440,7 @@ public class TabBar extends LinearLayout
@Override
public void onUrlAndTitle(Tab tab, String url, String title) {
+ mHasReceivedTitle = true;
TabViewData tvd = mTabMap.get(tab);
if (tvd != null) {
tvd.setUrlAndTitle(url, title);
@@ -445,13 +449,21 @@ public class TabBar extends LinearLayout
@Override
public void onPageFinished(Tab tab) {
+ if (!mHasReceivedTitle) {
+ TabViewData tvd = mTabMap.get(tab);
+ if (tvd != null) {
+ tvd.setUrlAndTitle(tvd.mUrl, null);
+ }
+ }
}
@Override
- public void onPageStarted(Tab tab, Bitmap favicon) {
+ public void onPageStarted(Tab tab, String url, Bitmap favicon) {
+ mHasReceivedTitle = false;
TabViewData tvd = mTabMap.get(tab);
if (tvd != null) {
tvd.setFavicon(favicon);
+ tvd.setUrlAndTitle(url, mLoadingText);
}
}