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

Commit 87574b7b authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge changes Ibec23fdb,Id7be5129,I25af8fad,Idbabfe39,I86b10805, ... into nyc-dev

* changes:
  Hiding clear-all button on drag start.
  Adding hint text for drop targets.
  Fixing animation spec animation problem.
  Making the dismiss animation feel smoother.
  Fixing issue with gap between task views.
  Adding desired undocking animation.
parents 84f0b791 b677bcbe
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -32,4 +32,5 @@
    android:shadowRadius="5"
    android:fontFamily="sans-serif-medium"
    android:background="?android:selectableItemBackground"
    android:visibility="invisible" />
    android:visibility="invisible"
    android:forceHasOverlappingRendering="false" />
+3 −0
Original line number Diff line number Diff line
@@ -640,6 +640,9 @@
    <!-- The amount of overscroll allowed when flinging to the end of the stack. -->
    <dimen name="recents_fling_overscroll_distance">24dp</dimen>

    <!-- The size of the drag hint text. -->
    <dimen name="recents_drag_hint_text_size">14sp</dimen>

    <!-- The min alpha to apply to a task affiliation group color. -->
    <item name="recents_task_affiliation_color_min_alpha_percentage" format="float" type="dimen">0.6</item>

+2 −0
Original line number Diff line number Diff line
@@ -737,6 +737,8 @@
    <string name="recents_stack_action_button_label">Clear all</string>
    <!-- Recents: Incompatible task message. [CHAR LIMIT=NONE] -->
    <string name="recents_incompatible_app_message">App doesn\'t support split screen</string>
    <!-- Recents: Hint text that shows on the drop targets to start multiwindow. [CHAR LIMIT=NONE] -->
    <string name="recents_drag_hint_message">Drag here to use split screen</string>

    <!-- Recents: MultiStack add stack split horizontal radio button. [CHAR LIMIT=NONE] -->
    <string name="recents_multistack_add_stack_dialog_split_horizontal">Split Horizontal</string>
+25 −18
Original line number Diff line number Diff line
@@ -51,11 +51,9 @@ public class SwipeHelper implements Gefingerpoken {
    private float SWIPE_ESCAPE_VELOCITY = 100f; // dp/sec
    private int DEFAULT_ESCAPE_ANIMATION_DURATION = 200; // ms
    private int MAX_ESCAPE_ANIMATION_DURATION = 400; // ms
    private int MAX_DISMISS_VELOCITY = 2000; // dp/sec
    private int MAX_DISMISS_VELOCITY = 4000; // dp/sec
    private static final int SNAP_ANIM_LEN = SLOW_ANIMATIONS ? 1000 : 150; // ms

    public static float SWIPE_PROGRESS_FADE_START = 0f; // fraction of thumbnail width
                                                 // where fade starts
    static final float SWIPE_PROGRESS_FADE_END = 0.5f; // fraction of thumbnail width
                                              // beyond which swipe progress->0
    private float mMinSwipeProgress = 0f;
@@ -102,8 +100,7 @@ public class SwipeHelper implements Gefingerpoken {
        mFalsingThreshold = context.getResources().getDimensionPixelSize(
                R.dimen.swipe_helper_falsing_threshold);
        mFalsingManager = FalsingManager.getInstance(context);
        mFlingAnimationUtils = new FlingAnimationUtils(context,
                MAX_ESCAPE_ANIMATION_DURATION / 1000f /* maxLengthSeconds */);
        mFlingAnimationUtils = new FlingAnimationUtils(context, getMaxEscapeAnimDuration() / 1000f);
    }

    public void setLongPressListener(LongPressListener listener) {
@@ -183,21 +180,23 @@ public class SwipeHelper implements Gefingerpoken {
        mMaxSwipeProgress = maxSwipeProgress;
    }

    private float getSwipeProgressForOffset(View view) {
    private float getSwipeProgressForOffset(View view, float translation) {
        float viewSize = getSize(view);
        final float fadeSize = SWIPE_PROGRESS_FADE_END * viewSize;
        float result = 1.0f;
        float pos = getTranslation(view);
        if (pos >= viewSize * SWIPE_PROGRESS_FADE_START) {
            result = 1.0f - (pos - viewSize * SWIPE_PROGRESS_FADE_START) / fadeSize;
        } else if (pos < viewSize * (1.0f - SWIPE_PROGRESS_FADE_START)) {
            result = 1.0f + (viewSize * SWIPE_PROGRESS_FADE_START + pos) / fadeSize;
        }
        float result = Math.abs(translation / viewSize);
        return Math.min(Math.max(mMinSwipeProgress, result), mMaxSwipeProgress);
    }

    private float getSwipeAlpha(float progress) {
        return Math.min(0, Math.max(1, progress / SWIPE_PROGRESS_FADE_END));
    }

    private void updateSwipeProgressFromOffset(View animView, boolean dismissable) {
        float swipeProgress = getSwipeProgressForOffset(animView);
        updateSwipeProgressFromOffset(animView, dismissable, getTranslation(animView));
    }

    private void updateSwipeProgressFromOffset(View animView, boolean dismissable,
            float translation) {
        float swipeProgress = getSwipeProgressForOffset(animView, translation);
        if (!mCallback.updateSwipeProgress(animView, dismissable, swipeProgress)) {
            if (FADE_OUT_DURING_SWIPE && dismissable) {
                float alpha = swipeProgress;
@@ -208,7 +207,7 @@ public class SwipeHelper implements Gefingerpoken {
                        animView.setLayerType(View.LAYER_TYPE_NONE, null);
                    }
                }
                animView.setAlpha(getSwipeProgressForOffset(animView));
                animView.setAlpha(getSwipeAlpha(swipeProgress));
            }
        }
        invalidateGlobalRegion(animView);
@@ -485,7 +484,7 @@ public class SwipeHelper implements Gefingerpoken {
     * view is being animated to dismiss or snap.
     */
    public void onTranslationUpdate(View animView, float value, boolean canBeDismissed) {
        updateSwipeProgressFromOffset(animView, canBeDismissed);
        updateSwipeProgressFromOffset(animView, canBeDismissed, value);
    }

    private void snapChildInstantly(final View view) {
@@ -600,7 +599,15 @@ public class SwipeHelper implements Gefingerpoken {
    }

    protected float getEscapeVelocity() {
        return SWIPE_ESCAPE_VELOCITY * mDensityScale;
        return getUnscaledEscapeVelocity() * mDensityScale;
    }

    protected float getUnscaledEscapeVelocity() {
        return SWIPE_ESCAPE_VELOCITY;
    }

    protected long getMaxEscapeAnimDuration() {
        return MAX_ESCAPE_ANIMATION_DURATION;
    }

    protected boolean swipedFarEnough() {
+2 −8
Original line number Diff line number Diff line
@@ -349,7 +349,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        loader.loadTasks(this, loadPlan, loadOpts);
        TaskStack stack = loadPlan.getTaskStack();
        mRecentsView.onReload(mIsVisible, stack.getTaskCount() == 0);
        mRecentsView.updateStack(stack);
        mRecentsView.updateStack(stack, true /* setStackViewTasks */);

        // Update the nav bar scrim, but defer the animation until the enter-window event
        boolean animateNavBarScrim = !launchState.launchedViaDockGesture;
@@ -455,13 +455,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD

        EventBus.getDefault().send(new ConfigurationChangedEvent(true /* fromMultiWindow */,
                false /* fromDeviceOrientationChange */, numStackTasks > 0));

        if (mRecentsView != null) {
            mRecentsView.updateStack(stack);
        }

        EventBus.getDefault().send(new MultiWindowStateChangedEvent(isInMultiWindowMode,
                numStackTasks > 0));
        EventBus.getDefault().send(new MultiWindowStateChangedEvent(isInMultiWindowMode, stack));
    }

    @Override
Loading