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

Commit 4d2f2483 authored by Alan Viverette's avatar Alan Viverette
Browse files

Fixes hotspot list transitions, update to use a single hotspot

Also updates background and button colors to match spec, removes
dependency on bouncycastle Arrays. Vastly simplifies ripple drawing.
Adds APIs for maximum ripple radius. Makes selectableItemBackground
bounded by default and adds an unbounded version and theme attribute.

BUG: 15315168
BUG: 15314684
BUG: 15314830
BUG: 15316768
BUG: 15333033
BUG: 15344050
Change-Id: Ib0619587ce78e43056b66571bae185e0f1613185
parent 37780146
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1015,6 +1015,7 @@ package android {
    field public static final int selectAllOnFocus = 16843102; // 0x101015e
    field public static final int selectable = 16843238; // 0x10101e6
    field public static final int selectableItemBackground = 16843534; // 0x101030e
    field public static final int selectableItemBackgroundBorderless = 16843867; // 0x101045b
    field public static final int selectedDateVerticalBar = 16843591; // 0x1010347
    field public static final int selectedWeekBackgroundColor = 16843586; // 0x1010342
    field public static final int sessionService = 16843841; // 0x1010441
@@ -11470,6 +11471,7 @@ package android.graphics.drawable {
  }
  public class RippleDrawable extends android.graphics.drawable.LayerDrawable {
    ctor public RippleDrawable(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable);
  }
  public class RotateDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
+24 −11
Original line number Diff line number Diff line
@@ -2495,17 +2495,25 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
    }

    /**
     * Positions the selector in a way that mimics keyboard focus. If the
     * selector drawable supports hotspots, this manages the focus hotspot.
     * Positions the selector in a way that mimics keyboard focus.
     */
    void positionSelectorLikeFocus(int position, View sel) {
        // If we're changing position, update the visibility since the selector
        // is technically being detached from the previous selection.
        final Drawable selector = mSelector;
        final boolean manageState = selector != null && mSelectorPosition != position
                && position != INVALID_POSITION;
        if (manageState) {
            selector.setVisible(false, false);
        }

        positionSelector(position, sel);

        final Drawable selector = mSelector;
        if (selector != null && position != INVALID_POSITION) {
        if (manageState) {
            final Rect bounds = mSelectorRect;
            final float x = bounds.exactCenterX();
            final float y = bounds.exactCenterY();
            selector.setVisible(getVisibility() == VISIBLE, false);
            selector.setHotspot(x, y);
        }
    }
@@ -2520,8 +2528,18 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
        if (sel instanceof SelectionBoundsAdjuster) {
            ((SelectionBoundsAdjuster)sel).adjustListItemSelectionBounds(selectorRect);
        }
        positionSelector(selectorRect.left, selectorRect.top, selectorRect.right,
                selectorRect.bottom);

        // Adjust for selection padding.
        selectorRect.left -= mSelectionLeftPadding;
        selectorRect.top -= mSelectionTopPadding;
        selectorRect.right += mSelectionRightPadding;
        selectorRect.bottom += mSelectionBottomPadding;

        // Update the selector drawable.
        final Drawable selector = mSelector;
        if (selector != null) {
            selector.setBounds(selectorRect);
        }

        final boolean isChildViewEnabled = mIsChildViewEnabled;
        if (sel.isEnabled() != isChildViewEnabled) {
@@ -2532,11 +2550,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
        }
    }

    private void positionSelector(int l, int t, int r, int b) {
        mSelectorRect.set(l - mSelectionLeftPadding, t - mSelectionTopPadding, r
                + mSelectionRightPadding, b + mSelectionBottomPadding);
    }

    @Override
    protected void dispatchDraw(Canvas canvas) {
        int saveCount = 0;
+2 −2
Original line number Diff line number Diff line
@@ -15,6 +15,6 @@
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="false" android:alpha="0.5" android:color="@color/quantum_grey_700"/>
    <item android:color="@color/quantum_grey_700"/>
    <item android:state_enabled="false" android:alpha="0.5" android:color="@color/button_quantum_dark"/>
    <item android:color="@color/button_quantum_dark"/>
</selector>
+2 −2
Original line number Diff line number Diff line
@@ -15,6 +15,6 @@
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="false" android:alpha="0.5" android:color="@color/quantum_grey_300"/>
    <item android:color="@color/quantum_grey_300"/>
    <item android:state_enabled="false" android:alpha="0.5" android:color="@color/button_quantum_light"/>
    <item android:color="@color/button_quantum_light"/>
</selector>
+2 −5
Original line number Diff line number Diff line
@@ -15,8 +15,5 @@
-->

<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:tint="?attr/colorControlHighlight">
    <item android:id="@id/mask">
        <color android:color="@color/white" />
    </item>
</ripple>
    android:tint="?attr/colorControlHighlight"
    android:pinned="true" />
Loading