Skip to content

Commit

Permalink
Huge Project Refresh
Browse files Browse the repository at this point in the history
Before anyone freaks out, all these changes are under-the-hood, meaning that you probably won't even notice them at all.

The biggest difference is raising the minSdkVersion from 9 to 14. Recently android bumped this number interally as there are basically no devices running lower than 14 anymore. Sorry but you are just wasting your time if you are trying to support anything lower than 14 now.

The next biggest change is updating the project to the new AndroidX libraries, which changes some imports and nothing else really.

The third biggest change is fixing a few bugs in the code that cause values to be drawn even if there are none, which results in your app crashing. Surprisingly, these checks already existed in a few of the newer chart types, but most lacked this simple check.

Other than those three changes, nothing else is functionally different. Well, saving to gallery works on all charts in the example app now, and you can quickly see the code for each example in the menus.

The only real potential "breaking" change is that charts are now saved as PNGs by default instead of JPGs if you go the route of not specifying as a JPG. You may want to double check your file sizes as PNGs can be larger than low quality JPGs.

I still have more plans for simplifying the API and fixing other issues with the project, for the small few that closely pay attention to individual commits: there's going to be more soon.
  • Loading branch information
almic committed Oct 26, 2018
1 parent 20bca4a commit d67ea48
Show file tree
Hide file tree
Showing 140 changed files with 4,397 additions and 3,771 deletions.
99 changes: 47 additions & 52 deletions MPChartExample/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,71 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxmassdeveloper.mpchartexample"
android:versionCode="55"
android:versionName="3.0.2" >
package="com.xxmassdeveloper.mpchartexample">

<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="25" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<application
android:allowBackup="true"
android:allowBackup="false"
android:hardwareAccelerated="true"
android:icon="@drawable/ic_launcher"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
android:theme="@style/AppTheme">
<activity
android:name="com.xxmassdeveloper.mpchartexample.notimportant.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="LineChartActivity1"></activity> <!-- android:configChanges="keyboardHidden|orientation|screenSize" -->
<activity android:name="LineChartActivity2"></activity>
<activity android:name=".LineChartTime"></activity>
<activity android:name="BarChartActivity"></activity>
<activity android:name="HorizontalBarChartActivity"></activity>
<activity android:name="PieChartActivity"></activity>
<activity android:name="PiePolylineChartActivity"></activity>
<activity android:name="MultiLineChartActivity"></activity>
<activity android:name="BarChartActivityMultiDataset"></activity>
<activity android:name="DrawChartActivity"></activity>
<activity android:name="ScatterChartActivity"></activity>
<activity android:name="BubbleChartActivity"></activity>
<activity android:name="com.xxmassdeveloper.mpchartexample.fragments.SimpleChartDemo"></activity>
<activity android:name="ListViewBarChartActivity"></activity>
<activity android:name="ListViewMultiChartActivity"></activity>
<activity android:name="StackedBarActivity"></activity>
<activity android:name="AnotherBarActivity"></activity>
<activity android:name="InvertedLineChartActivity"></activity>
<activity android:name="CandleStickChartActivity"></activity>
<activity android:name="CubicLineChartActivity"></activity>
<activity android:name="RadarChartActivity"></activity>
<activity android:name="LineChartActivityColored"></activity>
<activity android:name="DynamicalAddingActivity"></activity>
<activity android:name=".realm.RealmDatabaseActivityLine"></activity>
<activity android:name=".realm.RealmDatabaseActivityBar"></activity>
<activity android:name=".realm.RealmDatabaseActivityHorizontalBar"></activity>
<activity android:name=".realm.RealmDatabaseActivityScatter"></activity>
<activity android:name=".realm.RealmDatabaseActivityCandle"></activity>
<activity android:name=".realm.RealmDatabaseActivityBubble"></activity>
<activity android:name=".realm.RealmDatabaseActivityPie"></activity>
<activity android:name=".realm.RealmDatabaseActivityRadar"></activity>
<activity android:name=".realm.RealmMainActivity"></activity>
<activity android:name="RealtimeLineChartActivity"></activity>
<activity android:name="CombinedChartActivity"></activity>
<activity android:name="PerformanceLineChart"></activity>
<activity android:name="BarChartActivitySinus"></activity>
<activity android:name="ScrollViewActivity"></activity>
<activity android:name="StackedBarActivityNegative"></activity>
<activity android:name=".realm.RealmWikiExample"></activity>
<activity android:name=".BarChartPositiveNegative"></activity>
<activity android:name=".FilledLineActivity"></activity>
<activity android:name=".HalfPieChartActivity"></activity>
<activity android:name="LineChartActivity1" /> <!-- android:configChanges="keyboardHidden|orientation|screenSize" -->
<activity android:name="LineChartActivity2" />
<activity android:name=".LineChartTime" />
<activity android:name="BarChartActivity" />
<activity android:name="HorizontalBarChartActivity" />
<activity android:name="PieChartActivity" />
<activity android:name="PiePolylineChartActivity" />
<activity android:name="MultiLineChartActivity" />
<activity android:name="BarChartActivityMultiDataset" />
<activity android:name="DrawChartActivity" />
<activity android:name="ScatterChartActivity" />
<activity android:name="BubbleChartActivity" />
<activity android:name="com.xxmassdeveloper.mpchartexample.fragments.SimpleChartDemo" />
<activity android:name="ListViewBarChartActivity" />
<activity android:name="ListViewMultiChartActivity" />
<activity android:name="StackedBarActivity" />
<activity android:name="AnotherBarActivity" />
<activity android:name="InvertedLineChartActivity" />
<activity android:name="CandleStickChartActivity" />
<activity android:name="CubicLineChartActivity" />
<activity android:name="RadarChartActivity" />
<activity android:name="LineChartActivityColored" />
<activity android:name="DynamicalAddingActivity" />
<activity android:name=".realm.RealmDatabaseActivityLine" />
<activity android:name=".realm.RealmDatabaseActivityBar" />
<activity android:name=".realm.RealmDatabaseActivityHorizontalBar" />
<activity android:name=".realm.RealmDatabaseActivityScatter" />
<activity android:name=".realm.RealmDatabaseActivityCandle" />
<activity android:name=".realm.RealmDatabaseActivityBubble" />
<activity android:name=".realm.RealmDatabaseActivityPie" />
<activity android:name=".realm.RealmDatabaseActivityRadar" />
<activity android:name=".realm.RealmMainActivity" />
<activity android:name="RealtimeLineChartActivity" />
<activity android:name="CombinedChartActivity" />
<activity android:name="PerformanceLineChart" />
<activity android:name="BarChartActivitySinus" />
<activity android:name="ScrollViewActivity" />
<activity android:name="StackedBarActivityNegative" />
<activity android:name=".realm.RealmWikiExample" />
<activity android:name=".BarChartPositiveNegative" />
<activity android:name=".FilledLineActivity" />
<activity android:name=".HalfPieChartActivity" />
</application>

</manifest>
38 changes: 12 additions & 26 deletions MPChartExample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ apply plugin: 'com.android.application'
apply plugin: 'realm-android'

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
compileSdkVersion 28
defaultConfig {
applicationId "com.xxmassdeveloper.mpchartexample"
minSdkVersion 16
targetSdkVersion 27
targetSdkVersion 28
versionCode 56
versionName '3.0.3'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

sourceSets {
main {
Expand All @@ -33,17 +33,14 @@ android {
}
}

buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
//classpath 'io.realm:realm-gradle-plugin:0.88.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
dependencies {
implementation "androidx.appcompat:appcompat:1.0.0"
implementation 'com.google.android.material:material:1.0.0'
//implementation "androidx.legacy:legacy-support-v4:1.0.0"
//implementation "androidx.legacy:legacy-support-v13:1.0.0"
//compile project(':MPChartLib-Realm') // clone "https://github.com/PhilJay/MPAndroidChart-Realm" to get this or uncomment the gradle dependency below:
implementation 'com.github.PhilJay:MPAndroidChart-Realm:v2.0.2@aar'
implementation project(':MPChartLib')
}

repositories {
Expand All @@ -52,14 +49,3 @@ repositories {
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
}
}

dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])
//compile project(':MPChartLib-Realm') // clone "https://github.com/PhilJay/MPAndroidChart-Realm" to get this or uncomment the gradle dependency below:
implementation 'com.github.PhilJay:MPAndroidChart-Realm:v2.0.2@aar'

implementation project(':MPChartLib')
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'
}
Binary file removed MPChartExample/res/drawable-nodpi/marker.png
Binary file not shown.
2 changes: 1 addition & 1 deletion MPChartExample/res/layout/activity_age_distribution.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="match_parent">

<com.github.mikephil.charting.charts.HorizontalBarChart
android:id="@+id/chart1"
Expand Down
6 changes: 3 additions & 3 deletions MPChartExample/res/layout/activity_awesomedesign.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<android.support.v4.view.ViewPager
android:orientation="vertical">

<androidx.viewpager.widget.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
Expand Down
8 changes: 4 additions & 4 deletions MPChartExample/res/layout/activity_barchart.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="match_parent">

<com.github.mikephil.charting.charts.BarChart
android:id="@+id/chart1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/seekBar1" />

<SeekBar
android:id="@+id/seekBar2"
android:layout_width="match_parent"
Expand Down Expand Up @@ -39,7 +39,7 @@
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/seekBar1"
android:layout_alignParentRight="true"
android:text="500"
android:text="@string/dash"
android:layout_marginBottom="15dp"
android:layout_marginRight="10dp"
android:gravity="right"
Expand All @@ -51,7 +51,7 @@
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/seekBar2"
android:layout_alignParentRight="true"
android:text="500"
android:text="@string/dash"
android:layout_marginBottom="15dp"
android:layout_marginRight="10dp"
android:gravity="right"
Expand Down
4 changes: 2 additions & 2 deletions MPChartExample/res/layout/activity_barchart_noseekbar.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="match_parent">

<com.github.mikephil.charting.charts.BarChart
android:id="@+id/chart1"
android:layout_width="match_parent"
android:layout_height="match_parent" />

</RelativeLayout>
</RelativeLayout>
2 changes: 1 addition & 1 deletion MPChartExample/res/layout/activity_barchart_sinus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/seekbarValues"
android:layout_alignParentRight="true"
android:text="0"
android:text="@string/dash"
android:layout_marginBottom="15dp"
android:layout_marginRight="10dp"
android:gravity="right"
Expand Down
8 changes: 4 additions & 4 deletions MPChartExample/res/layout/activity_bubblechart.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="match_parent">

<com.github.mikephil.charting.charts.BubbleChart
android:id="@+id/chart1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:layout_above="@+id/seekBar1" />

<SeekBar
android:id="@+id/seekBar2"
android:layout_width="match_parent"
Expand Down Expand Up @@ -40,7 +40,7 @@
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/seekBar1"
android:layout_alignParentRight="true"
android:text="500"
android:text="@string/dash"
android:layout_marginBottom="15dp"
android:layout_marginRight="10dp"
android:gravity="right"
Expand All @@ -52,7 +52,7 @@
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/seekBar2"
android:layout_alignParentRight="true"
android:text="500"
android:text="@string/dash"
android:layout_marginBottom="15dp"
android:layout_marginRight="10dp"
android:gravity="right"
Expand Down
4 changes: 2 additions & 2 deletions MPChartExample/res/layout/activity_bubblechart_noseekbar.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="match_parent">

<com.github.mikephil.charting.charts.BubbleChart
android:id="@+id/chart1"
android:layout_width="match_parent"
android:layout_height="match_parent" />

</RelativeLayout>
</RelativeLayout>
8 changes: 4 additions & 4 deletions MPChartExample/res/layout/activity_candlechart.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="match_parent">

<com.github.mikephil.charting.charts.CandleStickChart
android:id="@+id/chart1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/seekBar1" />

<SeekBar
android:id="@+id/seekBar2"
android:layout_width="match_parent"
Expand Down Expand Up @@ -39,7 +39,7 @@
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/seekBar1"
android:layout_alignParentRight="true"
android:text="500"
android:text="@string/dash"
android:layout_marginBottom="15dp"
android:layout_marginRight="10dp"
android:gravity="right"
Expand All @@ -51,7 +51,7 @@
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/seekBar2"
android:layout_alignParentRight="true"
android:text="500"
android:text="@string/dash"
android:layout_marginBottom="15dp"
android:layout_marginRight="10dp"
android:gravity="right"
Expand Down
4 changes: 2 additions & 2 deletions MPChartExample/res/layout/activity_candlechart_noseekbar.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="match_parent">

<com.github.mikephil.charting.charts.CandleStickChart
android:id="@+id/chart1"
android:layout_width="match_parent"
android:layout_height="match_parent" />

</RelativeLayout>
</RelativeLayout>
2 changes: 1 addition & 1 deletion MPChartExample/res/layout/activity_colored_lines.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
android:orientation="vertical">

<com.github.mikephil.charting.charts.LineChart
android:id="@+id/chart1"
Expand Down
2 changes: 1 addition & 1 deletion MPChartExample/res/layout/activity_combined.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
android:id="@+id/chart1"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</RelativeLayout>
2 changes: 1 addition & 1 deletion MPChartExample/res/layout/activity_draw_chart.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="match_parent">

<com.github.mikephil.charting.charts.LineChart
android:id="@+id/chart1"
Expand Down
Loading

0 comments on commit d67ea48

Please sign in to comment.