more dialogs tweaking
This commit is contained in:
parent
bb041b1c06
commit
8864886702
4 changed files with 16 additions and 14 deletions
|
@ -351,12 +351,15 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
|
|
||||||
PumpEnactResult result = activePump.deliverTreatment(insulin, carbs, context);
|
PumpEnactResult result = activePump.deliverTreatment(insulin, carbs, context);
|
||||||
|
|
||||||
if (bolusProgressDialog != null) {
|
bolusProgressDialog.bolusEnded = true;
|
||||||
bolusProgressDialog.dismiss();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Config.logCongigBuilderActions)
|
if (bolusProgressDialog != null && bolusProgressDialog.running) {
|
||||||
log.debug("deliverTreatmentFromBolusWizard insulin: " + insulin + " carbs: " + carbs + " success: " + result.success + " enacted: " + result.enacted + " bolusDelivered: " + result.bolusDelivered);
|
try {
|
||||||
|
bolusProgressDialog.dismiss();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace(); // TODO: handle this better
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
Treatment t = new Treatment();
|
Treatment t = new Treatment();
|
||||||
|
|
|
@ -38,13 +38,10 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
||||||
Handler mHandler;
|
Handler mHandler;
|
||||||
public static HandlerThread mHandlerThread;
|
public static HandlerThread mHandlerThread;
|
||||||
|
|
||||||
Context parentContext = null;
|
public NewTreatmentDialog() {
|
||||||
|
|
||||||
public NewTreatmentDialog(Context context) {
|
|
||||||
mHandlerThread = new HandlerThread(NewTreatmentDialog.class.getSimpleName());
|
mHandlerThread = new HandlerThread(NewTreatmentDialog.class.getSimpleName());
|
||||||
mHandlerThread.start();
|
mHandlerThread.start();
|
||||||
this.mHandler = new Handler(mHandlerThread.getLooper());
|
this.mHandler = new Handler(mHandlerThread.getLooper());
|
||||||
parentContext = context;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -91,7 +88,9 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
||||||
final Double finalInsulinAfterConstraints = insulinAfterConstraints;
|
final Double finalInsulinAfterConstraints = insulinAfterConstraints;
|
||||||
final Integer finalCarbsAfterConstraints = carbsAfterConstraints;
|
final Integer finalCarbsAfterConstraints = carbsAfterConstraints;
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this.getContext());
|
final Context context = getContext();
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
|
|
||||||
builder.setTitle(this.getContext().getString(R.string.confirmation));
|
builder.setTitle(this.getContext().getString(R.string.confirmation));
|
||||||
builder.setMessage(confirmMessage);
|
builder.setMessage(confirmMessage);
|
||||||
builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||||
|
@ -101,9 +100,9 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
||||||
mHandler.post(new Runnable() {
|
mHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
PumpEnactResult result = pump.deliverTreatment(finalInsulinAfterConstraints, finalCarbsAfterConstraints, parentContext);
|
PumpEnactResult result = pump.deliverTreatment(finalInsulinAfterConstraints, finalCarbsAfterConstraints, context);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(parentContext);
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror));
|
builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror));
|
||||||
builder.setMessage(result.comment);
|
builder.setMessage(result.comment);
|
||||||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
|
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
|
||||||
|
|
|
@ -258,7 +258,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener {
|
||||||
|
|
||||||
ArrayList<CharSequence> profileList;
|
ArrayList<CharSequence> profileList;
|
||||||
profileList = profile.getProfileList();
|
profileList = profile.getProfileList();
|
||||||
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(parentContext,
|
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(getContext(),
|
||||||
android.R.layout.simple_spinner_item, profileList);
|
android.R.layout.simple_spinner_item, profileList);
|
||||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
profileSpinner.setAdapter(adapter);
|
profileSpinner.setAdapter(adapter);
|
||||||
|
|
|
@ -137,7 +137,7 @@ public class OverviewFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
FragmentManager manager = getFragmentManager();
|
FragmentManager manager = getFragmentManager();
|
||||||
NewTreatmentDialog treatmentDialogFragment = new NewTreatmentDialog(getContext());
|
NewTreatmentDialog treatmentDialogFragment = new NewTreatmentDialog();
|
||||||
treatmentDialogFragment.show(manager, "TreatmentDialog");
|
treatmentDialogFragment.show(manager, "TreatmentDialog");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue