summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2012-10-22 16:19:52 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-10-22 16:19:52 -0700
commitff4e0460b4cdeb329e37cb5f41eedc45717a17c4 (patch)
treed2f62fd31d5b1f075803e27693d0e57fc8f407be
parente96e907a01c0d633828dade014f07a5b93b07356 (diff)
parentb75f5defe8ace12b8b563e713f7175863ab5713d (diff)
downloadandroid_packages_apps_Gallery2-ff4e0460b4cdeb329e37cb5f41eedc45717a17c4.tar.gz
android_packages_apps_Gallery2-ff4e0460b4cdeb329e37cb5f41eedc45717a17c4.tar.bz2
android_packages_apps_Gallery2-ff4e0460b4cdeb329e37cb5f41eedc45717a17c4.zip
Merge "Drive GLRootView with Choreographer" into gb-ub-photos-arches
-rw-r--r--gallerycommon/src/com/android/gallery3d/common/ApiHelper.java3
-rw-r--r--src/com/android/gallery3d/ui/GLRootView.java15
2 files changed, 18 insertions, 0 deletions
diff --git a/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java b/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java
index a393025fa..837777e51 100644
--- a/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java
+++ b/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java
@@ -167,6 +167,9 @@ public class ApiHelper {
public static final boolean HAS_VIEW_PROPERTY_ANIMATOR =
Build.VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB_MR1;
+ public static final boolean HAS_POST_ON_ANIMATION =
+ Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN;
+
public static int getIntFieldIfExists(Class<?> klass, String fieldName,
Class<?> obj, int defaultVal) {
try {
diff --git a/src/com/android/gallery3d/ui/GLRootView.java b/src/com/android/gallery3d/ui/GLRootView.java
index dbdfb6716..b400b05c6 100644
--- a/src/com/android/gallery3d/ui/GLRootView.java
+++ b/src/com/android/gallery3d/ui/GLRootView.java
@@ -177,6 +177,21 @@ public class GLRootView extends GLSurfaceView
}
if (mRenderRequested) return;
mRenderRequested = true;
+ if (ApiHelper.HAS_POST_ON_ANIMATION) {
+ postOnAnimation(mRequestRenderOnAnimationFrame);
+ } else {
+ super.requestRender();
+ }
+ }
+
+ private Runnable mRequestRenderOnAnimationFrame = new Runnable() {
+ @Override
+ public void run() {
+ superRequestRender();
+ }
+ };
+
+ private void superRequestRender() {
super.requestRender();
}