Fix crash in charts activity, closes #277
This commit is contained in:
parent
059c7d0b15
commit
42dda911e4
|
@ -4,6 +4,7 @@ import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
|
@ -80,6 +81,7 @@ public abstract class AbstractChartFragment extends AbstractGBFragment {
|
||||||
};
|
};
|
||||||
private boolean mChartDirty = true;
|
private boolean mChartDirty = true;
|
||||||
private boolean supportsHeartrateChart = true;
|
private boolean supportsHeartrateChart = true;
|
||||||
|
private AsyncTask refreshTask;
|
||||||
|
|
||||||
public boolean isChartDirty() {
|
public boolean isChartDirty() {
|
||||||
return mChartDirty;
|
return mChartDirty;
|
||||||
|
@ -367,7 +369,10 @@ public abstract class AbstractChartFragment extends AbstractGBFragment {
|
||||||
if (chartsHost.getDevice() != null) {
|
if (chartsHost.getDevice() != null) {
|
||||||
mChartDirty = false;
|
mChartDirty = false;
|
||||||
updateDateInfo(getStartDate(), getEndDate());
|
updateDateInfo(getStartDate(), getEndDate());
|
||||||
createRefreshTask("Visualizing data", getActivity()).execute();
|
if (refreshTask != null && refreshTask.getStatus() != AsyncTask.Status.FINISHED) {
|
||||||
|
refreshTask.cancel(true);
|
||||||
|
}
|
||||||
|
refreshTask = createRefreshTask("Visualizing data", getActivity()).execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue