AnderWeb/discreteSeekBar

Error in indicator size measurement for custom transformToString

Open

#32 aperta il 30 mag 2015

Vedi su GitHub
 (5 commenti) (0 reazioni) (0 assegnatari)Java (406 fork)batch import
bughelp wanted

Metriche repository

Star
 (2113 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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.

Guida contributor