summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/app/widget/SearchEditTextLayout.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/dialer/app/widget/SearchEditTextLayout.java')
-rw-r--r--java/com/android/dialer/app/widget/SearchEditTextLayout.java67
1 files changed, 2 insertions, 65 deletions
diff --git a/java/com/android/dialer/app/widget/SearchEditTextLayout.java b/java/com/android/dialer/app/widget/SearchEditTextLayout.java
index 95bd12aa1..2051b65f2 100644
--- a/java/com/android/dialer/app/widget/SearchEditTextLayout.java
+++ b/java/com/android/dialer/app/widget/SearchEditTextLayout.java
@@ -23,7 +23,6 @@ import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.AttributeSet;
-import android.view.KeyEvent;
import android.view.View;
import android.widget.EditText;
import android.widget.FrameLayout;
@@ -38,7 +37,6 @@ public class SearchEditTextLayout extends FrameLayout {
/* Subclass-visible for testing */
protected boolean mIsExpanded = false;
protected boolean mIsFadedOut = false;
- private OnKeyListener mPreImeKeyListener;
private int mTopMargin;
private int mBottomMargin;
private int mLeftMargin;
@@ -56,20 +54,10 @@ public class SearchEditTextLayout extends FrameLayout {
private ValueAnimator mAnimator;
- private Callback mCallback;
-
public SearchEditTextLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
- public void setPreImeKeyListener(OnKeyListener listener) {
- mPreImeKeyListener = listener;
- }
-
- public void setCallback(Callback listener) {
- mCallback = listener;
- }
-
@Override
protected void onFinishInflate() {
MarginLayoutParams params = (MarginLayoutParams) getLayoutParams();
@@ -82,7 +70,7 @@ public class SearchEditTextLayout extends FrameLayout {
mCollapsed = findViewById(R.id.search_box_collapsed);
mExpanded = findViewById(R.id.search_box_expanded);
- mSearchView = (EditText) mExpanded.findViewById(R.id.search_view);
+ mSearchView = mExpanded.findViewById(R.id.search_view);
mSearchIcon = findViewById(R.id.search_magnifying_glass);
mCollapsedSearchBox = findViewById(R.id.search_box_start_search);
@@ -123,16 +111,6 @@ public class SearchEditTextLayout extends FrameLayout {
}
});
- mSearchView.setOnClickListener(
- new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (mCallback != null) {
- mCallback.onSearchViewClicked();
- }
- }
- });
-
mSearchView.addTextChangedListener(
new TextWatcher() {
@Override
@@ -147,43 +125,10 @@ public class SearchEditTextLayout extends FrameLayout {
public void afterTextChanged(Editable s) {}
});
- findViewById(R.id.search_close_button)
- .setOnClickListener(
- new OnClickListener() {
- @Override
- public void onClick(View v) {
- mSearchView.setText(null);
- }
- });
-
- findViewById(R.id.search_back_button)
- .setOnClickListener(
- new OnClickListener() {
- @Override
- public void onClick(View v) {
- if (mCallback != null) {
- mCallback.onBackButtonClicked();
- }
- }
- });
-
+ mClearButtonView.setOnClickListener(v -> mSearchView.setText(null));
super.onFinishInflate();
}
- @Override
- public boolean dispatchKeyEventPreIme(KeyEvent event) {
- if (mPreImeKeyListener != null) {
- if (mPreImeKeyListener.onKey(this, event.getKeyCode(), event)) {
- return true;
- }
- }
- return super.dispatchKeyEventPreIme(event);
- }
-
- public void fadeOut() {
- fadeOut(null);
- }
-
public void fadeOut(AnimUtils.AnimationCallback callback) {
AnimUtils.fadeOut(this, ANIMATION_DURATION, callback);
mIsFadedOut = true;
@@ -324,12 +269,4 @@ public class SearchEditTextLayout extends FrameLayout {
params.rightMargin = (int) (mRightMargin * fraction);
requestLayout();
}
-
- /** Listener for the back button next to the search view being pressed */
- public interface Callback {
-
- void onBackButtonClicked();
-
- void onSearchViewClicked();
- }
}