Example improvement, packagename refactoring, ...

This commit is contained in:
Philipp Jahoda 2014-07-28 17:48:27 +02:00
parent 3917ec507b
commit 8e21707d29
25 changed files with 85 additions and 39 deletions

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mpchartexample"
android:versionCode="1"
android:versionName="1.0" >
package="com.xxmassdeveloper.mpchartexample"
android:versionCode="2"
android:versionName="1.0.2" >
<uses-sdk
android:minSdkVersion="9"
@ -15,7 +15,7 @@
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.mpchartexample.MainActivity"
android:name="com.xxmassdeveloper.mpchartexample.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -31,7 +31,7 @@
<activity android:name="BarChartActivityMultiDataset"></activity>
<activity android:name="DrawChartActivity"></activity>
<activity android:name="ScatterChartActivity"></activity>
<activity android:name=".simple.SimpleChartDemo"></activity>
<activity android:name="com.xxmassdeveloper.mpchartexample.fragments.SimpleChartDemo"></activity>
</application>
</manifest>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 372 B

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 587 B

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/viewGithub" android:title="View on GitHub"></item>
<item android:id="@+id/website" android:title="Developer Website"></item>
<item android:id="@+id/report" android:title="Problem Report"></item>
</menu>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MPChartExample</string>
<string name="app_name">MPAndroidChart Example</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>

View file

@ -1,5 +1,5 @@
package com.example.mpchartexample;
package com.xxmassdeveloper.mpchartexample;
import android.app.Activity;
import android.os.Bundle;

View file

@ -1,5 +1,5 @@
package com.example.mpchartexample;
package com.xxmassdeveloper.mpchartexample;
import android.app.Activity;
import android.os.Bundle;
@ -15,6 +15,8 @@ import com.github.mikephil.charting.data.ChartData;
import com.github.mikephil.charting.data.DataSet;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.Legend.LegendPosition;
import java.util.ArrayList;
@ -72,6 +74,9 @@ public class BarChartActivityMultiDataset extends Activity implements OnSeekBarC
mSeekBarX.setProgress(45);
mSeekBarY.setProgress(100);
Legend l = mChart.getLegend();
l.setPosition(LegendPosition.RIGHT_OF_CHART);
}
@Override

View file

@ -1,4 +1,4 @@
package com.example.mpchartexample;
package com.xxmassdeveloper.mpchartexample;
import android.app.Activity;
import android.os.Bundle;

View file

@ -1,5 +1,5 @@
package com.example.mpchartexample;
package com.xxmassdeveloper.mpchartexample;
import android.app.Activity;
import android.os.Bundle;
@ -20,7 +20,6 @@ import com.github.mikephil.charting.data.filter.Approximator;
import com.github.mikephil.charting.data.filter.Approximator.ApproximatorType;
import com.github.mikephil.charting.interfaces.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.github.mikephil.charting.utils.FileUtils;
import com.github.mikephil.charting.utils.Highlight;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.Legend.LegendForm;

View file

@ -1,14 +1,17 @@
package com.example.mpchartexample;
package com.xxmassdeveloper.mpchartexample;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.Button;
import com.example.mpchartexample.simple.SimpleChartDemo;
import com.xxmassdeveloper.mpchartexample.fragments.SimpleChartDemo;
public class MainActivity extends Activity implements OnClickListener {
@ -76,4 +79,39 @@ public class MainActivity extends Activity implements OnClickListener {
break;
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Intent i = null;
switch(item.getItemId()) {
case R.id.viewGithub:
i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart"));
startActivity(i);
break;
case R.id.report:
i = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
"mailto","philjay.librarysup@gmail.com", null));
i.putExtra(Intent.EXTRA_SUBJECT, "MPAndroidChart Issue");
i.putExtra(Intent.EXTRA_TEXT, "Your error report here...");
startActivity(Intent.createChooser(i, "Report Problem"));
break;
case R.id.website:
i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("http://www.xxmassdeveloper.com"));
startActivity(i);
break;
}
return true;
}
}

View file

@ -1,5 +1,5 @@
package com.example.mpchartexample;
package com.xxmassdeveloper.mpchartexample;
import android.app.Activity;
import android.os.Bundle;

View file

@ -1,5 +1,5 @@
package com.example.mpchartexample;
package com.xxmassdeveloper.mpchartexample;
import android.content.Context;
import android.widget.TextView;

View file

@ -1,4 +1,4 @@
package com.example.mpchartexample;
package com.xxmassdeveloper.mpchartexample;
import android.app.Activity;
import android.os.Bundle;

View file

@ -1,5 +1,5 @@
package com.example.mpchartexample;
package com.xxmassdeveloper.mpchartexample;
import android.app.Activity;
import android.os.Bundle;

View file

@ -1,4 +1,4 @@
package com.example.mpchartexample.simple;
package com.xxmassdeveloper.mpchartexample.fragments;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v4.app.Fragment;
@ -7,10 +7,10 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.example.mpchartexample.MyMarkerView;
import com.example.mpchartexample.R;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.utils.Legend;
import com.xxmassdeveloper.mpchartexample.MyMarkerView;
import com.xxmassdeveloper.mpchartexample.R;
public class BarChartFrag extends SimpleFragment {

View file

@ -1,19 +1,15 @@
package com.example.mpchartexample.simple;
package com.xxmassdeveloper.mpchartexample.fragments;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.mpchartexample.MyMarkerView;
import com.example.mpchartexample.R;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.data.filter.Approximator;
import com.github.mikephil.charting.data.filter.Approximator.ApproximatorType;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.github.mikephil.charting.utils.Legend;
import com.xxmassdeveloper.mpchartexample.R;
public class LineChartFrag extends SimpleFragment {
@ -39,8 +35,9 @@ public class LineChartFrag extends SimpleFragment {
mChart.setDescription("");
mChart.setDrawFilled(false);
mChart.setDrawYValues(false);
mChart.setLineWidth(3.5f);
mChart.setCircleSize(5f);
mChart.setLineWidth(4f);
// mChart.setCircleSize(5f);
mChart.setDrawCircles(false);
mChart.setHighlightIndicatorEnabled(false);
mChart.setDrawBorder(false);
mChart.setDrawGridBackground(false);
@ -50,7 +47,6 @@ public class LineChartFrag extends SimpleFragment {
mChart.setStartAtZero(false);
mChart.setYRange(-1f, 1f, false);
mChart.setDrawCircles(true);
mChart.setData(getComplexity());

View file

@ -1,4 +1,4 @@
package com.example.mpchartexample.simple;
package com.xxmassdeveloper.mpchartexample.fragments;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v4.app.Fragment;
@ -6,11 +6,10 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.mpchartexample.R;
import com.github.mikephil.charting.charts.PieChart;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.Utils;
import com.github.mikephil.charting.utils.Legend.LegendPosition;
import com.xxmassdeveloper.mpchartexample.R;
public class PieChartFrag extends SimpleFragment {
@ -40,6 +39,10 @@ public class PieChartFrag extends SimpleFragment {
mChart.setHoleRadius(45f);
mChart.setTransparentCircleRadius(50f);
// enable / disable drawing of x- and y-values
// mChart.setDrawYValues(false);
// mChart.setDrawXValues(false);
mChart.setData(generateLessData());
Legend l = mChart.getLegend();

View file

@ -1,4 +1,4 @@
package com.example.mpchartexample.simple;
package com.xxmassdeveloper.mpchartexample.fragments;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v4.app.Fragment;
@ -6,13 +6,12 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.mpchartexample.MyMarkerView;
import com.example.mpchartexample.R;
import com.github.mikephil.charting.charts.ScatterChart;
import com.github.mikephil.charting.charts.ScatterChart.ScatterShape;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.Legend;
import com.xxmassdeveloper.mpchartexample.MyMarkerView;
import com.xxmassdeveloper.mpchartexample.R;
public class ScatterChartFrag extends SimpleFragment {

View file

@ -1,5 +1,5 @@
package com.example.mpchartexample.simple;
package com.xxmassdeveloper.mpchartexample.fragments;
import android.app.AlertDialog;
import android.content.DialogInterface;
@ -12,7 +12,7 @@ import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.WindowManager;
import com.example.mpchartexample.R;
import com.xxmassdeveloper.mpchartexample.R;
/**
* Demonstrates how to keep your charts straight forward, simple and beautiful with the MPAndroidChart library.

View file

@ -1,4 +1,4 @@
package com.example.mpchartexample.simple;
package com.xxmassdeveloper.mpchartexample.fragments;
import android.support.v4.app.Fragment;

BIN
design/header_symbol.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

BIN
design/ic_launcher Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB