Closed enewe101 closed 10 years ago
Based on the last discussion, Units from TypedValue will not be inferred as it may require project wide changes. Instead, now the issue is about parsing values detected as Strings but which are essentially numeric values. Below, I provide a list of such Strings detected from various categories and the proposed mechanism to convert them into Numeric Types. Please feel free to comment.
1) Claimed battery life STRING: 90 hours will be converted to numeric value 90
2) Width STRING: 14.7" will be converted to numeric value 14.7
3) Dimensions H x W x D (in.) STRING: 4.9 x 4.9 x 4.9 will be converted to a single numeric value - 117.649
4) LCD resolution STRING: 1366 x 768 will be converted to numeric value 1049088
5) I'm not sure about these Strings Size tested STRING: 265/70R17 (car tire) Warranty STRING: 24/84
I have parsed and tested cases 1 and 2. I am ignoring cases 3 and 4 since changing them introduces a huge number which causes havoc in other parts of the code like scoredAttributes causing those tests to fail. @asutcl Please tell me if there are any further changes required in TypedValue for the parsing of strings.
In TypedValue.equals
, please change the last line so that
value.aStringValue == aStringValue
becomes value.aStringValue.equals(aStringValue)
@mangalagb what's the status here? Is this issue closeable?
I have already made and committed the above mentioned changes into master. So yes. I think this issue can be closed.
I'll add a few tests and improvements to this one.
Currently TypedValue understands numeric values and ranges, with units being stripped off. Capture the units and make them available using
getUnits()
andhasUnits
.