diff options
author | Yorke Lee <yorkelee@google.com> | 2014-03-03 14:03:08 -0800 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2014-03-03 14:34:44 -0800 |
commit | 94f490466f2b7f4d9d19c4628a56442ccf8a6adf (patch) | |
tree | 715138096555999df67e23b026c162dfed7254cd | |
parent | 735bc040c07b905266f7619b292bfa3bd638acd5 (diff) |
Fix slight screen jank when sliding dialpad upwards
Apply the translation animation to mSearchAndRemoveViewContainer
(which houses the entire searchbox and its margins), so that the
translation takes into account the entire height of the searchbox
as well as its margins.
Also refactored hideSearchBar slightly to remove an unused codepath.
Bug: 13284310
Change-Id: I7b8873154059f616d8a52c4a0239ea6be89c8efc
-rw-r--r-- | res/layout/dialtacts_activity.xml | 1 | ||||
-rw-r--r-- | src/com/android/dialer/DialtactsActivity.java | 63 |
2 files changed, 32 insertions, 32 deletions
diff --git a/res/layout/dialtacts_activity.xml b/res/layout/dialtacts_activity.xml index 21f84bbfa..8f9f39cd2 100644 --- a/res/layout/dialtacts_activity.xml +++ b/res/layout/dialtacts_activity.xml @@ -39,6 +39,7 @@ <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" + android:id="@+id/search_and_remove_view_container" > <LinearLayout android:layout_width="match_parent" diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 4542137fc..c51035537 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -168,6 +168,9 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O private boolean mFirstLaunch; private View mSearchViewContainer; private RemoveView mRemoveViewContainer; + // This view points to the Framelayout that houses both the search view and remove view + // containers. + private View mSearchAndRemoveViewContainer; private View mSearchViewCloseButton; private View mVoiceSearchButton; private EditText mSearchView; @@ -310,6 +313,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O mFragmentsFrame = findViewById(R.id.dialtacts_frame); mRemoveViewContainer = (RemoveView) findViewById(R.id.remove_view_container); + mSearchAndRemoveViewContainer = (View) findViewById(R.id.search_and_remove_view_container); prepareSearchView(); if (UI.FILTER_CONTACTS_ACTION.equals(intent.getAction()) @@ -564,7 +568,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O final AnimatorListener mHideListener = new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { - mSearchViewContainer.setVisibility(View.GONE); + mSearchAndRemoveViewContainer.setVisibility(View.GONE); } }; @@ -583,43 +587,38 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O } public void hideSearchBar() { - hideSearchBar(true); + final int height = mSearchAndRemoveViewContainer.getHeight(); + mSearchAndRemoveViewContainer.animate().cancel(); + mSearchAndRemoveViewContainer.setAlpha(1); + mSearchAndRemoveViewContainer.setTranslationY(0); + mSearchAndRemoveViewContainer.animate().withLayer().alpha(0) + .translationY(-height).setDuration(200) + .setListener(mHideListener); + + mFragmentsFrame.animate().withLayer() + .translationY(-height).setDuration(200).setListener( + new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + mFragmentsFrame.setTranslationY(0); + } + }); } - public void hideSearchBar(boolean shiftView) { - if (shiftView) { - mSearchViewContainer.animate().cancel(); - mSearchViewContainer.setAlpha(1); - mSearchViewContainer.setTranslationY(0); - mSearchViewContainer.animate().withLayer().alpha(0).translationY(-mSearchView.getHeight()) - .setDuration(200).setListener(mHideListener); - - mFragmentsFrame.animate().withLayer() - .translationY(-mSearchViewContainer.getHeight()).setDuration(200).setListener( - new AnimatorListenerAdapter() { + public void showSearchBar() { + final int height = mSearchAndRemoveViewContainer.getHeight(); + mSearchAndRemoveViewContainer.animate().cancel(); + mSearchAndRemoveViewContainer.setAlpha(0); + mSearchAndRemoveViewContainer.setTranslationY(-height); + mSearchAndRemoveViewContainer.animate().withLayer().alpha(1).translationY(0) + .setDuration(200).setListener(new AnimatorListenerAdapter() { @Override - public void onAnimationEnd(Animator animation) { - mFragmentsFrame.setTranslationY(0); + public void onAnimationStart(Animator animation) { + mSearchAndRemoveViewContainer.setVisibility(View.VISIBLE); } }); - } else { - mSearchViewContainer.setTranslationY(-mSearchView.getHeight()); - } - } - - public void showSearchBar() { - mSearchViewContainer.animate().cancel(); - mSearchViewContainer.setAlpha(0); - mSearchViewContainer.setTranslationY(-mSearchViewContainer.getHeight()); - mSearchViewContainer.animate().withLayer().alpha(1).translationY(0).setDuration(200) - .setListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationStart(Animator animation) { - mSearchViewContainer.setVisibility(View.VISIBLE); - } - }); - mFragmentsFrame.setTranslationY(-mSearchViewContainer.getHeight()); + mFragmentsFrame.setTranslationY(-height); mFragmentsFrame.animate().withLayer().translationY(0).setDuration(200) .setListener( new AnimatorListenerAdapter() { |