Have most fragments update their content in onResume.

This commit is contained in:
Johannes Mockenhaupt 2017-07-18 12:37:35 +02:00
parent 26ebceb4d9
commit 7c6bdc0b31
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
15 changed files with 26 additions and 11 deletions

View file

@ -82,7 +82,7 @@ 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;
} }
@ -96,29 +96,30 @@ public class ActionsFragment extends Fragment implements View.OnClickListener {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
MainApp.bus().register(this); MainApp.bus().register(this);
updateGUI();
} }
@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() { private void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) if (activity != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {

View file

@ -188,6 +188,7 @@ public class CareportalFragment extends Fragment implements View.OnClickListener
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
MainApp.bus().register(this); MainApp.bus().register(this);
updateGUI();
} }
@Subscribe @Subscribe
@ -195,7 +196,7 @@ public class CareportalFragment extends Fragment implements View.OnClickListener
updateGUI(); updateGUI();
} }
void updateGUI() { private void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
updateAge(activity, sage, iage, cage, pbage); updateAge(activity, sage, iage, cage, pbage);
} }

View file

@ -71,6 +71,7 @@ public class LoopFragment extends Fragment implements View.OnClickListener {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
MainApp.bus().register(this); MainApp.bus().register(this);
updateGUI();
} }
@Override @Override
@ -110,7 +111,7 @@ public class LoopFragment extends Fragment implements View.OnClickListener {
} }
void updateGUI() { private void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) if (activity != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {

View file

@ -91,6 +91,7 @@ public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
MainApp.bus().register(this); MainApp.bus().register(this);
updateGUI();
} }
@Subscribe @Subscribe
@ -103,7 +104,7 @@ public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener
updateResultGUI(ev.text); updateResultGUI(ev.text);
} }
void updateGUI() { private void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) if (activity != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {

View file

@ -85,6 +85,7 @@ public class OpenAPSMAFragment extends Fragment implements View.OnClickListener
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
MainApp.bus().register(this); MainApp.bus().register(this);
updateGUI();
} }
@Subscribe @Subscribe

View file

@ -60,6 +60,7 @@ public class NSProfileFragment extends Fragment {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
MainApp.bus().register(this); MainApp.bus().register(this);
updateGUI();
} }
@Subscribe @Subscribe

View file

@ -166,6 +166,7 @@ public class DanaRFragment extends Fragment {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
MainApp.bus().register(this); MainApp.bus().register(this);
updateGUI();
} }
@Subscribe @Subscribe

View file

@ -164,6 +164,7 @@ public class DanaRKoreanFragment extends Fragment {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
MainApp.bus().register(this); MainApp.bus().register(this);
updateGUI();
} }
@Subscribe @Subscribe

View file

@ -163,6 +163,7 @@ public class DanaRv2Fragment extends Fragment {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
MainApp.bus().register(this); MainApp.bus().register(this);
updateGUI();
} }
@Subscribe @Subscribe

View file

@ -73,6 +73,7 @@ public class VirtualPumpFragment extends Fragment {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
MainApp.bus().register(this); MainApp.bus().register(this);
updateGUI();
} }
@Subscribe @Subscribe

View file

@ -66,6 +66,7 @@ public class SmsCommunicatorFragment extends Fragment {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
MainApp.bus().register(this); MainApp.bus().register(this);
updateGUI();
} }
@Subscribe @Subscribe

View file

@ -193,6 +193,7 @@ public class TreatmentsExtendedBolusesFragment extends Fragment {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
MainApp.bus().register(this); MainApp.bus().register(this);
updateGUI();
} }
@Subscribe @Subscribe

View file

@ -190,6 +190,7 @@ public class TreatmentsProfileSwitchFragment extends Fragment implements View.On
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
MainApp.bus().register(this); MainApp.bus().register(this);
updateGUI();
} }
@Subscribe @Subscribe
@ -197,7 +198,7 @@ public class TreatmentsProfileSwitchFragment extends Fragment implements View.On
updateGUI(); updateGUI();
} }
void updateGUI() { private void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) if (activity != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {

View file

@ -211,6 +211,7 @@ public class TreatmentsTempTargetFragment extends Fragment implements View.OnCli
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
MainApp.bus().register(this); MainApp.bus().register(this);
updateGUI();
} }
@Subscribe @Subscribe
@ -218,7 +219,7 @@ public class TreatmentsTempTargetFragment extends Fragment implements View.OnCli
updateGUI(); updateGUI();
} }
void updateGUI() { private void updateGUI() {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) if (activity != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {

View file

@ -212,6 +212,7 @@ public class TreatmentsTemporaryBasalsFragment extends Fragment {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
MainApp.bus().register(this); MainApp.bus().register(this);
updateGUI();
} }
@Subscribe @Subscribe