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

Commit 495c9709 authored by Selim Cinek's avatar Selim Cinek Committed by android-build-merger
Browse files

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

am: f5ad45f0

Change-Id: I173a86665aea690cc210f45bbd811ce3ce2b6918
parents ec22451b f5ad45f0
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -51,12 +51,10 @@


        <ImageButton
        <ImageButton
                android:layout_width="wrap_content"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:layout_gravity="center"
                android:paddingStart="12dp"
                android:paddingStart="12dp"
                android:paddingEnd="24dp"
                android:paddingEnd="24dp"
                android:paddingTop="16dp"
                android:paddingBottom="16dp"
                android:id="@+id/remote_input_send"
                android:id="@+id/remote_input_send"
                android:src="@drawable/ic_send"
                android:src="@drawable/ic_send"
                android:contentDescription="@*android:string/ime_action_send"
                android:contentDescription="@*android:string/ime_action_send"
+37 −0
Original line number Original line Diff line number Diff line
@@ -26,6 +26,7 @@ import android.service.notification.StatusBarNotification;
import android.util.ArraySet;
import android.util.ArraySet;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Log;
import android.view.MotionEvent;
import android.view.NotificationHeaderView;
import android.view.NotificationHeaderView;
import android.view.View;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup;
@@ -1631,6 +1632,42 @@ public class NotificationContentView extends FrameLayout {
        return null;
        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() {
    public int getExpandHeight() {
        int viewType = VISIBLE_TYPE_EXPANDED;
        int viewType = VISIBLE_TYPE_EXPANDED;
        if (mExpandedChild == null) {
        if (mExpandedChild == null) {
+9 −6
Original line number Original line Diff line number Diff line
@@ -4998,6 +4998,14 @@ public class StatusBar extends SystemUI implements DemoMode,


    @Override
    @Override
    public void onNotificationClicked(StatusBarNotification sbn, ExpandableNotificationRow row) {
    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();
        Notification notification = sbn.getNotification();
        final PendingIntent intent = notification.contentIntent != null
        final PendingIntent intent = notification.contentIntent != null
                ? notification.contentIntent
                ? notification.contentIntent
@@ -5061,12 +5069,7 @@ public class StatusBar extends SystemUI implements DemoMode,
                    Intent fillInIntent = null;
                    Intent fillInIntent = null;
                    Entry entry = row.getEntry();
                    Entry entry = row.getEntry();
                    CharSequence remoteInputText = null;
                    CharSequence remoteInputText = null;
                    RemoteInputController controller = mRemoteInputManager.getController();
                    if (!TextUtils.isEmpty(entry.remoteInputText)) {
                    if (controller.isRemoteInputActive(entry)) {
                        remoteInputText = row.getActiveRemoteInputText();
                    }
                    if (TextUtils.isEmpty(remoteInputText)
                            && !TextUtils.isEmpty(entry.remoteInputText)) {
                        remoteInputText = entry.remoteInputText;
                        remoteInputText = entry.remoteInputText;
                    }
                    }
                    if (!TextUtils.isEmpty(remoteInputText)
                    if (!TextUtils.isEmpty(remoteInputText)