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

Commit e2136770 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Push the jumpDrawablesToCurrentState() thing off everywhere it should be.

Also add a new interface that items in AbsListView can implement to
adjust the bounds of the selection shown for them.  This will allow
contacts to use list view's regular selection facility rather than
implementing something special in their item views.

Change-Id: I29cbdbc7122111ee97e47fe7d6ec55ff07be79cc
parent c63de86a
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -226127,6 +226127,27 @@
</parameter>
</method>
</interface>
<interface name="AbsListView.SelectionBoundsAdjuster"
 abstract="true"
 static="true"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<method name="adjustListItemSelectionBounds"
 return="void"
 abstract="true"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="bounds" type="android.graphics.Rect">
</parameter>
</method>
</interface>
<class name="AbsSeekBar"
 extends="android.widget.ProgressBar"
 abstract="true"
+10 −0
Original line number Diff line number Diff line
@@ -4283,6 +4283,16 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        }
    }

    @Override
    public void jumpDrawablesToCurrentState() {
        super.jumpDrawablesToCurrentState();
        final View[] children = mChildren;
        final int count = mChildrenCount;
        for (int i = 0; i < count; i++) {
            children[i].jumpDrawablesToCurrentState();
        }
    }

    @Override
    protected int[] onCreateDrawableState(int extraSpace) {
        if ((mGroupFlags & FLAG_ADD_STATES_FROM_CHILDREN) == 0) {
+25 −0
Original line number Diff line number Diff line
@@ -586,6 +586,22 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                int totalItemCount);
    }

    /**
     * The top-level view of a list item can implement this interface to allow
     * itself to modify the bounds of the selection shown for that item.
     */
    public interface SelectionBoundsAdjuster {
        /**
         * Called to allow the list item to adjust the bounds shown for
         * its selection.
         *
         * @param bounds On call, this contains the bounds the list has
         * selected for the item (that is the bounds of the entire view).  The
         * values can be modified as desired.
         */
        public void adjustListItemSelectionBounds(Rect bounds);
    }

    public AbsListView(Context context) {
        super(context);
        initAbsListView();
@@ -1756,6 +1772,9 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te

        final Rect selectorRect = mSelectorRect;
        selectorRect.set(sel.getLeft(), sel.getTop(), sel.getRight(), sel.getBottom());
        if (sel instanceof SelectionBoundsAdjuster) {
            ((SelectionBoundsAdjuster)sel).adjustListItemSelectionBounds(selectorRect);
        }
        positionSelector(selectorRect.left, selectorRect.top, selectorRect.right,
                selectorRect.bottom);

@@ -2002,6 +2021,12 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
        return mSelector == dr || super.verifyDrawable(dr);
    }

    @Override
    public void jumpDrawablesToCurrentState() {
        super.jumpDrawablesToCurrentState();
        if (mSelector != null) mSelector.jumpToCurrentState();
    }

    @Override
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
+6 −0
Original line number Diff line number Diff line
@@ -153,6 +153,12 @@ public abstract class AbsSeekBar extends ProgressBar {
        return who == mThumb || super.verifyDrawable(who);
    }

    @Override
    public void jumpDrawablesToCurrentState() {
        super.jumpDrawablesToCurrentState();
        if (mThumb != null) mThumb.jumpToCurrentState();
    }

    @Override
    protected void drawableStateChanged() {
        super.drawableStateChanged();
+6 −0
Original line number Diff line number Diff line
@@ -279,6 +279,12 @@ public abstract class CompoundButton extends Button implements Checkable {
        return super.verifyDrawable(who) || who == mButtonDrawable;
    }

    @Override
    public void jumpDrawablesToCurrentState() {
        super.jumpDrawablesToCurrentState();
        if (mButtonDrawable != null) mButtonDrawable.jumpToCurrentState();
    }

    static class SavedState extends BaseSavedState {
        boolean checked;

Loading