New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cutting bubble on screen rotate #53
Comments
I found solution. This problem is caused by old display metrics values in PopupIndicator class after screen rotation. I moved initialization of DisplayMetrics in onSizeChanged method: public void onSizeChanged() {
DisplayMetrics displayMetrics = mContext.getResources().getDisplayMetrics();
screenSize.set(displayMetrics.widthPixels, displayMetrics.heightPixels);
} Then simply call this method for PopupIndicator instance in onSizeChanged() method for DiscreteSeekBar class: @Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
Log.i("www", "onSizeChanged");
int thumbWidth = mThumb.getIntrinsicWidth();
int thumbHeight = mThumb.getIntrinsicHeight();
int addedThumb = mAddedTouchBounds;
int halfThumb = thumbWidth / 2;
int paddingLeft = getPaddingLeft() + addedThumb;
int paddingRight = getPaddingRight();
int bottom = getHeight() - getPaddingBottom() - addedThumb;
mThumb.setBounds(paddingLeft, bottom - thumbHeight, paddingLeft + thumbWidth, bottom);
int trackHeight = Math.max(mTrackHeight / 2, 1);
mTrack.setBounds(paddingLeft + halfThumb, bottom - halfThumb - trackHeight,
getWidth() - halfThumb - paddingRight - addedThumb, bottom - halfThumb + trackHeight);
int scrubberHeight = Math.max(mScrubberHeight / 2, 2);
mScrubber.setBounds(paddingLeft + halfThumb, bottom - halfThumb - scrubberHeight,
paddingLeft + halfThumb, bottom - halfThumb + scrubberHeight);
//Update the thumb position after size changed
updateThumbPosFromCurrentProgress();
mIndicator.onSizeChanged();
} |
I can't reproduce the issue. Does it happen on every android version? If you manage to reproduce it for the sample app, I've created a (I think) better solution but I'd need to reproduce the issue to see if it works. Thanks. |
…Activities/Fragments handling their own orientation changes. Closes github issue #53
https://i.gyazo.com/0765c4c94eb04a16335b1fc1880f9bea.gif
Have changed screen orientation to horizontal: bubble hides on a half way. But if app starts in horizontal – it's OK.
The text was updated successfully, but these errors were encountered: