summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authornicolasroard <nicolasroard@google.com>2013-03-18 17:27:55 -0700
committernicolasroard <nicolasroard@google.com>2013-03-18 20:22:20 -0700
commit35afd8f09183ae9b92e9b1b722cfa806032f189c (patch)
treef0b37a22dc407312bd3ca4dfa14fe8748d6fdf36 /src
parent9a5c1beb3b8f5586a91b465fb013d6c4cea6b87c (diff)
downloadandroid_packages_apps_Snap-35afd8f09183ae9b92e9b1b722cfa806032f189c.tar.gz
android_packages_apps_Snap-35afd8f09183ae9b92e9b1b722cfa806032f189c.tar.bz2
android_packages_apps_Snap-35afd8f09183ae9b92e9b1b722cfa806032f189c.zip
Fix disappearing panels and animations on ICS
bug:8405402 Change-Id: I9c0da8fbf20c424cc64ae5cc1be42414cb2f0964
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/filtershow/FilterShowActivity.java7
-rw-r--r--src/com/android/gallery3d/filtershow/PanelController.java79
2 files changed, 42 insertions, 44 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
index 2811910b0..1f21d2f67 100644
--- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java
+++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
@@ -26,7 +26,6 @@ import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
@@ -492,7 +491,7 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
loading.setVisibility(View.GONE);
final View filters = findViewById(R.id.filtersPanel);
filters.setVisibility(View.VISIBLE);
- if (PanelController.useAnimations()) {
+ if (PanelController.useAnimationsLayer()) {
float y = filters.getY();
filters.setY(y + filters.getHeight());
filters.animate().setDuration(600).y(y).withLayer().start();
@@ -949,7 +948,7 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
== Configuration.ORIENTATION_PORTRAIT) {
// If portrait, always remove the state panel
mShowingImageStatePanel = false;
- if (PanelController.useAnimations()) {
+ if (PanelController.useAnimationsLayer()) {
view.animate().setDuration(200).x(translate)
.withLayer().withEndAction(new Runnable() {
@Override
@@ -976,7 +975,7 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
if (getResources().getConfiguration().orientation
== Configuration.ORIENTATION_PORTRAIT) {
viewList.setVisibility(View.INVISIBLE);
- if (PanelController.useAnimations()) {
+ if (PanelController.useAnimationsLayer()) {
view.animate().setDuration(200).x(0).withLayer()
.start();
} else {
diff --git a/src/com/android/gallery3d/filtershow/PanelController.java b/src/com/android/gallery3d/filtershow/PanelController.java
index 206f54f64..83520320c 100644
--- a/src/com/android/gallery3d/filtershow/PanelController.java
+++ b/src/com/android/gallery3d/filtershow/PanelController.java
@@ -17,6 +17,7 @@
package com.android.gallery3d.filtershow;
import android.content.Context;
+import android.os.Handler;
import android.text.Html;
import android.view.View;
import android.view.View.OnClickListener;
@@ -51,7 +52,9 @@ public class PanelController implements OnClickListener {
private static final String LOGTAG = "PanelController";
private boolean mFixedAspect = false;
- public static boolean useAnimations() {
+ final Handler mHandler = new Handler();
+
+ public static boolean useAnimationsLayer() {
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
if (currentapiVersion >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
return true;
@@ -97,27 +100,21 @@ public class PanelController implements OnClickListener {
} else {
delta = w;
}
- if (PanelController.useAnimations()) {
- anim.x(delta);
- } else {
- mContainer.setX(delta);
- }
+ anim.x(delta);
} else if (move == VERTICAL_MOVE) {
- if (PanelController.useAnimations()) {
- anim.y(h);
- } else {
- mContainer.setY(h);
- }
+ anim.y(h);
}
- if (PanelController.useAnimations()) {
- anim.setDuration(ANIM_DURATION).withLayer().withEndAction(new Runnable() {
- @Override
- public void run() {
- mContainer.setVisibility(View.GONE);
- }
- });
+ anim.setDuration(ANIM_DURATION);
+ Runnable action = new Runnable() {
+ @Override
+ public void run() {
+ mContainer.setVisibility(View.GONE);
+ }
+ };
+ if (PanelController.useAnimationsLayer()) {
+ anim.withLayer().withEndAction(action);
} else {
- mContainer.setVisibility(View.GONE);
+ mHandler.postDelayed(action, ANIM_DURATION);
}
return anim;
}
@@ -130,19 +127,20 @@ public class PanelController implements OnClickListener {
ViewPropertyAnimator anim = mContainer.animate();
int w = mRowPanel.getWidth();
int h = mRowPanel.getHeight();
- if (useAnimations()) {
- if (move == HORIZONTAL_MOVE) {
- if (oldPos < mPosition) {
- mContainer.setX(w);
- } else {
- mContainer.setX(-w);
- }
- anim.x(0);
- } else if (move == VERTICAL_MOVE) {
- mContainer.setY(h);
- anim.y(0);
+ if (move == HORIZONTAL_MOVE) {
+ if (oldPos < mPosition) {
+ mContainer.setX(w);
+ } else {
+ mContainer.setX(-w);
}
- anim.setDuration(ANIM_DURATION).withLayer();
+ anim.x(0);
+ } else if (move == VERTICAL_MOVE) {
+ mContainer.setY(h);
+ anim.y(0);
+ }
+ anim.setDuration(ANIM_DURATION);
+ if (PanelController.useAnimationsLayer()) {
+ anim.withLayer();
}
return anim;
}
@@ -231,15 +229,16 @@ public class PanelController implements OnClickListener {
mView.setY(0);
int h = mRowPanel.getHeight();
anim.y(-h);
- if (PanelController.useAnimations()) {
- anim.setDuration(ANIM_DURATION).withLayer().withEndAction(new Runnable() {
- @Override
- public void run() {
- mView.setVisibility(View.GONE);
- }
- });
+ Runnable action = new Runnable() {
+ @Override
+ public void run() {
+ mView.setVisibility(View.GONE);
+ }
+ };
+ if (PanelController.useAnimationsLayer()) {
+ anim.setDuration(ANIM_DURATION).withLayer().withEndAction(action);
} else {
- mView.setVisibility(View.GONE);
+ mHandler.postDelayed(action, ANIM_DURATION);
}
mSelected = false;
return anim;
@@ -255,7 +254,7 @@ public class PanelController implements OnClickListener {
ViewPropertyAnimator anim = mView.animate();
anim.y(0);
anim.setDuration(ANIM_DURATION);
- if (PanelController.useAnimations()) {
+ if (PanelController.useAnimationsLayer()) {
anim.withLayer();
}
return anim;