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

Commit 6a19fcde authored by Svetoslav Ganov's avatar Svetoslav Ganov
Browse files

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

Change-Id: I8429ee1f06f5ef2c41a97c287d598f7c14c22837
parent 5203194f
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();
    }