diff options
Diffstat (limited to 'java/com/android/dialer/app/widget')
-rw-r--r-- | java/com/android/dialer/app/widget/ActionBarController.java | 28 | ||||
-rw-r--r-- | java/com/android/dialer/app/widget/SearchEditTextLayout.java | 67 |
2 files changed, 8 insertions, 87 deletions
diff --git a/java/com/android/dialer/app/widget/ActionBarController.java b/java/com/android/dialer/app/widget/ActionBarController.java index c1b4cc2b4..3daa0e2d4 100644 --- a/java/com/android/dialer/app/widget/ActionBarController.java +++ b/java/com/android/dialer/app/widget/ActionBarController.java @@ -49,18 +49,6 @@ public class ActionBarController { } }; - private final AnimationCallback mFadeInCallback = - new AnimationCallback() { - @Override - public void onAnimationEnd() { - slideActionBar(false /* slideUp */, false /* animate */); - } - - @Override - public void onAnimationCancel() { - slideActionBar(false /* slideUp */, false /* animate */); - } - }; private ValueAnimator mAnimator; public ActionBarController(ActivityUi activityUi, SearchEditTextLayout searchBox) { @@ -112,17 +100,13 @@ public class ActionBarController { mSearchBox.isFadedOut(), mSearchBox.isExpanded()); if (mActivityUi.isInSearchUi()) { - if (mActivityUi.hasSearchQuery()) { - if (mSearchBox.isFadedOut()) { - mSearchBox.setVisible(true); - } - if (!mSearchBox.isExpanded()) { - mSearchBox.expand(false /* animate */, false /* requestFocus */); - } - slideActionBar(false /* slideUp */, true /* animate */); - } else { - mSearchBox.fadeIn(mFadeInCallback); + if (mSearchBox.isFadedOut()) { + mSearchBox.setVisible(true); + } + if (!mSearchBox.isExpanded()) { + mSearchBox.expand(false /* animate */, false /* requestFocus */); } + slideActionBar(false /* slideUp */, true /* animate */); } } 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(); - } } |