Merge change 23812 into eclair
* changes:
Show the full url in the title bar.
diff --git a/res/layout/custom_screen.xml b/res/layout/custom_screen.xml
index f654a84..d1f1658 100644
--- a/res/layout/custom_screen.xml
+++ b/res/layout/custom_screen.xml
@@ -24,11 +24,6 @@
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
- <com.android.browser.TitleBarSet android:id="@+id/title_bar"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/tab_unselected"
- />
<LinearLayout android:id="@+id/error_console"
android:layout_width="fill_parent"
diff --git a/src/com/android/browser/AddBookmarkPage.java b/src/com/android/browser/AddBookmarkPage.java
index 87638d8..2575857 100644
--- a/src/com/android/browser/AddBookmarkPage.java
+++ b/src/com/android/browser/AddBookmarkPage.java
@@ -124,7 +124,7 @@
}
String url = unfilteredUrl;
if (!(url.startsWith("about:") || url.startsWith("data:") || url
- .startsWith("file:"))) {
+ .startsWith("file:") || url.startsWith("content:"))) {
WebAddress address;
try {
address = new WebAddress(unfilteredUrl);
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 5a27554..3706167 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -336,7 +336,6 @@
// holds everything else.
FrameLayout browserFrameLayout = (FrameLayout) LayoutInflater.from(this)
.inflate(R.layout.custom_screen, null);
- mTitleBar = (TitleBarSet) browserFrameLayout.findViewById(R.id.title_bar);
mContentView = (FrameLayout) browserFrameLayout.findViewById(
R.id.main_content);
mErrorConsoleContainer = (LinearLayout) browserFrameLayout.findViewById(
@@ -344,6 +343,7 @@
mCustomViewContainer = (FrameLayout) browserFrameLayout
.findViewById(R.id.fullscreen_custom_content);
frameLayout.addView(browserFrameLayout, COVER_SCREEN_PARAMS);
+ mTitleBar = new TitleBarSet(this);
} else {
mCustomViewContainer = new FrameLayout(this);
mCustomViewContainer.setBackgroundColor(Color.BLACK);
@@ -1243,8 +1243,6 @@
attachTabToContentView(tab);
if (CUSTOM_BROWSER_BAR) {
mTitleBar.setCurrentTab(index);
- WebView view = tab.getWebView();
- view.slideIntoFocus();
}
return true;
}
@@ -1624,6 +1622,8 @@
ViewGroup.LayoutParams.WRAP_CONTENT));
}
+ WebView view = t.getWebView();
+ view.addTitleBar(mTitleBar);
// Attach the sub window if necessary
attachSubWindow(t);
// Request focus on the top window.
@@ -1650,6 +1650,9 @@
mErrorConsoleContainer.removeView(mTabControl.getCurrentErrorConsole(false));
}
+ WebView view = t.getWebView();
+ view.addTitleBar(null);
+
// Remove the sub window if it exists.
if (t.getSubWebView() != null) {
mContentView.removeView(t.getSubWebViewContainer());
@@ -1985,6 +1988,10 @@
closeTab(current);
} else {
if (current.closeOnExit()) {
+ // force mPageStarted to be false as we are going to either
+ // finish the activity or remove the tab. This will ensure
+ // pauseWebView() taking action.
+ mPageStarted = false;
if (mTabControl.getTabCount() == 1) {
finish();
return;
@@ -2314,9 +2321,6 @@
CookieSyncManager.getInstance().resetSync();
mInLoad = true;
- if (CUSTOM_BROWSER_BAR) {
- mTitleBar.setVisibility(View.VISIBLE);
- }
updateInLoadMenuItems();
if (!mIsNetworkUp) {
if ( mAlertDialog == null) {
@@ -2873,27 +2877,6 @@
}
@Override
- public void onChangeViewingMode(WebView view, int newViewingMode) {
- if (!CUSTOM_BROWSER_BAR || view != getTopWindow()) {
- return;
- }
- switch (newViewingMode) {
- case WebView.NO_VIEWING_MODE:
- break;
- case WebView.OVERVIEW_MODE:
- case WebView.READING_MODE_WITH_TITLE_BAR:
- case WebView.TITLE_BAR_DISMISS_MODE:
- mTitleBar.setVisibility(View.VISIBLE);
- break;
- case WebView.READING_MODE:
- mTitleBar.setVisibility(View.GONE);
- break;
- default:
- break;
- }
- }
-
- @Override
public boolean onCreateWindow(WebView view, final boolean dialog,
final boolean userGesture, final Message resultMsg) {
// Short-circuit if we can't create any more tabs or sub windows.
diff --git a/src/com/android/browser/TitleBarSet.java b/src/com/android/browser/TitleBarSet.java
index 4bd3fd8..873f40b 100644
--- a/src/com/android/browser/TitleBarSet.java
+++ b/src/com/android/browser/TitleBarSet.java
@@ -181,10 +181,12 @@
* Remove the tab at the given position.
*/
/* package */ void removeTab(int position) {
+ int selection = getSelectedItemPosition();
mTitleBars.remove(position);
mCount--;
// Need to refresh our list
setAdapter(mTitleAdapter);
+ setCurrentTab(selection);
}
/**
@@ -206,6 +208,7 @@
* Change to the tab at the new position.
*/
/* package */ void setCurrentTab(int position) {
+ if (position < 0 || position >= mCount) return;
mIgnoreSelectedListener = true;
setSelection(position);
mIgnoreSelectedListener = false;