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

Commit 9f02d2fd authored by Jordan Demeulenaere's avatar Jordan Demeulenaere Committed by Android (Google) Code Review
Browse files

Merge changes from topic "dialog-refactor" into sc-v2-dev

* changes:
  Animate the cast dialog
  Refactor DialogLaunchAnimator and remove host dialog (2/2)
  Refactor DialogLaunchAnimator and remove host dialog (1/2)
parents f5fe79de 4538223f
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -151,6 +151,9 @@ public class Dialog implements DialogInterface, Window.Callback,

    private final Runnable mDismissAction = this::dismissDialog;

    /** A {@link Runnable} to run instead of dismissing when {@link #dismiss()} is called. */
    private Runnable mDismissOverride;

    /**
     * Creates a dialog window that uses the default dialog theme.
     * <p>
@@ -370,6 +373,11 @@ public class Dialog implements DialogInterface, Window.Callback,
     */
    @Override
    public void dismiss() {
        if (mDismissOverride != null) {
            mDismissOverride.run();
            return;
        }

        if (Looper.myLooper() == mHandler.getLooper()) {
            dismissDialog();
        } else {
@@ -1354,6 +1362,21 @@ public class Dialog implements DialogInterface, Window.Callback,
        mDismissMessage = msg;
    }

    /**
     * Set a {@link Runnable} to run when this dialog is dismissed instead of directly dismissing
     * it. This allows to animate the dialog in its window before dismissing it.
     *
     * Note that {@code override} should always end up calling this method with {@code null}
     * followed by a call to {@link #dismiss() dismiss} to actually dismiss the dialog.
     *
     * @see #dismiss()
     *
     * @hide
     */
    public void setDismissOverride(@Nullable Runnable override) {
        mDismissOverride = override;
    }

    /** @hide */
    public boolean takeCancelAndDismissListeners(@Nullable String msg,
            @Nullable OnCancelListener cancel, @Nullable OnDismissListener dismiss) {
+0 −1
Original line number Diff line number Diff line
@@ -16,5 +16,4 @@
-->
<resources>
    <item type="id" name="launch_animation_running"/>
    <item type="id" name="dialog_content_parent" />
</resources>
 No newline at end of file
+5 −10
Original line number Diff line number Diff line
@@ -15,15 +15,10 @@
     limitations under the License.
-->
<resources>
  <style name="HostDialogTheme">
    <item name="android:windowAnimationStyle">@style/Animation.HostDialog</item>
    <item name="android:windowIsFloating">false</item>
    <item name="android:backgroundDimEnabled">true</item>
    <item name="android:navigationBarColor">@android:color/transparent</item>
  </style>

  <style name="Animation.HostDialog" parent="@android:style/Animation">
    <item name="android:windowEnterAnimation">@anim/launch_host_dialog_enter</item>
    <item name="android:windowExitAnimation">@anim/launch_host_dialog_exit</item>
  <!-- An animation used by DialogLaunchAnimator to make a dialog appear instantly (to animate -->
  <!-- in-window) and disappear by fading out (when the exit into view is disabled). -->
  <style name="Animation.LaunchAnimation" parent="@android:style/Animation">
    <item name="android:windowEnterAnimation">@anim/launch_dialog_enter</item>
    <item name="android:windowExitAnimation">@anim/launch_dialog_exit</item>
  </style>
</resources>
 No newline at end of file
Loading