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

Commit a7e2e4b5 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Simplify UI and animation choreography a bit" into sc-dev

parents 5dc6029d d32ce863
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -25,7 +25,7 @@
    android:layout_marginBottom="@dimen/screenshot_offset_y"
    android:layout_marginBottom="@dimen/screenshot_offset_y"
    android:scaleType="fitEnd"
    android:scaleType="fitEnd"
    android:elevation="@dimen/screenshot_preview_elevation"
    android:elevation="@dimen/screenshot_preview_elevation"
    android:visibility="gone"
    android:visibility="invisible"
    android:background="@drawable/screenshot_rounded_corners"
    android:background="@drawable/screenshot_rounded_corners"
    android:adjustViewBounds="true"
    android:adjustViewBounds="true"
    android:contentDescription="@string/screenshot_edit_label"
    android:contentDescription="@string/screenshot_edit_label"
+177 −132

File changed.

Preview size limit exceeded, changes collapsed.

+16 −12
Original line number Original line Diff line number Diff line
@@ -316,21 +316,21 @@ public class ScreenshotView extends FrameLayout implements
        mScreenshotSelectorView.requestFocus();
        mScreenshotSelectorView.requestFocus();
    }
    }


    void prepareForAnimation(Bitmap bitmap, Insets screenInsets) {
    void setScreenshot(Bitmap bitmap, Insets screenInsets) {
        mScreenshotPreview.setImageDrawable(createScreenDrawable(mResources, bitmap, screenInsets));
        mScreenshotPreview.setImageDrawable(createScreenDrawable(mResources, bitmap, screenInsets));
        // make static preview invisible (from gone) so we can query its location on screen
        mScreenshotPreview.setVisibility(View.INVISIBLE);
    }
    }


    AnimatorSet createScreenshotDropInAnimation(Rect bounds, boolean showFlash) {
    AnimatorSet createScreenshotDropInAnimation(Rect bounds, boolean showFlash) {
        mScreenshotPreview.setLayerType(View.LAYER_TYPE_HARDWARE, null);
        if (DEBUG_ANIM) {
        mScreenshotPreview.buildLayer();
            Log.d(TAG, "createAnim: bounds=" + bounds + " showFlash=" + showFlash);
        }


        Rect previewBounds = new Rect();
        Rect previewBounds = new Rect();
        mScreenshotPreview.getBoundsOnScreen(previewBounds);
        mScreenshotPreview.getBoundsOnScreen(previewBounds);
        int[] previewLocation = new int[2];
        Rect targetPosition = new Rect();
        mScreenshotPreview.getLocationInWindow(previewLocation);
        mScreenshotPreview.getHitRect(targetPosition);


        // ratio of preview width, end vs. start size
        float cornerScale =
        float cornerScale =
                mCornerSizeX / (mOrientationPortrait ? bounds.width() : bounds.height());
                mCornerSizeX / (mOrientationPortrait ? bounds.width() : bounds.height());
        final float currentScale = 1 / cornerScale;
        final float currentScale = 1 / cornerScale;
@@ -358,8 +358,13 @@ public class ScreenshotView extends FrameLayout implements


        // animate from the current location, to the static preview location
        // animate from the current location, to the static preview location
        final PointF startPos = new PointF(bounds.centerX(), bounds.centerY());
        final PointF startPos = new PointF(bounds.centerX(), bounds.centerY());
        final PointF finalPos = new PointF(previewLocation[0] + previewBounds.width() / 2f,
        final PointF finalPos = new PointF(targetPosition.exactCenterX(),
                previewLocation[1] + previewBounds.height() / 2f);
                targetPosition.exactCenterY());

        if (DEBUG_ANIM) {
            Log.d(TAG, "toCorner: startPos=" + startPos);
            Log.d(TAG, "toCorner: finalPos=" + finalPos);
        }


        ValueAnimator toCorner = ValueAnimator.ofFloat(0, 1);
        ValueAnimator toCorner = ValueAnimator.ofFloat(0, 1);
        toCorner.setDuration(SCREENSHOT_TO_CORNER_Y_DURATION_MS);
        toCorner.setDuration(SCREENSHOT_TO_CORNER_Y_DURATION_MS);
@@ -427,7 +432,7 @@ public class ScreenshotView extends FrameLayout implements
            @Override
            @Override
            public void onAnimationEnd(Animator animation) {
            public void onAnimationEnd(Animator animation) {
                if (DEBUG_ANIM) {
                if (DEBUG_ANIM) {
                    Log.d(TAG, "drop-in animation completed");
                    Log.d(TAG, "drop-in animation ended");
                }
                }
                mDismissButton.setOnClickListener(view -> {
                mDismissButton.setOnClickListener(view -> {
                    if (DEBUG_INPUT) {
                    if (DEBUG_INPUT) {
@@ -653,13 +658,12 @@ public class ScreenshotView extends FrameLayout implements
        getViewTreeObserver().removeOnComputeInternalInsetsListener(this);
        getViewTreeObserver().removeOnComputeInternalInsetsListener(this);
        // Clear any references to the bitmap
        // Clear any references to the bitmap
        mScreenshotPreview.setImageDrawable(null);
        mScreenshotPreview.setImageDrawable(null);
        mScreenshotPreview.setVisibility(View.INVISIBLE);
        mPendingSharedTransition = false;
        mPendingSharedTransition = false;
        mActionsContainerBackground.setVisibility(View.GONE);
        mActionsContainerBackground.setVisibility(View.GONE);
        mActionsContainer.setVisibility(View.GONE);
        mActionsContainer.setVisibility(View.GONE);
        mBackgroundProtection.setAlpha(0f);
        mBackgroundProtection.setAlpha(0f);
        mDismissButton.setVisibility(View.GONE);
        mDismissButton.setVisibility(View.GONE);
        mScreenshotPreview.setVisibility(View.GONE);
        mScreenshotPreview.setLayerType(View.LAYER_TYPE_NONE, null);
        mScreenshotStatic.setTranslationX(0);
        mScreenshotStatic.setTranslationX(0);
        mScreenshotPreview.setTranslationY(0);
        mScreenshotPreview.setTranslationY(0);
        mScreenshotPreview.setContentDescription(
        mScreenshotPreview.setContentDescription(
+1 −1
Original line number Original line Diff line number Diff line
@@ -72,7 +72,7 @@ public class ScrollCaptureController {
     *
     *
     * @param after action to take after the flow is complete
     * @param after action to take after the flow is complete
     */
     */
    public void run(final Runnable after) {
    public void start(final Runnable after) {
        mCaptureTime = ZonedDateTime.now();
        mCaptureTime = ZonedDateTime.now();
        mRequestId = UUID.randomUUID();
        mRequestId = UUID.randomUUID();
        mConnection.start((session) -> startCapture(session, after));
        mConnection.start((session) -> startCapture(session, after));
+51 −17

File changed.

Preview size limit exceeded, changes collapsed.