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

Commit 5345c310 authored by Chris Wren's avatar Chris Wren Committed by Android (Google) Code Review
Browse files

Merge "Don't allow the status bar to collapse things we're touching." into jb-mr1-dev

parents 3185b376 3ddab0dc
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -18,4 +18,5 @@
<resources>
    <item type="id" name="expandable_tag" />
    <item type="id" name="user_expanded_tag" />
    <item type="id" name="user_lock_tag" />
</resources>
+14 −7
Original line number Diff line number Diff line
@@ -39,7 +39,8 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
        View getChildAtRawPosition(float x, float y);
        View getChildAtPosition(float x, float y);
        boolean canChildBeExpanded(View v);
        boolean setUserExpandedChild(View v, boolean userxpanded);
        boolean setUserExpandedChild(View v, boolean userExpanded);
        boolean setUserLockedChild(View v, boolean userLocked);
    }

    private static final String TAG = "ExpandHelper";
@@ -433,7 +434,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
                    final int y = (int) ev.getY();
                    View underPointer = findView(x, y);
                    if (isFinished && underPointer != null && underPointer != mCurrView) {
                        setGlow(0f);
                        finishScale(false);
                        initScale(underPointer);
                        mInitialTouchY = ev.getY();
                        mHasPopped = false;
@@ -458,6 +459,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
    private boolean initScale(View v) {
        if (v != null) {
            if (DEBUG) Slog.d(TAG, "scale begins on view: " + v);
            mCallback.setUserLockedChild(v, true);
            setView(v);
            setGlow(GLOW_BASE);
            mScaler.setView(v);
@@ -479,21 +481,26 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
    }

    private void finishScale(boolean force) {
        float currentHeight = mScaler.getHeight();
        float targetHeight = mSmallSize;
        float h = mScaler.getHeight();
        final boolean wasClosed = (mOldHeight == mSmallSize);
        if (wasClosed) {
            h = (force || h > mSmallSize) ? mNaturalHeight : mSmallSize;
            targetHeight = (force || currentHeight > mSmallSize) ? mNaturalHeight : mSmallSize;
        } else {
            h = (force || h < mNaturalHeight) ? mSmallSize : mNaturalHeight;
            targetHeight = (force || currentHeight < mNaturalHeight) ? mSmallSize : mNaturalHeight;
        }
        if (mScaleAnimation.isRunning()) {
            mScaleAnimation.cancel();
        }
        mScaleAnimation.setFloatValues(h);
        mScaleAnimation.setupStartValues();
        mScaleAnimation.start();
        setGlow(0f);
        mCallback.setUserExpandedChild(mCurrView, h == mNaturalHeight);
        if (targetHeight != currentHeight) {
            mScaleAnimation.setFloatValues(targetHeight);
            mScaleAnimation.setupStartValues();
            mScaleAnimation.start();
        }
        mCallback.setUserLockedChild(mCurrView, false);
        if (DEBUG) Slog.d(TAG, "scale was finished on view: " + mCurrView);
    }

+12 −8
Original line number Diff line number Diff line
@@ -780,6 +780,7 @@ public abstract class BaseStatusBar extends SystemUI implements
        int N = mNotificationData.size();
        for (int i = 0; i < N; i++) {
            NotificationData.Entry entry = mNotificationData.get(i);
            if (!entry.userLocked()) {
                if (i == (N-1)) {
                    if (DEBUG) Slog.d(TAG, "expanding top notification at " + i);
                    expandView(entry, true);
@@ -791,6 +792,9 @@ public abstract class BaseStatusBar extends SystemUI implements
                        if (DEBUG) Slog.d(TAG, "ignoring user-modified notification at " + i);
                    }
                }
            } else {
                if (DEBUG) Slog.d(TAG, "ignoring notification being held by user at " + i);
            }
        }
    }

+26 −0
Original line number Diff line number Diff line
@@ -71,6 +71,18 @@ public class NotificationData {
        public boolean setUserExpanded(boolean userExpanded) {
            return NotificationData.setUserExpanded(row, userExpanded);
        }
        /**
         * Return whether the entry is being touched by the user.
         */
        public boolean userLocked() {
            return NotificationData.getUserLocked(row);
        }
        /**
         * Set the flag indicating that this is being touched by the user.
         */
        public boolean setUserLocked(boolean userLocked) {
            return NotificationData.setUserLocked(row, userLocked);
        }
    }
    private final ArrayList<Entry> mEntries = new ArrayList<Entry>();
    private final Comparator<Entry> mEntryCmp = new Comparator<Entry>() {
@@ -197,4 +209,18 @@ public class NotificationData {
    public static boolean setUserExpanded(View row, boolean userExpanded) {
        return writeBooleanTag(row, R.id.user_expanded_tag, userExpanded);
    }

    /**
     * Return whether the entry is being touched by the user.
     */
    public static boolean getUserLocked(View row) {
        return readBooleanTag(row, R.id.user_lock_tag);
    }

    /**
     * Set whether the entry is being touched by the user.
     */
    public static boolean setUserLocked(View row, boolean userLocked) {
        return writeBooleanTag(row, R.id.user_lock_tag, userLocked);
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -161,6 +161,10 @@ public class NotificationRowLayout
        return NotificationData.setUserExpanded(v, userExpanded);
    }

    public boolean setUserLockedChild(View v, boolean userLocked) {
        return NotificationData.setUserLocked(v, userLocked);
    }

    public void onChildDismissed(View v) {
        final View veto = v.findViewById(R.id.veto);
        if (veto != null && veto.getVisibility() != View.GONE && mRemoveViews) {