Merge with 5ad4c64449adf707f3a0619d568deac185e7ff05

This commit is contained in:
bartn
2010-12-28 17:14:37 -08:00
4 changed files with 10 additions and 35 deletions
+5 -2
View File
@@ -21,7 +21,6 @@ limitations under the License.
<color name="darkgray">#FF444444</color>
<color name="gold">#FFffd700</color>
<color name="gray">#FFAAAAAA</color>
<color name="green">#FF00AA00</color>
<color name="lightblue">#FF00FFFF</color>
<color name="opaque_shadow">#70000000</color>
<color name="red">#FFFF0000</color>
@@ -30,6 +29,10 @@ limitations under the License.
<color name="white">#FFFFFFFF</color>
<!-- Chart colors by series. -->
<!-- Green and a transparent green -->
<color name="elevation_border">#FF00AA00</color>
<color name="elevation_fill">#8000AA00</color>
<!-- Purple and a transparent purple -->
<color name="heartrate_border">#FF401465</color>
<color name="heartrate_fill">#40401465</color>
@@ -38,7 +41,7 @@ limitations under the License.
<color name="cadence_border">#FFF128F3</color>
<color name="cadence_fill">#40F128F3</color>
<!-- red and a transparent red -->
<!-- Red and a transparent red -->
<color name="power_border">#FFFF0000</color>
<color name="power_fill">#40FF0000</color>
</resources>
@@ -85,29 +85,6 @@ public class ChartValueSeries {
this.title = context.getString(titleId);
}
/**
* Constructs a new chart value series.
*
* @param context The context for the chart
* @param formatString The format of the decimal format for this series
* @param fill The paint for filling the chart
* @param stroke The paint for stroking the outside the chart, optional
* @param rounding The factor to round the values by
*/
public ChartValueSeries(Context context,
String formatString,
Paint fill,
Paint stroke,
int rounding,
int titleId) {
this.format = new DecimalFormat(formatString);
this.fillPaint = fill;
this.labelPaint = fill;
this.strokePaint = stroke;
this.rounding = rounding;
this.title = context.getString(titleId);
}
/**
* Draws the path of the chart
*/
@@ -197,8 +197,8 @@ public class ChartView extends View {
series[ELEVATION_SERIES] =
new ChartValueSeries(context,
"###,###",
R.color.green,
-1,
R.color.elevation_fill,
R.color.elevation_border,
100,
R.string.elevation);
@@ -26,18 +26,13 @@ import android.test.AndroidTestCase;
*/
public class ChartValueSeriesTest extends AndroidTestCase {
private ChartValueSeries series;
private Paint fillPaint1;
@Override
protected void setUp() throws Exception {
fillPaint1 = new Paint();
fillPaint1.setStyle(Style.FILL);
fillPaint1.setColor(getContext().getResources().getColor(R.color.green));
fillPaint1.setAntiAlias(true);
series = new ChartValueSeries(getContext(),
"###,###",
fillPaint1,
null,
R.color.elevation_fill,
R.color.elevation_border,
100,
R.string.elevation);
}
@@ -48,7 +43,7 @@ public class ChartValueSeriesTest extends AndroidTestCase {
assertEquals(0, series.getMin());
assertEquals(0, series.getMax());
assertEquals(0.0, series.getSpread());
assertEquals(fillPaint1, series.getPaint());
assertEquals(Style.STROKE, series.getPaint().getStyle());
assertEquals(getContext().getString(R.string.elevation),
series.getTitle());
assertTrue(series.isEnabled());