android: Properly hide the IMC state fragment initially
authorTobias Brunner <tobias@strongswan.org>
Thu, 30 May 2013 09:57:39 +0000 (11:57 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 8 Jul 2013 16:49:29 +0000 (18:49 +0200)
src/frontends/android/src/org/strongswan/android/ui/ImcStateFragment.java

index 4736113..18893a3 100644 (file)
@@ -62,6 +62,8 @@ public class ImcStateFragment extends Fragment implements VpnStateListener
                Context context = getActivity().getApplicationContext();
                context.bindService(new Intent(context, VpnStateService.class),
                                                        mServiceConnection, Service.BIND_AUTO_CREATE);
+               /* hide it initially */
+               getFragmentManager().beginTransaction().hide(this).commit();
        }
 
        @Override
@@ -95,7 +97,6 @@ public class ImcStateFragment extends Fragment implements VpnStateListener
        public void updateView()
        {
                FragmentTransaction ft = getFragmentManager().beginTransaction();
-               ft.show(this);
 
                switch (mService.getImcState())
                {
@@ -106,10 +107,12 @@ public class ImcStateFragment extends Fragment implements VpnStateListener
                        case ISOLATE:
                                mStateView.setText(R.string.imc_state_isolate);
                                mStateView.setTextColor(getResources().getColor(R.color.warning_text));
+                               ft.show(this);
                                break;
                        case BLOCK:
                                mStateView.setText(R.string.imc_state_block);
                                mStateView.setTextColor(getResources().getColor(R.color.error_text));
+                               ft.show(this);
                                break;
                }
                ft.commit();