summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/layout/title_bar_nav.xml16
-rw-r--r--src/com/android/browser/BrowserSettings.java5
-rw-r--r--src/com/android/browser/NavigationBarPhone.java13
-rw-r--r--src/com/android/browser/UrlInputView.java20
4 files changed, 49 insertions, 5 deletions
diff --git a/res/layout/title_bar_nav.xml b/res/layout/title_bar_nav.xml
index eeba9d7..8ed6331 100644
--- a/res/layout/title_bar_nav.xml
+++ b/res/layout/title_bar_nav.xml
@@ -26,6 +26,14 @@
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
+ android:id="@+id/magnify"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingLeft="8dip"
+ android:paddingRight="8dip"
+ android:visibility="gone"
+ android:src="@drawable/ic_search_category_suggest" />
+ <ImageView
android:id="@+id/incognito_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -83,6 +91,14 @@
android:src="@drawable/ic_voice_search_holo_dark"
style="@style/HoloButton"
android:visibility="gone" />
+ <ImageView
+ android:id="@+id/clear"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:contentDescription="@string/accessibility_button_clear"
+ android:src="@drawable/ic_close_window_holo_dark"
+ style="@style/HoloButton"
+ android:visibility="gone" />
</LinearLayout>
<ImageButton
android:id="@+id/tab_switcher"
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index 09c7200..11316ff 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -128,7 +128,6 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
mAutofillHandler = new AutofillHandler(mContext);
mManagedSettings = new LinkedList<WeakReference<WebSettings>>();
mCustomUserAgents = new WeakHashMap<WebSettings, String>();
- mPrefs.registerOnSharedPreferenceChangeListener(this);
mAutofillHandler.asyncLoadFromDb();
BackgroundHandler.execute(mSetup);
}
@@ -168,6 +167,10 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
mWebStorageSizeManager = new WebStorageSizeManager(mContext,
new WebStorageSizeManager.StatFsDiskInfo(getAppCachePath()),
new WebStorageSizeManager.WebKitAppCacheInfo(getAppCachePath()));
+ // Workaround b/5253777
+ CookieManager.getInstance().acceptCookie();
+ // Workaround b/5254577
+ mPrefs.registerOnSharedPreferenceChangeListener(BrowserSettings.this);
if (Build.VERSION.CODENAME.equals("REL")) {
// This is a release build, always startup with debug disabled
setDebugEnabled(false);
diff --git a/src/com/android/browser/NavigationBarPhone.java b/src/com/android/browser/NavigationBarPhone.java
index fee9604..7e8695b 100644
--- a/src/com/android/browser/NavigationBarPhone.java
+++ b/src/com/android/browser/NavigationBarPhone.java
@@ -36,6 +36,8 @@ public class NavigationBarPhone extends NavigationBarBase implements
private ImageView mStopButton;
private ImageView mVoiceButton;
+ private ImageView mMagnify;
+ private ImageView mClearButton;
private Drawable mStopDrawable;
private Drawable mRefreshDrawable;
private String mStopDescription;
@@ -69,6 +71,9 @@ public class NavigationBarPhone extends NavigationBarBase implements
mStopButton.setOnClickListener(this);
mVoiceButton = (ImageView) findViewById(R.id.voice);
mVoiceButton.setOnClickListener(this);
+ mClearButton = (ImageView) findViewById(R.id.clear);
+ mClearButton.setOnClickListener(this);
+ mMagnify = (ImageView) findViewById(R.id.magnify);
mTabSwitcher = findViewById(R.id.tab_switcher);
mTabSwitcher.setOnClickListener(this);
mMore = findViewById(R.id.more);
@@ -156,6 +161,8 @@ public class NavigationBarPhone extends NavigationBarBase implements
((PhoneUi) mBaseUi).toggleNavScreen();
} else if (mMore == v) {
showMenu(mMore);
+ } else if (mClearButton == v) {
+ mUrlInput.setText("");
} else {
super.onClick(v);
}
@@ -209,6 +216,8 @@ public class NavigationBarPhone extends NavigationBarBase implements
case StateListener.STATE_NORMAL:
mComboIcon.setVisibility(View.VISIBLE);
mStopButton.setVisibility(View.GONE);
+ mClearButton.setVisibility(View.GONE);
+ mMagnify.setVisibility(View.GONE);
setSearchMode(mInVoiceMode);
mTabSwitcher.setVisibility(View.VISIBLE);
mTitleContainer.setBackgroundDrawable(null);
@@ -217,6 +226,8 @@ public class NavigationBarPhone extends NavigationBarBase implements
case StateListener.STATE_HIGHLIGHTED:
mComboIcon.setVisibility(View.GONE);
mStopButton.setVisibility(View.VISIBLE);
+ mClearButton.setVisibility(View.GONE);
+ mMagnify.setVisibility(View.GONE);
setSearchMode(true);
mTabSwitcher.setVisibility(View.GONE);
mMore.setVisibility(View.GONE);
@@ -225,6 +236,8 @@ public class NavigationBarPhone extends NavigationBarBase implements
case StateListener.STATE_EDITED:
mComboIcon.setVisibility(View.GONE);
mStopButton.setVisibility(View.GONE);
+ mClearButton.setVisibility(View.VISIBLE);
+ mMagnify.setVisibility(View.VISIBLE);
setSearchMode(false);
mTabSwitcher.setVisibility(View.GONE);
mMore.setVisibility(View.GONE);
diff --git a/src/com/android/browser/UrlInputView.java b/src/com/android/browser/UrlInputView.java
index 2acc69b..fbdf400 100644
--- a/src/com/android/browser/UrlInputView.java
+++ b/src/com/android/browser/UrlInputView.java
@@ -56,6 +56,8 @@ public class UrlInputView extends SuggestiveAutoCompleteTextView
static final String SUGGESTED = "browser-suggest";
static final String VOICE = "voice-search";
+ static final int POST_DELAY = 100;
+
static interface StateListener {
static final int STATE_NORMAL = 0;
static final int STATE_HIGHLIGHTED = 1;
@@ -123,16 +125,23 @@ public class UrlInputView extends SuggestiveAutoCompleteTextView
protected void onFocusChanged(boolean focused, int direction, Rect prevRect) {
super.onFocusChanged(focused, direction, prevRect);
+ int state = -1;
if (focused) {
if (hasSelection()) {
- changeState(StateListener.STATE_HIGHLIGHTED);
+ state = StateListener.STATE_HIGHLIGHTED;
} else {
- changeState(StateListener.STATE_EDITED);
+ state = StateListener.STATE_EDITED;
}
} else {
// reset the selection state
- changeState(StateListener.STATE_NORMAL);
+ state = StateListener.STATE_NORMAL;
}
+ final int s = state;
+ post(new Runnable() {
+ public void run() {
+ changeState(s);
+ }
+ });
}
@Override
@@ -141,7 +150,10 @@ public class UrlInputView extends SuggestiveAutoCompleteTextView
boolean res = super.onTouchEvent(evt);
if ((MotionEvent.ACTION_DOWN == evt.getActionMasked())
&& hasSelection) {
- changeState(StateListener.STATE_EDITED);
+ postDelayed(new Runnable() {
+ public void run() {
+ changeState(StateListener.STATE_EDITED);
+ }}, POST_DELAY);
}
return res;
}