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

Commit fdf6db67 authored by Tom Taylor's avatar Tom Taylor
Browse files

Make NumberPicker subclassable

Make a few methods and member variables protected so behavior can be
overridden. In this case, Messaging app uses the control and doesn't
want wrap-around behavior.

Change-Id: Iceb34743b7d17e933400750a5de56b9ecfe8f146
parent ccda4c49
Loading
Loading
Loading
Loading
+43 −43
Original line number Diff line number Diff line
@@ -81,10 +81,10 @@ public class NumberPicker extends LinearLayout implements OnClickListener,
    private final InputFilter mNumberInputFilter;

    private String[] mDisplayedValues;
    private int mStart;
    private int mEnd;
    private int mCurrent;
    private int mPrevious;
    protected int mStart;
    protected int mEnd;
    protected int mCurrent;
    protected int mPrevious;
    private OnChangedListener mListener;
    private Formatter mFormatter;
    private long mSpeed = 300;
@@ -206,7 +206,7 @@ public class NumberPicker extends LinearLayout implements OnClickListener,
                : String.valueOf(value);
    }

    private void changeCurrent(int current) {
    protected void changeCurrent(int current) {

        // Wrap around the values if we go past the start or end
        if (current > mEnd) {
@@ -220,13 +220,13 @@ public class NumberPicker extends LinearLayout implements OnClickListener,
        updateView();
    }

    private void notifyChange() {
    protected void notifyChange() {
        if (mListener != null) {
            mListener.onChanged(this, mPrevious, mCurrent);
        }
    }

    private void updateView() {
    protected void updateView() {

        /* If we don't have displayed values then use the
         * current number else find the correct value in the