From ddb618f4fad0752b20d3ff99466bc6a595481853 Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Fri, 9 Feb 2018 00:01:10 +0100 Subject: [PATCH] Fix on launch crash --- .../LayoutManagers/HomeLayoutGenerator.java | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/com/nauk/coinfolio/LayoutManagers/HomeLayoutGenerator.java b/app/src/main/java/com/nauk/coinfolio/LayoutManagers/HomeLayoutGenerator.java index 9fe6d6e..d941804 100644 --- a/app/src/main/java/com/nauk/coinfolio/LayoutManagers/HomeLayoutGenerator.java +++ b/app/src/main/java/com/nauk/coinfolio/LayoutManagers/HomeLayoutGenerator.java @@ -95,25 +95,28 @@ public class HomeLayoutGenerator { ((ImageView) view.findViewById(R.id.detailsArrow)) .getDrawable().setColorFilter(new PorterDuffColorFilter(currency.getChartColor(), PorterDuff.Mode.SRC_IN)); - List borders = getAxisBorders(currency); - LineChartView chartView = (LineChartView) view.findViewById(R.id.LineChartView); + if(currency.getHistoryMinutes() != null) + { + List borders = getAxisBorders(currency); + LineChartView chartView = (LineChartView) view.findViewById(R.id.LineChartView); - chartView.setAxisBorderValues(borders.get(0).floatValue(), borders.get(1).floatValue()) - .setYLabels(AxisRenderer.LabelPosition.NONE) - .setYAxis(false) - .setXAxis(false) - .setVisibility(View.VISIBLE); + chartView.setAxisBorderValues(borders.get(0).floatValue(), borders.get(1).floatValue()) + .setYLabels(AxisRenderer.LabelPosition.NONE) + .setYAxis(false) + .setXAxis(false) + .setVisibility(View.VISIBLE); - chartView.addData(generateChartSet(currency)); + chartView.addData(generateChartSet(currency)); - chartView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Intent intent = new Intent(context.getApplicationContext(), CurrencyDetailsActivity.class); - intent.putExtra("currency", currency); - context.getApplicationContext().startActivity(intent); - } - }); + chartView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent = new Intent(context.getApplicationContext(), CurrencyDetailsActivity.class); + intent.putExtra("currency", currency); + context.getApplicationContext().startActivity(intent); + } + }); + } if(isExtended) {