From 7eccf4559e3660da5715b69840b325fd7aa677a4 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Fri, 14 Mar 2014 12:52:42 -0700 Subject: Fade out favorites screen when dialpad is displayed Bug: 13453829 Change-Id: Ief313d3da78350f9ce576a766ce7cd863aa3d180 --- src/com/android/dialer/DialtactsActivity.java | 33 +++++++++++++++++++-------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index b0162e360..8bca7dd8b 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -121,7 +121,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O private static final int ACTIVITY_REQUEST_CODE_VOICE_SEARCH = 1; - private static final int FADE_ANIMATION_DURATION = 200; + private static final int ANIMATION_DURATION = 200; private String mFilterText; @@ -387,10 +387,16 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O mSmartDialSearchFragment = (SmartDialSearchFragment) fragment; mSmartDialSearchFragment.setOnPhoneNumberPickerActionListener( mPhoneNumberPickerActionListener); + if (mFragmentsFrame != null) { + mFragmentsFrame.setAlpha(1.0f); + } } else if (fragment instanceof SearchFragment) { mRegularSearchFragment = (RegularSearchFragment) fragment; mRegularSearchFragment.setOnPhoneNumberPickerActionListener( mPhoneNumberPickerActionListener); + if (mFragmentsFrame != null) { + mFragmentsFrame.setAlpha(1.0f); + } } else if (fragment instanceof PhoneFavoriteFragment) { mPhoneFavoriteFragment = (PhoneFavoriteFragment) fragment; mPhoneFavoriteFragment.setListener(mPhoneFavoriteListener); @@ -609,11 +615,11 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O mSearchAndRemoveViewContainer.setAlpha(1); mSearchAndRemoveViewContainer.setTranslationY(0); mSearchAndRemoveViewContainer.animate().withLayer().alpha(0) - .translationY(-height).setDuration(200) + .translationY(-height).setDuration(ANIMATION_DURATION) .setListener(mHideListener); mFragmentsFrame.animate().withLayer() - .translationY(-height).setDuration(200).setListener( + .translationY(-height).setDuration(ANIMATION_DURATION).setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { @@ -624,6 +630,11 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O mFragmentsSpacer.setVisibility(View.VISIBLE); } }); + + if (!mInDialpadSearch && !mInRegularSearch) { + // If the favorites fragment is showing, fade to blank. + mFragmentsFrame.animate().alpha(0.0f); + } } public void showSearchBar() { @@ -632,7 +643,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O mSearchAndRemoveViewContainer.setAlpha(0); mSearchAndRemoveViewContainer.setTranslationY(-height); mSearchAndRemoveViewContainer.animate().withLayer().alpha(1).translationY(0) - .setDuration(200).setListener(new AnimatorListenerAdapter() { + .setDuration(ANIMATION_DURATION).setListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { mSearchAndRemoveViewContainer.setVisibility(View.VISIBLE); @@ -640,7 +651,8 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O }); mFragmentsFrame.setTranslationY(-height); - mFragmentsFrame.animate().withLayer().translationY(0).setDuration(200) + mFragmentsFrame.animate().withLayer().translationY(0).setDuration(ANIMATION_DURATION) + .alpha(1.0f) .setListener( new AnimatorListenerAdapter() { @Override @@ -847,7 +859,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O } final FragmentTransaction transaction = getFragmentManager().beginTransaction(); - transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); SearchFragment fragment; if (mInDialpadSearch) { @@ -893,6 +904,10 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O // transitioned between search fragments getFragmentManager().popBackStack(0, FragmentManager.POP_BACK_STACK_INCLUSIVE); setNotInSearchUi(); + + if (isDialpadShowing()) { + mFragmentsFrame.setAlpha(0); + } } /** Returns an Intent to launch Call Settings screen */ @@ -981,7 +996,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override public void onDragStarted(int itemIndex, int x, int y, PhoneFavoriteTileView view) { - crossfadeViews(mRemoveViewContainer, mSearchViewContainer, FADE_ANIMATION_DURATION); + crossfadeViews(mRemoveViewContainer, mSearchViewContainer, ANIMATION_DURATION); } @Override @@ -989,7 +1004,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override public void onDragFinished(int x, int y) { - crossfadeViews(mSearchViewContainer, mRemoveViewContainer, FADE_ANIMATION_DURATION); + crossfadeViews(mSearchViewContainer, mRemoveViewContainer, ANIMATION_DURATION); } @Override @@ -1019,7 +1034,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O fadeIn.setVisibility(View.VISIBLE); fadeIn.setAlpha(0); - fadeIn.animate().alpha(1).setDuration(FADE_ANIMATION_DURATION) + fadeIn.animate().alpha(1).setDuration(ANIMATION_DURATION) .setListener(null); } -- cgit v1.2.3