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

Commit 3d2ecec8 authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

Merge changes I7993fde3,Ia804fc9b into rvc-dev

* changes:
  Fixed the double tap behavior on the expand button
  Forced the expand button to be double tappable on the lock screen
parents 8e0527a2 4f208ff3
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -271,6 +271,10 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
        }
    }

    public boolean isActive() {
        return mActivated;
    }

    private void startActivateAnimation(final boolean reverse) {
        if (!isAttachedToWindow()) {
            return;
+1 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ public class ActivatableNotificationViewController {
            if (mNeedsDimming && ev.getActionMasked() == MotionEvent.ACTION_DOWN
                    && mView.disallowSingleClick(ev)
                    && !mAccessibilityManager.isTouchExplorationEnabled()) {
                if (!mView.isActivated()) {
                if (!mView.isActive()) {
                    return true;
                } else if (!mDoubleTapHelper.isWithinDoubleTapSlop(ev)) {
                    mBlockNextTouch = true;
+11 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ class NotificationConversationTemplateViewWrapper constructor(
    private var conversationIcon: View? = null
    private var conversationBadge: View? = null
    private var expandButton: View? = null
    private lateinit var expandButtonContainer: View
    private var messagingLinearLayout: MessagingLinearLayout? = null

    init {
@@ -56,6 +57,8 @@ class NotificationConversationTemplateViewWrapper constructor(
                com.android.internal.R.id.conversation_icon_badge)
        expandButton = conversationLayout.requireViewById(
                com.android.internal.R.id.expand_button)
        expandButtonContainer = conversationLayout.requireViewById(
                com.android.internal.R.id.expand_button_container)
    }

    override fun onContentUpdated(row: ExpandableNotificationRow) {
@@ -90,6 +93,14 @@ class NotificationConversationTemplateViewWrapper constructor(
        conversationLayout.updateExpandability(expandable, onClickListener)
    }

    override fun disallowSingleClick(x: Float, y: Float): Boolean {
        if (expandButtonContainer.visibility == View.VISIBLE
                && isOnView(expandButtonContainer, x, y)) {
            return true
        }
        return super.disallowSingleClick(x, y)
    }

    override fun getMinLayoutHeight(): Int {
        if (mActionsContainer != null && mActionsContainer.visibility != View.GONE) {
            return minHeightWithActions
+0 −13
Original line number Diff line number Diff line
@@ -58,7 +58,6 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp
    private TextView mText;
    protected View mActionsContainer;
    private ImageView mReplyAction;
    private Rect mTmpRect = new Rect();

    private int mContentHeight;
    private int mMinHeightHint;
@@ -271,18 +270,6 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp
        return super.disallowSingleClick(x, y);
    }

    private boolean isOnView(View view, float x, float y) {
        View searchView = (View) view.getParent();
        while (searchView != null && !(searchView instanceof ExpandableNotificationRow)) {
            searchView.getHitRect(mTmpRect);
            x -= mTmpRect.left;
            y -= mTmpRect.top;
            searchView = (View) searchView.getParent();
        }
        view.getHitRect(mTmpRect);
        return mTmpRect.contains((int) x,(int) y);
    }

    @Override
    public void onContentUpdated(ExpandableNotificationRow row) {
        // Reinspect the notification. Before the super call, because the super call also updates
+22 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.graphics.Color;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
@@ -49,6 +50,7 @@ public abstract class NotificationViewWrapper implements TransformableView {

    protected final View mView;
    protected final ExpandableNotificationRow mRow;
    private final Rect mTmpRect = new Rect();

    protected int mBackgroundColor = 0;

@@ -305,6 +307,26 @@ public abstract class NotificationViewWrapper implements TransformableView {
        return false;
    }

    /**
     * Is a given x and y coordinate on a view.
     *
     * @param view the view to be checked
     * @param x the x coordinate, relative to the ExpandableNotificationRow
     * @param y the y coordinate, relative to the ExpandableNotificationRow
     * @return {@code true} if it is on the view
     */
    protected boolean isOnView(View view, float x, float y) {
        View searchView = (View) view.getParent();
        while (searchView != null && !(searchView instanceof ExpandableNotificationRow)) {
            searchView.getHitRect(mTmpRect);
            x -= mTmpRect.left;
            y -= mTmpRect.top;
            searchView = (View) searchView.getParent();
        }
        view.getHitRect(mTmpRect);
        return mTmpRect.contains((int) x,(int) y);
    }

    public int getMinLayoutHeight() {
        return 0;
    }