diff options
author | Yorke Lee <yorkelee@google.com> | 2015-04-03 10:27:36 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2015-04-03 10:27:36 -0700 |
commit | d522989fe9e77a8a7da1199948f44aa6cd03293e (patch) | |
tree | b52054adae564a925ca28c70e4e89809ac1b16a9 /src | |
parent | c00378bb97a1c86fc20967817c1866d12a2c522f (diff) |
Use hardware layer for SearchFragment fade in
This greatly improves the dialpad slidein animation on
low end devices.
Bug: 20055089
Change-Id: I17e04eeaad48b8d2245ef6d9ce5fef623588cccc
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/list/SearchFragment.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/com/android/dialer/list/SearchFragment.java b/src/com/android/dialer/list/SearchFragment.java index 000e139fe..50c294608 100644 --- a/src/com/android/dialer/list/SearchFragment.java +++ b/src/com/android/dialer/list/SearchFragment.java @@ -15,6 +15,9 @@ */ package com.android.dialer.list; +import android.animation.Animator; +import android.animation.AnimatorInflater; +import android.animation.AnimatorListenerAdapter; import android.app.Activity; import android.content.Intent; import android.content.res.Resources; @@ -129,6 +132,26 @@ public class SearchFragment extends PhoneNumberPickerFragment { } @Override + public Animator onCreateAnimator(int transit, boolean enter, int nextAnim) { + Animator animator = null; + if (nextAnim != 0) { + animator = AnimatorInflater.loadAnimator(getActivity(), nextAnim); + } + if (animator != null) { + final View view = getView(); + final int oldLayerType = view.getLayerType(); + view.setLayerType(View.LAYER_TYPE_HARDWARE, null); + animator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + view.setLayerType(oldLayerType, null); + } + }); + } + return animator; + } + + @Override protected void setSearchMode(boolean flag) { super.setSearchMode(flag); // This hides the "All contacts with phone numbers" header in the search fragment |