check for null on getDialog()

This commit is contained in:
Milos Kozak 2016-10-17 08:57:21 +02:00
parent 2354e60f31
commit a829a506f2
6 changed files with 15 additions and 8 deletions

View file

@ -271,7 +271,8 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); if (getDialog() != null)
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
} }
@Override @Override
@ -414,7 +415,8 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
data.put("percent", SafeParse.stringToDouble(percentEdit.getText().toString())); data.put("percent", SafeParse.stringToDouble(percentEdit.getText().toString()));
if (layoutAbsolute.getVisibility() != View.GONE) if (layoutAbsolute.getVisibility() != View.GONE)
data.put("absolute", SafeParse.stringToDouble(absoluteEdit.getText().toString())); data.put("absolute", SafeParse.stringToDouble(absoluteEdit.getText().toString()));
if (options.profile && profileSpinner.getSelectedItem() != null) data.put("profile", profileSpinner.getSelectedItem().toString()); if (options.profile && profileSpinner.getSelectedItem() != null)
data.put("profile", profileSpinner.getSelectedItem().toString());
if (SafeParse.stringToDouble(carbTimeEdit.getText().toString()) != 0d) if (SafeParse.stringToDouble(carbTimeEdit.getText().toString()) != 0d)
data.put("preBolus", SafeParse.stringToDouble(carbTimeEdit.getText().toString())); data.put("preBolus", SafeParse.stringToDouble(carbTimeEdit.getText().toString()));
if (!notesEdit.getText().toString().equals("")) if (!notesEdit.getText().toString().equals(""))

View file

@ -65,7 +65,8 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); if (getDialog() != null)
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
MainApp.bus().register(this); MainApp.bus().register(this);
running = true; running = true;
if (bolusEnded) dismiss(); if (bolusEnded) dismiss();

View file

@ -69,7 +69,8 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); if (getDialog() != null)
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
} }
@Override @Override

View file

@ -94,7 +94,8 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); if (getDialog() != null)
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
} }
@Override @Override

View file

@ -69,7 +69,8 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); if (getDialog() != null)
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
} }
@Override @Override

View file

@ -325,12 +325,13 @@ public class WizardDialog extends DialogFragment implements OnClickListener {
totalInsulin.setText(""); totalInsulin.setText("");
wizardDialogDeliverButton.setVisibility(Button.INVISIBLE); wizardDialogDeliverButton.setVisibility(Button.INVISIBLE);
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); if (getDialog() != null)
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
} }
private void calculateInsulin() { private void calculateInsulin() {