From d522989fe9e77a8a7da1199948f44aa6cd03293e Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Fri, 3 Apr 2015 10:27:36 -0700 Subject: Use hardware layer for SearchFragment fade in This greatly improves the dialpad slidein animation on low end devices. Bug: 20055089 Change-Id: I17e04eeaad48b8d2245ef6d9ce5fef623588cccc --- src/com/android/dialer/list/SearchFragment.java | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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; @@ -128,6 +131,26 @@ public class SearchFragment extends PhoneNumberPickerFragment { ViewUtil.addBottomPaddingToListViewForFab(getListView(), getResources()); } + @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); -- cgit v1.2.3