diff options
author | Michael Kolb <kolby@google.com> | 2010-09-03 10:10:58 -0700 |
---|---|---|
committer | Michael Kolb <kolby@google.com> | 2010-09-08 19:38:24 -0700 |
commit | c7485ae06c6d5d33c57a03d02bbeed54edb3c66f (patch) | |
tree | a88714dea017db9bc4ad749358dc63352a2d31bb /src/com/android/browser/UrlInputView.java | |
parent | 47654f464e2ecd65fb049817201fb00a9f8fe29c (diff) | |
download | packages_apps_Browser-c7485ae06c6d5d33c57a03d02bbeed54edb3c66f.zip packages_apps_Browser-c7485ae06c6d5d33c57a03d02bbeed54edb3c66f.tar.gz packages_apps_Browser-c7485ae06c6d5d33c57a03d02bbeed54edb3c66f.tar.bz2 |
checkpoint for moving UI to Holo style
mostly final assets
dialogs are not styled correctly
Change-Id: Ib98312ca9465ded3efc2743f9828fe9a815814cc
Diffstat (limited to 'src/com/android/browser/UrlInputView.java')
-rw-r--r-- | src/com/android/browser/UrlInputView.java | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/src/com/android/browser/UrlInputView.java b/src/com/android/browser/UrlInputView.java index 77d7daf..9ae464b 100644 --- a/src/com/android/browser/UrlInputView.java +++ b/src/com/android/browser/UrlInputView.java @@ -22,8 +22,10 @@ import android.content.Context; import android.database.Cursor; import android.graphics.drawable.Drawable; import android.util.AttributeSet; +import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; +import android.view.MotionEvent; import android.view.View; import android.view.View.OnFocusChangeListener; import android.view.ViewGroup; @@ -47,7 +49,8 @@ public class UrlInputView extends AutoCompleteTextView private UrlInputListener mListener; private InputMethodManager mInputManager; private SuggestionsAdapter mAdapter; - private Drawable mFocusDrawable; + + private OnFocusChangeListener mWrappedFocusListener; public UrlInputView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); @@ -65,16 +68,21 @@ public class UrlInputView extends AutoCompleteTextView } private void init(Context ctx) { - mFocusDrawable = ctx.getResources().getDrawable(R.drawable.textfield_stroke); mInputManager = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE); setOnEditorActionListener(this); - setOnFocusChangeListener(this); + super.setOnFocusChangeListener(this); final ContentResolver cr = mContext.getContentResolver(); mAdapter = new SuggestionsAdapter(mContext, BrowserProvider.getBookmarksSuggestions(cr, null)); setAdapter(mAdapter); setOnItemClickListener(this); - setSelectAllOnFocus(true); + setSelectAllOnFocus(false); + + } + + @Override + public void setOnFocusChangeListener(OnFocusChangeListener focusListener) { + mWrappedFocusListener = focusListener; } @Override @@ -82,15 +90,30 @@ public class UrlInputView extends AutoCompleteTextView finishInput(getText().toString()); return true; } - + + @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) { - setBackgroundDrawable(hasFocus ? mFocusDrawable : null); if (hasFocus) { forceIme(); } else { finishInput(null); } + if (mWrappedFocusListener != null) { + mWrappedFocusListener.onFocusChange(v, hasFocus); + } } @Override @@ -110,6 +133,7 @@ public class UrlInputView extends AutoCompleteTextView private void finishInput(String url) { this.dismissDropDown(); + this.setSelection(0,0); mInputManager.hideSoftInputFromWindow(getWindowToken(), 0); if (url == null) { mListener.onDismiss(); |