Merge pull request #295 from jotomo/on-resume-update-gui

On resume update gui
This commit is contained in:
AdrianLxM 2017-07-21 16:47:28 +02:00 committed by GitHub
commit 3d82bdb347
23 changed files with 147 additions and 299 deletions

View file

@ -31,11 +31,12 @@ import info.nightscout.androidaps.plugins.Actions.dialogs.NewTempBasalDialog;
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;
/** /**
* A simple {@link Fragment} subclass. * A simple {@link Fragment} subclass.
*/ */
public class ActionsFragment extends Fragment implements View.OnClickListener { public class ActionsFragment extends SubscriberFragment implements View.OnClickListener {
static ActionsPlugin actionsPlugin = new ActionsPlugin(); static ActionsPlugin actionsPlugin = new ActionsPlugin();
@ -82,43 +83,32 @@ public class ActionsFragment extends Fragment implements View.OnClickListener {
tempBasal.setOnClickListener(this); tempBasal.setOnClickListener(this);
fill.setOnClickListener(this); fill.setOnClickListener(this);
updateGUIIfVisible(); updateGUI();
return view; return view;
} }
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
}
@Subscribe @Subscribe
public void onStatusEvent(final EventInitializationChanged ev) { public void onStatusEvent(final EventInitializationChanged ev) {
updateGUIIfVisible(); updateGUI();
} }
@Subscribe @Subscribe
public void onStatusEvent(final EventRefreshOverview ev) { public void onStatusEvent(final EventRefreshOverview ev) {
updateGUIIfVisible(); updateGUI();
} }
@Subscribe @Subscribe
public void onStatusEvent(final EventExtendedBolusChange ev) { public void onStatusEvent(final EventExtendedBolusChange ev) {
updateGUIIfVisible(); updateGUI();
} }
@Subscribe @Subscribe
public void onStatusEvent(final EventTempBasalChange ev) { public void onStatusEvent(final EventTempBasalChange ev) {
updateGUIIfVisible(); updateGUI();
} }
void updateGUIIfVisible() { @Override
protected void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) if (activity != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {

View file

@ -19,9 +19,10 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.db.CareportalEvent; import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.events.EventCareportalEventChange; import info.nightscout.androidaps.events.EventCareportalEventChange;
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog; import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.Overview.OverviewFragment; import info.nightscout.androidaps.plugins.Overview.OverviewFragment;
public class CareportalFragment extends Fragment implements View.OnClickListener { public class CareportalFragment extends SubscriberFragment implements View.OnClickListener {
static CareportalPlugin careportalPlugin; static CareportalPlugin careportalPlugin;
@ -178,24 +179,13 @@ public class CareportalFragment extends Fragment implements View.OnClickListener
newDialog.show(manager, "NewNSTreatmentDialog"); newDialog.show(manager, "NewNSTreatmentDialog");
} }
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
}
@Subscribe @Subscribe
public void onStatusEvent(final EventCareportalEventChange c) { public void onStatusEvent(final EventCareportalEventChange c) {
updateGUI(); updateGUI();
} }
void updateGUI() { @Override
protected void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
updateAge(activity, sage, iage, cage, pbage); updateAge(activity, sage, iage, cage, pbage);
} }

View file

@ -0,0 +1,22 @@
package info.nightscout.androidaps.plugins.Common;
import android.support.v4.app.Fragment;
import info.nightscout.androidaps.MainApp;
abstract public class SubscriberFragment extends Fragment {
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
updateGUI();
}
protected abstract void updateGUI();
}

View file

@ -35,12 +35,22 @@ public class InsulinFastactingFragment extends Fragment {
insulinDia = (TextView) view.findViewById(R.id.insulin_dia); insulinDia = (TextView) view.findViewById(R.id.insulin_dia);
insulinGraph = (ActivityGraph) view.findViewById(R.id.insuling_graph); insulinGraph = (ActivityGraph) view.findViewById(R.id.insuling_graph);
insulinName.setText(insulinFastactingPlugin.getFriendlyName()); updateGUI();
insulinComment.setText(insulinFastactingPlugin.getComment());
insulinDia.setText(MainApp.sResources.getText(R.string.dia) + " " + new Double(insulinFastactingPlugin.getDia()).toString() + "h");
insulinGraph.show(insulinFastactingPlugin);
return view; return view;
} }
@Override
public void onResume() {
super.onResume();
updateGUI();
}
private void updateGUI() {
insulinName.setText(insulinFastactingPlugin.getFriendlyName());
insulinComment.setText(insulinFastactingPlugin.getComment());
insulinDia.setText(MainApp.sResources.getText(R.string.dia) + " " + new Double(insulinFastactingPlugin.getDia()).toString() + "h");
insulinGraph.show(insulinFastactingPlugin);
}
} }

View file

@ -36,12 +36,22 @@ public class InsulinFastactingProlongedFragment extends Fragment {
insulinDia = (TextView) view.findViewById(R.id.insulin_dia); insulinDia = (TextView) view.findViewById(R.id.insulin_dia);
insulinGraph = (ActivityGraph) view.findViewById(R.id.insuling_graph); insulinGraph = (ActivityGraph) view.findViewById(R.id.insuling_graph);
insulinName.setText(insulinFastactingProlongedPlugin.getFriendlyName()); updateGUI();
insulinComment.setText(insulinFastactingProlongedPlugin.getComment());
insulinDia.setText(MainApp.sResources.getText(R.string.dia) + " " + new Double(insulinFastactingProlongedPlugin.getDia()).toString() + "h");
insulinGraph.show(insulinFastactingProlongedPlugin);
return view; return view;
} }
@Override
public void onResume() {
super.onResume();
updateGUI();
}
private void updateGUI() {
insulinName.setText(insulinFastactingProlongedPlugin.getFriendlyName());
insulinComment.setText(insulinFastactingProlongedPlugin.getComment());
insulinDia.setText(MainApp.sResources.getText(R.string.dia) + " " + new Double(insulinFastactingProlongedPlugin.getDia()).toString() + "h");
insulinGraph.show(insulinFastactingProlongedPlugin);
}
} }

View file

@ -3,7 +3,6 @@ package info.nightscout.androidaps.plugins.Loop;
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -19,10 +18,11 @@ import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.Loop.events.EventLoopSetLastRunGui; import info.nightscout.androidaps.plugins.Loop.events.EventLoopSetLastRunGui;
import info.nightscout.androidaps.plugins.Loop.events.EventLoopUpdateGui; import info.nightscout.androidaps.plugins.Loop.events.EventLoopUpdateGui;
public class LoopFragment extends Fragment implements View.OnClickListener { public class LoopFragment extends SubscriberFragment implements View.OnClickListener {
private static Logger log = LoggerFactory.getLogger(LoopFragment.class); private static Logger log = LoggerFactory.getLogger(LoopFragment.class);
private static LoopPlugin loopPlugin; private static LoopPlugin loopPlugin;
@ -61,18 +61,6 @@ public class LoopFragment extends Fragment implements View.OnClickListener {
return view; return view;
} }
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
}
@Override @Override
public void onClick(View view) { public void onClick(View view) {
switch (view.getId()) { switch (view.getId()) {
@ -110,7 +98,8 @@ public class LoopFragment extends Fragment implements View.OnClickListener {
} }
void updateGUI() { @Override
protected void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) if (activity != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {

View file

@ -28,12 +28,13 @@ import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientNewLog; import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientNewLog;
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientRestart; import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientRestart;
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientUpdateGUI; import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientUpdateGUI;
import info.nightscout.utils.SP; import info.nightscout.utils.SP;
public class NSClientInternalFragment extends Fragment implements View.OnClickListener, CompoundButton.OnCheckedChangeListener { public class NSClientInternalFragment extends SubscriberFragment implements View.OnClickListener, CompoundButton.OnCheckedChangeListener {
private static Logger log = LoggerFactory.getLogger(NSClientInternalFragment.class); private static Logger log = LoggerFactory.getLogger(NSClientInternalFragment.class);
static NSClientInternalPlugin nsClientInternalPlugin; static NSClientInternalPlugin nsClientInternalPlugin;
@ -150,25 +151,13 @@ public class NSClientInternalFragment extends Fragment implements View.OnClickLi
} }
} }
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
updateGUI();
}
@Subscribe @Subscribe
public void onStatusEvent(final EventNSClientUpdateGUI ev) { public void onStatusEvent(final EventNSClientUpdateGUI ev) {
updateGUI(); updateGUI();
} }
private void updateGUI() { @Override
protected void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) if (activity != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {

View file

@ -20,11 +20,12 @@ import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui; import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui; import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui;
import info.nightscout.utils.JSONFormatter; import info.nightscout.utils.JSONFormatter;
public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener { public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnClickListener {
private static Logger log = LoggerFactory.getLogger(OpenAPSAMAFragment.class); private static Logger log = LoggerFactory.getLogger(OpenAPSAMAFragment.class);
private static OpenAPSAMAPlugin openAPSAMAPlugin; private static OpenAPSAMAPlugin openAPSAMAPlugin;
@ -81,18 +82,6 @@ public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener
} }
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
}
@Subscribe @Subscribe
public void onStatusEvent(final EventOpenAPSUpdateGui ev) { public void onStatusEvent(final EventOpenAPSUpdateGui ev) {
updateGUI(); updateGUI();
@ -103,7 +92,8 @@ public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener
updateResultGUI(ev.text); updateResultGUI(ev.text);
} }
void updateGUI() { @Override
protected void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) if (activity != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {

View file

@ -18,11 +18,12 @@ import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui; import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui; import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui;
import info.nightscout.utils.JSONFormatter; import info.nightscout.utils.JSONFormatter;
public class OpenAPSMAFragment extends Fragment implements View.OnClickListener { public class OpenAPSMAFragment extends SubscriberFragment implements View.OnClickListener {
private static Logger log = LoggerFactory.getLogger(OpenAPSMAFragment.class); private static Logger log = LoggerFactory.getLogger(OpenAPSMAFragment.class);
private static OpenAPSMAPlugin openAPSMAPlugin; private static OpenAPSMAPlugin openAPSMAPlugin;
@ -75,18 +76,6 @@ public class OpenAPSMAFragment extends Fragment implements View.OnClickListener
} }
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
}
@Subscribe @Subscribe
public void onStatusEvent(final EventOpenAPSUpdateGui ev) { public void onStatusEvent(final EventOpenAPSUpdateGui ev) {
updateGUI(); updateGUI();
@ -97,7 +86,8 @@ public class OpenAPSMAFragment extends Fragment implements View.OnClickListener
updateResultGUI(ev.text); updateResultGUI(ev.text);
} }
void updateGUI() { @Override
protected void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) if (activity != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
@ -123,7 +113,7 @@ public class OpenAPSMAFragment extends Fragment implements View.OnClickListener
}); });
} }
void updateResultGUI(final String text) { private void updateResultGUI(final String text) {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) if (activity != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {

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);
@ -484,15 +483,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();
} }
@ -520,7 +516,7 @@ public class CircadianPercentageProfileFragment extends Fragment {
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
updateGui(); updateGUI();
} }
}); });
} }

View file

@ -27,10 +27,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.SafeParse; import info.nightscout.utils.SafeParse;
import info.nightscout.utils.TimeListEdit; import info.nightscout.utils.TimeListEdit;
public class LocalProfileFragment extends Fragment { public class LocalProfileFragment extends SubscriberFragment {
private static Logger log = LoggerFactory.getLogger(LocalProfileFragment.class); private static Logger log = LoggerFactory.getLogger(LocalProfileFragment.class);
private static LocalProfilePlugin localProfilePlugin = new LocalProfilePlugin(); private static LocalProfilePlugin localProfilePlugin = new LocalProfilePlugin();
@ -73,7 +74,7 @@ public class LocalProfileFragment extends Fragment {
layout.findViewById(R.id.localprofile_basal).setVisibility(View.GONE); layout.findViewById(R.id.localprofile_basal).setVisibility(View.GONE);
} }
onStatusEvent(null); updateGUI();
mgdlView.setChecked(localProfilePlugin.mgdl); mgdlView.setChecked(localProfilePlugin.mgdl);
mmolView.setChecked(localProfilePlugin.mmol); mmolView.setChecked(localProfilePlugin.mmol);
@ -130,26 +131,18 @@ public class LocalProfileFragment extends Fragment {
diaView.addTextChangedListener(textWatch); diaView.addTextChangedListener(textWatch);
onStatusEvent(null); updateGUI();
return layout; return layout;
} }
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
onStatusEvent(null);
}
@Subscribe @Subscribe
public void onStatusEvent(final EventInitializationChanged e) { public void onStatusEvent(final EventInitializationChanged e) {
updateGUI();
}
@Override
protected void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) if (activity != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {

View file

@ -13,10 +13,11 @@ import com.squareup.otto.Subscribe;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.ProfileNS.events.EventNSProfileUpdateGUI; import info.nightscout.androidaps.plugins.ProfileNS.events.EventNSProfileUpdateGUI;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
public class NSProfileFragment extends Fragment { public class NSProfileFragment extends SubscriberFragment {
private static NSProfilePlugin nsProfilePlugin = new NSProfilePlugin(); private static NSProfilePlugin nsProfilePlugin = new NSProfilePlugin();
public static NSProfilePlugin getPlugin() { public static NSProfilePlugin getPlugin() {
@ -50,18 +51,6 @@ public class NSProfileFragment extends Fragment {
return layout; return layout;
} }
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
}
@Subscribe @Subscribe
public void onStatusEvent(final EventNSProfileUpdateGUI ev) { public void onStatusEvent(final EventNSProfileUpdateGUI ev) {
Activity activity = getActivity(); Activity activity = getActivity();
@ -74,7 +63,8 @@ public class NSProfileFragment extends Fragment {
}); });
} }
private void updateGUI() { @Override
protected void updateGUI() {
if (MainApp.getConfigBuilder().getProfile() == null) { if (MainApp.getConfigBuilder().getProfile() == null) {
noProfile.setVisibility(View.VISIBLE); noProfile.setVisibility(View.VISIBLE);
return; return;

View file

@ -25,9 +25,10 @@ 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.SafeParse; import info.nightscout.utils.SafeParse;
public class SimpleProfileFragment extends Fragment { public class SimpleProfileFragment extends SubscriberFragment {
private static Logger log = LoggerFactory.getLogger(SimpleProfileFragment.class); private static Logger log = LoggerFactory.getLogger(SimpleProfileFragment.class);
private static SimpleProfilePlugin simpleProfilePlugin = new SimpleProfilePlugin(); private static SimpleProfilePlugin simpleProfilePlugin = new SimpleProfilePlugin();
@ -66,7 +67,7 @@ public class SimpleProfileFragment extends Fragment {
layout.findViewById(R.id.simpleprofile_basalrate_label).setVisibility(View.GONE); layout.findViewById(R.id.simpleprofile_basalrate_label).setVisibility(View.GONE);
} }
onStatusEvent(null); updateGUI();
mgdlView.setChecked(simpleProfilePlugin.mgdl); mgdlView.setChecked(simpleProfilePlugin.mgdl);
mmolView.setChecked(simpleProfilePlugin.mmol); mmolView.setChecked(simpleProfilePlugin.mmol);
@ -138,26 +139,18 @@ public class SimpleProfileFragment extends Fragment {
targetlowView.addTextChangedListener(textWatch); targetlowView.addTextChangedListener(textWatch);
targethighView.addTextChangedListener(textWatch); targethighView.addTextChangedListener(textWatch);
onStatusEvent(null); updateGUI();
return layout; return layout;
} }
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
onStatusEvent(null);
}
@Subscribe @Subscribe
public void onStatusEvent(final EventInitializationChanged e) { public void onStatusEvent(final EventInitializationChanged e) {
updateGUI();
}
@Override
protected void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) if (activity != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {

View file

@ -27,6 +27,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventExtendedBolusChange; import info.nightscout.androidaps.events.EventExtendedBolusChange;
import info.nightscout.androidaps.events.EventPumpStatusChanged; import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.events.EventTempBasalChange; import info.nightscout.androidaps.events.EventTempBasalChange;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.PumpDanaR.Dialogs.ProfileViewDialog; import info.nightscout.androidaps.plugins.PumpDanaR.Dialogs.ProfileViewDialog;
import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRHistoryActivity; import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRHistoryActivity;
import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRStatsActivity; import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRStatsActivity;
@ -35,7 +36,7 @@ import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.SetWarnColor; import info.nightscout.utils.SetWarnColor;
public class DanaRFragment extends Fragment { public class DanaRFragment extends SubscriberFragment {
private static Logger log = LoggerFactory.getLogger(DanaRFragment.class); private static Logger log = LoggerFactory.getLogger(DanaRFragment.class);
private static DanaRPlugin danaRPlugin; private static DanaRPlugin danaRPlugin;
@ -156,18 +157,6 @@ public class DanaRFragment extends Fragment {
return view; return view;
} }
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
}
@Subscribe @Subscribe
public void onStatusEvent(final EventPumpStatusChanged c) { public void onStatusEvent(final EventPumpStatusChanged c) {
Activity activity = getActivity(); Activity activity = getActivity();
@ -204,7 +193,8 @@ public class DanaRFragment extends Fragment {
} }
// GUI functions // GUI functions
private void updateGUI() { @Override
protected void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null && basaBasalRateView != null) if (activity != null && basaBasalRateView != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {

View file

@ -27,6 +27,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventExtendedBolusChange; import info.nightscout.androidaps.events.EventExtendedBolusChange;
import info.nightscout.androidaps.events.EventPumpStatusChanged; import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.events.EventTempBasalChange; import info.nightscout.androidaps.events.EventTempBasalChange;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
import info.nightscout.androidaps.plugins.PumpDanaR.Dialogs.ProfileViewDialog; import info.nightscout.androidaps.plugins.PumpDanaR.Dialogs.ProfileViewDialog;
import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRHistoryActivity; import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRHistoryActivity;
@ -36,7 +37,7 @@ import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.SetWarnColor; import info.nightscout.utils.SetWarnColor;
public class DanaRKoreanFragment extends Fragment { public class DanaRKoreanFragment extends SubscriberFragment {
private static Logger log = LoggerFactory.getLogger(DanaRKoreanFragment.class); private static Logger log = LoggerFactory.getLogger(DanaRKoreanFragment.class);
private static DanaRKoreanPlugin danaRKoreanPlugin = new DanaRKoreanPlugin(); private static DanaRKoreanPlugin danaRKoreanPlugin = new DanaRKoreanPlugin();
@ -154,18 +155,6 @@ public class DanaRKoreanFragment extends Fragment {
return view; return view;
} }
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
}
@Subscribe @Subscribe
public void onStatusEvent(final EventPumpStatusChanged c) { public void onStatusEvent(final EventPumpStatusChanged c) {
Activity activity = getActivity(); Activity activity = getActivity();
@ -202,7 +191,8 @@ public class DanaRKoreanFragment extends Fragment {
} }
// GUI functions // GUI functions
private void updateGUI() { @Override
protected void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null && basaBasalRateView != null) if (activity != null && basaBasalRateView != null)

View file

@ -27,6 +27,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventExtendedBolusChange; import info.nightscout.androidaps.events.EventExtendedBolusChange;
import info.nightscout.androidaps.events.EventPumpStatusChanged; import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.events.EventTempBasalChange; import info.nightscout.androidaps.events.EventTempBasalChange;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
import info.nightscout.androidaps.plugins.PumpDanaR.Dialogs.ProfileViewDialog; import info.nightscout.androidaps.plugins.PumpDanaR.Dialogs.ProfileViewDialog;
import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRHistoryActivity; import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRHistoryActivity;
@ -36,7 +37,7 @@ import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.SetWarnColor; import info.nightscout.utils.SetWarnColor;
public class DanaRv2Fragment extends Fragment { public class DanaRv2Fragment extends SubscriberFragment {
private static Logger log = LoggerFactory.getLogger(DanaRv2Fragment.class); private static Logger log = LoggerFactory.getLogger(DanaRv2Fragment.class);
private static DanaRv2Plugin danaRPlugin; private static DanaRv2Plugin danaRPlugin;
@ -153,18 +154,6 @@ public class DanaRv2Fragment extends Fragment {
return view; return view;
} }
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
}
@Subscribe @Subscribe
public void onStatusEvent(final EventPumpStatusChanged c) { public void onStatusEvent(final EventPumpStatusChanged c) {
Activity activity = getActivity(); Activity activity = getActivity();
@ -201,7 +190,8 @@ public class DanaRv2Fragment extends Fragment {
} }
// GUI functions // GUI functions
private void updateGUI() { @Override
protected void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null && basaBasalRateView != null) if (activity != null && basaBasalRateView != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {

View file

@ -5,7 +5,6 @@ import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -16,13 +15,12 @@ import com.squareup.otto.Subscribe;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.Date;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.PumpVirtual.events.EventVirtualPumpUpdateGui; import info.nightscout.androidaps.plugins.PumpVirtual.events.EventVirtualPumpUpdateGui;
public class VirtualPumpFragment extends Fragment { public class VirtualPumpFragment extends SubscriberFragment {
private static Logger log = LoggerFactory.getLogger(VirtualPumpFragment.class); private static Logger log = LoggerFactory.getLogger(VirtualPumpFragment.class);
TextView basaBasalRateView; TextView basaBasalRateView;
@ -63,24 +61,13 @@ public class VirtualPumpFragment extends Fragment {
return view; return view;
} }
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
}
@Subscribe @Subscribe
public void onStatusEvent(final EventVirtualPumpUpdateGui ev) { public void onStatusEvent(final EventVirtualPumpUpdateGui ev) {
updateGUI(); updateGUI();
} }
public void updateGUI() { @Override
protected void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null && basaBasalRateView != null) if (activity != null && basaBasalRateView != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {

View file

@ -20,13 +20,14 @@ import java.util.Comparator;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventSmsCommunicatorUpdateGui; import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventSmsCommunicatorUpdateGui;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
/** /**
* A simple {@link Fragment} subclass. * A simple {@link Fragment} subclass.
*/ */
public class SmsCommunicatorFragment extends Fragment { public class SmsCommunicatorFragment extends SubscriberFragment {
private static Logger log = LoggerFactory.getLogger(SmsCommunicatorFragment.class); private static Logger log = LoggerFactory.getLogger(SmsCommunicatorFragment.class);
private static SmsCommunicatorPlugin smsCommunicatorPlugin; private static SmsCommunicatorPlugin smsCommunicatorPlugin;
@ -56,25 +57,14 @@ public class SmsCommunicatorFragment extends Fragment {
return view; return view;
} }
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
}
@Subscribe @Subscribe
public void onStatusEvent(final EventSmsCommunicatorUpdateGui ev) { public void onStatusEvent(final EventSmsCommunicatorUpdateGui ev) {
updateGUI(); updateGUI();
} }
private void updateGUI() { @Override
protected void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) if (activity != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {

View file

@ -37,13 +37,14 @@ import info.nightscout.androidaps.db.Treatment;
import info.nightscout.androidaps.events.EventNewBG; import info.nightscout.androidaps.events.EventNewBG;
import info.nightscout.androidaps.events.EventTreatmentChange; import info.nightscout.androidaps.events.EventTreatmentChange;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.NSUpload; import info.nightscout.utils.NSUpload;
import info.nightscout.utils.SP; import info.nightscout.utils.SP;
public class TreatmentsBolusFragment extends Fragment implements View.OnClickListener { public class TreatmentsBolusFragment extends SubscriberFragment implements View.OnClickListener {
private static Logger log = LoggerFactory.getLogger(TreatmentsBolusFragment.class); private static Logger log = LoggerFactory.getLogger(TreatmentsBolusFragment.class);
RecyclerView recyclerView; RecyclerView recyclerView;
@ -205,19 +206,6 @@ public class TreatmentsBolusFragment extends Fragment implements View.OnClickLis
} }
} }
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
updateGUI();
}
@Subscribe @Subscribe
public void onStatusEvent(final EventTreatmentChange ev) { public void onStatusEvent(final EventTreatmentChange ev) {
updateGUI(); updateGUI();
@ -228,7 +216,8 @@ public class TreatmentsBolusFragment extends Fragment implements View.OnClickLis
updateGUI(); updateGUI();
} }
public void updateGUI() { @Override
protected void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) if (activity != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {

View file

@ -30,13 +30,14 @@ import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.events.EventExtendedBolusChange; import info.nightscout.androidaps.events.EventExtendedBolusChange;
import info.nightscout.androidaps.events.EventNewBG; import info.nightscout.androidaps.events.EventNewBG;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.NSUpload; import info.nightscout.utils.NSUpload;
import info.nightscout.androidaps.data.Intervals; import info.nightscout.androidaps.data.Intervals;
public class TreatmentsExtendedBolusesFragment extends Fragment { public class TreatmentsExtendedBolusesFragment extends SubscriberFragment {
private static Logger log = LoggerFactory.getLogger(TreatmentsExtendedBolusesFragment.class); private static Logger log = LoggerFactory.getLogger(TreatmentsExtendedBolusesFragment.class);
RecyclerView recyclerView; RecyclerView recyclerView;
@ -181,18 +182,6 @@ public class TreatmentsExtendedBolusesFragment extends Fragment {
return view; return view;
} }
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
}
@Subscribe @Subscribe
public void onStatusEvent(final EventExtendedBolusChange ev) { public void onStatusEvent(final EventExtendedBolusChange ev) {
updateGUI(); updateGUI();
@ -203,7 +192,8 @@ public class TreatmentsExtendedBolusesFragment extends Fragment {
updateGUI(); updateGUI();
} }
public void updateGUI() { @Override
protected void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null && recyclerView != null) if (activity != null && recyclerView != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {

View file

@ -30,6 +30,7 @@ import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TempTarget; import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.events.EventProfileSwitchChange; import info.nightscout.androidaps.events.EventProfileSwitchChange;
import info.nightscout.androidaps.events.EventTempTargetChange; import info.nightscout.androidaps.events.EventTempTargetChange;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.NSUpload; import info.nightscout.utils.NSUpload;
@ -40,7 +41,7 @@ import info.nightscout.utils.SP;
* Created by mike on 13/01/17. * Created by mike on 13/01/17.
*/ */
public class TreatmentsProfileSwitchFragment extends Fragment implements View.OnClickListener { public class TreatmentsProfileSwitchFragment extends SubscriberFragment implements View.OnClickListener {
RecyclerView recyclerView; RecyclerView recyclerView;
LinearLayoutManager llm; LinearLayoutManager llm;
@ -180,24 +181,13 @@ public class TreatmentsProfileSwitchFragment extends Fragment implements View.On
} }
} }
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
}
@Subscribe @Subscribe
public void onStatusEvent(final EventProfileSwitchChange ev) { public void onStatusEvent(final EventProfileSwitchChange ev) {
updateGUI(); updateGUI();
} }
void updateGUI() { @Override
protected void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) if (activity != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {

View file

@ -26,6 +26,7 @@ import info.nightscout.androidaps.Services.Intents;
import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TempTarget; import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.events.EventTempTargetChange; import info.nightscout.androidaps.events.EventTempTargetChange;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.NSUpload; import info.nightscout.utils.NSUpload;
@ -36,7 +37,7 @@ import info.nightscout.utils.SP;
* Created by mike on 13/01/17. * Created by mike on 13/01/17.
*/ */
public class TreatmentsTempTargetFragment extends Fragment implements View.OnClickListener { public class TreatmentsTempTargetFragment extends SubscriberFragment implements View.OnClickListener {
RecyclerView recyclerView; RecyclerView recyclerView;
LinearLayoutManager llm; LinearLayoutManager llm;
@ -210,24 +211,13 @@ public class TreatmentsTempTargetFragment extends Fragment implements View.OnCli
} }
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
}
@Subscribe @Subscribe
public void onStatusEvent(final EventTempTargetChange ev) { public void onStatusEvent(final EventTempTargetChange ev) {
updateGUI(); updateGUI();
} }
void updateGUI() { @Override
protected void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) if (activity != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {

View file

@ -30,13 +30,14 @@ import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.events.EventNewBG; import info.nightscout.androidaps.events.EventNewBG;
import info.nightscout.androidaps.events.EventTempBasalChange; import info.nightscout.androidaps.events.EventTempBasalChange;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.NSUpload; import info.nightscout.utils.NSUpload;
import info.nightscout.androidaps.data.Intervals; import info.nightscout.androidaps.data.Intervals;
public class TreatmentsTemporaryBasalsFragment extends Fragment { public class TreatmentsTemporaryBasalsFragment extends SubscriberFragment {
private static Logger log = LoggerFactory.getLogger(TreatmentsTemporaryBasalsFragment.class); private static Logger log = LoggerFactory.getLogger(TreatmentsTemporaryBasalsFragment.class);
RecyclerView recyclerView; RecyclerView recyclerView;
@ -200,18 +201,6 @@ public class TreatmentsTemporaryBasalsFragment extends Fragment {
return view; return view;
} }
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
}
@Subscribe @Subscribe
public void onStatusEvent(final EventTempBasalChange ev) { public void onStatusEvent(final EventTempBasalChange ev) {
updateGUI(); updateGUI();
@ -222,7 +211,8 @@ public class TreatmentsTemporaryBasalsFragment extends Fragment {
updateGUI(); updateGUI();
} }
public void updateGUI() { @Override
protected void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) if (activity != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {