AnderWeb/discreteSeekBar

Error in indicator size measurement for custom transformToString

Open

#32 opened on May 30, 2015

View on GitHub
 (5 comments) (0 reactions) (0 assignees)Java (2,113 stars) (406 forks)batch import
bughelp wanted

Description

When using a custom string transform, the the librarys bubble measuring is wrong. I assume it is using 0 or something else to probe the size, transformToString results in.

What I was doing is I used.

@Override
public String transformToString(int value) {
    DecimalFormat speedFormat = new DecimalFormat("#.##");
    float speed = value / 1000F;
    return speedFormat.format(value) + "x";
}

But set the minimum to 500 and the maxium to 2000. The result was the text being cropped. I assume that the library probes for a 0, which led to a result of x for my app. And that the library used the x as the bounds size for the bubble. A good fix would be to use the mMax value to probe for the size. A workaround I impemented was to use:

if (value < internalMin)
    value = internalMax;

inside

transformToString(int value)

That way the correct measurement is ensured.

Contributor guide