Skip to content

Commit

Permalink
refactor(EasingFunction): Simplified EasingFunction
Browse files Browse the repository at this point in the history
EasingFunction has been simplified greatly, and I've added a MUCH needed
annotation to relevant methods.

Easing.EasingOptions has been deprecated, as well as any methods using
them. Converting is as simple as deleting the "EasingOptions" part.

A new signature is available for animateXY()!

You are now able to pass one EasingFunction to animateXY() if you want
both axes to be animated the same way.

Quietly included are some gradle build updates, incrementing the
appcompat version to 27.1.1, and using the new `javacompiler` to avoid
deprecation of `javacompile`
  • Loading branch information
almic committed Apr 30, 2018
1 parent 89d18a7 commit 35c9fc9
Show file tree
Hide file tree
Showing 19 changed files with 524 additions and 821 deletions.
2 changes: 1 addition & 1 deletion MPChartExample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ dependencies {
implementation 'com.github.PhilJay:MPAndroidChart-Realm:v2.0.2@aar'

implementation project(':MPChartLib')
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:appcompat-v7:27.1.1'
//compile 'io.realm:realm-android:0.87.5' // dependency for realm-database API (http://realm.io)
//compile 'com.github.PhilJay:MPAndroidChart:v2.2.5'
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected void onCreate(Bundle savedInstanceState) {

setData(4, 100);

mChart.animateY(1400, Easing.EasingOption.EaseInOutQuad);
mChart.animateY(1400, Easing.EaseInOutQuad);

Legend l = mChart.getLegend();
l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
break;
}
case R.id.animateY: {
mChart.animateY(3000, Easing.EasingOption.EaseInCubic);
mChart.animateY(3000, Easing.EaseInCubic);
break;
}
case R.id.animateXY: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected void onCreate(Bundle savedInstanceState) {

setData(4, 100);

mChart.animateY(1400, Easing.EasingOption.EaseInOutQuad);
mChart.animateY(1400, Easing.EaseInOutQuad);
// mChart.spin(2000, 0, 360);

mSeekBarX.setOnSeekBarChangeListener(this);
Expand Down Expand Up @@ -179,8 +179,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
break;
}
case R.id.actionToggleSpin: {
mChart.spin(1000, mChart.getRotationAngle(), mChart.getRotationAngle() + 360, Easing.EasingOption
.EaseInCubic);
mChart.spin(1000, mChart.getRotationAngle(), mChart.getRotationAngle() + 360, Easing.EaseInCubic);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class PiePolylineChartActivity extends DemoBase implements OnSeekBarChang
private PieChart mChart;
private SeekBar mSeekBarX, mSeekBarY;
private TextView tvX, tvY;

private Typeface tf;

@Override
Expand Down Expand Up @@ -97,7 +97,7 @@ protected void onCreate(Bundle savedInstanceState) {

setData(4, 100);

mChart.animateY(1400, Easing.EasingOption.EaseInOutQuad);
mChart.animateY(1400, Easing.EaseInOutQuad);
// mChart.spin(2000, 0, 360);

Legend l = mChart.getLegend();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ protected void onCreate(Bundle savedInstanceState) {

setData();

mChart.animateXY(
1400, 1400,
Easing.EasingOption.EaseInOutQuad,
Easing.EasingOption.EaseInOutQuad);
mChart.animateXY(1400, 1400, Easing.EaseInOutQuad);

XAxis xAxis = mChart.getXAxis();
xAxis.setTypeface(mTfLight);
Expand Down Expand Up @@ -193,8 +190,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
break;
}
case R.id.actionToggleSpin: {
mChart.spin(2000, mChart.getRotationAngle(), mChart.getRotationAngle() + 360, Easing.EasingOption
.EaseInCubic);
mChart.spin(2000, mChart.getRotationAngle(), mChart.getRotationAngle() + 360, Easing.EaseInCubic);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ private void setData() {
// set data
mChart.setData(data);
mChart.setFitBars(true);
mChart.animateY(1400, Easing.EasingOption.EaseInOutQuart);
mChart.animateY(1400, Easing.EaseInOutQuart);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ private void setData() {

// set data
mChart.setData(data);
mChart.animateY(1400, Easing.EasingOption.EaseInOutQuart);
mChart.animateY(1400, Easing.EaseInOutQuart);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ private void setData() {

// set data
mChart.setData(data);
mChart.animateY(1400, Easing.EasingOption.EaseInOutQuart);
mChart.animateY(1400, Easing.EaseInOutQuart);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ private void setData() {

// set data
mChart.setData(data);
mChart.animateY(1400, Easing.EasingOption.EaseInOutQuart);
mChart.animateY(1400, Easing.EaseInOutQuart);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ private void setData() {

// set data
mChart.setData(data);
mChart.animateY(1400, Easing.EasingOption.EaseInOutQuart);
mChart.animateY(1400, Easing.EaseInOutQuart);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ private void setData() {

// set data
mChart.setData(data);
mChart.animateY(1400, Easing.EasingOption.EaseInOutQuart);
mChart.animateY(1400, Easing.EaseInOutQuart);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public String getFormattedValue(float value, AxisBase axis) {

// set data
lineChart.setData(lineData);
lineChart.animateY(1400, Easing.EasingOption.EaseInOutQuart);
lineChart.animateY(1400, Easing.EaseInOutQuart);


// BAR-CHART
Expand All @@ -128,6 +128,6 @@ public String getFormattedValue(float value, AxisBase axis) {

barChart.setData(barData);
barChart.setFitBars(true);
barChart.animateY(1400, Easing.EasingOption.EaseInOutQuart);
barChart.animateY(1400, Easing.EaseInOutQuart);
}
}
8 changes: 5 additions & 3 deletions MPChartLib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ android {
buildToolsVersion '27.0.3'
// resourcePrefix 'mpcht'
defaultConfig {
//noinspection MinSdkTooLow
minSdkVersion 9
targetSdkVersion 27
versionCode 3
Expand Down Expand Up @@ -35,16 +36,17 @@ repositories {

dependencies {
//provided 'io.realm:realm-android:0.87.5' // "optional" dependency to realm-database API
implementation 'com.android.support:support-annotations:27.1.1'
testImplementation 'junit:junit:4.12'
testImplementation "org.mockito:mockito-core:1.10.19"
}

android.libraryVariants.all { variant ->
def name = variant.buildType.name
def task = project.tasks.create "jar${name.capitalize()}", Jar
task.dependsOn variant.javaCompile
task.from variant.javaCompile.destinationDir
artifacts.add('archives', task);
task.dependsOn variant.javaCompiler
task.from variant.javaCompiler.destinationDir
artifacts.add('archives', task)
}

task sourcesJar(type: Jar) {
Expand Down
Loading

0 comments on commit 35c9fc9

Please sign in to comment.