summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/drawable-mdpi/ic_add_string.pngbin0 -> 1005 bytes
-rw-r--r--res/drawable-mdpi/ic_favorite_on_dark.pngbin0 -> 933 bytes
-rw-r--r--res/drawable-mdpi/ic_go_dark.pngbin0 -> 416 bytes
-rw-r--r--res/drawable-mdpi/ic_menu_cab_close.pngbin0 -> 1296 bytes
-rw-r--r--res/drawable-mdpi/ic_menu_cab_pencil.pngbin0 -> 1976 bytes
-rw-r--r--res/drawable-mdpi/ic_menu_overflow.pngbin0 -> 995 bytes
-rw-r--r--res/drawable-mdpi/ic_pressed.pngbin1446 -> 1888 bytes
-rw-r--r--res/drawable-mdpi/ic_search_category_browser.png (renamed from res/drawable-mdpi/ic_search_catgeory_browser.png)bin820 -> 820 bytes
-rw-r--r--[-rwxr-xr-x]res/drawable-mdpi/ic_search_category_suggest.pngbin997 -> 607 bytes
-rw-r--r--res/drawable-mdpi/menu_dropdown.9.pngbin0 -> 559 bytes
-rw-r--r--res/drawable-mdpi/tab_selected_bg.9.pngbin765 -> 630 bytes
-rw-r--r--res/drawable-mdpi/text_field_results.9.pngbin558 -> 1225 bytes
-rw-r--r--res/drawable-mdpi/urlbar_bg.9.pngbin1228 -> 1642 bytes
-rw-r--r--res/layout/url_bar.xml50
-rw-r--r--res/layout/url_dropdown_item.xml (renamed from res/layout/simple_dropdown_item_2line.xml)20
-rw-r--r--res/values-xlarge/styles.xml16
-rw-r--r--src/com/android/browser/TitleBarXLarge.java73
-rw-r--r--src/com/android/browser/UrlInputView.java55
18 files changed, 151 insertions, 63 deletions
diff --git a/res/drawable-mdpi/ic_add_string.png b/res/drawable-mdpi/ic_add_string.png
new file mode 100644
index 0000000..e3b95cb
--- /dev/null
+++ b/res/drawable-mdpi/ic_add_string.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_favorite_on_dark.png b/res/drawable-mdpi/ic_favorite_on_dark.png
new file mode 100644
index 0000000..50563c1
--- /dev/null
+++ b/res/drawable-mdpi/ic_favorite_on_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_go_dark.png b/res/drawable-mdpi/ic_go_dark.png
new file mode 100644
index 0000000..88c0985
--- /dev/null
+++ b/res/drawable-mdpi/ic_go_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_cab_close.png b/res/drawable-mdpi/ic_menu_cab_close.png
new file mode 100644
index 0000000..3451027
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_cab_close.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_cab_pencil.png b/res/drawable-mdpi/ic_menu_cab_pencil.png
new file mode 100644
index 0000000..5d6ab57
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_cab_pencil.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_overflow.png b/res/drawable-mdpi/ic_menu_overflow.png
new file mode 100644
index 0000000..e565760
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_overflow.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_pressed.png b/res/drawable-mdpi/ic_pressed.png
index dccdc83..fd1c7d9 100644
--- a/res/drawable-mdpi/ic_pressed.png
+++ b/res/drawable-mdpi/ic_pressed.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_search_catgeory_browser.png b/res/drawable-mdpi/ic_search_category_browser.png
index d721425..d721425 100644
--- a/res/drawable-mdpi/ic_search_catgeory_browser.png
+++ b/res/drawable-mdpi/ic_search_category_browser.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_search_category_suggest.png b/res/drawable-mdpi/ic_search_category_suggest.png
index a4ed7aa..0216581 100755..100644
--- a/res/drawable-mdpi/ic_search_category_suggest.png
+++ b/res/drawable-mdpi/ic_search_category_suggest.png
Binary files differ
diff --git a/res/drawable-mdpi/menu_dropdown.9.png b/res/drawable-mdpi/menu_dropdown.9.png
new file mode 100644
index 0000000..562d55b
--- /dev/null
+++ b/res/drawable-mdpi/menu_dropdown.9.png
Binary files differ
diff --git a/res/drawable-mdpi/tab_selected_bg.9.png b/res/drawable-mdpi/tab_selected_bg.9.png
index 2004313..261982e 100644
--- a/res/drawable-mdpi/tab_selected_bg.9.png
+++ b/res/drawable-mdpi/tab_selected_bg.9.png
Binary files differ
diff --git a/res/drawable-mdpi/text_field_results.9.png b/res/drawable-mdpi/text_field_results.9.png
index 5d08fe9..167c42d 100644
--- a/res/drawable-mdpi/text_field_results.9.png
+++ b/res/drawable-mdpi/text_field_results.9.png
Binary files differ
diff --git a/res/drawable-mdpi/urlbar_bg.9.png b/res/drawable-mdpi/urlbar_bg.9.png
index eccf41b..18b49e7 100644
--- a/res/drawable-mdpi/urlbar_bg.9.png
+++ b/res/drawable-mdpi/urlbar_bg.9.png
Binary files differ
diff --git a/res/layout/url_bar.xml b/res/layout/url_bar.xml
index 29a6462..b803881 100644
--- a/res/layout/url_bar.xml
+++ b/res/layout/url_bar.xml
@@ -54,10 +54,11 @@
android:background="@drawable/browserbarbutton"
android:src="@drawable/ic_bookmarks_history_normal" />
<LinearLayout
- android:id="@+id/urlbar"
+ android:id="@+id/urlbar_unfocused"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1.0"
+ android:background="@null"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/star"
@@ -72,15 +73,14 @@
android:layout_height="wrap_content"
style="@style/HoloIcon"
android:visibility="gone" />
- <com.android.browser.UrlInputView
- android:id="@+id/editurl"
+ <EditText
+ android:id="@+id/url_unfocused"
android:layout_width="0dip"
android:layout_weight="1.0"
android:layout_height="match_parent"
android:background="@null"
- android:paddingLeft="16dip"
- android:paddingRight="16dip"
android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="#ffc0c0c0"
android:hint="@string/search_hint"
android:gravity="center_vertical"
android:singleLine="true"
@@ -98,6 +98,46 @@
style="@style/HoloButton"
android:background="@drawable/browserbarbutton" />
</LinearLayout>
+ <LinearLayout
+ android:id="@+id/urlbar_focused"
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_weight="1.0"
+ android:orientation="horizontal"
+ android:background="@drawable/text_field_results"
+ android:visibility="gone"
+ >
+ <ImageView
+ android:id="@+id/searchicon"
+ android:src="@drawable/ic_search_category_suggest"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ style="@style/HoloButton" />
+ <com.android.browser.UrlInputView
+ android:id="@+id/url_focused"
+ android:layout_width="0dip"
+ android:layout_weight="1.0"
+ android:layout_height="match_parent"
+ android:background="@null"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="@color/black"
+ android:hint="@string/search_hint"
+ android:gravity="center_vertical"
+ android:singleLine="true"
+ android:ellipsize="end"
+ android:lines="1"
+ android:scrollHorizontally="true"
+ android:inputType="textUri"
+ android:imeOptions="actionGo" />
+ <ImageButton
+ android:id="@+id/go"
+ android:src="@drawable/ic_go_dark"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:gravity="center_vertical"
+ style="@style/HoloButton"
+ android:background="@drawable/browserbarbutton" />
+ </LinearLayout>
</LinearLayout>
<com.android.browser.PageProgressView
android:id="@+id/progress"
diff --git a/res/layout/simple_dropdown_item_2line.xml b/res/layout/url_dropdown_item.xml
index 8b955ec..5e8f84c 100644
--- a/res/layout/simple_dropdown_item_2line.xml
+++ b/res/layout/url_dropdown_item.xml
@@ -2,7 +2,7 @@
<!--
/* //device/apps/common/assets/res/any/layout/simple_spinner_item.xml
**
-** Copyright 2008, The Android Open Source Project
+** Copyright 2010, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -21,7 +21,7 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="?android:attr/listPreferredItemHeight"
+ android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:baselineAligned="false">
@@ -30,11 +30,10 @@
android:layout_height="wrap_content"
android:id="@+id/icon1"
android:scaleType="center"
- android:paddingLeft="2dip"
- android:paddingRight="2dip" />
+ style="@style/HoloButton" />
<TwoLineListItem
- android:paddingTop="2dip"
- android:paddingBottom="2dip"
+ android:paddingTop="16dip"
+ android:paddingBottom="16dip"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
@@ -57,4 +56,13 @@
android:layout_below="@android:id/text1"
android:layout_alignLeft="@android:id/text1" />
</TwoLineListItem>
+ <ImageButton
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/icon2"
+ android:scaleType="center"
+ style="@style/HoloButton"
+ android:src="@drawable/ic_add_string"
+ android:background="@drawable/browserbarbutton"
+ />
</LinearLayout>
diff --git a/res/values-xlarge/styles.xml b/res/values-xlarge/styles.xml
index d48a502..0f17da3 100644
--- a/res/values-xlarge/styles.xml
+++ b/res/values-xlarge/styles.xml
@@ -26,6 +26,10 @@
<item name="android:actionBarStyle">@style/ActionBarStyle</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:actionModeBackground">@drawable/cab_bg</item>
+ <item name="android:actionModeCloseDrawable">@drawable/ic_menu_cab_close</item>
+ <item name="android:actionButtonStyle">@style/ActionButton</item>
+ <item name="android:actionDropDownStyle">@style/ActionDropdown</item>
+ <item name="android:actionOverflowButtonStyle">@style/Overflow</item>
</style>
<style name="Dialog.Holo" parent="android:Theme.Holo">
<item name="android:windowFrame">@null</item>
@@ -47,6 +51,18 @@
<item name="android:padding">0dip</item>
<item name="android:displayOptions">hideHome</item>
</style>
+ <style name="ActionButton">
+ <item name="android:height">12dip</item>
+ <item name="android:background">@drawable/browserbarbutton</item>
+ </style>
+ <style name="ActionDropdown">
+ <item name="android:background">@drawable/menu_dropdown</item>
+ </style>
+ <style name="Overflow">
+ <item name="android:src">@drawable/ic_menu_overflow</item>
+ <item name="android:paddingLeft">16dip</item>
+ <item name="android:paddingRight">16dip</item>
+ </style>
<style name="TitleBar">
<item name="android:windowEnterAnimation">@anim/title_bar_enter</item>
<item name="android:windowExitAnimation">@anim/title_bar_exit</item>
diff --git a/src/com/android/browser/TitleBarXLarge.java b/src/com/android/browser/TitleBarXLarge.java
index e305c07..3408108 100644
--- a/src/com/android/browser/TitleBarXLarge.java
+++ b/src/com/android/browser/TitleBarXLarge.java
@@ -18,17 +18,13 @@ package com.android.browser;
import com.android.browser.UrlInputView.UrlInputListener;
-import android.app.AlertDialog;
import android.app.SearchManager;
import android.content.Context;
-import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
-import android.graphics.Color;
import android.graphics.drawable.Drawable;
-import android.os.Bundle;
-import android.os.Message;
+import android.util.Log;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.MenuInflater;
@@ -36,6 +32,7 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.widget.ImageView;
+import android.widget.TextView;
/**
* tabbed title bar for xlarge screen browser
@@ -48,8 +45,6 @@ public class TitleBarXLarge extends TitleBarBase
private BrowserActivity mBrowserActivity;
private Drawable mStopDrawable;
private Drawable mReloadDrawable;
- private Drawable mFocusDrawable;
- private Drawable mUnFocusDrawable;
private View mContainer;
@@ -57,11 +52,14 @@ public class TitleBarXLarge extends TitleBarBase
private View mForwardButton;
private View mStar;
private View mSearchButton;
- private View mInputContainer;
+ private View mFocusContainer;
+ private View mUnfocusContainer;
+ private View mGoButton;
private ImageView mStopButton;
private View mAllButton;
private PageProgressView mProgressView;
- private UrlInputView mUrlView;
+ private UrlInputView mUrlFocused;
+ private TextView mUrlUnfocused;
private boolean mInLoad;
public TitleBarXLarge(BrowserActivity context) {
@@ -70,8 +68,6 @@ public class TitleBarXLarge extends TitleBarBase
Resources resources = context.getResources();
mStopDrawable = resources.getDrawable(R.drawable.ic_stop_normal);
mReloadDrawable = resources.getDrawable(R.drawable.ic_refresh_normal);
- mFocusDrawable = resources.getDrawable(R.drawable.text_field_results);
- mUnFocusDrawable = resources.getDrawable(R.drawable.text_field);
rebuildLayout(context, true);
}
@@ -80,7 +76,8 @@ public class TitleBarXLarge extends TitleBarBase
factory.inflate(R.layout.url_bar, this);
mContainer = findViewById(R.id.taburlbar);
- mUrlView = (UrlInputView) findViewById(R.id.editurl);
+ mUrlFocused = (UrlInputView) findViewById(R.id.url_focused);
+ mUrlUnfocused = (TextView) findViewById(R.id.url_unfocused);
mAllButton = findViewById(R.id.all_btn);
// TODO: Change enabled states based on whether you can go
// back/forward. Probably should be done inside onPageStarted.
@@ -90,8 +87,10 @@ public class TitleBarXLarge extends TitleBarBase
mStopButton = (ImageView) findViewById(R.id.stop);
mSearchButton = findViewById(R.id.search);
mLockIcon = (ImageView) findViewById(R.id.lock);
+ mGoButton = findViewById(R.id.go);
mProgressView = (PageProgressView) findViewById(R.id.progress);
- mInputContainer = findViewById(R.id.urlbar);
+ mFocusContainer = findViewById(R.id.urlbar_focused);
+ mUnfocusContainer = findViewById(R.id.urlbar_unfocused);
mBackButton.setOnClickListener(this);
mForwardButton.setOnClickListener(this);
@@ -99,16 +98,19 @@ public class TitleBarXLarge extends TitleBarBase
mAllButton.setOnClickListener(this);
mStopButton.setOnClickListener(this);
mSearchButton.setOnClickListener(this);
- mUrlView.setUrlInputListener(this);
- mUrlView.setOnFocusChangeListener(this);
- mInputContainer.setBackgroundDrawable(mUnFocusDrawable);
- mUrlView.setTextColor(Color.GRAY);
-
+ mGoButton.setOnClickListener(this);
+ mUrlFocused.setUrlInputListener(this);
+ mUrlUnfocused.setOnFocusChangeListener(this);
}
public void onFocusChange(View v, boolean hasFocus) {
- mInputContainer.setBackgroundDrawable(hasFocus ? mFocusDrawable : mUnFocusDrawable);
- mUrlView.setTextColor(hasFocus ? Color.BLACK : Color.GRAY);
+ if (hasFocus) {
+ swapUrlContainer(true);
+ mUrlFocused.selectAll();
+ mUrlFocused.requestFocus();
+ mUrlFocused.setDropDownWidth(mUnfocusContainer.getWidth());
+ mUrlFocused.setDropDownHorizontalOffset(-mUrlFocused.getLeft());
+ }
}
@Override
@@ -125,6 +127,8 @@ public class TitleBarXLarge extends TitleBarBase
search();
} else if (mStopButton == v) {
stopOrRefresh();
+ } else if (mGoButton == v) {
+ onAction(mUrlFocused.getText().toString());
}
}
@@ -132,10 +136,6 @@ public class TitleBarXLarge extends TitleBarBase
return mContainer.getHeight();
}
- void requestUrlInputFocus() {
- mUrlView.requestFocus();
- }
-
@Override
void setFavicon(Bitmap icon) { }
@@ -149,13 +149,29 @@ public class TitleBarXLarge extends TitleBarBase
i.setAction(Intent.ACTION_SEARCH);
i.putExtra(SearchManager.QUERY, text);
mBrowserActivity.onNewIntent(i);
+ swapUrlContainer(false);
+ setDisplayTitle(text);
}
@Override
public void onDismiss() {
mBrowserActivity.getTabControl().getCurrentTopWebView().requestFocus();
mBrowserActivity.hideFakeTitleBar();
- mUrlView.setText(mBrowserActivity.getTabControl().getCurrentWebView().getUrl());
+ setDisplayTitle(mBrowserActivity.getTabControl().getCurrentWebView().getUrl());
+ swapUrlContainer(false);
+ }
+
+ @Override
+ public void onEdit(String text) {
+ setDisplayTitle(text);
+ if (text != null) {
+ mUrlFocused.setSelection(text.length());
+ }
+ }
+
+ private void swapUrlContainer(boolean focus) {
+ mUnfocusContainer.setVisibility(focus ? View.GONE : View.VISIBLE);
+ mFocusContainer.setVisibility(focus ? View.VISIBLE : View.GONE);
}
@Override
@@ -166,8 +182,8 @@ public class TitleBarXLarge extends TitleBarBase
}
private void search() {
- mUrlView.setText("");
- mUrlView.requestFocus();
+ setDisplayTitle("");
+ mUrlUnfocused.requestFocus();
}
private void stopOrRefresh() {
@@ -199,7 +215,8 @@ public class TitleBarXLarge extends TitleBarBase
@Override
/* package */ void setDisplayTitle(String title) {
- mUrlView.setText(title);
+ mUrlFocused.setText(title);
+ mUrlUnfocused.setText(title);
}
}
diff --git a/src/com/android/browser/UrlInputView.java b/src/com/android/browser/UrlInputView.java
index 9ae464b..96a5980 100644
--- a/src/com/android/browser/UrlInputView.java
+++ b/src/com/android/browser/UrlInputView.java
@@ -20,21 +20,26 @@ import android.app.SearchManager;
import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
+import android.graphics.Color;
import android.graphics.drawable.Drawable;
+import android.text.Editable;
+import android.text.SpannableStringBuilder;
+import android.text.TextWatcher;
+import android.text.style.BackgroundColorSpan;
import android.util.AttributeSet;
import android.util.Log;
+import android.view.ActionMode;
import android.view.KeyEvent;
import android.view.LayoutInflater;
-import android.view.MotionEvent;
import android.view.View;
+import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
import android.widget.AutoCompleteTextView;
import android.widget.CursorAdapter;
import android.widget.Filterable;
+import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
@@ -44,7 +49,7 @@ import android.widget.TextView.OnEditorActionListener;
* handling suggestions
*/
public class UrlInputView extends AutoCompleteTextView
- implements OnFocusChangeListener, OnItemClickListener, OnEditorActionListener {
+ implements OnFocusChangeListener, OnClickListener, OnEditorActionListener {
private UrlInputListener mListener;
private InputMethodManager mInputManager;
@@ -75,9 +80,13 @@ public class UrlInputView extends AutoCompleteTextView
mAdapter = new SuggestionsAdapter(mContext,
BrowserProvider.getBookmarksSuggestions(cr, null));
setAdapter(mAdapter);
- setOnItemClickListener(this);
setSelectAllOnFocus(false);
-
+ }
+
+ @Override
+ public ActionMode startActionMode(ActionMode.Callback callback) {
+ // suppress selection action mode
+ return null;
}
@Override
@@ -92,19 +101,6 @@ public class UrlInputView extends AutoCompleteTextView
}
@Override
- public boolean onTouchEvent(MotionEvent evt) {
-
- if ((evt.getAction() == MotionEvent.ACTION_DOWN) && !this.hasFocus()) {
- Log.i("test","onTouch");
- selectAll();
- requestFocus();
- return true;
- } else {
- return super.onTouchEvent(evt);
- }
- }
-
- @Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
forceIme();
@@ -117,12 +113,18 @@ public class UrlInputView extends AutoCompleteTextView
}
@Override
- public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
- String url = mAdapter.getViewString(view);
- finishInput(url);
+ public void onClick(View view) {
+ if (view instanceof ImageButton) {
+ // user pressed edit search button
+ String text = mAdapter.getViewString((View)view.getParent());
+ mListener.onEdit(text);
+ } else {
+ // user selected dropdown item
+ String url = mAdapter.getViewString(view);
+ finishInput(url);
+ }
}
-
public void setUrlInputListener(UrlInputListener listener) {
mListener = listener;
}
@@ -155,6 +157,7 @@ public class UrlInputView extends AutoCompleteTextView
interface UrlInputListener {
public void onDismiss();
public void onAction(String text);
+ public void onEdit(String text);
}
/**
@@ -190,7 +193,7 @@ public class UrlInputView extends AutoCompleteTextView
public View newView(Context context, Cursor cursor, ViewGroup parent) {
final LayoutInflater inflater = LayoutInflater.from(context);
final View view = inflater.inflate(
- R.layout.simple_dropdown_item_2line, parent, false);
+ R.layout.url_dropdown_item, parent, false);
bindView(view, context, cursor);
return view;
}
@@ -200,16 +203,20 @@ public class UrlInputView extends AutoCompleteTextView
TextView tv1 = (TextView) view.findViewById(android.R.id.text1);
TextView tv2 = (TextView) view.findViewById(android.R.id.text2);
ImageView ic1 = (ImageView) view.findViewById(R.id.icon1);
+ View ic2 = view.findViewById(R.id.icon2);
tv1.setText(cursor.getString(mIndexText1));
String url = cursor.getString(mIndexText2);
tv2.setText((url != null) ? url : "");
+ ic2.setOnClickListener(UrlInputView.this);
// assume an id
try {
int id = Integer.parseInt(cursor.getString(mIndexIcon));
Drawable d = context.getResources().getDrawable(id);
ic1.setImageDrawable(d);
+ ic2.setVisibility((id == R.drawable.ic_search_category_suggest)? View.VISIBLE : View.GONE);
} catch (NumberFormatException nfx) {
}
+ view.setOnClickListener(UrlInputView.this);
}
@Override