Skip to content

Commit 9425b5a

Browse files
committed
* new demo app logo
* Removed actionbar from demo app * More styleable attrs, including a couple for Pie. * Refactored the XYGraphWidget to use BoxModel / DisplayDimensions to manage it's grid padding/margin. * Updated the SimpleXYPlot example to be a little prettier and a little more informative
1 parent 7f12502 commit 9425b5a

27 files changed

Lines changed: 268 additions & 227 deletions

androidplot-core/src/main/java/com/androidplot/Plot.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,15 @@ public void run() {
375375
* @param attrs
376376
*/
377377
private void processBaseAttrs(TypedArray attrs) {
378+
379+
// renderMode
380+
RenderMode renderMode = RenderMode.values()
381+
[attrs.getInt(R.styleable.Plot_renderMode, getRenderMode().ordinal())];
382+
if(renderMode != getRenderMode()) {
383+
setRenderMode(renderMode);
384+
}
385+
386+
// title
378387
setTitle(attrs.getString(R.styleable.Plot_label));
379388
getTitleWidget().getLabelPaint().setTextSize(
380389
attrs.getDimension(R.styleable.Plot_labelTextSize,

androidplot-core/src/main/java/com/androidplot/pie/PieChart.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@
2020
import android.content.res.TypedArray;
2121
import android.util.AttributeSet;
2222
import com.androidplot.Plot;
23+
import com.androidplot.R;
2324
import com.androidplot.ui.AnchorPosition;
2425
import com.androidplot.ui.SizeLayoutType;
2526
import com.androidplot.ui.Size;
27+
import com.androidplot.util.AttrUtils;
2628
import com.androidplot.util.PixelUtils;
2729
import com.androidplot.ui.XLayoutStyle;
2830
import com.androidplot.ui.YLayoutStyle;
@@ -82,7 +84,10 @@ protected void onPreInit() {
8284

8385
@Override
8486
protected void processAttrs(TypedArray attrs) {
85-
// TODO
87+
88+
// borderPaint
89+
AttrUtils.configureLinePaint(attrs, getBorderPaint(),
90+
R.styleable.pie_PieChart_pieBorderColor, R.styleable.pie_PieChart_pieBorderThickness);
8691
}
8792

8893
public PieWidget getPieWidget() {

androidplot-core/src/main/java/com/androidplot/ui/BoxModel.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ public class BoxModel implements BoxModelable{
3333
private float paddingTop;
3434
private float paddingRight;
3535
private float paddingBottom;
36-
//private RectF marginRect;
37-
//private RectF paddingRect;
3836

37+
/**
38+
* Default with 0 for all padding / margin values
39+
*/
3940
public BoxModel() {
40-
41+
// nothing to do
4142
}
4243

4344
@SuppressWarnings("SameParameterValue")
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright 2015 AndroidPlot.com
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.androidplot.util;
18+
19+
import android.graphics.RectF;
20+
21+
/**
22+
* Convenience methods for dealing with {@link android.graphics.RectF}
23+
*/
24+
public abstract class RectFUtils {
25+
26+
27+
/**
28+
* Determine if two {@link RectF} instances are equal. Must be used in place
29+
* of default equality operation due to a bug that exists in older versions of Android:
30+
* http://stackoverflow.com/questions/13517852/rectf-equals-fails-on-android-versions-below-jelly-bean
31+
* @param r1 May not be null
32+
* @param r2 May not be null
33+
* @return True if r1 and r2 are identical, false otherwise.
34+
*/
35+
public static boolean areIdentical(RectF r1, RectF r2) {
36+
return r1.left == r2.left &&
37+
r1.top == r2.top &&
38+
r1.right == r2.right &&
39+
r1.bottom == r2.bottom;
40+
}
41+
}

0 commit comments

Comments
 (0)