From f6673d3e5cbd10febea04f02035591ab15c5c7c0 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Fri, 23 Aug 2013 15:34:17 -0700 Subject: Hide dialpad fragment and exit search ui when phone number selected Bug: 10328290 Change-Id: I3fc560f0727c493ae5f051320ea6abe4715f0e79 --- src/com/android/dialer/DialtactsActivity.java | 20 +++++++++++--------- src/com/android/dialer/dialpad/DialpadFragment.java | 6 +++++- 2 files changed, 16 insertions(+), 10 deletions(-) (limited to 'src/com') diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 499ff31bd..5826afd69 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -181,12 +181,14 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O // CallLog screen (search UI will be automatically exited). PhoneNumberInteraction.startInteractionForPhoneCall( DialtactsActivity.this, dataUri, getCallOrigin()); + hideDialpadAndSearchUi(); } @Override public void onCallNumberDirectly(String phoneNumber) { Intent intent = CallUtil.getCallIntent(phoneNumber, getCallOrigin()); startActivity(intent); + hideDialpadAndSearchUi(); } @Override @@ -430,7 +432,12 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O ft.commit(); } - private void hideDialpadFragment(boolean animate) { + private void hideDialpadFragment(boolean animate, boolean clearDialpad) { + if (mDialpadFragment == null) return; + if (clearDialpad) { + mDialpadFragment.clearDialpad(); + } + if (!mDialpadFragment.isVisible()) return; mDialpadFragment.setAdjustTranslationForAnimation(animate); final FragmentTransaction ft = getFragmentManager().beginTransaction(); if (animate) { @@ -459,12 +466,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O }); } - private void hideDialpadFragmentIfNecessary() { - if (mDialpadFragment != null && mDialpadFragment.isVisible()) { - hideDialpadFragment(true); - } - } - final AnimatorListener mHideListener = new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { @@ -793,9 +794,10 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override public void onBackPressed() { if (mDialpadFragment != null && mDialpadFragment.isVisible()) { - hideDialpadFragment(true); + hideDialpadFragment(true, false); } else if (mInSearchUi) { mSearchView.setText(null); + mDialpadFragment.clearDialpad(); } else if (isTaskRoot()) { // Instead of stopping, simply push this to the back of the stack. // This is only done when running at the top of the stack; @@ -830,7 +832,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override public void onListFragmentScrollStateChange(int scrollState) { if (scrollState == OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) { - hideDialpadFragmentIfNecessary(); + hideDialpadFragment(true, false); hideInputMethod(getCurrentFocus()); } } diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index 82f537755..79e830730 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -745,7 +745,7 @@ public class DialpadFragment extends Fragment if (mClearDigitsOnStop) { mClearDigitsOnStop = false; - mDigits.getText().clear(); + clearDialpad(); } } @@ -1157,6 +1157,10 @@ public class DialpadFragment extends Fragment } } + public void clearDialpad() { + mDigits.getText().clear(); + } + private String getCallOrigin() { return (getActivity() instanceof DialtactsActivity) ? ((DialtactsActivity) getActivity()).getCallOrigin() : null; -- cgit v1.2.3