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

Commit 8ef86a12 authored by Selim Cinek's avatar Selim Cinek
Browse files

Forced the expand button to be double tappable on the lock screen

Bug: 150905003
Test: manual on device
Change-Id: Ia804fc9ba6e9ea4a64109821abc30546c08db176
parent afc20587
Loading
Loading
Loading
Loading
+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;
    }