summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/TitleBar.java
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2009-07-20 13:38:47 -0400
committerLeon Scroggins <scroggo@google.com>2009-07-20 13:38:47 -0400
commitd7c3dd53ddd4e480ca11517af461ae0764adc2a8 (patch)
tree3cce299cc5198aca9686be36178c994219339d5a /src/com/android/browser/TitleBar.java
parentbff2d603c022691237c31d9a57ad8c217c6e7e11 (diff)
downloadpackages_apps_Browser-d7c3dd53ddd4e480ca11517af461ae0764adc2a8.zip
packages_apps_Browser-d7c3dd53ddd4e480ca11517af461ae0764adc2a8.tar.gz
packages_apps_Browser-d7c3dd53ddd4e480ca11517af461ae0764adc2a8.tar.bz2
Set a title for pages with no title.
In the title bar, we were showing "Loading..." as the title for a page that finished loading but still has no title. Now, display the url where the title is displayed and display nothing for the url.
Diffstat (limited to 'src/com/android/browser/TitleBar.java')
-rw-r--r--src/com/android/browser/TitleBar.java25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/com/android/browser/TitleBar.java b/src/com/android/browser/TitleBar.java
index b818dd2..f534a03 100644
--- a/src/com/android/browser/TitleBar.java
+++ b/src/com/android/browser/TitleBar.java
@@ -39,6 +39,7 @@ public class TitleBar extends LinearLayout {
private ImageView mFavicon;
private ImageView mLockIcon;
private boolean mInLoad;
+ private boolean mTitleSet;
public TitleBar(Context context) {
this(context, null);
@@ -112,6 +113,11 @@ public class TitleBar extends LinearLayout {
mRtButton.setVisibility(View.VISIBLE);
mLftButton.setImageDrawable(mBookmarkDrawable);
mInLoad = false;
+ if (!mTitleSet) {
+ mTitle.setText(mUrl.getText());
+ mUrl.setText(null);
+ mTitleSet = true;
+ }
} else {
mCircularProgress.setProgress(newProgress);
mHorizontalProgress.setProgress(newProgress);
@@ -132,13 +138,24 @@ public class TitleBar extends LinearLayout {
}
/* package */ void setTitleAndUrl(CharSequence title, CharSequence url) {
+ if (url != null) {
+ url = BrowserActivity.buildTitleUrl(url.toString());
+ }
if (null == title) {
- mTitle.setText(R.string.title_bar_loading);
+ if (mInLoad) {
+ mTitleSet = false;
+ mTitle.setText(R.string.title_bar_loading);
+ } else {
+ // If the page has no title, put the url in the title space
+ // and leave the url blank.
+ mTitle.setText(url);
+ mUrl.setText(null);
+ mTitleSet = true;
+ return;
+ }
} else {
mTitle.setText(title);
- }
- if (url != null) {
- url = BrowserActivity.buildTitleUrl(url.toString());
+ mTitleSet = true;
}
mUrl.setText(url);
}