Merge remote-tracking branch 'origin/dev' into combo-scripter-v2

* origin/dev:
  Check activity != null before drawing graph.
This commit is contained in:
Johannes Mockenhaupt 2018-01-03 21:18:12 +01:00
commit bf25af8c42
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -11,6 +11,7 @@ import android.graphics.Paint;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
@ -1337,7 +1338,9 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
secondGraphData.addNowLine(now);
// do GUI update
getActivity().runOnUiThread(new Runnable() {
FragmentActivity activity = getActivity();
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (showIobView.isChecked() || showCobView.isChecked() || showDeviationsView.isChecked() || showRatiosView.isChecked()) {
@ -1345,13 +1348,14 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
} else {
iobGraph.setVisibility(View.GONE);
}
// finaly enforce drawing of graphs
// finally enforce drawing of graphs
graphData.performUpdate();
secondGraphData.performUpdate();
Profiler.log(log, from + " - onDataChanged", updateGUIStart);
}
});
}
}
}).start();
Profiler.log(log, from, updateGUIStart);