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

Commit 4161a104 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by android-build-merger
Browse files

Fix deadzone in seascape orientation

am: c8d66036

Change-Id: Ic02394700b6fc6ea07f17f8ef39d7a4d50344422
parents 2fd19b6d c8d66036
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -565,6 +565,7 @@ public class NavigationBarView extends LinearLayout {
        getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener);
        getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener);


        mDeadZone = (DeadZone) mCurrentView.findViewById(R.id.deadzone);
        mDeadZone = (DeadZone) mCurrentView.findViewById(R.id.deadzone);
        mDeadZone.setDisplayRotation(mCurrentRotation);


        // force the low profile & disabled states into compliance
        // force the low profile & disabled states into compliance
        mBarTransitions.init();
        mBarTransitions.init();
+26 −2
Original line number Original line Diff line number Diff line
@@ -24,6 +24,7 @@ import android.os.SystemClock;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.util.Slog;
import android.util.Slog;
import android.view.MotionEvent;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.View;
import android.view.View;


import com.android.systemui.R;
import com.android.systemui.R;
@@ -54,6 +55,7 @@ public class DeadZone extends View {
    private int mHold, mDecay;
    private int mHold, mDecay;
    private boolean mVertical;
    private boolean mVertical;
    private long mLastPokeTime;
    private long mLastPokeTime;
    private int mDisplayRotation;


    private final Runnable mDebugFlash = new Runnable() {
    private final Runnable mDebugFlash = new Runnable() {
        @Override
        @Override
@@ -132,7 +134,16 @@ public class DeadZone extends View {
            int size = (int) getSize(event.getEventTime());
            int size = (int) getSize(event.getEventTime());
            // In the vertical orientation consume taps along the left edge.
            // In the vertical orientation consume taps along the left edge.
            // In horizontal orientation consume taps along the top edge.
            // In horizontal orientation consume taps along the top edge.
            final boolean consumeEvent = mVertical ? event.getX() < size : event.getY() < size;
            final boolean consumeEvent;
            if (mVertical) {
                if (mDisplayRotation == Surface.ROTATION_270) {
                    consumeEvent = event.getX() > getWidth() - size;
                } else {
                    consumeEvent = event.getX() < size;
                }
            } else {
                consumeEvent = event.getY() < size;
            }
            if (consumeEvent) {
            if (consumeEvent) {
                if (CHATTY) {
                if (CHATTY) {
                    Slog.v(TAG, "consuming errant click: (" + event.getX() + "," + event.getY() + ")");
                    Slog.v(TAG, "consuming errant click: (" + event.getX() + "," + event.getY() + ")");
@@ -170,7 +181,16 @@ public class DeadZone extends View {
        }
        }


        final int size = (int) getSize(SystemClock.uptimeMillis());
        final int size = (int) getSize(SystemClock.uptimeMillis());
        can.clipRect(0, 0, mVertical ? size : can.getWidth(), mVertical ? can.getHeight() : size);
        if (mVertical) {
            if (mDisplayRotation == Surface.ROTATION_270) {
                can.clipRect(can.getWidth() - size, 0, can.getWidth(), can.getHeight());
            } else {
                can.clipRect(0, 0, size, can.getHeight());
            }
        } else {
            can.clipRect(0, 0, can.getWidth(), size);
        }

        final float frac = DEBUG ? (mFlashFrac - 0.5f) + 0.5f : mFlashFrac;
        final float frac = DEBUG ? (mFlashFrac - 0.5f) + 0.5f : mFlashFrac;
        can.drawARGB((int) (frac * 0xFF), 0xDD, 0xEE, 0xAA);
        can.drawARGB((int) (frac * 0xFF), 0xDD, 0xEE, 0xAA);


@@ -178,4 +198,8 @@ public class DeadZone extends View {
            // crazy aggressive redrawing here, for debugging only
            // crazy aggressive redrawing here, for debugging only
            postInvalidateDelayed(100);
            postInvalidateDelayed(100);
    }
    }

    public void setDisplayRotation(int rotation) {
        mDisplayRotation = rotation;
    }
}
}