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

Commit b89d5cc2 authored by George Mount's avatar George Mount
Browse files

Allow Activities to opt into using Overlay for shared elements.

Bug 17001227

Change-Id: Icc49a81357ee69abd2a15a1d1efcead298ab3fb7
parent 94f6878b
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -1445,6 +1445,7 @@ package android {
    field public static final int windowSharedElementExitTransition = 16843834; // 0x101043a
    field public static final int windowSharedElementExitTransition = 16843834; // 0x101043a
    field public static final int windowSharedElementReenterTransition = 16843954; // 0x10104b2
    field public static final int windowSharedElementReenterTransition = 16843954; // 0x10104b2
    field public static final int windowSharedElementReturnTransition = 16843953; // 0x10104b1
    field public static final int windowSharedElementReturnTransition = 16843953; // 0x10104b1
    field public static final int windowSharedElementsUseOverlay = 16843964; // 0x10104bc
    field public static final int windowShowAnimation = 16842934; // 0x10100b6
    field public static final int windowShowAnimation = 16842934; // 0x10100b6
    field public static final int windowShowWallpaper = 16843410; // 0x1010292
    field public static final int windowShowWallpaper = 16843410; // 0x1010292
    field public static final int windowSoftInputMode = 16843307; // 0x101022b
    field public static final int windowSoftInputMode = 16843307; // 0x101022b
@@ -35138,6 +35139,7 @@ package android.view {
    method public android.transition.Transition getSharedElementExitTransition();
    method public android.transition.Transition getSharedElementExitTransition();
    method public android.transition.Transition getSharedElementReenterTransition();
    method public android.transition.Transition getSharedElementReenterTransition();
    method public android.transition.Transition getSharedElementReturnTransition();
    method public android.transition.Transition getSharedElementReturnTransition();
    method public boolean getSharedElementsUseOverlay();
    method public abstract int getStatusBarColor();
    method public abstract int getStatusBarColor();
    method public long getTransitionBackgroundFadeDuration();
    method public long getTransitionBackgroundFadeDuration();
    method public android.transition.TransitionManager getTransitionManager();
    method public android.transition.TransitionManager getTransitionManager();
@@ -35199,6 +35201,7 @@ package android.view {
    method public void setSharedElementExitTransition(android.transition.Transition);
    method public void setSharedElementExitTransition(android.transition.Transition);
    method public void setSharedElementReenterTransition(android.transition.Transition);
    method public void setSharedElementReenterTransition(android.transition.Transition);
    method public void setSharedElementReturnTransition(android.transition.Transition);
    method public void setSharedElementReturnTransition(android.transition.Transition);
    method public void setSharedElementsUseOverlay(boolean);
    method public void setSoftInputMode(int);
    method public void setSoftInputMode(int);
    method public abstract void setStatusBarColor(int);
    method public abstract void setStatusBarColor(int);
    method public abstract void setTitle(java.lang.CharSequence);
    method public abstract void setTitle(java.lang.CharSequence);
+14 −7
Original line number Original line Diff line number Diff line
@@ -665,6 +665,9 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
    }
    }


    protected void moveSharedElementsToOverlay() {
    protected void moveSharedElementsToOverlay() {
        if (!mWindow.getSharedElementsUseOverlay()) {
            return;
        }
        int numSharedElements = mSharedElements.size();
        int numSharedElements = mSharedElements.size();
        ViewGroup decor = getDecor();
        ViewGroup decor = getDecor();
        if (decor != null) {
        if (decor != null) {
@@ -700,6 +703,17 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
    }
    }


    protected void moveSharedElementsFromOverlay() {
    protected void moveSharedElementsFromOverlay() {
        int numListeners = mGhostViewListeners.size();
        for (int i = 0; i < numListeners; i++) {
            GhostViewListeners listener = mGhostViewListeners.get(i);
            ViewGroup parent = (ViewGroup) listener.getView().getParent();
            parent.getViewTreeObserver().removeOnPreDrawListener(listener);
        }
        mGhostViewListeners.clear();

        if (mWindow == null || !mWindow.getSharedElementsUseOverlay()) {
            return;
        }
        ViewGroup decor = getDecor();
        ViewGroup decor = getDecor();
        if (decor != null) {
        if (decor != null) {
            ViewGroupOverlay overlay = decor.getOverlay();
            ViewGroupOverlay overlay = decor.getOverlay();
@@ -709,13 +723,6 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
                GhostView.removeGhost(sharedElement);
                GhostView.removeGhost(sharedElement);
            }
            }
        }
        }
        int numListeners = mGhostViewListeners.size();
        for (int i = 0; i < numListeners; i++) {
            GhostViewListeners listener = mGhostViewListeners.get(i);
            ViewGroup parent = (ViewGroup) listener.getView().getParent();
            parent.getViewTreeObserver().removeOnPreDrawListener(listener);
        }
        mGhostViewListeners.clear();
    }
    }


    protected void setGhostVisibility(int visibility) {
    protected void setGhostVisibility(int visibility) {
+21 −0
Original line number Original line Diff line number Diff line
@@ -1661,6 +1661,27 @@ public abstract class Window {
     */
     */
    public void setTransitionBackgroundFadeDuration(long fadeDurationMillis) { }
    public void setTransitionBackgroundFadeDuration(long fadeDurationMillis) { }


    /**
     * Returns <code>true</code> when shared elements should use an Overlay during
     * shared element transitions or <code>false</code> when they should animate as
     * part of the normal View hierarchy. The default value is true.
     *
     * @return <code>true</code> when shared elements should use an Overlay during
     * shared element transitions or <code>false</code> when they should animate as
     * part of the normal View hierarchy.
     */
    public boolean getSharedElementsUseOverlay() { return true; }

    /**
     * Sets whether or not shared elements should use an Overlay during shared element transitions.
     * The default value is true.
     *
     * @param sharedElementsUseOverlay <code>true</code> indicates that shared elements should
     *                                 be transitioned with an Overlay or <code>false</code>
     *                                 to transition within the normal View hierarchy.
     */
    public void setSharedElementsUseOverlay(boolean sharedElementsUseOverlay) { }

    /**
    /**
     * @return the color of the status bar.
     * @return the color of the status bar.
     */
     */
+8 −0
Original line number Original line Diff line number Diff line
@@ -517,6 +517,10 @@
             {@link android.view.Window#setAllowExitTransitionOverlap(boolean)}. -->
             {@link android.view.Window#setAllowExitTransitionOverlap(boolean)}. -->
        <attr name="windowAllowExitTransitionOverlap" format="boolean"/>
        <attr name="windowAllowExitTransitionOverlap" format="boolean"/>


        <!-- Indicates whether or not shared elements should use an overlay
             during transitions. The default value is true. -->
        <attr name="windowSharedElementsUseOverlay" format="boolean"/>

        <!-- Internal layout used internally for window decor -->
        <!-- Internal layout used internally for window decor -->
        <attr name="windowActionBarFullscreenDecorLayout" format="reference" />
        <attr name="windowActionBarFullscreenDecorLayout" format="reference" />


@@ -1836,6 +1840,10 @@
             {@link android.view.Window#setAllowExitTransitionOverlap(boolean)}. -->
             {@link android.view.Window#setAllowExitTransitionOverlap(boolean)}. -->
        <attr name="windowAllowExitTransitionOverlap"/>
        <attr name="windowAllowExitTransitionOverlap"/>


        <!-- Indicates whether or not shared elements should use an overlay
             during transitions. The default value is true. -->
        <attr name="windowSharedElementsUseOverlay"/>

        <!-- Flag indicating whether this Window is responsible for drawing the background for the
        <!-- Flag indicating whether this Window is responsible for drawing the background for the
             system bars. If true and the window is not floating, the system bars are drawn with a
             system bars. If true and the window is not floating, the system bars are drawn with a
             transparent background and the corresponding areas in this window are filled with the
             transparent background and the corresponding areas in this window are filled with the
+1 −0
Original line number Original line Diff line number Diff line
@@ -2275,6 +2275,7 @@
  <public type="attr" name="outlineProvider" />
  <public type="attr" name="outlineProvider" />
  <public type="attr" name="ageHint" />
  <public type="attr" name="ageHint" />
  <public type="attr" name="country" />
  <public type="attr" name="country" />
  <public type="attr" name="windowSharedElementsUseOverlay" />


  <public-padding type="dimen" name="l_resource_pad" end="0x01050010" />
  <public-padding type="dimen" name="l_resource_pad" end="0x01050010" />


Loading