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

Commit aa2f8066 authored by Svetoslav Ganov's avatar Svetoslav Ganov Committed by Android (Google) Code Review
Browse files

Merge "Minor tweak of NumberPicker to draw the scroll wheel at the right locaion"

parents 3e655510 6a19fcde
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -1201,16 +1201,15 @@ public class NumberPicker extends LinearLayout {
    private void initializeScrollWheel() {
        if (mInitialScrollOffset != Integer.MIN_VALUE) {
            return;

        }
        int[] selectorIndices = getSelectorIndices();
        int totalTextHeight = selectorIndices.length * mTextSize;
        float totalTextGapHeight = (mBottom - mTop) - totalTextHeight;
        float textGapCount = selectorIndices.length - 1;
        int selectorTextGapHeight = (int) (totalTextGapHeight / textGapCount + 0.5f);
        // Compensate if text size is odd since every time we get its middle a pixel is lost.
        mInitialScrollOffset = mCurrentScrollOffset = mTextSize - (3 * (mTextSize % 2));
        mSelectorElementHeight = mTextSize + selectorTextGapHeight;
        mInitialScrollOffset = mTextSize - 3 * (mSelectorElementHeight % 2);
        mCurrentScrollOffset = mInitialScrollOffset;
        updateInputTextView();
    }