AnderWeb/discreteSeekBar

Error in indicator size measurement for custom transformToString

Open

#32 ouverte le 30 mai 2015

Voir sur GitHub
 (5 commentaires) (0 réactions) (0 assignés)Java (406 forks)batch import
bughelp wanted

Métriques du dépôt

Stars
 (2 113 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

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.

Guide contributeur