Bug 871651 - Use hardware layers to animate about:home (r=sriram)
authorLucas Rocha <lucasr@mozilla.com>
Fri, 16 Aug 2013 23:05:56 +0100
changeset 143549 959652e54e37f35a8b8eee4fa3ec894278c9ea8c
parent 143548 6e9684831044042fee75c40a70b6521261c1bcb1
child 143550 84e56b699e9b1a9595c363d8c9bae75567888054
push id25130
push userlrocha@mozilla.com
push dateWed, 21 Aug 2013 09:41:27 +0000
treeherdermozilla-central@b2486721572e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssriram
bugs871651
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 871651 - Use hardware layers to animate about:home (r=sriram)
mobile/android/base/home/HomePager.java
--- a/mobile/android/base/home/HomePager.java
+++ b/mobile/android/base/home/HomePager.java
@@ -123,16 +123,28 @@ public class HomePager extends ViewPager
         adapter.addTab(Page.READING_LIST, ReadingListPage.class, null, getContext().getString(R.string.reading_list));
 
         setAdapter(adapter);
 
         setCurrentItem(adapter.getItemPosition(page), false);
         setVisibility(VISIBLE);
 
         if (animator != null && Build.VERSION.SDK_INT >= 11) {
+            animator.addPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() {
+                @Override
+                public void onPropertyAnimationStart() {
+                    setLayerType(View.LAYER_TYPE_HARDWARE, null);
+                }
+
+                @Override
+                public void onPropertyAnimationEnd() {
+                    setLayerType(View.LAYER_TYPE_NONE, null);
+                }
+            });
+
             ViewHelper.setAlpha(this, 0.0f);
 
             animator.attach(this,
                             PropertyAnimator.Property.ALPHA,
                             1.0f);
         }
     }