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

Commit de220369 authored by Alan Viverette's avatar Alan Viverette Committed by Android Git Automerger
Browse files

am e11794a2: Merge "Update switch, checkbox, radio button, button, and toggle...

am e11794a2: Merge "Update switch, checkbox, radio button, button, and toggle button" into lmp-preview-dev

* commit 'e11794a2c1af70a265b6476ce3f3587814e9f0b3':
  Update switch, checkbox, radio button, button, and toggle button
parents 450cd7ff 048aad39
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -255,6 +255,16 @@ public abstract class AbsSeekBar extends ProgressBar {
        }
    }

    @Override
    public void invalidateDrawable(Drawable dr) {
        super.invalidateDrawable(dr);

        if (dr == mThumb) {
            // Handle changes to thumb width and height.
            requestLayout();
        }
    }

    @Override
    void onProgressRefresh(float scale, boolean fromUser) {
        super.onProgressRefresh(scale, fromUser);
+33 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.RemotableViewMethod;
import android.view.ViewDebug;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
@@ -156,10 +157,36 @@ public class CheckedTextView extends TextView implements Checkable {
            mCheckMarkWidth = 0;
        }
        mCheckMarkDrawable = d;
        // Do padding resolution. This will call internalSetPadding() and do a requestLayout() if needed.

        // Do padding resolution. This will call internalSetPadding() and do a
        // requestLayout() if needed.
        resolvePadding();
    }

    @RemotableViewMethod
    @Override
    public void setVisibility(int visibility) {
        super.setVisibility(visibility);

        if (mCheckMarkDrawable != null) {
            mCheckMarkDrawable.setVisible(visibility == VISIBLE, false);
        }
    }

    @Override
    public void jumpDrawablesToCurrentState() {
        super.jumpDrawablesToCurrentState();

        if (mCheckMarkDrawable != null) {
            mCheckMarkDrawable.jumpToCurrentState();
        }
    }

    @Override
    protected boolean verifyDrawable(Drawable who) {
        return who == mCheckMarkDrawable || super.verifyDrawable(who);
    }

    /**
     * Gets the checkmark drawable
     *
@@ -249,6 +276,11 @@ public class CheckedTextView extends TextView implements Checkable {
            }
            checkMarkDrawable.setBounds(mScrollX + left, top, mScrollX + right, bottom);
            checkMarkDrawable.draw(canvas);

            final Drawable background = getBackground();
            if (background != null) {
                background.setHotspotBounds(mScrollX + left, top, mScrollX + right, bottom);
            }
        }
    }
    
+12 −3
Original line number Diff line number Diff line
@@ -951,9 +951,8 @@ public class Switch extends CompoundButton {

        final int[] myDrawableState = getDrawableState();

        if (mThumbDrawable != null && mThumbDrawable.setState(myDrawableState)) {
            // Handle changes to thumb width and height.
            requestLayout();
        if (mThumbDrawable != null) {
            mThumbDrawable.setState(myDrawableState);
        }

        if (mTrackDrawable != null) {
@@ -963,6 +962,16 @@ public class Switch extends CompoundButton {
        invalidate();
    }

    @Override
    public void invalidateDrawable(Drawable drawable) {
        super.invalidateDrawable(drawable);

        if (drawable == mThumbDrawable) {
            // Handle changes to thumb width and height.
            requestLayout();
        }
    }

    @Override
    protected boolean verifyDrawable(Drawable who) {
        return super.verifyDrawable(who) || who == mThumbDrawable || who == mTrackDrawable;
+17 −1
Original line number Diff line number Diff line
@@ -1026,7 +1026,7 @@ public class AlertController {
                        ? dialog.mSingleChoiceItemLayout : dialog.mListItemLayout;
                if (mCursor == null) {
                    adapter = (mAdapter != null) ? mAdapter
                            : new ArrayAdapter<CharSequence>(mContext, layout, R.id.text1, mItems);
                            : new CheckedItemAdapter(mContext, layout, R.id.text1, mItems);
                } else {
                    adapter = new SimpleCursorAdapter(mContext, layout, 
                            mCursor, new String[]{mLabelColumn}, new int[]{R.id.text1});
@@ -1081,4 +1081,20 @@ public class AlertController {
        }
    }

    private static class CheckedItemAdapter extends ArrayAdapter<CharSequence> {
        public CheckedItemAdapter(Context context, int resource, int textViewResourceId,
                CharSequence[] objects) {
            super(context, resource, textViewResourceId, objects);
        }

        @Override
        public boolean hasStableIds() {
            return true;
        }

        @Override
        public long getItemId(int position) {
            return position;
        }
    }
}
−211 B
Loading image diff...
Loading