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

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

Merge "Fixed the touch targets when replying" into pi-dev

parents 42a53783 a77d2c58
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -51,12 +51,10 @@

        <ImageButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:paddingStart="12dp"
                android:paddingEnd="24dp"
                android:paddingTop="16dp"
                android:paddingBottom="16dp"
                android:id="@+id/remote_input_send"
                android:src="@drawable/ic_send"
                android:contentDescription="@*android:string/ime_action_send"
+37 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.service.notification.StatusBarNotification;
import android.util.ArraySet;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.NotificationHeaderView;
import android.view.View;
import android.view.ViewGroup;
@@ -1631,6 +1632,42 @@ public class NotificationContentView extends FrameLayout {
        return null;
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        float y = ev.getY();
        // We still want to distribute touch events to the remote input even if it's outside the
        // view boundary. We're therefore manually dispatching these events to the remote view
        RemoteInputView riv = getRemoteInputForView(getViewForVisibleType(mVisibleType));
        if (riv != null && riv.getVisibility() == VISIBLE) {
            int inputStart = mUnrestrictedContentHeight - riv.getHeight();
            if (y <= mUnrestrictedContentHeight && y >= inputStart) {
                ev.offsetLocation(0, -inputStart);
                return riv.dispatchTouchEvent(ev);
            }
        }
        return super.dispatchTouchEvent(ev);
    }

    /**
     * Overridden to make sure touches to the reply action bar actually go through to this view
     */
    @Override
    public boolean pointInView(float localX, float localY, float slop) {
        float top = mClipTopAmount;
        float bottom = mUnrestrictedContentHeight;
        return localX >= -slop && localY >= top - slop && localX < ((mRight - mLeft) + slop) &&
                localY < (bottom + slop);
    }

    private RemoteInputView getRemoteInputForView(View child) {
        if (child == mExpandedChild) {
            return mExpandedRemoteInput;
        } else if (child == mHeadsUpChild) {
            return mHeadsUpRemoteInput;
        }
        return null;
    }

    public int getExpandHeight() {
        int viewType = VISIBLE_TYPE_EXPANDED;
        if (mExpandedChild == null) {
+9 −6
Original line number Diff line number Diff line
@@ -4998,6 +4998,14 @@ public class StatusBar extends SystemUI implements DemoMode,

    @Override
    public void onNotificationClicked(StatusBarNotification sbn, ExpandableNotificationRow row) {
        RemoteInputController controller = mRemoteInputManager.getController();
        if (controller.isRemoteInputActive(row.getEntry())
                && !TextUtils.isEmpty(row.getActiveRemoteInputText())) {
            // We have an active remote input typed and the user clicked on the notification.
            // this was probably unintentional, so we're closing the edit text instead.
            controller.closeRemoteInputs();
            return;
        }
        Notification notification = sbn.getNotification();
        final PendingIntent intent = notification.contentIntent != null
                ? notification.contentIntent
@@ -5061,12 +5069,7 @@ public class StatusBar extends SystemUI implements DemoMode,
                    Intent fillInIntent = null;
                    Entry entry = row.getEntry();
                    CharSequence remoteInputText = null;
                    RemoteInputController controller = mRemoteInputManager.getController();
                    if (controller.isRemoteInputActive(entry)) {
                        remoteInputText = row.getActiveRemoteInputText();
                    }
                    if (TextUtils.isEmpty(remoteInputText)
                            && !TextUtils.isEmpty(entry.remoteInputText)) {
                    if (!TextUtils.isEmpty(entry.remoteInputText)) {
                        remoteInputText = entry.remoteInputText;
                    }
                    if (!TextUtils.isEmpty(remoteInputText)