android: Properly hide the IMC state fragment initially

This commit is contained in:
Tobias Brunner
2013-07-08 18:49:29 +02:00
parent 0ef98957a7
commit 873f389b37
@@ -62,6 +62,8 @@ public class ImcStateFragment extends Fragment implements VpnStateListener
Context context = getActivity().getApplicationContext(); Context context = getActivity().getApplicationContext();
context.bindService(new Intent(context, VpnStateService.class), context.bindService(new Intent(context, VpnStateService.class),
mServiceConnection, Service.BIND_AUTO_CREATE); mServiceConnection, Service.BIND_AUTO_CREATE);
/* hide it initially */
getFragmentManager().beginTransaction().hide(this).commit();
} }
@Override @Override
@@ -95,7 +97,6 @@ public class ImcStateFragment extends Fragment implements VpnStateListener
public void updateView() public void updateView()
{ {
FragmentTransaction ft = getFragmentManager().beginTransaction(); FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.show(this);
switch (mService.getImcState()) switch (mService.getImcState())
{ {
@@ -106,10 +107,12 @@ public class ImcStateFragment extends Fragment implements VpnStateListener
case ISOLATE: case ISOLATE:
mStateView.setText(R.string.imc_state_isolate); mStateView.setText(R.string.imc_state_isolate);
mStateView.setTextColor(getResources().getColor(R.color.warning_text)); mStateView.setTextColor(getResources().getColor(R.color.warning_text));
ft.show(this);
break; break;
case BLOCK: case BLOCK:
mStateView.setText(R.string.imc_state_block); mStateView.setText(R.string.imc_state_block);
mStateView.setTextColor(getResources().getColor(R.color.error_text)); mStateView.setTextColor(getResources().getColor(R.color.error_text));
ft.show(this);
break; break;
} }
ft.commit(); ft.commit();