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

Commit 8d2ba6da authored by George Mount's avatar George Mount Committed by Android (Google) Code Review
Browse files

Merge "Pass elevation to enable shadow in shared elements." into lmp-dev

parents 1681ac0b 26c82b6e
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -128,6 +128,7 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
    protected static final String KEY_SNAPSHOT = "shared_element:bitmap";
    protected static final String KEY_SCALE_TYPE = "shared_element:scaleType";
    protected static final String KEY_IMAGE_MATRIX = "shared_element:imageMatrix";
    protected static final String KEY_ELEVATION = "shared_element:elevation";

    protected static final ImageView.ScaleType[] SCALE_TYPE_VALUES = ImageView.ScaleType.values();

@@ -393,6 +394,8 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {

        float z = sharedElementBundle.getFloat(KEY_TRANSLATION_Z);
        view.setTranslationZ(z);
        float elevation = sharedElementBundle.getFloat(KEY_ELEVATION);
        view.setElevation(elevation);

        float left = sharedElementBundle.getFloat(KEY_SCREEN_LEFT);
        float top = sharedElementBundle.getFloat(KEY_SCREEN_TOP);
@@ -499,6 +502,8 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
        state.mBottom = view.getBottom();
        state.mMeasuredWidth = view.getMeasuredWidth();
        state.mMeasuredHeight = view.getMeasuredHeight();
        state.mTranslationZ = view.getTranslationZ();
        state.mElevation = view.getElevation();
        if (!(view instanceof ImageView)) {
            return state;
        }
@@ -557,6 +562,8 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
                  imageView.setImageMatrix(state.mMatrix);
                }
            }
            view.setElevation(state.mElevation);
            view.setTranslationZ(state.mTranslationZ);
            int widthSpec = View.MeasureSpec.makeMeasureSpec(state.mMeasuredWidth,
                    View.MeasureSpec.EXACTLY);
            int heightSpec = View.MeasureSpec.makeMeasureSpec(state.mMeasuredHeight,
@@ -622,6 +629,7 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
        sharedElementBundle.putFloat(KEY_SCREEN_TOP, tempBounds.top);
        sharedElementBundle.putFloat(KEY_SCREEN_BOTTOM, tempBounds.bottom);
        sharedElementBundle.putFloat(KEY_TRANSLATION_Z, view.getTranslationZ());
        sharedElementBundle.putFloat(KEY_ELEVATION, view.getElevation());

        Parcelable bitmap = mListener.captureSharedElementSnapshot(view, tempMatrix, tempBounds);
        if (bitmap != null) {
@@ -801,5 +809,7 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
        int mMeasuredHeight;
        ImageView.ScaleType mScaleType;
        Matrix mMatrix;
        float mTranslationZ;
        float mElevation;
    }
}