From 2d4511aecf66bc983faf8768ef24ac2125e672cf Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Tue, 31 Jul 2018 11:29:42 +0200 Subject: [PATCH] fix lint issues --- .../mpchartexample/AnotherBarActivity.java | 4 +-- .../mpchartexample/BarChartActivity.java | 15 ++++---- .../BarChartActivityMultiDataset.java | 8 ++--- .../mpchartexample/BarChartActivitySinus.java | 2 +- .../BarChartPositiveNegative.java | 4 +-- .../mpchartexample/BubbleChartActivity.java | 8 ++--- .../CandleStickChartActivity.java | 2 +- .../mpchartexample/CombinedChartActivity.java | 12 +++---- .../CubicLineChartActivity.java | 6 ++-- .../mpchartexample/DrawChartActivity.java | 2 +- .../DynamicalAddingActivity.java | 2 +- .../mpchartexample/FilledLineActivity.java | 6 ++-- .../mpchartexample/HalfPieChartActivity.java | 2 +- .../HorizontalBarChartActivity.java | 19 ++++++----- .../InvertedLineChartActivity.java | 3 +- .../mpchartexample/LineChartActivity1.java | 4 +-- .../mpchartexample/LineChartActivity2.java | 9 +++-- .../LineChartActivityColored.java | 20 +++++------ .../mpchartexample/LineChartTime.java | 7 ++-- .../ListViewBarChartActivity.java | 34 +++++++++---------- .../ListViewMultiChartActivity.java | 12 +++---- .../MultiLineChartActivity.java | 4 +-- .../mpchartexample/PerformanceLineChart.java | 2 +- .../mpchartexample/PieChartActivity.java | 4 +-- .../PiePolylineChartActivity.java | 8 ++--- .../mpchartexample/RadarChartActivity.java | 6 ++-- .../mpchartexample/ScatterChartActivity.java | 8 ++--- .../mpchartexample/ScrollViewActivity.java | 2 +- .../mpchartexample/StackedBarActivity.java | 4 +-- .../StackedBarActivityNegative.java | 2 +- .../mpchartexample/custom/RealmDemoData.java | 2 +- .../fragments/SimpleFragment.java | 14 ++++---- .../mpchartexample/notimportant/DemoBase.java | 7 ++-- .../notimportant/MainActivity.java | 2 +- .../realm/RealmDatabaseActivityBar.java | 4 +-- .../realm/RealmDatabaseActivityBubble.java | 4 +-- .../realm/RealmDatabaseActivityCandle.java | 4 +-- .../RealmDatabaseActivityHorizontalBar.java | 5 ++- .../realm/RealmDatabaseActivityLine.java | 4 +-- .../realm/RealmDatabaseActivityPie.java | 2 +- .../realm/RealmDatabaseActivityRadar.java | 4 +-- .../realm/RealmDatabaseActivityScatter.java | 4 +-- .../realm/RealmMainActivity.java | 2 +- .../realm/RealmWikiExample.java | 8 ++--- .../mikephil/charting/charts/Chart.java | 2 +- .../charting/components/AxisBase.java | 2 +- .../mikephil/charting/data/BarDataSet.java | 2 +- .../mikephil/charting/data/BaseDataSet.java | 8 ++--- .../mikephil/charting/data/BubbleDataSet.java | 2 +- .../mikephil/charting/data/CandleDataSet.java | 18 +++++----- .../mikephil/charting/data/ChartData.java | 2 +- .../mikephil/charting/data/CombinedData.java | 2 +- .../mikephil/charting/data/DataSet.java | 8 ++--- .../mikephil/charting/data/LineDataSet.java | 6 ++-- .../mikephil/charting/data/RadarDataSet.java | 2 +- .../charting/data/ScatterDataSet.java | 2 +- .../charting/highlight/ChartHighlighter.java | 2 +- .../highlight/PieRadarHighlighter.java | 2 +- .../listener/PieRadarChartTouchListener.java | 2 +- .../renderer/CombinedChartRenderer.java | 4 +-- .../charting/utils/ColorTemplate.java | 4 +-- .../mikephil/charting/utils/FileUtils.java | 6 ++-- .../mikephil/charting/test/ChartDataTest.java | 10 +++--- .../mikephil/charting/test/DataSetTest.java | 8 ++--- 64 files changed, 185 insertions(+), 196 deletions(-) diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/AnotherBarActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/AnotherBarActivity.java index f6cffddcb..5a4ae1097 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/AnotherBarActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/AnotherBarActivity.java @@ -154,7 +154,7 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { tvX.setText("" + (mSeekBarX.getProgress() + 1)); tvY.setText("" + (mSeekBarY.getProgress())); - ArrayList yVals1 = new ArrayList(); + ArrayList yVals1 = new ArrayList<>(); for (int i = 0; i < mSeekBarX.getProgress() + 1; i++) { float mult = (mSeekBarY.getProgress() + 1); @@ -175,7 +175,7 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { set1.setColors(ColorTemplate.VORDIPLOM_COLORS); set1.setDrawValues(false); - ArrayList dataSets = new ArrayList(); + ArrayList dataSets = new ArrayList<>(); dataSets.add(set1); BarData data = new BarData(dataSets); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivity.java index c0e340562..a4efaa7f5 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivity.java @@ -32,7 +32,6 @@ import com.github.mikephil.charting.interfaces.datasets.IDataSet; import com.github.mikephil.charting.listener.OnChartValueSelectedListener; import com.github.mikephil.charting.model.GradientColor; -import com.github.mikephil.charting.utils.ColorTemplate; import com.github.mikephil.charting.utils.MPPointF; import com.xxmassdeveloper.mpchartexample.custom.DayAxisValueFormatter; import com.xxmassdeveloper.mpchartexample.custom.MyAxisValueFormatter; @@ -216,13 +215,14 @@ public boolean onOptionsItemSelected(MenuItem item) { return true; } + @SuppressLint("SetTextI18n") @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { - tvX.setText("" + (mSeekBarX.getProgress() + 2)); - tvY.setText("" + (mSeekBarY.getProgress())); + tvX.setText(Integer.toString(mSeekBarX.getProgress() + 2)); + tvY.setText(Integer.toString(mSeekBarY.getProgress())); - setData(mSeekBarX.getProgress() + 1 , mSeekBarY.getProgress()); + setData(mSeekBarX.getProgress() + 1, mSeekBarY.getProgress()); mChart.invalidate(); } @@ -240,7 +240,7 @@ private void setData(int count, float range) { float start = 1f; - ArrayList yVals1 = new ArrayList(); + ArrayList yVals1 = new ArrayList<>(); for (int i = (int) start; i < start + count + 1; i++) { float mult = (range + 1); @@ -292,7 +292,7 @@ private void setData(int count, float range) { set1.setGradientColors(gradientColors); - ArrayList dataSets = new ArrayList(); + ArrayList dataSets = new ArrayList<>(); dataSets.add(set1); BarData data = new BarData(dataSets); @@ -328,5 +328,6 @@ public void onValueSelected(Entry e, Highlight h) { } @Override - public void onNothingSelected() { } + public void onNothingSelected() { + } } diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivityMultiDataset.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivityMultiDataset.java index 204dc1fe6..a9e14b9a3 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivityMultiDataset.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivityMultiDataset.java @@ -189,10 +189,10 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { tvX.setText(startYear + "-" + endYear); tvY.setText("" + (mSeekBarY.getProgress())); - ArrayList yVals1 = new ArrayList(); - ArrayList yVals2 = new ArrayList(); - ArrayList yVals3 = new ArrayList(); - ArrayList yVals4 = new ArrayList(); + ArrayList yVals1 = new ArrayList<>(); + ArrayList yVals2 = new ArrayList<>(); + ArrayList yVals3 = new ArrayList<>(); + ArrayList yVals4 = new ArrayList<>(); float randomMultiplier = mSeekBarY.getProgress() * 100000f; diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivitySinus.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivitySinus.java index 82b039909..ed97d3816 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivitySinus.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivitySinus.java @@ -199,7 +199,7 @@ public void onStopTrackingTouch(SeekBar seekBar) { private void setData(int count) { - ArrayList entries = new ArrayList(); + ArrayList entries = new ArrayList<>(); for (int i = 0; i < count; i++) { entries.add(mSinusData.get(i)); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartPositiveNegative.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartPositiveNegative.java index 7d6bd4489..23e06ee25 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartPositiveNegative.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartPositiveNegative.java @@ -97,8 +97,8 @@ public String getFormattedValue(float value, AxisBase axis) { private void setData(List dataList) { - ArrayList values = new ArrayList(); - List colors = new ArrayList(); + ArrayList values = new ArrayList<>(); + List colors = new ArrayList<>(); int green = Color.rgb(110, 190, 102); int red = Color.rgb(211, 74, 88); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BubbleChartActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BubbleChartActivity.java index bc1750381..ef6e63d93 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BubbleChartActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BubbleChartActivity.java @@ -167,9 +167,9 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { tvX.setText("" + count); tvY.setText("" + range); - ArrayList yVals1 = new ArrayList(); - ArrayList yVals2 = new ArrayList(); - ArrayList yVals3 = new ArrayList(); + ArrayList yVals1 = new ArrayList<>(); + ArrayList yVals2 = new ArrayList<>(); + ArrayList yVals3 = new ArrayList<>(); for (int i = 0; i < count; i++) { float val = (float) (Math.random() * range); @@ -208,7 +208,7 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { set3.setColor(ColorTemplate.COLORFUL_COLORS[2], 130); set3.setDrawValues(true); - ArrayList dataSets = new ArrayList(); + ArrayList dataSets = new ArrayList<>(); dataSets.add(set1); // add the datasets dataSets.add(set2); dataSets.add(set3); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CandleStickChartActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CandleStickChartActivity.java index 54eb768a7..e269df1cd 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CandleStickChartActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CandleStickChartActivity.java @@ -172,7 +172,7 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { mChart.resetTracking(); - ArrayList yVals1 = new ArrayList(); + ArrayList yVals1 = new ArrayList<>(); for (int i = 0; i < prog; i++) { float mult = (mSeekBarY.getProgress() + 1); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CombinedChartActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CombinedChartActivity.java index e4d8fb2e3..c766a07df 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CombinedChartActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CombinedChartActivity.java @@ -105,7 +105,7 @@ private LineData generateLineData() { LineData d = new LineData(); - ArrayList entries = new ArrayList(); + ArrayList entries = new ArrayList<>(); for (int index = 0; index < itemcount; index++) entries.add(new Entry(index + 0.5f, getRandom(15, 5))); @@ -129,8 +129,8 @@ private LineData generateLineData() { private BarData generateBarData() { - ArrayList entries1 = new ArrayList(); - ArrayList entries2 = new ArrayList(); + ArrayList entries1 = new ArrayList<>(); + ArrayList entries2 = new ArrayList<>(); for (int index = 0; index < itemcount; index++) { entries1.add(new BarEntry(0, getRandom(25, 25))); @@ -170,7 +170,7 @@ protected ScatterData generateScatterData() { ScatterData d = new ScatterData(); - ArrayList entries = new ArrayList(); + ArrayList entries = new ArrayList<>(); for (float index = 0; index < itemcount; index += 0.5f) entries.add(new Entry(index + 0.25f, getRandom(10, 55))); @@ -189,7 +189,7 @@ protected CandleData generateCandleData() { CandleData d = new CandleData(); - ArrayList entries = new ArrayList(); + ArrayList entries = new ArrayList<>(); for (int index = 0; index < itemcount; index += 2) entries.add(new CandleEntry(index + 1f, 90, 70, 85, 75f)); @@ -209,7 +209,7 @@ protected BubbleData generateBubbleData() { BubbleData bd = new BubbleData(); - ArrayList entries = new ArrayList(); + ArrayList entries = new ArrayList<>(); for (int index = 0; index < itemcount; index++) { float y = getRandom(10, 105); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CubicLineChartActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CubicLineChartActivity.java index 4a278c398..553d133d0 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CubicLineChartActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CubicLineChartActivity.java @@ -260,13 +260,11 @@ public void onStopTrackingTouch(SeekBar seekBar) { private void setData(int count, float range) { - ArrayList yVals = new ArrayList(); + ArrayList yVals = new ArrayList<>(); for (int i = 0; i < count; i++) { float mult = (range + 1); - float val = (float) (Math.random() * mult) + 20;// + (float) - // ((mult * - // 0.1) / 10); + float val = (float) (Math.random() * mult) + 20;// + (float)((mult * 0.1) / 10); yVals.add(new Entry(i, val)); } diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/DrawChartActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/DrawChartActivity.java index d3551068c..238223345 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/DrawChartActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/DrawChartActivity.java @@ -75,7 +75,7 @@ protected void onCreate(Bundle savedInstanceState) { private void initWithDummyData() { - ArrayList yVals = new ArrayList(); + ArrayList yVals = new ArrayList<>(); // create a dataset and give it a type (0) LineDataSet set1 = new LineDataSet(yVals, "DataSet"); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/DynamicalAddingActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/DynamicalAddingActivity.java index f8f64c374..dac938c1f 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/DynamicalAddingActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/DynamicalAddingActivity.java @@ -107,7 +107,7 @@ private void addDataSet() { int count = (data.getDataSetCount() + 1); - ArrayList yVals = new ArrayList(); + ArrayList yVals = new ArrayList<>(); for (int i = 0; i < data.getEntryCount(); i++) { yVals.add(new Entry(i, (float) (Math.random() * 50f) + 50f * count)); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/FilledLineActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/FilledLineActivity.java index 9109d5d29..6ad8902aa 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/FilledLineActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/FilledLineActivity.java @@ -67,7 +67,7 @@ protected void onCreate(Bundle savedInstanceState) { private void setData(int count, float range) { - ArrayList yVals1 = new ArrayList(); + ArrayList yVals1 = new ArrayList<>(); for (int i = 0; i < count; i++) { float val = (float) (Math.random() * range) + 50;// + (float) @@ -76,7 +76,7 @@ private void setData(int count, float range) { yVals1.add(new Entry(i, val)); } - ArrayList yVals2 = new ArrayList(); + ArrayList yVals2 = new ArrayList<>(); for (int i = 0; i < count; i++) { float val = (float) (Math.random() * range) + 450;// + (float) @@ -135,7 +135,7 @@ public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProv } }); - ArrayList dataSets = new ArrayList(); + ArrayList dataSets = new ArrayList<>(); dataSets.add(set1); // add the datasets dataSets.add(set2); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/HalfPieChartActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/HalfPieChartActivity.java index 38a228b32..17ad74d64 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/HalfPieChartActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/HalfPieChartActivity.java @@ -87,7 +87,7 @@ protected void onCreate(Bundle savedInstanceState) { private void setData(int count, float range) { - ArrayList values = new ArrayList(); + ArrayList values = new ArrayList<>(); for (int i = 0; i < count; i++) { values.add(new PieEntry((float) ((Math.random() * range) + range / 5), mParties[i % mParties.length])); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/HorizontalBarChartActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/HorizontalBarChartActivity.java index 95e138aad..a12039fb4 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/HorizontalBarChartActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/HorizontalBarChartActivity.java @@ -15,7 +15,6 @@ import com.github.mikephil.charting.charts.HorizontalBarChart; import com.github.mikephil.charting.components.Legend; -import com.github.mikephil.charting.components.Legend.LegendPosition; import com.github.mikephil.charting.components.XAxis; import com.github.mikephil.charting.components.XAxis.XAxisPosition; import com.github.mikephil.charting.components.YAxis; @@ -131,7 +130,7 @@ public boolean onOptionsItemSelected(MenuItem item) { for (IBarDataSet iSet : sets) { - IBarDataSet set = (BarDataSet) iSet; + IBarDataSet set = iSet; set.setDrawValues(!set.isDrawValuesEnabled()); } @@ -144,7 +143,7 @@ public boolean onOptionsItemSelected(MenuItem item) { for (IBarDataSet iSet : sets) { - IBarDataSet set = (BarDataSet) iSet; + IBarDataSet set = iSet; set.setDrawIcons(!set.isDrawIconsEnabled()); } @@ -152,7 +151,7 @@ public boolean onOptionsItemSelected(MenuItem item) { break; } case R.id.actionToggleHighlight: { - if(mChart.getData() != null) { + if (mChart.getData() != null) { mChart.getData().setHighlightEnabled(!mChart.getData().isHighlightEnabled()); mChart.invalidate(); } @@ -174,7 +173,7 @@ public boolean onOptionsItemSelected(MenuItem item) { } case R.id.actionToggleBarBorders: { for (IBarDataSet set : mChart.getData().getDataSets()) - ((BarDataSet)set).setBarBorderWidth(set.getBarBorderWidth() == 1.f ? 0.f : 1.f); + ((BarDataSet) set).setBarBorderWidth(set.getBarBorderWidth() == 1.f ? 0.f : 1.f); mChart.invalidate(); break; @@ -232,7 +231,7 @@ private void setData(int count, float range) { float barWidth = 9f; float spaceForBar = 10f; - ArrayList yVals1 = new ArrayList(); + ArrayList yVals1 = new ArrayList<>(); for (int i = 0; i < count; i++) { float val = (float) (Math.random() * range); @@ -244,7 +243,7 @@ private void setData(int count, float range) { if (mChart.getData() != null && mChart.getData().getDataSetCount() > 0) { - set1 = (BarDataSet)mChart.getData().getDataSetByIndex(0); + set1 = (BarDataSet) mChart.getData().getDataSetByIndex(0); set1.setValues(yVals1); mChart.getData().notifyDataChanged(); mChart.notifyDataSetChanged(); @@ -253,7 +252,7 @@ private void setData(int count, float range) { set1.setDrawIcons(false); - ArrayList dataSets = new ArrayList(); + ArrayList dataSets = new ArrayList<>(); dataSets.add(set1); BarData data = new BarData(dataSets); @@ -265,6 +264,7 @@ private void setData(int count, float range) { } protected RectF mOnValueSelectedRectF = new RectF(); + @SuppressLint("NewApi") @Override public void onValueSelected(Entry e, Highlight h) { @@ -286,5 +286,6 @@ public void onValueSelected(Entry e, Highlight h) { @Override public void onNothingSelected() { - }; + } + } diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/InvertedLineChartActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/InvertedLineChartActivity.java index 4ad4e691e..855a14b8d 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/InvertedLineChartActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/InvertedLineChartActivity.java @@ -249,12 +249,11 @@ public void onStartTrackingTouch(SeekBar seekBar) { @Override public void onStopTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub - } private void setData(int count, float range) { - ArrayList entries = new ArrayList(); + ArrayList entries = new ArrayList<>(); for (int i = 0; i < count; i++) { float xVal = (float) (Math.random() * range); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivity1.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivity1.java index 85d213e35..15e50cb52 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivity1.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivity1.java @@ -350,7 +350,7 @@ public void onStopTrackingTouch(SeekBar seekBar) { private void setData(int count, float range) { - ArrayList values = new ArrayList(); + ArrayList values = new ArrayList<>(); for (int i = 0; i < count; i++) { @@ -395,7 +395,7 @@ private void setData(int count, float range) { set1.setFillColor(Color.BLACK); } - ArrayList dataSets = new ArrayList(); + ArrayList dataSets = new ArrayList<>(); dataSets.add(set1); // add the datasets // create a data object with the datasets diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivity2.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivity2.java index e2a381ff9..2a5c893ec 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivity2.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivity2.java @@ -282,7 +282,7 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { private void setData(int count, float range) { - ArrayList yVals1 = new ArrayList(); + ArrayList yVals1 = new ArrayList<>(); for (int i = 0; i < count; i++) { float mult = range / 2f; @@ -290,18 +290,17 @@ private void setData(int count, float range) { yVals1.add(new Entry(i, val)); } - ArrayList yVals2 = new ArrayList(); + ArrayList yVals2 = new ArrayList<>(); for (int i = 0; i < count-1; i++) { - float mult = range; - float val = (float) (Math.random() * mult) + 450; + float val = (float) (Math.random() * range) + 450; yVals2.add(new Entry(i, val)); // if(i == 10) { // yVals2.add(new Entry(i, val + 50)); // } } - ArrayList yVals3 = new ArrayList(); + ArrayList yVals3 = new ArrayList<>(); for (int i = 0; i < count; i++) { float mult = range; diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivityColored.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivityColored.java index 39730d55b..f81ad9419 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivityColored.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivityColored.java @@ -18,7 +18,6 @@ public class LineChartActivityColored extends DemoBase { private LineChart[] mCharts = new LineChart[4]; - private Typeface mTf; @Override protected void onCreate(Bundle savedInstanceState) { @@ -32,7 +31,7 @@ protected void onCreate(Bundle savedInstanceState) { mCharts[2] = findViewById(R.id.chart3); mCharts[3] = findViewById(R.id.chart4); - mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Bold.ttf"); + Typeface mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Bold.ttf"); for (int i = 0; i < mCharts.length; i++) { @@ -44,9 +43,9 @@ protected void onCreate(Bundle savedInstanceState) { } } - private int[] mColors = new int[] { - Color.rgb(137, 230, 81), - Color.rgb(240, 240, 30), + private int[] mColors = new int[]{ + Color.rgb(137, 230, 81), + Color.rgb(240, 240, 30), Color.rgb(89, 199, 250), Color.rgb(250, 104, 104) }; @@ -57,7 +56,7 @@ private void setupChart(LineChart chart, LineData data, int color) { // no description text chart.getDescription().setEnabled(false); - + // mChart.setDrawHorizontalGrid(false); // // enable / disable grid background @@ -75,7 +74,7 @@ private void setupChart(LineChart chart, LineData data, int color) { chart.setPinchZoom(false); chart.setBackgroundColor(color); - + // set custom chart offsets (automatic offset calculation is hereby disabled) chart.setViewPortOffsets(10, 0, 10, 0); @@ -96,10 +95,10 @@ private void setupChart(LineChart chart, LineData data, int color) { // animate calls invalidate()... chart.animateX(2500); } - + private LineData getData(int count, float range) { - ArrayList yVals = new ArrayList(); + ArrayList yVals = new ArrayList<>(); for (int i = 0; i < count; i++) { float val = (float) (Math.random() * range) + 3; @@ -120,8 +119,7 @@ private LineData getData(int count, float range) { set1.setDrawValues(false); // create a data object with the datasets - LineData data = new LineData(set1); - return data; + return new LineData(set1); } } diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartTime.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartTime.java index 6bf96f02a..aacacc851 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartTime.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartTime.java @@ -25,7 +25,6 @@ import com.github.mikephil.charting.utils.ColorTemplate; import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase; -import java.sql.Time; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; @@ -266,15 +265,13 @@ private void setData(int count, float range) { // now in hours long now = TimeUnit.MILLISECONDS.toHours(System.currentTimeMillis()); - ArrayList values = new ArrayList(); - - float from = now; + ArrayList values = new ArrayList<>(); // count = hours float to = now + count; // increment by 1 hour - for (float x = from; x < to; x++) { + for (float x = (float) now; x < to; x++) { float y = getRandom(range, 50); values.add(new Entry(x, y)); // add one entry per hour diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/ListViewBarChartActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/ListViewBarChartActivity.java index 54218a53d..ed7e88def 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/ListViewBarChartActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/ListViewBarChartActivity.java @@ -3,8 +3,8 @@ import android.content.Context; import android.graphics.Color; -import android.graphics.Typeface; import android.os.Bundle; +import android.support.annotation.NonNull; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -29,7 +29,7 @@ /** * Demonstrates the use of charts inside a ListView. IMPORTANT: provide a * specific height attribute for the chart inside your listview-item - * + * * @author Philipp Jahoda */ public class ListViewBarChartActivity extends DemoBase { @@ -40,10 +40,10 @@ protected void onCreate(Bundle savedInstanceState) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_listview_chart); - + ListView lv = findViewById(R.id.listView1); - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); // 20 items for (int i = 0; i < 20; i++) { @@ -56,23 +56,23 @@ protected void onCreate(Bundle savedInstanceState) { private class ChartDataAdapter extends ArrayAdapter { - public ChartDataAdapter(Context context, List objects) { + ChartDataAdapter(Context context, List objects) { super(context, 0, objects); } + @NonNull @Override - public View getView(int position, View convertView, ViewGroup parent) { + public View getView(int position, View convertView, @NonNull ViewGroup parent) { BarData data = getItem(position); - ViewHolder holder = null; + ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); - convertView = LayoutInflater.from(getContext()).inflate( - R.layout.list_item_barchart, null); + convertView = LayoutInflater.from(getContext()).inflate(R.layout.list_item_barchart, null); holder.chart = convertView.findViewById(R.id.chart); convertView.setTag(holder); @@ -91,12 +91,12 @@ public View getView(int position, View convertView, ViewGroup parent) { xAxis.setPosition(XAxisPosition.BOTTOM); xAxis.setTypeface(mTfLight); xAxis.setDrawGridLines(false); - + YAxis leftAxis = holder.chart.getAxisLeft(); leftAxis.setTypeface(mTfLight); leftAxis.setLabelCount(5, false); leftAxis.setSpaceTop(15f); - + YAxis rightAxis = holder.chart.getAxisRight(); rightAxis.setTypeface(mTfLight); rightAxis.setLabelCount(5, false); @@ -105,7 +105,7 @@ public View getView(int position, View convertView, ViewGroup parent) { // set data holder.chart.setData(data); holder.chart.setFitBars(true); - + // do not forget to refresh the chart // holder.chart.invalidate(); holder.chart.animateY(700); @@ -121,12 +121,12 @@ private class ViewHolder { /** * generates a random ChartData object with just one DataSet - * + * * @return */ private BarData generateData(int cnt) { - ArrayList entries = new ArrayList(); + ArrayList entries = new ArrayList<>(); for (int i = 0; i < 12; i++) { entries.add(new BarEntry(i, (float) (Math.random() * 70) + 30)); @@ -135,10 +135,10 @@ private BarData generateData(int cnt) { BarDataSet d = new BarDataSet(entries, "New DataSet " + cnt); d.setColors(ColorTemplate.VORDIPLOM_COLORS); d.setBarShadowColor(Color.rgb(203, 203, 203)); - - ArrayList sets = new ArrayList(); + + ArrayList sets = new ArrayList<>(); sets.add(d); - + BarData cd = new BarData(sets); cd.setBarWidth(0.9f); return cd; diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/ListViewMultiChartActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/ListViewMultiChartActivity.java index 0c9f132f0..812b834fd 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/ListViewMultiChartActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/ListViewMultiChartActivity.java @@ -47,7 +47,7 @@ protected void onCreate(Bundle savedInstanceState) { ListView lv = findViewById(R.id.listView1); - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); // 30 items for (int i = 0; i < 30; i++) { @@ -96,7 +96,7 @@ public int getViewTypeCount() { */ private LineData generateDataLine(int cnt) { - ArrayList e1 = new ArrayList(); + ArrayList e1 = new ArrayList<>(); for (int i = 0; i < 12; i++) { e1.add(new Entry(i, (int) (Math.random() * 65) + 40)); @@ -108,7 +108,7 @@ private LineData generateDataLine(int cnt) { d1.setHighLightColor(Color.rgb(244, 117, 117)); d1.setDrawValues(false); - ArrayList e2 = new ArrayList(); + ArrayList e2 = new ArrayList<>(); for (int i = 0; i < 12; i++) { e2.add(new Entry(i, e1.get(i).getY() - 30)); @@ -122,7 +122,7 @@ private LineData generateDataLine(int cnt) { d2.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[0]); d2.setDrawValues(false); - ArrayList sets = new ArrayList(); + ArrayList sets = new ArrayList<>(); sets.add(d1); sets.add(d2); @@ -137,7 +137,7 @@ private LineData generateDataLine(int cnt) { */ private BarData generateDataBar(int cnt) { - ArrayList entries = new ArrayList(); + ArrayList entries = new ArrayList<>(); for (int i = 0; i < 12; i++) { entries.add(new BarEntry(i, (int) (Math.random() * 70) + 30)); @@ -159,7 +159,7 @@ private BarData generateDataBar(int cnt) { */ private PieData generateDataPie(int cnt) { - ArrayList entries = new ArrayList(); + ArrayList entries = new ArrayList<>(); for (int i = 0; i < 4; i++) { entries.add(new PieEntry((float) ((Math.random() * 70) + 30), "Quarter " + (i+1))); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/MultiLineChartActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/MultiLineChartActivity.java index e6acf0167..c28b6541b 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/MultiLineChartActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/MultiLineChartActivity.java @@ -191,11 +191,11 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { tvX.setText("" + (mSeekBarX.getProgress())); tvY.setText("" + (mSeekBarY.getProgress())); - ArrayList dataSets = new ArrayList(); + ArrayList dataSets = new ArrayList<>(); for (int z = 0; z < 3; z++) { - ArrayList values = new ArrayList(); + ArrayList values = new ArrayList<>(); for (int i = 0; i < mSeekBarX.getProgress(); i++) { double val = (Math.random() * mSeekBarY.getProgress()) + 3; diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/PerformanceLineChart.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/PerformanceLineChart.java index a2d4becad..58cb0f31d 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/PerformanceLineChart.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/PerformanceLineChart.java @@ -91,7 +91,7 @@ public void onStopTrackingTouch(SeekBar seekBar) { private void setData(int count, float range) { - ArrayList yVals = new ArrayList(); + ArrayList yVals = new ArrayList<>(); for (int i = 0; i < count; i++) { float mult = (range + 1); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/PieChartActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/PieChartActivity.java index 0252ff8ff..877b14ca9 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/PieChartActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/PieChartActivity.java @@ -199,7 +199,7 @@ private void setData(int count, float range) { float mult = range; - ArrayList entries = new ArrayList(); + ArrayList entries = new ArrayList<>(); // NOTE: The order of the entries when being added to the entries array determines their position around the center of // the chart. @@ -219,7 +219,7 @@ private void setData(int count, float range) { // add a lot of colors - ArrayList colors = new ArrayList(); + ArrayList colors = new ArrayList<>(); for (int c : ColorTemplate.VORDIPLOM_COLORS) colors.add(c); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/PiePolylineChartActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/PiePolylineChartActivity.java index c0199723d..a09ec8f78 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/PiePolylineChartActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/PiePolylineChartActivity.java @@ -183,14 +183,12 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { private void setData(int count, float range) { - float mult = range; - - ArrayList entries = new ArrayList(); + ArrayList entries = new ArrayList<>(); // NOTE: The order of the entries when being added to the entries array determines their position around the center of // the chart. for (int i = 0; i < count; i++) { - entries.add(new PieEntry((float) (Math.random() * mult) + mult / 5, mParties[i % mParties.length])); + entries.add(new PieEntry((float) (Math.random() * range) + range / 5, mParties[i % mParties.length])); } PieDataSet dataSet = new PieDataSet(entries, "Election Results"); @@ -199,7 +197,7 @@ private void setData(int count, float range) { // add a lot of colors - ArrayList colors = new ArrayList(); + ArrayList colors = new ArrayList<>(); for (int c : ColorTemplate.VORDIPLOM_COLORS) colors.add(c); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/RadarChartActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/RadarChartActivity.java index d354886f6..6076e761e 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/RadarChartActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/RadarChartActivity.java @@ -203,8 +203,8 @@ public void setData() { float min = 20; int cnt = 5; - ArrayList entries1 = new ArrayList(); - ArrayList entries2 = new ArrayList(); + ArrayList entries1 = new ArrayList<>(); + ArrayList entries2 = new ArrayList<>(); // NOTE: The order of the entries when being added to the entries array determines their position around the center of // the chart. @@ -234,7 +234,7 @@ public void setData() { set2.setDrawHighlightCircleEnabled(true); set2.setDrawHighlightIndicators(false); - ArrayList sets = new ArrayList(); + ArrayList sets = new ArrayList<>(); sets.add(set1); sets.add(set2); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/ScatterChartActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/ScatterChartActivity.java index f0f889e19..982e4bc2d 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/ScatterChartActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/ScatterChartActivity.java @@ -160,9 +160,9 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { tvX.setText("" + (mSeekBarX.getProgress() + 1)); tvY.setText("" + (mSeekBarY.getProgress())); - ArrayList yVals1 = new ArrayList(); - ArrayList yVals2 = new ArrayList(); - ArrayList yVals3 = new ArrayList(); + ArrayList yVals1 = new ArrayList<>(); + ArrayList yVals2 = new ArrayList<>(); + ArrayList yVals3 = new ArrayList<>(); for (int i = 0; i < mSeekBarX.getProgress(); i++) { float val = (float) (Math.random() * mSeekBarY.getProgress()) + 3; @@ -196,7 +196,7 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { set2.setScatterShapeSize(8f); set3.setScatterShapeSize(8f); - ArrayList dataSets = new ArrayList(); + ArrayList dataSets = new ArrayList<>(); dataSets.add(set1); // add the datasets dataSets.add(set2); dataSets.add(set3); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/ScrollViewActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/ScrollViewActivity.java index 1aeb7f0f0..bafe7308a 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/ScrollViewActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/ScrollViewActivity.java @@ -50,7 +50,7 @@ protected void onCreate(Bundle savedInstanceState) { private void setData(int count) { - ArrayList yVals = new ArrayList(); + ArrayList yVals = new ArrayList<>(); for (int i = 0; i < count; i++) { float val = (float) (Math.random() * count) + 15; diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/StackedBarActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/StackedBarActivity.java index 995106017..574d9ab7d 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/StackedBarActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/StackedBarActivity.java @@ -193,7 +193,7 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { tvX.setText("" + (mSeekBarX.getProgress() + 1)); tvY.setText("" + (mSeekBarY.getProgress())); - ArrayList yVals1 = new ArrayList(); + ArrayList yVals1 = new ArrayList<>(); for (int i = 0; i < mSeekBarX.getProgress() + 1; i++) { float mult = (mSeekBarY.getProgress() + 1); @@ -221,7 +221,7 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { set1.setColors(getColors()); set1.setStackLabels(new String[]{"Births", "Divorces", "Marriages"}); - ArrayList dataSets = new ArrayList(); + ArrayList dataSets = new ArrayList<>(); dataSets.add(set1); BarData data = new BarData(dataSets); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/StackedBarActivityNegative.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/StackedBarActivityNegative.java index c1d64a106..77bee7cb0 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/StackedBarActivityNegative.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/StackedBarActivityNegative.java @@ -97,7 +97,7 @@ public String getFormattedValue(float value, AxisBase axis) { l.setXEntrySpace(6f); // IMPORTANT: When using negative values in stacked bars, always make sure the negative values are in the array first - ArrayList yValues = new ArrayList(); + ArrayList yValues = new ArrayList<>(); yValues.add(new BarEntry(5, new float[]{ -10, 10 })); yValues.add(new BarEntry(15, new float[]{ -12, 13 })); yValues.add(new BarEntry(25, new float[]{ -15, 15 })); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/RealmDemoData.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/RealmDemoData.java index 7becc88c9..087667176 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/RealmDemoData.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/RealmDemoData.java @@ -49,7 +49,7 @@ public RealmDemoData(float xValue, float yValue) { */ public RealmDemoData(float xValue, float[] stackValues) { this.xValue = xValue; - this.stackValues = new RealmList(); + this.stackValues = new RealmList<>(); for (float val : stackValues) { this.stackValues.add(new RealmFloat(val)); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/fragments/SimpleFragment.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/fragments/SimpleFragment.java index 22b35e496..8f3461d09 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/fragments/SimpleFragment.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/fragments/SimpleFragment.java @@ -44,11 +44,11 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa protected BarData generateBarData(int dataSets, float range, int count) { - ArrayList sets = new ArrayList(); + ArrayList sets = new ArrayList<>(); for(int i = 0; i < dataSets; i++) { - ArrayList entries = new ArrayList(); + ArrayList entries = new ArrayList<>(); // entries = FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "stacked_bars.txt"); @@ -68,13 +68,13 @@ protected BarData generateBarData(int dataSets, float range, int count) { protected ScatterData generateScatterData(int dataSets, float range, int count) { - ArrayList sets = new ArrayList(); + ArrayList sets = new ArrayList<>(); ScatterChart.ScatterShape[] shapes = ScatterChart.ScatterShape.getAllDefaultShapes(); for(int i = 0; i < dataSets; i++) { - ArrayList entries = new ArrayList(); + ArrayList entries = new ArrayList<>(); for(int j = 0; j < count; j++) { entries.add(new Entry(j, (float) (Math.random() * range) + range / 4)); @@ -101,7 +101,7 @@ protected PieData generatePieData() { int count = 4; - ArrayList entries1 = new ArrayList(); + ArrayList entries1 = new ArrayList<>(); for(int i = 0; i < count; i++) { entries1.add(new PieEntry((float) ((Math.random() * 60) + 40), "Quarter " + (i+1))); @@ -121,7 +121,7 @@ protected PieData generatePieData() { protected LineData generateLineData() { - ArrayList sets = new ArrayList(); + ArrayList sets = new ArrayList<>(); LineDataSet ds1 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "sine.txt"), "Sine function"); LineDataSet ds2 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "cosine.txt"), "Cosine function"); @@ -146,7 +146,7 @@ protected LineData generateLineData() { protected LineData getComplexity() { - ArrayList sets = new ArrayList(); + ArrayList sets = new ArrayList<>(); LineDataSet ds1 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "n.txt"), "O(n)"); LineDataSet ds2 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "nlogn.txt"), "O(nlogn)"); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/notimportant/DemoBase.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/notimportant/DemoBase.java index 59b73b1ad..375cfdb40 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/notimportant/DemoBase.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/notimportant/DemoBase.java @@ -3,7 +3,6 @@ import android.graphics.Typeface; import android.os.Bundle; -import android.renderscript.Type; import android.support.annotation.Nullable; import android.support.v4.app.FragmentActivity; @@ -11,16 +10,16 @@ /** * Baseclass of all Activities of the Demo Application. - * + * * @author Philipp Jahoda */ public abstract class DemoBase extends FragmentActivity { - protected String[] mMonths = new String[] { + protected String[] mMonths = new String[]{ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec" }; - protected String[] mParties = new String[] { + protected String[] mParties = new String[]{ "Party A", "Party B", "Party C", "Party D", "Party E", "Party F", "Party G", "Party H", "Party I", "Party J", "Party K", "Party L", "Party M", "Party N", "Party O", "Party P", "Party Q", "Party R", "Party S", "Party T", "Party U", "Party V", "Party W", "Party X", diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/notimportant/MainActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/notimportant/MainActivity.java index d994f87c9..75929852b 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/notimportant/MainActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/notimportant/MainActivity.java @@ -64,7 +64,7 @@ protected void onCreate(Bundle savedInstanceState) { // initialize the utilities Utils.init(this); - ArrayList objects = new ArrayList(); + ArrayList objects = new ArrayList<>(); objects.add(new ContentItem("Line Chart", "A simple demonstration of the linechart.")); objects.add(new ContentItem("Line Chart (Dual YAxis)", diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityBar.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityBar.java index 1e5d5cb8d..9d94a4ade 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityBar.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityBar.java @@ -50,11 +50,11 @@ private void setData() { RealmResults result = mRealm.where(RealmDemoData.class).findAll(); //RealmBarDataSet set = new RealmBarDataSet(result, "stackValues", "xIndex"); // normal entries - RealmBarDataSet set = new RealmBarDataSet(result, "xValue", "yValue"); // stacked entries + RealmBarDataSet set = new RealmBarDataSet<>(result, "xValue", "yValue"); // stacked entries set.setColors(new int[] {ColorTemplate.rgb("#FF5722"), ColorTemplate.rgb("#03A9F4")}); set.setLabel("Realm BarDataSet"); - ArrayList dataSets = new ArrayList(); + ArrayList dataSets = new ArrayList<>(); dataSets.add(set); // add the dataset // create a data object with the dataset list diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityBubble.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityBubble.java index ad65a3de1..3493ade94 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityBubble.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityBubble.java @@ -53,11 +53,11 @@ private void setData() { RealmResults result = mRealm.where(RealmDemoData.class).findAll(); - RealmBubbleDataSet set = new RealmBubbleDataSet(result, "xValue", "yValue", "bubbleSize"); + RealmBubbleDataSet set = new RealmBubbleDataSet<>(result, "xValue", "yValue", "bubbleSize"); set.setLabel("Realm BubbleDataSet"); set.setColors(ColorTemplate.COLORFUL_COLORS, 110); - ArrayList dataSets = new ArrayList(); + ArrayList dataSets = new ArrayList<>(); dataSets.add(set); // add the dataset // create a data object with the dataset list diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityCandle.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityCandle.java index 96fbade85..49d8903c6 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityCandle.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityCandle.java @@ -53,7 +53,7 @@ private void setData() { RealmResults result = mRealm.where(RealmDemoData.class).findAll(); - RealmCandleDataSet set = new RealmCandleDataSet(result, "xValue", "high", "low", "open", "close"); + RealmCandleDataSet set = new RealmCandleDataSet<>(result, "xValue", "high", "low", "open", "close"); set.setLabel("Realm CandleDataSet"); set.setShadowColor(Color.DKGRAY); set.setShadowWidth(0.7f); @@ -63,7 +63,7 @@ private void setData() { set.setIncreasingPaintStyle(Paint.Style.STROKE); set.setNeutralColor(Color.BLUE); - ArrayList dataSets = new ArrayList(); + ArrayList dataSets = new ArrayList<>(); dataSets.add(set); // add the dataset // create a data object with the dataset list diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityHorizontalBar.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityHorizontalBar.java index b5e334513..ddd5a2efe 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityHorizontalBar.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityHorizontalBar.java @@ -53,13 +53,12 @@ private void setData() { RealmResults result = mRealm.where(RealmDemoData.class).findAll(); - //RealmBarDataSet set = new RealmBarDataSet(result, "stackValues", "xIndex"); // normal entries - RealmBarDataSet set = new RealmBarDataSet(result, "xValue", "stackValues", "floatValue"); // stacked entries + RealmBarDataSet set = new RealmBarDataSet<>(result, "xValue", "stackValues", "floatValue"); // stacked entries set.setColors(new int[]{ColorTemplate.rgb("#8BC34A"), ColorTemplate.rgb("#FFC107"), ColorTemplate.rgb("#9E9E9E")}); set.setLabel("Mobile OS distribution"); set.setStackLabels(new String[]{"iOS", "Android", "Other"}); - ArrayList dataSets = new ArrayList(); + ArrayList dataSets = new ArrayList<>(); dataSets.add(set); // add the dataset // create a data object with the dataset list diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityLine.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityLine.java index 7d2e49fdf..c0bbd3caf 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityLine.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityLine.java @@ -55,7 +55,7 @@ private void setData() { RealmResults result = mRealm.where(RealmDemoData.class).findAll(); - RealmLineDataSet set = new RealmLineDataSet(result, "xValue", "yValue"); + RealmLineDataSet set = new RealmLineDataSet<>(result, "xValue", "yValue"); set.setMode(LineDataSet.Mode.CUBIC_BEZIER); set.setLabel("Realm LineDataSet"); set.setDrawCircleHole(false); @@ -64,7 +64,7 @@ private void setData() { set.setLineWidth(1.8f); set.setCircleRadius(3.6f); - ArrayList dataSets = new ArrayList(); + ArrayList dataSets = new ArrayList<>(); dataSets.add(set); // add the dataset // create a data object with the dataset list diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityPie.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityPie.java index 9fad49c61..46af4cda3 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityPie.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityPie.java @@ -53,7 +53,7 @@ private void setData() { RealmResults result = mRealm.where(RealmDemoData.class).findAll(); - RealmPieDataSet set = new RealmPieDataSet(result, "yValue", "label"); + RealmPieDataSet set = new RealmPieDataSet<>(result, "yValue", "label"); set.setColors(ColorTemplate.VORDIPLOM_COLORS); set.setLabel("Example market share"); set.setSliceSpace(2); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityRadar.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityRadar.java index 02f3ac049..0d5180569 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityRadar.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityRadar.java @@ -56,7 +56,7 @@ private void setData() { RealmResults result = mRealm.where(RealmDemoData.class).findAll(); //RealmBarDataSet set = new RealmBarDataSet(result, "stackValues", "xIndex"); // normal entries - RealmRadarDataSet set = new RealmRadarDataSet(result, "yValue"); // stacked entries + RealmRadarDataSet set = new RealmRadarDataSet<>(result, "yValue"); // stacked entries set.setLabel("Realm RadarDataSet"); set.setDrawFilled(true); set.setColor(ColorTemplate.rgb("#009688")); @@ -64,7 +64,7 @@ private void setData() { set.setFillAlpha(130); set.setLineWidth(2f); - ArrayList dataSets = new ArrayList(); + ArrayList dataSets = new ArrayList<>(); dataSets.add(set); // add the dataset // create a data object with the dataset list diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityScatter.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityScatter.java index 9da64cbf1..01e015193 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityScatter.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmDatabaseActivityScatter.java @@ -53,13 +53,13 @@ private void setData() { RealmResults result = mRealm.where(RealmDemoData.class).findAll(); - RealmScatterDataSet set = new RealmScatterDataSet(result, "xValue", "yValue"); + RealmScatterDataSet set = new RealmScatterDataSet<>(result, "xValue", "yValue"); set.setLabel("Realm ScatterDataSet"); set.setScatterShapeSize(9f); set.setColor(ColorTemplate.rgb("#CDDC39")); set.setScatterShape(ScatterChart.ScatterShape.CIRCLE); - ArrayList dataSets = new ArrayList(); + ArrayList dataSets = new ArrayList<>(); dataSets.add(set); // add the dataset // create a data object with the dataset list diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmMainActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmMainActivity.java index 1776a8bd7..9e007fa55 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmMainActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmMainActivity.java @@ -34,7 +34,7 @@ protected void onCreate(Bundle savedInstanceState) { setTitle("Realm.io Examples"); - ArrayList objects = new ArrayList(); + ArrayList objects = new ArrayList<>(); objects.add(new ContentItem("Line Chart", "Creating a LineChart with Realm.io database")); objects.add(new ContentItem("Bar Chart", diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmWikiExample.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmWikiExample.java index f223be609..bb07d1024 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmWikiExample.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmWikiExample.java @@ -95,7 +95,7 @@ public String getFormattedValue(float value, AxisBase axis) { lineChart.getXAxis().setValueFormatter(formatter); barChart.getXAxis().setValueFormatter(formatter); - RealmLineDataSet lineDataSet = new RealmLineDataSet(results, "scoreNr", "totalScore"); + RealmLineDataSet lineDataSet = new RealmLineDataSet<>(results, "scoreNr", "totalScore"); lineDataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER); lineDataSet.setLabel("Result Scores"); lineDataSet.setDrawCircleHole(false); @@ -104,7 +104,7 @@ public String getFormattedValue(float value, AxisBase axis) { lineDataSet.setLineWidth(1.8f); lineDataSet.setCircleRadius(3.6f); - ArrayList dataSets = new ArrayList(); + ArrayList dataSets = new ArrayList<>(); dataSets.add(lineDataSet); LineData lineData = new LineData(dataSets); @@ -116,11 +116,11 @@ public String getFormattedValue(float value, AxisBase axis) { // BAR-CHART - RealmBarDataSet barDataSet = new RealmBarDataSet(results, "scoreNr", "totalScore"); + RealmBarDataSet barDataSet = new RealmBarDataSet<>(results, "scoreNr", "totalScore"); barDataSet.setColors(new int[]{ColorTemplate.rgb("#FF5722"), ColorTemplate.rgb("#03A9F4")}); barDataSet.setLabel("Realm BarDataSet"); - ArrayList barDataSets = new ArrayList(); + ArrayList barDataSets = new ArrayList<>(); barDataSets.add(barDataSet); BarData barData = new BarData(barDataSets); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/Chart.java b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/Chart.java index 35ec2ec1e..8cec22ccc 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/Chart.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/Chart.java @@ -1648,7 +1648,7 @@ public boolean saveToGallery(String fileName, int quality) { /** * tasks to be done after the view is setup */ - protected ArrayList mJobs = new ArrayList(); + protected ArrayList mJobs = new ArrayList<>(); public void removeViewportJob(Runnable job) { mJobs.remove(job); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/components/AxisBase.java b/MPChartLib/src/main/java/com/github/mikephil/charting/components/AxisBase.java index 3c8028c24..d1e8ee2c6 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/components/AxisBase.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/components/AxisBase.java @@ -159,7 +159,7 @@ public AxisBase() { this.mTextSize = Utils.convertDpToPixel(10f); this.mXOffset = Utils.convertDpToPixel(5f); this.mYOffset = Utils.convertDpToPixel(5f); - this.mLimitLines = new ArrayList(); + this.mLimitLines = new ArrayList<>(); } /** diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/BarDataSet.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/BarDataSet.java index 496f4046f..dfbb65df3 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/BarDataSet.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/BarDataSet.java @@ -53,7 +53,7 @@ public BarDataSet(List yVals, String label) { @Override public DataSet copy() { - List entries = new ArrayList(); + List entries = new ArrayList<>(); for (int i = 0; i < mValues.size(); i++) { entries.add(mValues.get(i).copy()); } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/BaseDataSet.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/BaseDataSet.java index 7800986dc..6b7139d37 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/BaseDataSet.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/BaseDataSet.java @@ -97,8 +97,8 @@ public abstract class BaseDataSet implements IDataSet { * Default constructor. */ public BaseDataSet() { - mColors = new ArrayList(); - mValueColors = new ArrayList(); + mColors = new ArrayList<>(); + mValueColors = new ArrayList<>(); // default color mColors.add(Color.rgb(140, 234, 255)); @@ -221,7 +221,7 @@ public void setColors(int[] colors, Context c) { */ public void addColor(int color) { if (mColors == null) - mColors = new ArrayList(); + mColors = new ArrayList<>(); mColors.add(color); } @@ -283,7 +283,7 @@ public void setColors(int[] colors, int alpha) { */ public void resetColors() { if (mColors == null) { - mColors = new ArrayList(); + mColors = new ArrayList<>(); } mColors.clear(); } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/BubbleDataSet.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/BubbleDataSet.java index 1f88272dd..b258054ad 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/BubbleDataSet.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/BubbleDataSet.java @@ -41,7 +41,7 @@ protected void calcMinMax(BubbleEntry e) { @Override public DataSet copy() { - List entries = new ArrayList(); + List entries = new ArrayList<>(); for (int i = 0; i < mValues.size(); i++) { entries.add(mValues.get(i).copy()); } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/CandleDataSet.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/CandleDataSet.java index c7f836280..9ad3a5194 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/CandleDataSet.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/CandleDataSet.java @@ -79,7 +79,7 @@ public CandleDataSet(List yVals, String label) { @Override public DataSet copy() { - List entries = new ArrayList(); + List entries = new ArrayList<>(); for (int i = 0; i < mValues.size(); i++) { entries.add(mValues.get(i).copy()); } @@ -181,16 +181,16 @@ public boolean getShowCandleBar() { } // TODO - /** - * It is necessary to implement ColorsList class that will encapsulate - * colors list functionality, because It's wrong to copy paste setColor, - * addColor, ... resetColors for each time when we want to add a coloring - * options for one of objects - * - * @author Mesrop + /* + It is necessary to implement ColorsList class that will encapsulate + colors list functionality, because It's wrong to copy paste setColor, + addColor, ... resetColors for each time when we want to add a coloring + options for one of objects + + @author Mesrop */ - /** BELOW THIS COLOR HANDLING */ + /* BELOW THIS COLOR HANDLING */ /** * Sets the one and ONLY color that should be used for this DataSet when diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/ChartData.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/ChartData.java index 60d89f475..136632e7e 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/ChartData.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/ChartData.java @@ -58,7 +58,7 @@ public abstract class ChartData> { * Default constructor. */ public ChartData() { - mDataSets = new ArrayList(); + mDataSets = new ArrayList<>(); } /** diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/CombinedData.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/CombinedData.java index 39625b30f..8ede9f31b 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/CombinedData.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/CombinedData.java @@ -133,7 +133,7 @@ public CandleData getCandleData() { */ public List getAllData() { - List data = new ArrayList(); + List data = new ArrayList<>(); if (mLineData != null) data.add(mLineData); if (mBarData != null) diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/DataSet.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/DataSet.java index 3c69d9c58..9371c4603 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/DataSet.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/DataSet.java @@ -53,7 +53,7 @@ public DataSet(List values, String label) { this.mValues = values; if (mValues == null) - mValues = new ArrayList(); + mValues = new ArrayList<>(); calcMinMax(); } @@ -215,7 +215,7 @@ public void addEntryOrdered(T e) { return; if (mValues == null) { - mValues = new ArrayList(); + mValues = new ArrayList<>(); } calcMinMax(e); @@ -242,7 +242,7 @@ public boolean addEntry(T e) { List values = getValues(); if (values == null) { - values = new ArrayList(); + values = new ArrayList<>(); } calcMinMax(e); @@ -382,7 +382,7 @@ public int getEntryIndex(float xValue, float closestToY, Rounding rounding) { @Override public List getEntriesForXValue(float xValue) { - List entries = new ArrayList(); + List entries = new ArrayList<>(); int low = 0; int high = mValues.size() - 1; diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/LineDataSet.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/LineDataSet.java index c1018d1fb..3c5a8256e 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/LineDataSet.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/LineDataSet.java @@ -72,7 +72,7 @@ public LineDataSet(List yVals, String label) { // mLineWidth = Utils.convertDpToPixel(1f); if (mCircleColors == null) { - mCircleColors = new ArrayList(); + mCircleColors = new ArrayList<>(); } mCircleColors.clear(); @@ -84,7 +84,7 @@ public LineDataSet(List yVals, String label) { @Override public DataSet copy() { - List entries = new ArrayList(); + List entries = new ArrayList<>(); for (int i = 0; i < mValues.size(); i++) { entries.add(mValues.get(i).copy()); } @@ -356,7 +356,7 @@ public void setCircleColor(int color) { */ public void resetCircleColors() { if (mCircleColors == null) { - mCircleColors = new ArrayList(); + mCircleColors = new ArrayList<>(); } mCircleColors.clear(); } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/RadarDataSet.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/RadarDataSet.java index 09c94b417..986e994ee 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/RadarDataSet.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/RadarDataSet.java @@ -101,7 +101,7 @@ public void setHighlightCircleStrokeWidth(float strokeWidth) { @Override public DataSet copy() { - List entries = new ArrayList(); + List entries = new ArrayList<>(); for (int i = 0; i < mValues.size(); i++) { entries.add(mValues.get(i).copy()); } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/ScatterDataSet.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/ScatterDataSet.java index d234c751a..3978de0f6 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/ScatterDataSet.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/ScatterDataSet.java @@ -47,7 +47,7 @@ public ScatterDataSet(List yVals, String label) { @Override public DataSet copy() { - List entries = new ArrayList(); + List entries = new ArrayList<>(); for (int i = 0; i < mValues.size(); i++) { entries.add(mValues.get(i).copy()); } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/ChartHighlighter.java b/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/ChartHighlighter.java index f889bf19d..dd3dd2040 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/ChartHighlighter.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/ChartHighlighter.java @@ -25,7 +25,7 @@ public class ChartHighlighter /** * buffer for storing previously highlighted values */ - protected List mHighlightBuffer = new ArrayList(); + protected List mHighlightBuffer = new ArrayList<>(); public ChartHighlighter(T chart) { this.mChart = chart; diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/PieRadarHighlighter.java b/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/PieRadarHighlighter.java index a19906d75..807642f4e 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/PieRadarHighlighter.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/PieRadarHighlighter.java @@ -17,7 +17,7 @@ public abstract class PieRadarHighlighter implement /** * buffer for storing previously highlighted values */ - protected List mHighlightBuffer = new ArrayList(); + protected List mHighlightBuffer = new ArrayList<>(); public PieRadarHighlighter(T chart) { this.mChart = chart; diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/listener/PieRadarChartTouchListener.java b/MPChartLib/src/main/java/com/github/mikephil/charting/listener/PieRadarChartTouchListener.java index 527617472..d1ead4f98 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/listener/PieRadarChartTouchListener.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/listener/PieRadarChartTouchListener.java @@ -28,7 +28,7 @@ public class PieRadarChartTouchListener extends ChartTouchListener _velocitySamples = new ArrayList(); + private ArrayList _velocitySamples = new ArrayList<>(); private long mDecelerationLastTime = 0; private float mDecelerationAngularVelocity = 0.f; diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/CombinedChartRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/CombinedChartRenderer.java index 6d0d4d3da..79ea07681 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/CombinedChartRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/CombinedChartRenderer.java @@ -24,7 +24,7 @@ public class CombinedChartRenderer extends DataRenderer { /** * all rederers for the different kinds of data this combined-renderer can draw */ - protected List mRenderers = new ArrayList(5); + protected List mRenderers = new ArrayList<>(5); protected WeakReference mChart; @@ -103,7 +103,7 @@ public void drawExtras(Canvas c) { renderer.drawExtras(c); } - protected List mHighlightBuffer = new ArrayList(); + protected List mHighlightBuffer = new ArrayList<>(); @Override public void drawHighlighted(Canvas c, Highlight[] indices) { diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/utils/ColorTemplate.java b/MPChartLib/src/main/java/com/github/mikephil/charting/utils/ColorTemplate.java index 4d9c1de79..f6b4f64f9 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/utils/ColorTemplate.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/utils/ColorTemplate.java @@ -99,7 +99,7 @@ public static int colorWithAlpha(int color, int alpha) { */ public static List createColors(Resources r, int[] colors) { - List result = new ArrayList(); + List result = new ArrayList<>(); for (int i : colors) { result.add(r.getColor(i)); @@ -117,7 +117,7 @@ public static List createColors(Resources r, int[] colors) { */ public static List createColors(int[] colors) { - List result = new ArrayList(); + List result = new ArrayList<>(); for (int i : colors) { result.add(i); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/utils/FileUtils.java b/MPChartLib/src/main/java/com/github/mikephil/charting/utils/FileUtils.java index 5aff51ff8..5607ad498 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/utils/FileUtils.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/utils/FileUtils.java @@ -41,7 +41,7 @@ public static List loadEntriesFromFile(String path) { // Get the text file File file = new File(sdcard, path); - List entries = new ArrayList(); + List entries = new ArrayList<>(); try { @SuppressWarnings("resource") @@ -108,7 +108,7 @@ public static List loadEntriesFromFile(String path) { */ public static List loadEntriesFromAssets(AssetManager am, String path) { - List entries = new ArrayList(); + List entries = new ArrayList<>(); BufferedReader reader = null; try { @@ -229,7 +229,7 @@ public static void saveToSdCard(List entries, String path) { public static List loadBarEntriesFromAssets(AssetManager am, String path) { - List entries = new ArrayList(); + List entries = new ArrayList<>(); BufferedReader reader = null; try { diff --git a/MPChartLib/src/test/java/com/github/mikephil/charting/test/ChartDataTest.java b/MPChartLib/src/test/java/com/github/mikephil/charting/test/ChartDataTest.java index ae464eefd..6d276091e 100644 --- a/MPChartLib/src/test/java/com/github/mikephil/charting/test/ChartDataTest.java +++ b/MPChartLib/src/test/java/com/github/mikephil/charting/test/ChartDataTest.java @@ -24,14 +24,14 @@ public class ChartDataTest { @Test public void testDynamicChartData() { - List entries1 = new ArrayList(); + List entries1 = new ArrayList<>(); entries1.add(new Entry(10, 10)); entries1.add(new Entry(15, -2)); entries1.add(new Entry(21, 50)); ScatterDataSet set1 = new ScatterDataSet(entries1, ""); - List entries2 = new ArrayList(); + List entries2 = new ArrayList<>(); entries2.add(new Entry(-1, 10)); entries2.add(new Entry(10, 2)); entries2.add(new Entry(20, 5)); @@ -78,7 +78,7 @@ public void testDynamicChartData() { assertEquals(-100, data.getYMin(YAxis.AxisDependency.RIGHT), 0.01f); assertEquals(100f, data.getYMax(YAxis.AxisDependency.RIGHT), 0.01f); - List entries3 = new ArrayList(); + List entries3 = new ArrayList<>(); entries3.add(new Entry(0, 200)); entries3.add(new Entry(0, -50)); @@ -108,7 +108,7 @@ public void testDynamicChartData() { assertEquals(0, lineData.getDataSetCount()); - List lineEntries1 = new ArrayList(); + List lineEntries1 = new ArrayList<>(); lineEntries1.add(new Entry(10, 90)); lineEntries1.add(new Entry(1000, 1000)); @@ -132,7 +132,7 @@ public void testDynamicChartData() { assertEquals(90, lineData.getYMin(YAxis.AxisDependency.RIGHT), 0.01f); assertEquals(1000, lineData.getYMax(YAxis.AxisDependency.RIGHT), 0.01f); - List lineEntries2 = new ArrayList(); + List lineEntries2 = new ArrayList<>(); lineEntries2.add(new Entry(-1000, 2000)); lineEntries2.add(new Entry(2000, -3000)); diff --git a/MPChartLib/src/test/java/com/github/mikephil/charting/test/DataSetTest.java b/MPChartLib/src/test/java/com/github/mikephil/charting/test/DataSetTest.java index 3be28d2a5..054db7f47 100644 --- a/MPChartLib/src/test/java/com/github/mikephil/charting/test/DataSetTest.java +++ b/MPChartLib/src/test/java/com/github/mikephil/charting/test/DataSetTest.java @@ -21,7 +21,7 @@ public class DataSetTest { @Test public void testCalcMinMax() { - List entries = new ArrayList(); + List entries = new ArrayList<>(); entries.add(new Entry(10, 10)); entries.add(new Entry(15, 2)); entries.add(new Entry(21, 5)); @@ -58,7 +58,7 @@ public void testCalcMinMax() { @Test public void testAddRemoveEntry() { - List entries = new ArrayList(); + List entries = new ArrayList<>(); entries.add(new Entry(10, 10)); entries.add(new Entry(15, 2)); entries.add(new Entry(21, 5)); @@ -143,7 +143,7 @@ public void testAddRemoveEntry() { @Test public void testGetEntryForXValue() { - List entries = new ArrayList(); + List entries = new ArrayList<>(); entries.add(new Entry(10, 10)); entries.add(new Entry(15, 5)); entries.add(new Entry(21, 5)); @@ -183,7 +183,7 @@ public void testGetEntryForXValue() { public void testGetEntryForXValueWithDuplicates() { // sorted list of values (by x position) - List values = new ArrayList(); + List values = new ArrayList<>(); values.add(new Entry(0, 10)); values.add(new Entry(1, 20)); values.add(new Entry(2, 30));