summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2015-05-08 17:17:01 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-05-08 17:17:02 +0000
commite7ef086eb7b676a5006345082fe12b7ec15e084b (patch)
treecae865b9430f66ea72a8d9de2128b74c98b3eaf5 /src
parentb255456e6d0067a0aa9fceacbb0e021ba86bf94d (diff)
parent6c450eb606f9e052a152e37759d3866cb605e1ba (diff)
Merge "Fix jank when showing dialpad" into mnc-dev
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/DialtactsActivity.java35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 5c7dd6f19..cccc06ea0 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -165,6 +165,15 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
*/
private Animation mSlideOut;
+ AnimationListenerAdapter mSlideInListener = new AnimationListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animation animation) {
+ if (!isInSearchUi()) {
+ enterSearchUi(true /* isSmartDial */, mSearchQuery, false);
+ }
+ }
+ };
+
/**
* Listener for after slide out animation completes on dialer fragment.
*/
@@ -293,7 +302,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
final boolean sameSearchMode = (mIsDialpadShown && mInDialpadSearch) ||
(!mIsDialpadShown && mInRegularSearch);
if (!sameSearchMode) {
- enterSearchUi(mIsDialpadShown, mSearchQuery);
+ enterSearchUi(mIsDialpadShown, mSearchQuery, true /* animate */);
}
}
@@ -318,7 +327,8 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
public void onClick(View v) {
if (!isInSearchUi()) {
mActionBarController.onSearchBoxTapped();
- enterSearchUi(false /* smartDialSearch */, mSearchView.getText().toString());
+ enterSearchUi(false /* smartDialSearch */, mSearchView.getText().toString(),
+ true /* animate */);
}
}
};
@@ -431,6 +441,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
mSlideIn.setInterpolator(AnimUtils.EASE_IN);
mSlideOut.setInterpolator(AnimUtils.EASE_OUT);
+ mSlideIn.setAnimationListener(mSlideInListener);
mSlideOut.setAnimationListener(mSlideOutListener);
mParentLayout = (FrameLayout) findViewById(R.id.dialtacts_mainlayout);
@@ -682,9 +693,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
}
mActionBarController.onDialpadUp();
- if (!isInSearchUi()) {
- enterSearchUi(true /* isSmartDial */, mSearchQuery);
- }
+ mListsFragment.getView().animate().alpha(0).withLayer();
}
/**
@@ -898,7 +907,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
/**
* Shows the search fragment
*/
- private void enterSearchUi(boolean smartDialSearch, String query) {
+ private void enterSearchUi(boolean smartDialSearch, String query, boolean animate) {
if (mStateSaved || getFragmentManager().isDestroyed()) {
// Weird race condition where fragment is doing work after the activity is destroyed
// due to talkback being on (b/10209937). Just return since we can't do any
@@ -927,7 +936,11 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
mInRegularSearch = !smartDialSearch;
SearchFragment fragment = (SearchFragment) getFragmentManager().findFragmentByTag(tag);
- transaction.setCustomAnimations(android.R.animator.fade_in, 0);
+ if (animate) {
+ transaction.setCustomAnimations(android.R.animator.fade_in, 0);
+ } else {
+ transaction.setTransition(FragmentTransaction.TRANSIT_NONE);
+ }
if (fragment == null) {
if (smartDialSearch) {
fragment = new SmartDialSearchFragment();
@@ -941,10 +954,14 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
// DialtactsActivity will provide the options menu
fragment.setHasOptionsMenu(false);
fragment.setShowEmptyListForNullQuery(true);
- fragment.setQueryString(query, false /* delaySelection */);
+ if (!smartDialSearch) {
+ fragment.setQueryString(query, false /* delaySelection */);
+ }
transaction.commit();
- mListsFragment.getView().animate().alpha(0).withLayer();
+ if (animate) {
+ mListsFragment.getView().animate().alpha(0).withLayer();
+ }
mListsFragment.setUserVisibleHint(false);
}