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