Let CircadianPercentageProfileFragment inherit from SubscriberFragment.

This commit is contained in:
Johannes Mockenhaupt 2017-07-21 14:50:00 +02:00
parent 03ad898562
commit fdc0aea24b
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -39,10 +39,11 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment; import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog; import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow; import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.SafeParse; import info.nightscout.utils.SafeParse;
public class CircadianPercentageProfileFragment extends Fragment { public class CircadianPercentageProfileFragment extends SubscriberFragment {
private static Logger log = LoggerFactory.getLogger(CircadianPercentageProfileFragment.class); private static Logger log = LoggerFactory.getLogger(CircadianPercentageProfileFragment.class);
private static CircadianPercentageProfilePlugin circadianPercentageProfilePlugin = new CircadianPercentageProfilePlugin(); private static CircadianPercentageProfilePlugin circadianPercentageProfilePlugin = new CircadianPercentageProfilePlugin();
@ -309,16 +310,14 @@ public class CircadianPercentageProfileFragment extends Fragment {
percentageView.addTextChangedListener(textWatch); percentageView.addTextChangedListener(textWatch);
timeshiftView.addTextChangedListener(textWatch); timeshiftView.addTextChangedListener(textWatch);
updateGui(); updateGUI();
onStatusEvent(new EventInitializationChanged()); onStatusEvent(new EventInitializationChanged());
return layout; return layout;
} }
public void updateGui() { public void updateGUI() {
updateProfileInfo(); updateProfileInfo();
diaView.removeTextChangedListener(textWatch); diaView.removeTextChangedListener(textWatch);
@ -485,15 +484,12 @@ public class CircadianPercentageProfileFragment extends Fragment {
} }
basalEditDialog = null; basalEditDialog = null;
MainApp.bus().unregister(this);
fl.requestFocusFromTouch(); fl.requestFocusFromTouch();
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
updateGui();
MainApp.bus().register(this);
onStatusEvent(new EventInitializationChanged()); onStatusEvent(new EventInitializationChanged());
fl.requestFocusFromTouch(); fl.requestFocusFromTouch();
} }
@ -521,7 +517,7 @@ public class CircadianPercentageProfileFragment extends Fragment {
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
updateGui(); updateGUI();
} }
}); });
} }