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

Commit cd944dc6 authored by Aaron Heuckroth's avatar Aaron Heuckroth
Browse files

Clean up interfaces for StackScrollLayout.

Test: Automated tests should pass.
Change-Id: Ibf2718bfaacff0adcfca7ef8ca2f3eb2b867debf
parent 294ade62
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -87,6 +87,8 @@ public class SwipeHelper implements Gefingerpoken {
    private Runnable mWatchLongPress;
    private final long mLongPressTimeout;

    protected boolean mSwipingInProgress;

    final private int[] mTmpPos = new int[2];
    private final int mFalsingThreshold;
    private boolean mTouchAboveFalsingThreshold;
@@ -127,6 +129,10 @@ public class SwipeHelper implements Gefingerpoken {
        mDisableHwLayers = disableHwLayers;
    }

    public boolean isSwipingInProgress() {
        return mSwipingInProgress;
    }

    private float getPos(MotionEvent ev) {
        return mSwipeDirection == X ? ev.getX() : ev.getY();
    }
@@ -318,6 +324,7 @@ public class SwipeHelper implements Gefingerpoken {
                    if (Math.abs(delta) > mPagingTouchSlop
                            && Math.abs(delta) > Math.abs(deltaPerpendicular)) {
                        if (mCallback.canChildBeDragged(mCurrView)) {
                            mSwipingInProgress = true;
                            mCallback.onBeginDrag(mCurrView);
                            mDragging = true;
                            mInitialTouchPos = getPos(ev);
@@ -437,6 +444,7 @@ public class SwipeHelper implements Gefingerpoken {
                    wasRemoved = row.isRemoved();
                }
                if (!mCancelled || wasRemoved) {
                    mSwipingInProgress = false;
                    mCallback.onChildDismissed(animView);
                }
                if (endAction != null) {
@@ -626,6 +634,7 @@ public class SwipeHelper implements Gefingerpoken {
                                !swipedFastEnough() /* useAccelerateInterpolator */);
                    } else {
                        // snappity
                        mSwipingInProgress = false;
                        mCallback.onDragCancelled(mCurrView);
                        snapChild(mCurrView, 0 /* leftTarget */, velocity);
                    }
+4 −1
Original line number Diff line number Diff line
@@ -24,7 +24,10 @@ import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
public interface VisibilityLocationProvider {

    /**
     * @return whether the view is in a visible location right now.
     * Returns whether an ExpandableNotificationRow is in a visible location or not.
     *
     * @param row
     * @return true if row is in a visible location
     */
    boolean isInVisibleLocation(ExpandableNotificationRow row);
}
+3 −16
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.view.View;
import android.view.ViewGroup;

import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
import com.android.systemui.statusbar.notification.VisibilityLocationProvider;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.ExpandableView;
import com.android.systemui.statusbar.notification.NotificationData;
@@ -31,7 +32,8 @@ import com.android.systemui.statusbar.notification.logging.NotificationLogger;
 * Interface representing the entity that contains notifications. It can have
 * notification views added and removed from it, and will manage displaying them to the user.
 */
public interface NotificationListContainer {
public interface NotificationListContainer extends ExpandableView.OnHeightChangedListener,
        VisibilityLocationProvider {

    /**
     * Called when a child is being transferred.
@@ -127,14 +129,6 @@ public interface NotificationListContainer {
     */
    ViewGroup getViewParentForNotification(NotificationData.Entry entry);

    /**
     * Called when the height of an expandable view changes.
     *
     * @param view view whose height changed
     * @param animate whether this change should be animated
     */
    void onHeightChanged(ExpandableView view, boolean animate);

    /**
     * Resets the currently exposed menu view.
     *
@@ -158,13 +152,6 @@ public interface NotificationListContainer {
     */
    void cleanUpViewState(View view);

    /**
     * Returns whether an ExpandableNotificationRow is in a visible location or not.
     *
     * @param row
     * @return true if row is in a visible location
     */
    boolean isInVisibleLocation(ExpandableNotificationRow row);

    /**
     * Sets a listener to listen for changes in notification locations.
+804 −794

File changed.

Preview size limit exceeded, changes collapsed.

+3 −2
Original line number Diff line number Diff line
@@ -31,11 +31,9 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.SwipeHelper;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
import com.android.systemui.statusbar.notification.ShadeViewRefactor;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.ExpandableView;

@ShadeViewRefactor(ShadeViewRefactor.RefactorComponent.INPUT)
class NotificationSwipeHelper extends SwipeHelper
        implements NotificationSwipeActionHelper {
    @VisibleForTesting
@@ -229,6 +227,7 @@ class NotificationSwipeHelper extends SwipeHelper
        if (mCallback.isExpanded()) {
            // We don't want to quick-dismiss when it's a heads up as this might lead to closing
            // of the panel early.
            mSwipingInProgress = false;
            mCallback.handleChildViewDismissed(view);
        }
        mCallback.onDismiss();
@@ -248,6 +247,7 @@ class NotificationSwipeHelper extends SwipeHelper
    @Override
    public void snapChild(final View animView, final float targetLeft, float velocity) {
        superSnapChild(animView, targetLeft, velocity);
        mSwipingInProgress = false;
        mCallback.onDragCancelled(animView);
        if (targetLeft == 0) {
            handleMenuCoveredOrDismissed();
@@ -354,6 +354,7 @@ class NotificationSwipeHelper extends SwipeHelper

    public void onMenuShown(View animView) {
        setExposedMenuView(getTranslatingParentView());
        mSwipingInProgress = false;
        mCallback.onDragCancelled(animView);
        Handler handler = getHandler();

Loading