Skip to content

Commit d67ea48

Browse files
committed
Huge Project Refresh
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.
1 parent 20bca4a commit d67ea48

File tree

140 files changed

+4397
-3771
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+4397
-3771
lines changed

MPChartExample/AndroidManifest.xml

Lines changed: 47 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,66 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.xxmassdeveloper.mpchartexample"
4-
android:versionCode="55"
5-
android:versionName="3.0.2" >
3+
package="com.xxmassdeveloper.mpchartexample">
64

7-
<uses-sdk
8-
android:minSdkVersion="16"
9-
android:targetSdkVersion="25" />
105
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
116

127
<application
13-
android:allowBackup="true"
8+
android:allowBackup="false"
149
android:hardwareAccelerated="true"
15-
android:icon="@drawable/ic_launcher"
10+
android:icon="@drawable/ic_launcher"
1611
android:label="@string/app_name"
17-
android:theme="@style/AppTheme" >
12+
android:theme="@style/AppTheme">
1813
<activity
1914
android:name="com.xxmassdeveloper.mpchartexample.notimportant.MainActivity"
2015
android:label="@string/app_name" >
2116
<intent-filter>
2217
<action android:name="android.intent.action.MAIN" />
23-
18+
<action android:name="android.intent.action.VIEW" />
2419
<category android:name="android.intent.category.LAUNCHER" />
2520
</intent-filter>
2621
</activity>
27-
<activity android:name="LineChartActivity1"></activity> <!-- android:configChanges="keyboardHidden|orientation|screenSize" -->
28-
<activity android:name="LineChartActivity2"></activity>
29-
<activity android:name=".LineChartTime"></activity>
30-
<activity android:name="BarChartActivity"></activity>
31-
<activity android:name="HorizontalBarChartActivity"></activity>
32-
<activity android:name="PieChartActivity"></activity>
33-
<activity android:name="PiePolylineChartActivity"></activity>
34-
<activity android:name="MultiLineChartActivity"></activity>
35-
<activity android:name="BarChartActivityMultiDataset"></activity>
36-
<activity android:name="DrawChartActivity"></activity>
37-
<activity android:name="ScatterChartActivity"></activity>
38-
<activity android:name="BubbleChartActivity"></activity>
39-
<activity android:name="com.xxmassdeveloper.mpchartexample.fragments.SimpleChartDemo"></activity>
40-
<activity android:name="ListViewBarChartActivity"></activity>
41-
<activity android:name="ListViewMultiChartActivity"></activity>
42-
<activity android:name="StackedBarActivity"></activity>
43-
<activity android:name="AnotherBarActivity"></activity>
44-
<activity android:name="InvertedLineChartActivity"></activity>
45-
<activity android:name="CandleStickChartActivity"></activity>
46-
<activity android:name="CubicLineChartActivity"></activity>
47-
<activity android:name="RadarChartActivity"></activity>
48-
<activity android:name="LineChartActivityColored"></activity>
49-
<activity android:name="DynamicalAddingActivity"></activity>
50-
<activity android:name=".realm.RealmDatabaseActivityLine"></activity>
51-
<activity android:name=".realm.RealmDatabaseActivityBar"></activity>
52-
<activity android:name=".realm.RealmDatabaseActivityHorizontalBar"></activity>
53-
<activity android:name=".realm.RealmDatabaseActivityScatter"></activity>
54-
<activity android:name=".realm.RealmDatabaseActivityCandle"></activity>
55-
<activity android:name=".realm.RealmDatabaseActivityBubble"></activity>
56-
<activity android:name=".realm.RealmDatabaseActivityPie"></activity>
57-
<activity android:name=".realm.RealmDatabaseActivityRadar"></activity>
58-
<activity android:name=".realm.RealmMainActivity"></activity>
59-
<activity android:name="RealtimeLineChartActivity"></activity>
60-
<activity android:name="CombinedChartActivity"></activity>
61-
<activity android:name="PerformanceLineChart"></activity>
62-
<activity android:name="BarChartActivitySinus"></activity>
63-
<activity android:name="ScrollViewActivity"></activity>
64-
<activity android:name="StackedBarActivityNegative"></activity>
65-
<activity android:name=".realm.RealmWikiExample"></activity>
66-
<activity android:name=".BarChartPositiveNegative"></activity>
67-
<activity android:name=".FilledLineActivity"></activity>
68-
<activity android:name=".HalfPieChartActivity"></activity>
22+
<activity android:name="LineChartActivity1" /> <!-- android:configChanges="keyboardHidden|orientation|screenSize" -->
23+
<activity android:name="LineChartActivity2" />
24+
<activity android:name=".LineChartTime" />
25+
<activity android:name="BarChartActivity" />
26+
<activity android:name="HorizontalBarChartActivity" />
27+
<activity android:name="PieChartActivity" />
28+
<activity android:name="PiePolylineChartActivity" />
29+
<activity android:name="MultiLineChartActivity" />
30+
<activity android:name="BarChartActivityMultiDataset" />
31+
<activity android:name="DrawChartActivity" />
32+
<activity android:name="ScatterChartActivity" />
33+
<activity android:name="BubbleChartActivity" />
34+
<activity android:name="com.xxmassdeveloper.mpchartexample.fragments.SimpleChartDemo" />
35+
<activity android:name="ListViewBarChartActivity" />
36+
<activity android:name="ListViewMultiChartActivity" />
37+
<activity android:name="StackedBarActivity" />
38+
<activity android:name="AnotherBarActivity" />
39+
<activity android:name="InvertedLineChartActivity" />
40+
<activity android:name="CandleStickChartActivity" />
41+
<activity android:name="CubicLineChartActivity" />
42+
<activity android:name="RadarChartActivity" />
43+
<activity android:name="LineChartActivityColored" />
44+
<activity android:name="DynamicalAddingActivity" />
45+
<activity android:name=".realm.RealmDatabaseActivityLine" />
46+
<activity android:name=".realm.RealmDatabaseActivityBar" />
47+
<activity android:name=".realm.RealmDatabaseActivityHorizontalBar" />
48+
<activity android:name=".realm.RealmDatabaseActivityScatter" />
49+
<activity android:name=".realm.RealmDatabaseActivityCandle" />
50+
<activity android:name=".realm.RealmDatabaseActivityBubble" />
51+
<activity android:name=".realm.RealmDatabaseActivityPie" />
52+
<activity android:name=".realm.RealmDatabaseActivityRadar" />
53+
<activity android:name=".realm.RealmMainActivity" />
54+
<activity android:name="RealtimeLineChartActivity" />
55+
<activity android:name="CombinedChartActivity" />
56+
<activity android:name="PerformanceLineChart" />
57+
<activity android:name="BarChartActivitySinus" />
58+
<activity android:name="ScrollViewActivity" />
59+
<activity android:name="StackedBarActivityNegative" />
60+
<activity android:name=".realm.RealmWikiExample" />
61+
<activity android:name=".BarChartPositiveNegative" />
62+
<activity android:name=".FilledLineActivity" />
63+
<activity android:name=".HalfPieChartActivity" />
6964
</application>
7065

7166
</manifest>

MPChartExample/build.gradle

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ apply plugin: 'com.android.application'
22
apply plugin: 'realm-android'
33

44
android {
5-
compileSdkVersion 27
6-
buildToolsVersion '27.0.3'
5+
compileSdkVersion 28
76
defaultConfig {
7+
applicationId "com.xxmassdeveloper.mpchartexample"
88
minSdkVersion 16
9-
targetSdkVersion 27
9+
targetSdkVersion 28
1010
versionCode 56
1111
versionName '3.0.3'
12-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1313

1414
sourceSets {
1515
main {
@@ -33,17 +33,14 @@ android {
3333
}
3434
}
3535

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

4946
repositories {
@@ -52,14 +49,3 @@ repositories {
5249
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
5350
}
5451
}
55-
56-
dependencies {
57-
//compile fileTree(dir: 'libs', include: ['*.jar'])
58-
//compile project(':MPChartLib-Realm') // clone "https://github.com/PhilJay/MPAndroidChart-Realm" to get this or uncomment the gradle dependency below:
59-
implementation 'com.github.PhilJay:MPAndroidChart-Realm:v2.0.2@aar'
60-
61-
implementation project(':MPChartLib')
62-
implementation 'com.android.support:appcompat-v7:27.1.1'
63-
//compile 'io.realm:realm-android:0.87.5' // dependency for realm-database API (http://realm.io)
64-
//compile 'com.github.PhilJay:MPAndroidChart:v2.2.5'
65-
}
-12.2 KB
Binary file not shown.

MPChartExample/res/layout/activity_age_distribution.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent"
4-
android:layout_height="match_parent" >
4+
android:layout_height="match_parent">
55

66
<com.github.mikephil.charting.charts.HorizontalBarChart
77
android:id="@+id/chart1"

MPChartExample/res/layout/activity_awesomedesign.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent"
44
android:layout_height="match_parent"
5-
android:orientation="vertical" >
6-
7-
<android.support.v4.view.ViewPager
5+
android:orientation="vertical">
6+
7+
<androidx.viewpager.widget.ViewPager
88
xmlns:android="http://schemas.android.com/apk/res/android"
99
android:id="@+id/pager"
1010
android:layout_width="match_parent"

MPChartExample/res/layout/activity_barchart.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent"
4-
android:layout_height="match_parent" >
4+
android:layout_height="match_parent">
55

66
<com.github.mikephil.charting.charts.BarChart
77
android:id="@+id/chart1"
88
android:layout_width="match_parent"
99
android:layout_height="match_parent"
1010
android:layout_above="@+id/seekBar1" />
11-
11+
1212
<SeekBar
1313
android:id="@+id/seekBar2"
1414
android:layout_width="match_parent"
@@ -39,7 +39,7 @@
3939
android:layout_height="wrap_content"
4040
android:layout_alignBottom="@+id/seekBar1"
4141
android:layout_alignParentRight="true"
42-
android:text="500"
42+
android:text="@string/dash"
4343
android:layout_marginBottom="15dp"
4444
android:layout_marginRight="10dp"
4545
android:gravity="right"
@@ -51,7 +51,7 @@
5151
android:layout_height="wrap_content"
5252
android:layout_alignBottom="@+id/seekBar2"
5353
android:layout_alignParentRight="true"
54-
android:text="500"
54+
android:text="@string/dash"
5555
android:layout_marginBottom="15dp"
5656
android:layout_marginRight="10dp"
5757
android:gravity="right"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent"
4-
android:layout_height="match_parent" >
4+
android:layout_height="match_parent">
55

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

11-
</RelativeLayout>
11+
</RelativeLayout>

MPChartExample/res/layout/activity_barchart_sinus.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
android:layout_height="wrap_content"
2929
android:layout_alignBottom="@+id/seekbarValues"
3030
android:layout_alignParentRight="true"
31-
android:text="0"
31+
android:text="@string/dash"
3232
android:layout_marginBottom="15dp"
3333
android:layout_marginRight="10dp"
3434
android:gravity="right"

MPChartExample/res/layout/activity_bubblechart.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent"
4-
android:layout_height="match_parent" >
4+
android:layout_height="match_parent">
55

66
<com.github.mikephil.charting.charts.BubbleChart
77
android:id="@+id/chart1"
88
android:layout_width="match_parent"
99
android:layout_height="match_parent"
1010
android:background="@android:color/white"
1111
android:layout_above="@+id/seekBar1" />
12-
12+
1313
<SeekBar
1414
android:id="@+id/seekBar2"
1515
android:layout_width="match_parent"
@@ -40,7 +40,7 @@
4040
android:layout_height="wrap_content"
4141
android:layout_alignBottom="@+id/seekBar1"
4242
android:layout_alignParentRight="true"
43-
android:text="500"
43+
android:text="@string/dash"
4444
android:layout_marginBottom="15dp"
4545
android:layout_marginRight="10dp"
4646
android:gravity="right"
@@ -52,7 +52,7 @@
5252
android:layout_height="wrap_content"
5353
android:layout_alignBottom="@+id/seekBar2"
5454
android:layout_alignParentRight="true"
55-
android:text="500"
55+
android:text="@string/dash"
5656
android:layout_marginBottom="15dp"
5757
android:layout_marginRight="10dp"
5858
android:gravity="right"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent"
4-
android:layout_height="match_parent" >
4+
android:layout_height="match_parent">
55

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

11-
</RelativeLayout>
11+
</RelativeLayout>

0 commit comments

Comments
 (0)