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

Commit 9605efa6 authored by Johannes Gallmann's avatar Johannes Gallmann
Browse files

Cleanup unused RevealParams from RemoteInputView

Bug: 260335638
Flag: LEGACY NOTIFICATION_INLINE_REPLY_ANIMATION ENABLED
Test: atest RemoteInputViewTest
Test: Manual, i.e. verifying that inline reply animations work as expected
Change-Id: I4a53664996693b278f01df4d1c7d148000934685
parent 150e981c
Loading
Loading
Loading
Loading
+0 −19
Original line number Diff line number Diff line
@@ -41,7 +41,6 @@ import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.RemoteViews;
import android.widget.RemoteViews.InteractionHandler;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -473,25 +472,7 @@ public class NotificationRemoteInputManager implements CoreStartable {
            // if we still didn't find a view that is attached, let's abort.
            return false;
        }
        int width = view.getWidth();
        if (view instanceof TextView) {
            // Center the reveal on the text which might be off-center from the TextView
            TextView tv = (TextView) view;
            if (tv.getLayout() != null) {
                int innerWidth = (int) tv.getLayout().getLineWidth(0);
                innerWidth += tv.getCompoundPaddingLeft() + tv.getCompoundPaddingRight();
                width = Math.min(width, innerWidth);
            }
        }
        int cx = view.getLeft() + width / 2;
        int cy = view.getTop() + view.getHeight() / 2;
        int w = riv.getWidth();
        int h = riv.getHeight();
        int r = Math.max(
                Math.max(cx + cy, cx + (h - cy)),
                Math.max((w - cx) + cy, (w - cx) + (h - cy)));

        riv.getController().setRevealParams(new RemoteInputView.RevealParams(cx, cy, r));

        riv.getController().setPendingIntent(pendingIntent);
        riv.getController().setRemoteInput(input);
        riv.getController().setRemoteInputs(inputs);
+0 −43
Original line number Diff line number Diff line
@@ -45,7 +45,6 @@ import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.OnReceiveContentListener;
import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.ViewGroup;
import android.view.ViewRootImpl;
import android.view.WindowInsets;
@@ -85,9 +84,7 @@ import com.android.systemui.res.R;
import com.android.systemui.statusbar.RemoteInputController;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.wrapper.NotificationViewWrapper;
import com.android.systemui.statusbar.notification.stack.StackStateAnimator;
import com.android.systemui.statusbar.phone.LightBarController;
import com.android.wm.shell.animation.Interpolators;

import java.util.ArrayList;
import java.util.Collection;
@@ -132,8 +129,6 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
    private boolean mColorized;
    private int mLastBackgroundColor;
    private boolean mResetting;
    @Nullable
    private RevealParams mRevealParams;
    private Rect mContentBackgroundBounds;
    private boolean mIsAnimatingAppearance = false;

@@ -465,20 +460,6 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
                if (actionsContainer != null) actionsContainer.setAlpha(0f);
                animator.start();

            } else if (animate && mRevealParams != null && mRevealParams.radius > 0) {
                android.animation.Animator reveal = mRevealParams.createCircularHideAnimator(this);
                reveal.setInterpolator(Interpolators.FAST_OUT_LINEAR_IN);
                reveal.setDuration(StackStateAnimator.ANIMATION_DURATION_CLOSE_REMOTE_INPUT);
                reveal.addListener(new android.animation.AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(android.animation.Animator animation) {
                        setVisibility(GONE);
                        if (mWrapper != null) {
                            mWrapper.setRemoteInputVisible(false);
                        }
                    }
                });
                reveal.start();
            } else {
                setVisibility(GONE);
                if (doAfterDefocus != null) doAfterDefocus.run();
@@ -720,10 +701,6 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
        mRemoved = true;
    }

    public void setRevealParameters(@Nullable RevealParams revealParams) {
        mRevealParams = revealParams;
    }

    @Override
    public void dispatchStartTemporaryDetach() {
        super.dispatchStartTemporaryDetach();
@@ -1178,24 +1155,4 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
        }

    }

    public static class RevealParams {
        final int centerX;
        final int centerY;
        final int radius;

        public RevealParams(int centerX, int centerY, int radius) {
            this.centerX = centerX;
            this.centerY = centerY;
            this.radius = radius;
        }

        android.animation.Animator createCircularHideAnimator(View view) {
            return ViewAnimationUtils.createCircularReveal(view, centerX, centerY, radius, 0);
        }

        android.animation.Animator createCircularRevealAnimator(View view) {
            return ViewAnimationUtils.createCircularReveal(view, centerX, centerY, 0, radius);
        }
    }
}
+1 −14
Original line number Diff line number Diff line
@@ -30,14 +30,13 @@ import android.util.ArraySet
import android.util.Log
import android.view.View
import com.android.internal.logging.UiEventLogger
import com.android.systemui.res.R
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.res.R
import com.android.systemui.statusbar.NotificationRemoteInputManager
import com.android.systemui.statusbar.RemoteInputController
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.collection.NotificationEntry.EditedSuggestionInfo
import com.android.systemui.statusbar.policy.RemoteInputView.NotificationRemoteInputEvent
import com.android.systemui.statusbar.policy.RemoteInputView.RevealParams
import com.android.systemui.statusbar.policy.dagger.RemoteInputViewScope
import javax.inject.Inject

@@ -61,8 +60,6 @@ interface RemoteInputViewController {
    /** Other [RemoteInput]s from the notification associated with this Controller. */
    var remoteInputs: Array<RemoteInput>?

    var revealParams: RevealParams?

    /**
     * Sets the smart reply that should be inserted in the remote input, or `null` if the user is
     * not editing a smart reply.
@@ -91,7 +88,6 @@ interface RemoteInputViewController {
        other.close()
        remoteInput = other.remoteInput
        remoteInputs = other.remoteInputs
        revealParams = other.revealParams
        pendingIntent = other.pendingIntent
        focus()
    }
@@ -142,14 +138,6 @@ class RemoteInputViewControllerImpl @Inject constructor(
    override var pendingIntent: PendingIntent? = null
    override var remoteInputs: Array<RemoteInput>? = null

    override var revealParams: RevealParams? = null
        set(value) {
            field = value
            if (isBound) {
                view.setRevealParameters(value)
            }
        }

    override val isActive: Boolean get() = view.isActive

    override fun bind() {
@@ -161,7 +149,6 @@ class RemoteInputViewControllerImpl @Inject constructor(
            view.setHintText(it.label)
            view.setSupportedMimeTypes(it.allowedDataTypes)
        }
        view.setRevealParameters(revealParams)

        view.addOnEditTextFocusChangedListener(onFocusChangeListener)
        view.addOnSendRemoteInputListener(onSendRemoteInputListener)