Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b8270a94 authored by nicolasroard's avatar nicolasroard
Browse files

Fix disappearing panels and animations on ICS

bug:8405402

Change-Id: I9c0da8fbf20c424cc64ae5cc1be42414cb2f0964
parent 783a72da
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="horizontal"
            android:animateLayoutChanges="true">
            android:animateLayoutChanges="false">

        <LinearLayout
        android:id="@+id/mainPanel"
+3 −4
Original line number Diff line number Diff line
@@ -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 {
+39 −40
Original line number Diff line number Diff line
@@ -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);
                }
            } else if (move == VERTICAL_MOVE) {
                if (PanelController.useAnimations()) {
                anim.y(h);
                } else {
                    mContainer.setY(h);
                }
            }
            if (PanelController.useAnimations()) {
                anim.setDuration(ANIM_DURATION).withLayer().withEndAction(new Runnable() {
            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,7 +127,6 @@ 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);
@@ -142,7 +138,9 @@ public class PanelController implements OnClickListener {
                mContainer.setY(h);
                anim.y(0);
            }
                anim.setDuration(ANIM_DURATION).withLayer();
            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() {
            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;