Add clear button to the search bar instead of go button
This commit is contained in:
parent
1896fa6151
commit
8061d8726a
@ -182,7 +182,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
|||||||
// Image
|
// Image
|
||||||
private Bitmap mDefaultVideoPoster, mWebpageBitmap, mFolderBitmap;
|
private Bitmap mDefaultVideoPoster, mWebpageBitmap, mFolderBitmap;
|
||||||
private final ColorDrawable mBackground = new ColorDrawable();
|
private final ColorDrawable mBackground = new ColorDrawable();
|
||||||
private Drawable mDeleteIcon, mRefreshIcon, mSearchIcon, mIcon;
|
private Drawable mDeleteIcon, mRefreshIcon, mClearIcon, mIcon;
|
||||||
private DrawerArrowDrawable mArrowDrawable;
|
private DrawerArrowDrawable mArrowDrawable;
|
||||||
|
|
||||||
// Proxy
|
// Proxy
|
||||||
@ -340,12 +340,12 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
|||||||
}
|
}
|
||||||
mDeleteIcon = ThemeUtils.getLightThemedDrawable(this, R.drawable.ic_action_delete);
|
mDeleteIcon = ThemeUtils.getLightThemedDrawable(this, R.drawable.ic_action_delete);
|
||||||
mRefreshIcon = ThemeUtils.getLightThemedDrawable(this, R.drawable.ic_action_refresh);
|
mRefreshIcon = ThemeUtils.getLightThemedDrawable(this, R.drawable.ic_action_refresh);
|
||||||
mSearchIcon = ThemeUtils.getLightThemedDrawable(this, R.drawable.ic_action_forward);
|
mClearIcon = ThemeUtils.getLightThemedDrawable(this, R.drawable.ic_action_delete);
|
||||||
|
|
||||||
int iconBounds = Utils.dpToPx(30);
|
int iconBounds = Utils.dpToPx(30);
|
||||||
mDeleteIcon.setBounds(0, 0, iconBounds, iconBounds);
|
mDeleteIcon.setBounds(0, 0, iconBounds, iconBounds);
|
||||||
mRefreshIcon.setBounds(0, 0, iconBounds, iconBounds);
|
mRefreshIcon.setBounds(0, 0, iconBounds, iconBounds);
|
||||||
mSearchIcon.setBounds(0, 0, iconBounds, iconBounds);
|
mClearIcon.setBounds(0, 0, iconBounds, iconBounds);
|
||||||
mIcon = mRefreshIcon;
|
mIcon = mRefreshIcon;
|
||||||
SearchListenerClass search = new SearchListenerClass();
|
SearchListenerClass search = new SearchListenerClass();
|
||||||
mSearch.setCompoundDrawables(null, null, mRefreshIcon, null);
|
mSearch.setCompoundDrawables(null, null, mRefreshIcon, null);
|
||||||
@ -461,8 +461,8 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
|||||||
((AutoCompleteTextView) v).selectAll(); // Hack to make sure
|
((AutoCompleteTextView) v).selectAll(); // Hack to make sure
|
||||||
// the text gets
|
// the text gets
|
||||||
// selected
|
// selected
|
||||||
mIcon = mSearchIcon;
|
mIcon = mClearIcon;
|
||||||
mSearch.setCompoundDrawables(null, null, mSearchIcon, null);
|
mSearch.setCompoundDrawables(null, null, mClearIcon, null);
|
||||||
}
|
}
|
||||||
final Animation anim = new Animation() {
|
final Animation anim = new Animation() {
|
||||||
|
|
||||||
@ -528,12 +528,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
|||||||
if (tappedX) {
|
if (tappedX) {
|
||||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||||
if (mSearch.hasFocus()) {
|
if (mSearch.hasFocus()) {
|
||||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
mSearch.setText("");
|
||||||
imm.hideSoftInputFromWindow(mSearch.getWindowToken(), 0);
|
|
||||||
searchTheWeb(mSearch.getText().toString());
|
|
||||||
if (mCurrentView != null) {
|
|
||||||
mCurrentView.requestFocus();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
refreshOrStop();
|
refreshOrStop();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user