SeekBarHint icon indicating copy to clipboard operation
SeekBarHint copied to clipboard

Wrong position of hint if `popupWidth` is not specified

Open traninho opened this issue 9 years ago • 0 comments

Hi,

first of all, thank you for the widget. I have found out that the widget shows the popup at wrong position if popupWidth is not specified.

    private float getXPosition(SeekBar seekBar){
        float val = (((float)seekBar.getProgress() * (float)(seekBar.getWidth() - 2 * seekBar.getThumbOffset())) / seekBar.getMax());
        float offset = seekBar.getThumbOffset();

        int textWidth = mPopupWidth;
        float textCenter = (textWidth/2.0f);

        float newX = val+offset - textCenter;

        return newX;
    }

The problem is that if you not specify popupWidth then mPopupWidth will have LayoutParam.WRAP_CONTENT set (a value is -2) and textCenter will be -1.

traninho avatar Mar 12 '15 16:03 traninho