CodeAndMagic / GaugeView

An Android library for drawing gauges on Canvas.
Apache License 2.0
224 stars 156 forks source link

Fixed api compatibility issues: #7

Open misterbobdobalina opened 10 years ago

misterbobdobalina commented 10 years ago

Fixed api compatibility issues:

android:minSdkVersion="8" android:targetSdkVersion="19"

However, TargetApi wasn't introduced until api level 16, which won't work with api level 8 as above.

Same with: Build.VERSION_CODES.HONEYCOMB added in api level 11 View.LAYER_TYPE_SOFTWARE added in api level 11 Replaced them with their constant values instead.

I have verified that it works on api level 14. It won't compile otherwise.

Finally: readRanges() never uses its input parameters in: private void readRanges(final Resources res, final int rangesId, final int colorsId)

    if (rangesId > 0 && colorsId > 0) {
        final String[] ranges = res.getStringArray(R.array.ranges);
        final String[] colors = res.getStringArray(R.array.rangeColors)
        ...

Changed it so that it uses rangesId and colorsId instead.

I have tried this as an apklib an it workds. It was incorrect as it was before, because it wouldn't reference the correct resources if I remember correctly.