Skip to content

Commit 6106561

Browse files
committed
Renamed AxisType to Axis and SizeLayoutType to SizeLayout
1 parent 0be35e1 commit 6106561

16 files changed

Lines changed: 102 additions & 103 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@ private void init(Context context, AttributeSet attrs, int defStyle) {
330330
PixelUtils.init(getContext());
331331
layoutManager = new LayoutManager();
332332
titleWidget = new TextLabelWidget(layoutManager, new Size(25,
333-
SizeLayoutType.ABSOLUTE, 100,
334-
SizeLayoutType.ABSOLUTE),
333+
SizeLayout.ABSOLUTE, 100,
334+
SizeLayout.ABSOLUTE),
335335
TextOrientation.HORIZONTAL);
336336
titleWidget.position(0, XLayoutStyle.RELATIVE_TO_CENTER, 0,
337337
YLayoutStyle.ABSOLUTE_FROM_TOP, AnchorPosition.TOP_MIDDLE);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import com.androidplot.Plot;
2323
import com.androidplot.R;
2424
import com.androidplot.ui.AnchorPosition;
25-
import com.androidplot.ui.SizeLayoutType;
25+
import com.androidplot.ui.SizeLayout;
2626
import com.androidplot.ui.Size;
2727
import com.androidplot.util.AttrUtils;
2828
import com.androidplot.util.PixelUtils;
@@ -63,9 +63,9 @@ protected void onPreInit() {
6363
this,
6464
new Size(
6565
PixelUtils.dpToPix(DEFAULT_PIE_WIDGET_H_DP),
66-
SizeLayoutType.FILL,
66+
SizeLayout.FILL,
6767
PixelUtils.dpToPix(DEFAULT_PIE_WIDGET_W_DP),
68-
SizeLayoutType.FILL));
68+
SizeLayout.FILL));
6969

7070
pieWidget.position(
7171
PixelUtils.dpToPix(DEFAULT_PIE_WIDGET_X_OFFSET_DP),

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
public class Size {
2626

2727
// convenience value; sets size to 100% width and height of the widget container.
28-
public static Size FILL = new Size(0, SizeLayoutType.FILL, 0, SizeLayoutType.FILL);
28+
public static Size FILL = new Size(0, SizeLayout.FILL, 0, SizeLayout.FILL);
2929

3030
private SizeMetric height;
3131
private SizeMetric width;
@@ -37,7 +37,7 @@ public class Size {
3737
* @param width Width value used algorithm to calculate the width of the associated widget(s).
3838
* @param widthLayoutType Algorithm used to calculate the width of the associated widget(s).
3939
*/
40-
public Size(float height, SizeLayoutType heightLayoutType, float width, SizeLayoutType widthLayoutType) {
40+
public Size(float height, SizeLayout heightLayoutType, float width, SizeLayout widthLayoutType) {
4141
this.height = new SizeMetric(height, heightLayoutType);
4242
this.width = new SizeMetric(width, widthLayoutType);
4343
}

androidplot-core/src/main/java/com/androidplot/ui/SizeLayoutType.java renamed to androidplot-core/src/main/java/com/androidplot/ui/SizeLayout.java

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
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.ui;
18-
19-
/**
20-
* SizeLayoutType is an enumeration of algorithms available for calculating an arbitrary dimension of a widget.
21-
* Each algorithm also takes a single value called "val" in this doc.
22-
* ABSOLUTE - Val is treated as absolute. If val is 5 then the size of the widget along the associated axis is 5 pixels.
23-
*
24-
* RELATIVE - Val represents the percentage of the display that the widget should fill along the associated axis. For example,
25-
* if the total size of the owning plot is 120 pixels and val is set to 50 then the size of the widget along the associated axis
26-
* is 60; 50% of 120 = 60.
27-
*
28-
* FILL - Widget completely fills along the associated axis, minus the input size value
29-
*/
30-
public enum SizeLayoutType {
31-
ABSOLUTE,
32-
RELATIVE,
33-
FILL
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.ui;
18+
19+
/**
20+
* SizeLayoutType is an enumeration of algorithms available for calculating an arbitrary dimension of a widget.
21+
* Each algorithm also takes a single value called "val" in this doc.
22+
* ABSOLUTE - Val is treated as absolute. If val is 5 then the size of the widget along the associated axis is 5 pixels.
23+
*
24+
* RELATIVE - Val represents the percentage of the display that the widget should fill along the associated axis. For example,
25+
* if the total size of the owning plot is 120 pixels and val is set to 50 then the size of the widget along the associated axis
26+
* is 60; 50% of 120 = 60.
27+
*
28+
* FILL - Widget completely fills along the associated axis, minus the input size value
29+
*/
30+
public enum SizeLayout {
31+
ABSOLUTE,
32+
RELATIVE,
33+
FILL
3434
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919
/**
2020
* Encapsulates a sizing algorithm and an associated value.
2121
*
22-
* The available algorithms list are stored in the {@link SizeLayoutType} enumeration.
22+
* The available algorithms list are stored in the {@link SizeLayout} enumeration.
2323
*
2424
*/
25-
public class SizeMetric extends LayoutMetric<SizeLayoutType> {
25+
public class SizeMetric extends LayoutMetric<SizeLayout> {
2626

27-
public SizeMetric(float value, SizeLayoutType layoutType) {
27+
public SizeMetric(float value, SizeLayout layoutType) {
2828
super(value, layoutType);
2929
}
3030

31-
protected void validatePair(float value, SizeLayoutType layoutType) {
31+
protected void validatePair(float value, SizeLayout layoutType) {
3232
switch(layoutType) {
3333
case RELATIVE:
3434
if(value < 0 || value > 1) {
@@ -57,7 +57,7 @@ public float getPixelValue(float size) {
5757
}
5858

5959
@Override
60-
public void setLayoutType(SizeLayoutType layoutType) {
60+
public void setLayoutType(SizeLayout layoutType) {
6161
super.setLayoutType(layoutType);
6262
}
6363
}

androidplot-core/src/main/java/com/androidplot/ui/widget/TextLabelWidget.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public TextLabelWidget(LayoutManager layoutManager, String title, Size size, Tex
4848
}
4949

5050
public TextLabelWidget(LayoutManager layoutManager, Size size, TextOrientation orientation) {
51-
super(layoutManager, new Size(0, SizeLayoutType.ABSOLUTE, 0, SizeLayoutType.ABSOLUTE));
51+
super(layoutManager, new Size(0, SizeLayout.ABSOLUTE, 0, SizeLayout.ABSOLUTE));
5252
setSize(size);
5353
this.orientation = orientation;
5454
}
@@ -81,11 +81,11 @@ public void pack() {
8181
}
8282
switch(orientation) {
8383
case HORIZONTAL:
84-
setSize(new Size(size.height(), SizeLayoutType.ABSOLUTE, size.width()+2, SizeLayoutType.ABSOLUTE));
84+
setSize(new Size(size.height(), SizeLayout.ABSOLUTE, size.width()+2, SizeLayout.ABSOLUTE));
8585
break;
8686
case VERTICAL_ASCENDING:
8787
case VERTICAL_DESCENDING:
88-
setSize(new Size(size.width(), SizeLayoutType.ABSOLUTE, size.height()+2, SizeLayoutType.ABSOLUTE));
88+
setSize(new Size(size.width(), SizeLayout.ABSOLUTE, size.height()+2, SizeLayout.ABSOLUTE));
8989
break;
9090
}
9191
refreshLayout();

androidplot-core/src/main/java/com/androidplot/ui/widget/Widget.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,15 @@ public void setWidth(float width) {
130130
size.getWidth().setValue(width);
131131
}
132132

133-
public void setWidth(float width, SizeLayoutType layoutType) {
133+
public void setWidth(float width, SizeLayout layoutType) {
134134
size.getWidth().set(width, layoutType);
135135
}
136136

137137
public void setHeight(float height) {
138138
size.getHeight().setValue(height);
139139
}
140140

141-
public void setHeight(float height, SizeLayoutType layoutType) {
141+
public void setHeight(float height, SizeLayout layoutType) {
142142
size.getHeight().set(height, layoutType);
143143
}
144144

androidplot-core/src/main/java/com/androidplot/util/AttrUtils.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ public static void configureSize(TypedArray attrs, Size model, int heightSizeLay
115115
private static void configureSizeMetric(TypedArray attrs, SizeMetric model, int typeAttr, int valueAttr) {
116116

117117
final float value = getIntFloatDimenValue(attrs, valueAttr, model.getValue()).floatValue();
118-
final SizeLayoutType sizeLayoutType =
118+
final SizeLayout sizeLayout =
119119
getSizeLayoutType(attrs, typeAttr, model.getLayoutType());
120120

121-
model.set(value, sizeLayoutType);
121+
model.set(value, sizeLayout);
122122
}
123123

124-
private static SizeLayoutType getSizeLayoutType(TypedArray attrs, int attr, SizeLayoutType defaultValue) {
125-
return SizeLayoutType.values()[attrs.getInt(attr, defaultValue.ordinal())];
124+
private static SizeLayout getSizeLayoutType(TypedArray attrs, int attr, SizeLayout defaultValue) {
125+
return SizeLayout.values()[attrs.getInt(attr, defaultValue.ordinal())];
126126
}
127127

128128
public static void configureWidget(TypedArray attrs, Widget widget, int heightSizeLayoutTypeAttr, int heightAttr,

androidplot-core/src/main/java/com/androidplot/xy/XYAxisType.java renamed to androidplot-core/src/main/java/com/androidplot/xy/Axis.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
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.xy;
18-
19-
public enum XYAxisType {
20-
DOMAIN,
21-
RANGE
22-
}
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.xy;
18+
19+
public enum Axis {
20+
DOMAIN,
21+
RANGE
22+
}

androidplot-core/src/main/java/com/androidplot/xy/XYGraphWidget.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,8 @@ private void calculateGridDimensions(RectF widgetRect) {
456456
}
457457
}
458458

459-
private void drawTickText(Canvas canvas, XYAxisType axis, Number value,
460-
float xPix, float yPix, Paint labelPaint) {
459+
private void drawTickText(Canvas canvas, Axis axis, Number value,
460+
float xPix, float yPix, Paint labelPaint) {
461461
NumberLabelFormatter formatter;
462462
String txt;
463463
double v = value.doubleValue();
@@ -518,7 +518,7 @@ private void drawDomainTick(Canvas canvas, float xPix, Number xVal,
518518
yPix = gridRect.top - domainTickExtension
519519
- domainTickLabelVerticalOffset;
520520
}
521-
drawTickText(canvas, XYAxisType.DOMAIN, xVal,
521+
drawTickText(canvas, Axis.DOMAIN, xVal,
522522
xPix + domainTickLabelHorizontalOffset, yPix,
523523
labelPaint);
524524
}
@@ -555,7 +555,7 @@ public void drawRangeTick(Canvas canvas, float yPix, Number yVal,
555555
xPix = gridRect.right
556556
+ (rangeTickExtension + rangeTickLabelHorizontalOffset);
557557
}
558-
drawTickText(canvas, XYAxisType.RANGE, yVal, xPix, yPix - rangeTickLabelVerticalOffset,
558+
drawTickText(canvas, Axis.RANGE, yVal, xPix, yPix - rangeTickLabelVerticalOffset,
559559
labelPaint);
560560
}
561561
} else if (linePaint != null && (rangeSubTick || rangeLabelSubTickExtension > ZERO)) {
@@ -593,7 +593,7 @@ protected void drawGrid(Canvas canvas) {
593593
domainOriginF = paddedGridRect.left;
594594
}
595595

596-
XYStep domainStep = XYStepCalculator.getStep(plot, XYAxisType.DOMAIN,
596+
XYStep domainStep = XYStepCalculator.getStep(plot, Axis.DOMAIN,
597597
paddedGridRect, plot.getCalculatedMinX().doubleValue(), plot
598598
.getCalculatedMaxX().doubleValue());
599599

@@ -671,7 +671,7 @@ protected void drawGrid(Canvas canvas) {
671671
rangeOriginF = paddedGridRect.bottom;
672672
}
673673

674-
XYStep rangeStep = XYStepCalculator.getStep(plot, XYAxisType.RANGE,
674+
XYStep rangeStep = XYStepCalculator.getStep(plot, Axis.RANGE,
675675
paddedGridRect, plot.getCalculatedMinY().doubleValue(), plot
676676
.getCalculatedMaxY().doubleValue());
677677

0 commit comments

Comments
 (0)