Skip to content

Commit b46fd30

Browse files
authored
Release 1.5.10 Changes (#117)
* uprev to 1.5.10 * remove circleci, add github actions build script * #114 fix setLinesPerRangeLabel & setLinesPerDomainLabel * fix barchart documentation
1 parent cb114c5 commit b46fd30

File tree

13 files changed

+98
-137
lines changed

13 files changed

+98
-137
lines changed

.circleci/config.yml

Lines changed: 0 additions & 96 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: build androidplot
2+
on:
3+
push:
4+
branches:
5+
- v1.5.10b # TODO change to master
6+
jobs:
7+
build-and-test:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout Code
11+
uses: actions/checkout@v3
12+
13+
- name: Build and Test
14+
run: ./gradlew testDebugUnitTest jacocoTestDebugUnitTestReport
15+
16+
- name: Build Release
17+
env:
18+
ENCODED: ${{ secrets.DEMOAPP_KEYSTORE }}
19+
KEYSTORE: keystore.jks
20+
KEY_ALIAS: Key0
21+
KEYSTORE_PASSWORD: ${{ secrets.DEMOAPP_KEYSTORE_PASSWORD }}
22+
KEY_PASSWORD: ${{ secrets.DEMOAPP_KEY_PASSWORD }}
23+
run: |
24+
echo $ENCODED | base64 -di > "${GITHUB_WORKSPACE}/demoapp/keystore.jks"
25+
./gradlew assembleRelease
26+
27+
- name: Javadoc
28+
run: ./gradlew javadoc
29+
30+
- name: Code Coverage
31+
run: bash <(curl -s https://codecov.io/bash)
32+
33+
- uses: actions/upload-artifact@v3
34+
with:
35+
name: Core Library
36+
path: androidplot-core/build/outputs/aar/*.aar
37+
retention-days: 30
38+
39+
- uses: actions/upload-artifact@v3
40+
if: github.ref_name == 'master'
41+
with:
42+
name: Demoapp APK
43+
path: demoapp/build/outputs/apk/release/*.apk
44+
retention-days: 30
45+
46+
- name: Stage for Maven Central
47+
if: github.ref_name == 'master'
48+
env:
49+
OSSRH_ACTOR: ${{ secrets.OSSRH_ACTOR }}
50+
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
51+
SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
52+
SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }}
53+
run: ./gradlew publish

androidplot-core/build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,10 @@ android {
7474
}
7575
}
7676
}
77-
78-
lintOptions {
79-
// TODO: enable and address lint issues.
77+
lint {
8078
abortOnError false
8179
}
80+
8281
}
8382

8483
group = 'com.androidplot'

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

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ protected void doOnDraw(Canvas canvas, RectF widgetRect) {
564564
}
565565

566566
protected void drawDomainLine(Canvas canvas, float xPix, Number xVal,
567-
Paint linePaint, boolean isOrigin) {
567+
Paint linePaint, boolean isOrigin, boolean shouldDrawLabel) {
568568

569569
// lines
570570
if (linePaint != null) {
@@ -574,22 +574,35 @@ protected void drawDomainLine(Canvas canvas, float xPix, Number xVal,
574574
}
575575

576576
// labels
577-
drawLineLabel(canvas, Edge.TOP, xVal, xPix, labelRect.top, isOrigin);
578-
drawLineLabel(canvas, Edge.BOTTOM, xVal, xPix, labelRect.bottom, isOrigin);
577+
if(shouldDrawLabel) {
578+
if (isLineLabelEnabled(Edge.TOP)) {
579+
drawLineLabel(canvas, Edge.TOP, xVal, xPix, labelRect.top, isOrigin);
580+
}
581+
582+
if (isLineLabelEnabled(Edge.BOTTOM)) {
583+
drawLineLabel(canvas, Edge.BOTTOM, xVal, xPix, labelRect.bottom, isOrigin);
584+
}
585+
}
579586
}
580587

581588
protected void drawRangeLine(Canvas canvas, float yPix, Number yVal,
582-
Paint linePaint, boolean isOrigin) {
589+
Paint linePaint, boolean isOrigin, boolean shouldDrawLabel) {
583590
// lines
584591
if (linePaint != null) {
585592
canvas.drawLine(gridRect.left - lineExtensionLeft, yPix,
586593
gridRect.right + lineExtensionRight, yPix, linePaint
587594
);
588595
}
589596

590-
// labels
591-
drawLineLabel(canvas, Edge.LEFT, yVal, labelRect.left, yPix, isOrigin);
592-
drawLineLabel(canvas, Edge.RIGHT, yVal, labelRect.right, yPix, isOrigin);
597+
if(shouldDrawLabel) {
598+
// labels
599+
if (isLineLabelEnabled(Edge.LEFT)) {
600+
drawLineLabel(canvas, Edge.LEFT, yVal, labelRect.left, yPix, isOrigin);
601+
}
602+
if (isLineLabelEnabled(Edge.RIGHT)) {
603+
drawLineLabel(canvas, Edge.RIGHT, yVal, labelRect.right, yPix, isOrigin);
604+
}
605+
}
593606
}
594607

595608
protected void drawLineLabel(Canvas canvas,
@@ -598,9 +611,7 @@ protected void drawLineLabel(Canvas canvas,
598611
float x,
599612
float y,
600613
boolean isOrigin) {
601-
if (isLineLabelEnabled(edge)) {
602-
getLineLabelRenderer(edge).drawLabel(canvas, getLineLabelStyle(edge), val, x, y, isOrigin);
603-
}
614+
getLineLabelRenderer(edge).drawLabel(canvas, getLineLabelStyle(edge), val, x, y, isOrigin);
604615
}
605616

606617
/**
@@ -646,7 +657,7 @@ protected void drawGrid(Canvas canvas) {
646657
} else {
647658
linePaint = domainSubGridLinePaint;
648659
}
649-
drawDomainLine(canvas, (float) xPix, xVal, linePaint, isOrigin);
660+
drawDomainLine(canvas, (float) xPix, xVal, linePaint, isOrigin, isMajorTick);
650661
}
651662

652663
Number rangeOrigin = plot.getRangeOrigin();
@@ -684,7 +695,7 @@ protected void drawGrid(Canvas canvas) {
684695
} else {
685696
linePaint = rangeSubGridLinePaint;
686697
}
687-
drawRangeLine(canvas, (float) yPix, yVal, linePaint, isOrigin);
698+
drawRangeLine(canvas, (float) yPix, yVal, linePaint, isOrigin, isMajorTick);
688699
}
689700
}
690701

androidplot-core/src/test/java/com/androidplot/xy/XYGraphWidgetTest.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@
2121

2222
import com.androidplot.test.*;
2323
import com.androidplot.ui.*;
24-
import com.androidplot.util.DisplayDimensions;
2524

2625
import org.junit.*;
2726
import org.mockito.*;
2827

2928
import static junit.framework.Assert.assertEquals;
3029
import static junit.framework.Assert.assertFalse;
3130
import static junit.framework.Assert.assertTrue;
32-
import static junit.framework.Assert.fail;
3331
import static org.mockito.ArgumentMatchers.anyDouble;
3432
import static org.mockito.Matchers.any;
3533
import static org.mockito.Matchers.anyBoolean;
@@ -202,7 +200,6 @@ public void drawCursorLabel_drawsText() {
202200

203201
@Test
204202
public void setLineLabelEdges_setsEdges() {
205-
206203
graphWidget.setLineLabelEdges(XYGraphWidget.Edge.LEFT, XYGraphWidget.Edge.BOTTOM);
207204
assertTrue(graphWidget.isLineLabelEnabled(XYGraphWidget.Edge.LEFT));
208205
assertTrue(graphWidget.isLineLabelEnabled(XYGraphWidget.Edge.BOTTOM));
@@ -312,10 +309,10 @@ public void setGridInsets_updatesGridRect() {
312309

313310
private void runDrawGridTest() {
314311
doNothing().when(graphWidget).
315-
drawDomainLine(any(Canvas.class), anyFloat(), any(Number.class), any(Paint.class), anyBoolean());
312+
drawDomainLine(any(Canvas.class), anyFloat(), any(Number.class), any(Paint.class), anyBoolean(), anyBoolean());
316313

317314
doNothing().when(graphWidget).
318-
drawRangeLine(any(Canvas.class), anyFloat(), any(Number.class), any(Paint.class), anyBoolean());
315+
drawRangeLine(any(Canvas.class), anyFloat(), any(Number.class), any(Paint.class), anyBoolean(), anyBoolean());
319316

320317
xyPlot.setRangeBoundaries(0, 100, BoundaryMode.FIXED);
321318
xyPlot.setDomainBoundaries(0, 100, BoundaryMode.FIXED);
@@ -324,9 +321,9 @@ private void runDrawGridTest() {
324321

325322
// expecting a 100x100 grid to be drawn:
326323
verify(graphWidget, times(100))
327-
.drawDomainLine(eq(canvas), anyFloat(), anyDouble(), any(Paint.class), eq(false));
324+
.drawDomainLine(eq(canvas), anyFloat(), anyDouble(), any(Paint.class), eq(false), anyBoolean());
328325

329326
verify(graphWidget, times(100))
330-
.drawRangeLine(eq(canvas), anyFloat(), anyDouble(), any(Paint.class), eq(false));
327+
.drawRangeLine(eq(canvas), anyFloat(), anyDouble(), any(Paint.class), eq(false), anyBoolean());
331328
}
332329
}

build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,22 @@ ext {
1818
theCompileSdkVersion = 30
1919
theTargetSdkVersion = 30
2020
theMinSdkVersion = 5
21-
theVersionName = '1.5.9'
21+
theVersionName = '1.5.10'
2222
theVersionCode = 1
2323
gitUrl = 'https://github.com/halfhp/androidplot.git'
2424
}
2525

2626
buildscript {
2727
repositories {
2828
mavenCentral()
29+
maven { url "https://plugins.gradle.org/m2/" }
2930
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots' }
3031
google()
3132
}
3233

3334
dependencies {
34-
classpath 'com.android.tools.build:gradle:7.0.2'
35-
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.5-SNAPSHOT'
35+
classpath 'com.android.tools.build:gradle:7.2.1'
36+
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.5'
3637
}
3738
}
3839

demoapp/build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,10 @@ android {
8080
debuggable true
8181
}
8282
}
83-
84-
lintOptions {
85-
// TODO: set to true and address all the lint issues.
83+
lint {
8684
abortOnError false
8785
}
86+
8887
}
8988

9089
play {

demoapp/src/main/java/com/androidplot/demos/SimpleXYPlotActivity.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ public void onCreate(Bundle savedInstanceState)
8888
// add a new series' to the xyplot:
8989
plot.addSeries(series1, series1Format);
9090
plot.addSeries(series2, series2Format);
91+
plot.setLinesPerRangeLabel(3);
92+
plot.setLinesPerDomainLabel(2);
9193

9294
plot.getGraph().getLineLabelStyle(XYGraphWidget.Edge.BOTTOM).setFormat(new Format() {
9395
@Override

docs/barchart.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,14 @@ The exact size of the `BarGroup` is specified in pixels and the space between ea
118118
is dynamically calculated based on that size.
119119

120120
```java
121-
barRenderer.setBarWidth(BarRenderer.BarGroupWidthMode.FIXED_WIDTH, PixelUtils.dpToPix(25));
121+
barRenderer.setBarGroupWidth(BarRenderer.BarGroupWidthMode.FIXED_WIDTH, PixelUtils.dpToPix(25));
122122
```
123123
##### FIXED_GAP
124124
The exact size of the "gap" between each `BarGroup` is specified in pixels and the size of each `BarGroup`
125125
is dynamically calculated based on that spacing.
126126

127127
```java
128-
barRenderer.setBarWidth(BarRenderer.BarGroupWidthMode.FIXED_GAP, PixelUtils.dpToPix(5));
128+
barRenderer.setBarGroupWidth(BarRenderer.BarGroupWidthMode.FIXED_GAP, PixelUtils.dpToPix(5));
129129
```
130130

131131
# Example

docs/quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ To use the library in your gradle project add the following to your build.gradle
1414

1515
```groovy
1616
dependencies {
17-
implementation "com.androidplot:androidplot-core:1.5.9"
17+
implementation "com.androidplot:androidplot-core:1.5.10"
1818
}
1919
```
2020

0 commit comments

Comments
 (0)