Merge remote-tracking branch 'origin/dev' into combo-scripter-v2
* origin/dev: Check activity != null before drawing graph.
This commit is contained in:
commit
bf25af8c42
1 changed files with 17 additions and 13 deletions
|
@ -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,20 +1338,23 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
secondGraphData.addNowLine(now);
|
||||
|
||||
// do GUI update
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (showIobView.isChecked() || showCobView.isChecked() || showDeviationsView.isChecked() || showRatiosView.isChecked()) {
|
||||
iobGraph.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
iobGraph.setVisibility(View.GONE);
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity != null) {
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (showIobView.isChecked() || showCobView.isChecked() || showDeviationsView.isChecked() || showRatiosView.isChecked()) {
|
||||
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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue