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

Commit 36530859 authored by Jaewan Kim's avatar Jaewan Kim Committed by Android (Google) Code Review
Browse files

Merge "PIP: Fix regressions" into nyc-dev

parents f90db089 419c8953
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -35,9 +35,9 @@
    <!-- Placeholder view to give focus to the PIP menus. -->
    <View
        android:id="@+id/pip"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_width="1dp"
        android:layout_height="1dp"
        android:focusable="true"
        android:visibility="gone" />
        android:visibility="visible" />

</com.android.systemui.recents.tv.views.RecentsTvView>
+5 −2
Original line number Diff line number Diff line
@@ -651,4 +651,7 @@

    <!-- The amount to translate when animating the removal of a task. -->
    <dimen name="recents_task_view_remove_anim_translation_x">100dp</dimen>

    <!-- The alpha to apply to the recents row when it doesn't have focus -->
    <item name="recents_recents_row_dim_alpha" format="float" type="dimen">0.5</item>
</resources>
+14 −8
Original line number Diff line number Diff line
@@ -107,7 +107,9 @@ public class RecentsTvActivity extends Activity implements OnPreDrawListener {
        public void onMoveToFullscreen() {
            // Recents should be dismissed when PIP moves to fullscreen. If not, Recents will
            // be unnecessarily shown in the scenario: PIP->Fullscreen->PIP.
            dismissRecentsToLaunchTargetTaskOrHome();
            // Do not show Recents close animation because PIP->Fullscreen animation will be shown
            // instead.
            dismissRecentsToLaunchTargetTaskOrHome(false);
        }

        @Override
@@ -118,7 +120,7 @@ public class RecentsTvActivity extends Activity implements OnPreDrawListener {
            new PipRecentsOverlayManager.Callback() {
                @Override
                public void onClosed() {
                    dismissRecentsToLaunchTargetTaskOrHome();
                    dismissRecentsToLaunchTargetTaskOrHome(true);
                }

                @Override
@@ -211,13 +213,15 @@ public class RecentsTvActivity extends Activity implements OnPreDrawListener {
        }
    }

    boolean dismissRecentsToLaunchTargetTaskOrHome() {
    boolean dismissRecentsToLaunchTargetTaskOrHome(boolean animate) {
        SystemServicesProxy ssp = Recents.getSystemServices();
        if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) {
            // If we have a focused Task, launch that Task now
            if (mRecentsView.launchPreviousTask()) return true;
            if (mRecentsView.launchPreviousTask(animate)) {
              return true;
            }
            // If none of the other cases apply, then just go Home
            dismissRecentsToHome(true /* animateTaskViews */);
            dismissRecentsToHome(animate /* animateTaskViews */);
        }
        return false;
    }
@@ -374,7 +378,7 @@ public class RecentsTvActivity extends Activity implements OnPreDrawListener {
    public void onEnterAnimationComplete() {
        super.onEnterAnimationComplete();
        if(mLaunchedFromHome) {
            mHomeRecentsEnterExitAnimationHolder.startEnterAnimation();
            mHomeRecentsEnterExitAnimationHolder.startEnterAnimation(mPipManager.isPipShown());
        }
        EventBus.getDefault().send(new EnterRecentsWindowAnimationCompletedEvent());
    }
@@ -463,7 +467,7 @@ public class RecentsTvActivity extends Activity implements OnPreDrawListener {
        if (launchState.launchedFromHome) {
            dismissRecentsToHome(true /* animateTaskViews */);
        } else {
            dismissRecentsToLaunchTargetTaskOrHome();
            dismissRecentsToLaunchTargetTaskOrHome(true);
        }
    }

@@ -561,6 +565,8 @@ public class RecentsTvActivity extends Activity implements OnPreDrawListener {
            // as if it's the part of the Recents UI.
            mPipRecentsOverlayManager.requestFocus(
                    mTaskStackViewAdapter.getItemCount() > 0);
        } else {
            mPipRecentsOverlayManager.clearFocus();
        }
    }
}
+10 −8
Original line number Diff line number Diff line
@@ -29,7 +29,8 @@ public class DismissAnimationsHolder {
    private LinearLayout mDismissArea;
    private LinearLayout mInfoField;
    private View mThumbnailView;
    private int mCardYDelta;
    private int mDismissEnterYDelta;
    private int mDismissStartYDelta;
    private long mShortDuration;
    private long mLongDuration;

@@ -38,7 +39,8 @@ public class DismissAnimationsHolder {
        mDismissArea = (LinearLayout) taskCardView.findViewById(R.id.card_dismiss);
        mThumbnailView = taskCardView.findViewById(R.id.card_view_thumbnail);
        Resources res = taskCardView.getResources();
        mCardYDelta = res.getDimensionPixelOffset(R.dimen.recents_tv_dismiss_shift_down);
        mDismissEnterYDelta = res.getDimensionPixelOffset(R.dimen.recents_tv_dismiss_shift_down);
        mDismissStartYDelta = mDismissEnterYDelta * 2;
        mShortDuration =  res.getInteger(R.integer.dismiss_short_duration);
        mLongDuration =  res.getInteger(R.integer.dismiss_long_duration);
    }
@@ -52,13 +54,13 @@ public class DismissAnimationsHolder {
        mInfoField.animate()
                .setDuration(mShortDuration)
                .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
                .translationYBy(mCardYDelta)
                .translationY(mDismissEnterYDelta)
                .alpha(0.5f);

        mThumbnailView.animate()
                .setDuration(mShortDuration)
                .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
                .translationYBy(mCardYDelta)
                .translationY(mDismissEnterYDelta)
                .alpha(0.5f);
    }

@@ -71,13 +73,13 @@ public class DismissAnimationsHolder {
        mInfoField.animate()
                .setDuration(mShortDuration)
                .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
                .translationYBy(-mCardYDelta)
                .translationY(0)
                .alpha(1.0f);

        mThumbnailView.animate()
                .setDuration(mShortDuration)
                .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
                .translationYBy(-mCardYDelta)
                .translationY(0)
                .alpha(1.0f);
    }

@@ -90,14 +92,14 @@ public class DismissAnimationsHolder {
        mInfoField.animate()
                .setDuration(mLongDuration)
                .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
                .translationYBy(mCardYDelta)
                .translationY(mDismissStartYDelta)
                .alpha(0.0f)
                .setListener(listener);

        mThumbnailView.animate()
                .setDuration(mLongDuration)
                .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
                .translationYBy(mCardYDelta)
                .translationY(mDismissStartYDelta)
                .alpha(0.0f);
    }

+4 −2
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ public class HomeRecentsEnterExitAnimationHolder {

    private Context mContext;
    private TaskStackHorizontalGridView mGridView;
    private float mDimAlpha;
    private long mDelay;
    private int mDuration;
    private int mTranslationX;
@@ -36,18 +37,19 @@ public class HomeRecentsEnterExitAnimationHolder {
            TaskStackHorizontalGridView gridView) {
        mContext = context;
        mGridView = gridView;
        mDimAlpha = mContext.getResources().getFloat(R.dimen.recents_recents_row_dim_alpha);
        mTranslationX = mContext.getResources()
                .getDimensionPixelSize(R.dimen.recents_tv_home_recents_shift);
        mDelay = mContext.getResources().getInteger(R.integer.recents_home_delay);
        mDuration =  mContext.getResources().getInteger(R.integer.recents_home_duration);
    }

    public void startEnterAnimation() {
    public void startEnterAnimation(boolean isPipShown) {
        for(int i = 0; i < mGridView.getChildCount(); i++) {
            TaskCardView view = (TaskCardView) mGridView.getChildAt(i);
            view.setTranslationX(-mTranslationX);
            view.animate()
                    .alpha(1.0f)
                    .alpha(isPipShown ? mDimAlpha : 1.0f)
                    .translationX(0)
                    .setDuration(mDuration)
                    .setStartDelay(mDelay * i)
Loading