altosdroid: use 'show' to set new tab contents in onResume
authorKeith Packard <keithp@keithp.com>
Fri, 29 May 2015 16:43:58 +0000 (09:43 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 29 May 2015 16:43:58 +0000 (09:43 -0700)
Hook onResume so that newly created/recreated tabs get current
contents. The set_visible hook isn't sufficient for that.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidTab.java

index b3824aa..cc1acd6 100644 (file)
@@ -62,13 +62,20 @@ public abstract class AltosDroidTab extends Fragment implements AltosUnitsListen
                        AltosGreatCircle        from_receiver = last_from_receiver;
                        Location                receiver = last_receiver;
 
-                       show(state, from_receiver, receiver);
                        ft.show(this);
+                       show(state, from_receiver, receiver);
                } else
                        ft.hide(this);
                ft.commitAllowingStateLoss();
        }
 
+       @Override
+       public void onResume() {
+               super.onResume();
+               AltosDebug.debug("onResume tab %s\n", tab_name());
+               set_visible(true);
+       }
+
        public void update_ui(AltosState state, AltosGreatCircle from_receiver, Location receiver, boolean is_current) {
                last_state = state;
                last_from_receiver = from_receiver;