Merge changes 23486,23988 into eclair
* changes:
Update the manifest to mark the activity as the default.
enable plugins to launch an activity within the browser
diff --git a/res/drawable/ic_btn_bookmark_browsertab.png b/res/drawable/ic_btn_bookmark_browsertab.png
new file mode 100644
index 0000000..1c52124
--- /dev/null
+++ b/res/drawable/ic_btn_bookmark_browsertab.png
Binary files differ
diff --git a/res/drawable/tab_browser_selected.9.png b/res/drawable/tab_browser_selected.9.png
new file mode 100644
index 0000000..40ad080
--- /dev/null
+++ b/res/drawable/tab_browser_selected.9.png
Binary files differ
diff --git a/res/drawable/tab_browser_unselected.9.png b/res/drawable/tab_browser_unselected.9.png
new file mode 100644
index 0000000..9b5ec0e
--- /dev/null
+++ b/res/drawable/tab_browser_unselected.9.png
Binary files differ
diff --git a/res/layout/title_bar.xml b/res/layout/title_bar.xml
index 7245a9b..be5f51c 100644
--- a/res/layout/title_bar.xml
+++ b/res/layout/title_bar.xml
@@ -16,15 +16,14 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/search_plate"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="12dip"
android:paddingRight="12dip"
android:paddingTop="0dip"
- android:paddingBottom="16dip"
- android:background="@*android:drawable/search_plate_global" >
+ android:paddingBottom="0dip"
+ android:background="@drawable/tab_browser_selected" >
<ProgressBar android:id="@+id/progress_horizontal"
style="?android:attr/progressBarStyleHorizontal"
@@ -34,7 +33,6 @@
/>
<LinearLayout
- android:id="@+id/search_edit_frame"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dip"
@@ -42,8 +40,8 @@
<TextView
android:id="@+id/title"
- android:background="@*android:drawable/textfield_search"
- android:layout_height="40dip"
+ android:background="@*android:drawable/textfield_default"
+ android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1.0"
android:paddingLeft="8dip"
@@ -51,21 +49,20 @@
android:singleLine="true"
android:ellipsize="end"
/>
- <ProgressBar android:id="@+id/progress_circular"
- style="?android:attr/progressBarStyleSmallTitle"
- android:layout_width="40dip"
- android:layout_height="40dip"
+ <ImageView android:id="@+id/lock"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:layout_marginLeft="3dip"
- android:max="100"
+ android:layout_gravity="center_vertical"
+ android:visibility="gone"
/>
<ImageView
android:id="@+id/rt_btn"
- android:layout_width="40dip"
- android:layout_height="40dip"
+ android:layout_width="42dip"
+ android:layout_height="42dip"
android:layout_marginLeft="8dip"
- android:scaleType="fitXY"
android:background="@*android:drawable/btn_search_dialog_voice"
- android:src="@drawable/ic_menu_bookmark"
+ android:src="@drawable/ic_btn_bookmark_browsertab"
/>
</LinearLayout>
</LinearLayout>
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 3706167..3b0745e 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -481,7 +481,11 @@
}
if (urlData.isEmpty()) {
- bookmarksOrHistoryPicker(false, true);
+ if (mSettings.isLoginInitialized()) {
+ webView.loadUrl(mSettings.getHomePage());
+ } else {
+ waitForCredentials();
+ }
} else {
if (extra != null) {
urlData.setPostData(extra
@@ -1250,11 +1254,10 @@
/* package */ void closeCurrentWindow() {
final TabControl.Tab current = mTabControl.getCurrentTab();
if (mTabControl.getTabCount() == 1) {
- // This is the last tab. Open a new one, as well as the history
- // picker, and close the current one.
+ // This is the last tab. Open a new one, with the home
+ // page and close the current one.
TabControl.Tab newTab = openTabAndShow(
- BrowserActivity.EMPTY_URL_DATA, false, null);
- bookmarksOrHistoryPicker(false, true);
+ mSettings.getHomePage(), false, null);
closeTab(current);
mTabControl.setCurrentTab(newTab);
return;
@@ -1298,12 +1301,11 @@
switch (item.getItemId()) {
// -- Main menu
case R.id.new_tab_menu_id:
- openTabAndShow(EMPTY_URL_DATA, false, null);
- bookmarksOrHistoryPicker(false, true);
+ openTabAndShow(mSettings.getHomePage(), false, null);
break;
case R.id.goto_menu_id:
- bookmarksOrHistoryPicker(false, false);
+ bookmarksOrHistoryPicker(false);
break;
case R.id.add_bookmark_menu_id:
@@ -1371,7 +1373,7 @@
break;
case R.id.classic_history_menu_id:
- bookmarksOrHistoryPicker(true, false);
+ bookmarksOrHistoryPicker(true);
break;
case R.id.share_page_menu_id:
@@ -1623,7 +1625,7 @@
}
WebView view = t.getWebView();
- view.addTitleBar(mTitleBar);
+ view.setEmbeddedTitleBar(mTitleBar);
// Attach the sub window if necessary
attachSubWindow(t);
// Request focus on the top window.
@@ -1651,7 +1653,7 @@
}
WebView view = t.getWebView();
- view.addTitleBar(null);
+ view.setEmbeddedTitleBar(null);
// Remove the sub window if it exists.
if (t.getSubWebView() != null) {
@@ -2042,7 +2044,7 @@
return KeyTracker.State.DONE_TRACKING;
}
if (stage == KeyTracker.Stage.LONG_REPEAT) {
- bookmarksOrHistoryPicker(true, false);
+ bookmarksOrHistoryPicker(true);
return KeyTracker.State.DONE_TRACKING;
} else if (stage == KeyTracker.Stage.UP) {
// FIXME: Currently, we do not have a notion of the
@@ -3870,32 +3872,12 @@
getTopWindow().loadUrl(data);
}
}
-/*
- FIXME: Removing this breaks the behavior of pressing BACK from
- the Go page resulting in the window being closed. However, it
- needs to be removed so that the user can use the Search bar to
- enter a URL. Further, the Go behavior is going to change
- drastically, so this behavior may not last anyway.
- } else if (resultCode == RESULT_CANCELED
- && mCancelGoPageMeansClose) {
- if (mTabControl.getTabCount() == 1) {
- // finish the Browser. When the Browser opens up again,
- // we will go through onCreate and once again open up
- // the Go page.
- finish();
- return;
- }
- closeCurrentWindow();
-*/
}
break;
default:
break;
}
- mCancelGoPageMeansClose = false;
- if (getTopWindow() != null) {
- getTopWindow().requestFocus();
- }
+ getTopWindow().requestFocus();
}
/*
@@ -3911,20 +3893,12 @@
}
- // True if canceling the "Go" screen should result in closing the current
- // window/browser.
- private boolean mCancelGoPageMeansClose;
-
/**
* Open the Go page.
* @param startWithHistory If true, open starting on the history tab.
* Otherwise, start with the bookmarks tab.
- * @param cancelGoPageMeansClose Set to true if this came from a new tab, or
- * from the only tab, and canceling means to
- * close the tab (and possibly the browser)
*/
- /* package */ void bookmarksOrHistoryPicker(boolean startWithHistory,
- boolean cancelGoPageMeansClose) {
+ /* package */ void bookmarksOrHistoryPicker(boolean startWithHistory) {
WebView current = mTabControl.getCurrentWebView();
if (current == null) {
return;
@@ -3948,17 +3922,14 @@
}
intent.putExtra("title", title);
intent.putExtra("url", url);
- // If this is opening in a new window, then disable opening in a
- // (different) new window. Also disable it if we have maxed out the
- // windows.
- intent.putExtra("disable_new_window", cancelGoPageMeansClose
- || mTabControl.getTabCount() >= TabControl.MAX_TABS);
+ // Disable opening in a new window if we have maxed out the windows
+ intent.putExtra("disable_new_window", mTabControl.getTabCount()
+ >= TabControl.MAX_TABS);
intent.putExtra("touch_icon_url", current.getTouchIconUrl());
if (startWithHistory) {
intent.putExtra(CombinedBookmarkHistoryActivity.STARTING_TAB,
CombinedBookmarkHistoryActivity.HISTORY_TAB);
}
- mCancelGoPageMeansClose = cancelGoPageMeansClose;
startActivityForResult(intent, COMBO_PAGE);
}
diff --git a/src/com/android/browser/TitleBar.java b/src/com/android/browser/TitleBar.java
index f03e2da..c2e822c 100644
--- a/src/com/android/browser/TitleBar.java
+++ b/src/com/android/browser/TitleBar.java
@@ -18,6 +18,7 @@
import android.content.Context;
import android.graphics.Rect;
+import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
@@ -36,10 +37,10 @@
private TextView mTitle;
private Drawable mCloseDrawable;
private ImageView mRtButton;
- private ProgressBar mCircularProgress;
+ private Drawable mCircularProgress;
private ProgressBar mHorizontalProgress;
private Drawable mFavicon;
- private Drawable mLockIcon;
+ private ImageView mLockIcon;
private Drawable mStopDrawable;
private Drawable mBookmarkDrawable;
private boolean mInLoad;
@@ -55,6 +56,8 @@
mTitle = (TextView) findViewById(R.id.title);
mTitle.setCompoundDrawablePadding(5);
+ mLockIcon = (ImageView) findViewById(R.id.lock);
+
mRtButton = (ImageView) findViewById(R.id.rt_btn);
mRtButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
@@ -63,11 +66,13 @@
mWebView.stopLoading();
}
} else {
- mBrowserActivity.bookmarksOrHistoryPicker(false, false);
+ mBrowserActivity.bookmarksOrHistoryPicker(false);
}
}
});
- mCircularProgress = (ProgressBar) findViewById(R.id.progress_circular);
+ mCircularProgress = (Drawable) context.getResources().getDrawable(
+ com.android.internal.R.drawable.search_spinner);
+ mCircularProgress.setBounds(0,0,20,20);
mHorizontalProgress = (ProgressBar) findViewById(
R.id.progress_horizontal);
mWebView = webview;
@@ -95,7 +100,8 @@
if (d != null) {
d.setBounds(0, 0, 20, 20);
}
- mTitle.setCompoundDrawables(d, null, mLockIcon, null);
+ Drawable progress = mInLoad ? mCircularProgress : null;
+ mTitle.setCompoundDrawables(d, null, progress, null);
mFavicon = d;
}
@@ -103,40 +109,45 @@
* Set the Drawable for the lock icon, or null to hide it.
*/
/* package */ void setLock(Drawable d) {
- if (d != null) {
- d.setBounds(0, 0, 20, 20);
+ if (null == d) {
+ mLockIcon.setVisibility(View.GONE);
+ } else {
+ mLockIcon.setImageDrawable(d);
+ mLockIcon.setVisibility(View.VISIBLE);
}
- mTitle.setCompoundDrawables(mFavicon, null, d, null);
- mLockIcon = d;
}
/**
* Update the progress, from 0 to 100.
*/
/* package */ void setProgress(int newProgress) {
- if (newProgress == mCircularProgress.getMax()) {
- mCircularProgress.setVisibility(View.GONE);
- mHorizontalProgress.setVisibility(View.GONE);
+ if (newProgress == mHorizontalProgress.getMax()) {
+ mTitle.setCompoundDrawables(mFavicon, null, null, null);
+ ((Animatable) mCircularProgress).stop();
+ mHorizontalProgress.setVisibility(View.INVISIBLE);
if (mBookmarkDrawable != null) {
mRtButton.setImageDrawable(mBookmarkDrawable);
}
mInLoad = false;
} else {
- mCircularProgress.setProgress(newProgress);
mHorizontalProgress.setProgress(newProgress);
- mCircularProgress.setVisibility(View.VISIBLE);
- mHorizontalProgress.setVisibility(View.VISIBLE);
- if (mBookmarkDrawable == null) {
- mBookmarkDrawable = mRtButton.getDrawable();
+ if (!mInLoad) {
+ mTitle.setCompoundDrawables(mFavicon, null, mCircularProgress,
+ null);
+ ((Animatable) mCircularProgress).start();
+ mHorizontalProgress.setVisibility(View.VISIBLE);
+ if (mBookmarkDrawable == null) {
+ mBookmarkDrawable = mRtButton.getDrawable();
+ }
+ if (mStopDrawable == null) {
+ mRtButton.setImageResource(
+ com.android.internal.R.drawable.ic_menu_stop);
+ mStopDrawable = mRtButton.getDrawable();
+ } else {
+ mRtButton.setImageDrawable(mStopDrawable);
+ }
+ mInLoad = true;
}
- if (mStopDrawable == null) {
- mRtButton.setImageResource(
- com.android.internal.R.drawable.ic_menu_stop);
- mStopDrawable = mRtButton.getDrawable();
- } else {
- mRtButton.setImageDrawable(mStopDrawable);
- }
- mInLoad = true;
}
}
@@ -155,7 +166,6 @@
mTitle.setText(R.string.tab_picker_title);
setFavicon(null);
setLock(null);
- mCircularProgress.setVisibility(View.GONE);
mHorizontalProgress.setVisibility(View.GONE);
}
}
diff --git a/src/com/android/browser/TitleBarSet.java b/src/com/android/browser/TitleBarSet.java
index 873f40b..c71cfa7 100644
--- a/src/com/android/browser/TitleBarSet.java
+++ b/src/com/android/browser/TitleBarSet.java
@@ -58,6 +58,8 @@
setCallbackOnUnselectedItemClick(true);
setSpacing(0);
setOnItemSelectedListener(this);
+ setBackgroundResource(R.drawable.tab_browser_unselected);
+ setPadding(0,0,0,0);
}
/**