Skip to content
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

Enhancement: Allow formatted string in NumericWheelAdapter #3

Closed
GoogleCodeExporter opened this issue Aug 3, 2015 · 1 comment
Closed

Comments

@GoogleCodeExporter
Copy link

Current NumericWheelAdapter implementation only takes an integer, then convert 
to string.  It would be nice if it could allow formatted string i.e. 
00,01,02,... as in minutes or even decimal.

It can be easily done by introducing an additional constructor to 
NumericWheelAdapter:

private String format = null;

public NumericWheelAdapter(int minValue, int maxValue, String format) {
    this.minValue = minValue;
    this.maxValue = maxValue;
    this.format = format;
}

// And modification to the getItem method:

public String getItem(int index) {
    if (index >= 0 && index < getItemsCount()) {
        if(this.format != null) {
            return String.format(this.format, minValue+index);
        } else {
            return Integer.toString(minValue + index);
        }
    }
    return null;
}

I'm attaching a new NumericWheelAdapter.java

Original issue reported on code.google.com by dzu...@gmail.com on 8 Nov 2010 at 3:01

Attachments:

@GoogleCodeExporter
Copy link
Author

Done.
Thank you for the solution!

Original comment by yuri.kan...@gmail.com on 10 Nov 2010 at 7:27

  • Changed state: Fixed
  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant