Fix on launch crash

This commit is contained in:
Tanguy Herbron 2018-02-09 00:01:10 +01:00
parent fdd059b956
commit ddb618f4fa

View File

@ -95,25 +95,28 @@ public class HomeLayoutGenerator {
((ImageView) view.findViewById(R.id.detailsArrow)) ((ImageView) view.findViewById(R.id.detailsArrow))
.getDrawable().setColorFilter(new PorterDuffColorFilter(currency.getChartColor(), PorterDuff.Mode.SRC_IN)); .getDrawable().setColorFilter(new PorterDuffColorFilter(currency.getChartColor(), PorterDuff.Mode.SRC_IN));
List<Double> borders = getAxisBorders(currency); if(currency.getHistoryMinutes() != null)
LineChartView chartView = (LineChartView) view.findViewById(R.id.LineChartView); {
List<Double> borders = getAxisBorders(currency);
LineChartView chartView = (LineChartView) view.findViewById(R.id.LineChartView);
chartView.setAxisBorderValues(borders.get(0).floatValue(), borders.get(1).floatValue()) chartView.setAxisBorderValues(borders.get(0).floatValue(), borders.get(1).floatValue())
.setYLabels(AxisRenderer.LabelPosition.NONE) .setYLabels(AxisRenderer.LabelPosition.NONE)
.setYAxis(false) .setYAxis(false)
.setXAxis(false) .setXAxis(false)
.setVisibility(View.VISIBLE); .setVisibility(View.VISIBLE);
chartView.addData(generateChartSet(currency)); chartView.addData(generateChartSet(currency));
chartView.setOnClickListener(new View.OnClickListener() { chartView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Intent intent = new Intent(context.getApplicationContext(), CurrencyDetailsActivity.class); Intent intent = new Intent(context.getApplicationContext(), CurrencyDetailsActivity.class);
intent.putExtra("currency", currency); intent.putExtra("currency", currency);
context.getApplicationContext().startActivity(intent); context.getApplicationContext().startActivity(intent);
} }
}); });
}
if(isExtended) if(isExtended)
{ {