oli107 / material-range-bar

Android widget for selecting a range of values.
Apache License 2.0
1.68k stars 370 forks source link

onRestoreInstanceState, Thumbs are not visible #64

Open m-akopov opened 8 years ago

m-akopov commented 8 years ago

When onRestoreInstanceState of the view is called, the thumbs become invisible. I think that's because createPins method is called, and it creates thumbs with 0 radius pans.


mRightThumb
                .init(ctx, yPos, 0, mPinColor, mTextColor, mCircleSize, mCircleColor, mMinPinFont,
                        mMaxPinFont, false);

Please fix it.

OneWorld123 commented 8 years ago

Fix in method "createPins". I borrowed the code for the pinSize from the method "onSizeChanged". Only occures, if setTemporaryPins(false)

float density = getResources().getDisplayMetrics().density;
    float expandedPinRadius = mExpandedPinRadius / density;

    if (mIsRangeBar) {
        mLeftThumb = new PinView(ctx);
        mLeftThumb.init(ctx, yPos, expandedPinRadius, mPinColor, mTextColor, mCircleSize, mCircleColor,
                mMinPinFont, mMaxPinFont, false);
    }
    mRightThumb = new PinView(ctx);
    mRightThumb
            .init(ctx, yPos, expandedPinRadius, mPinColor, mTextColor, mCircleSize, mCircleColor, mMinPinFont,
                    mMaxPinFont, false);
ghost commented 8 years ago

Hello, I have the same question about disappearing thumb. Please could you tell me how to fix in method "createPins" in library? Thanks a lot. ~~