summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/nfc
diff options
context:
space:
mode:
authorFabrice Di Meglio <fdimeglio@google.com>2014-06-11 20:14:15 -0700
committerFabrice Di Meglio <fdimeglio@google.com>2014-06-12 11:13:23 -0700
commit138ff8c0457c6e1345015973668d652fa17c7c3b (patch)
tree4a4e80986fc33e2a297a359b07253fde5b27333c /src/com/android/settings/nfc
parent601aad2022311f88c290e8fc9d426ce76f1bd1b3 (diff)
downloadpackages_apps_Settings-138ff8c0457c6e1345015973668d652fa17c7c3b.zip
packages_apps_Settings-138ff8c0457c6e1345015973668d652fa17c7c3b.tar.gz
packages_apps_Settings-138ff8c0457c6e1345015973668d652fa17c7c3b.tar.bz2
Make the SwitchBar appear immediately
- change the way the SwitchBar is shown and hidden - save its state - remove the delay transition code Change-Id: I07260430e6709b42517ca011f6d3c3446a626731
Diffstat (limited to 'src/com/android/settings/nfc')
-rw-r--r--src/com/android/settings/nfc/AndroidBeam.java26
1 files changed, 6 insertions, 20 deletions
diff --git a/src/com/android/settings/nfc/AndroidBeam.java b/src/com/android/settings/nfc/AndroidBeam.java
index eb3ff9b..add0fa7 100644
--- a/src/com/android/settings/nfc/AndroidBeam.java
+++ b/src/com/android/settings/nfc/AndroidBeam.java
@@ -33,7 +33,6 @@ public class AndroidBeam extends Fragment
private View mView;
private NfcAdapter mNfcAdapter;
private SwitchBar mSwitchBar;
- private Switch mSwitch;
private CharSequence mOldActivityTitle;
@Override
@@ -63,46 +62,33 @@ public class AndroidBeam extends Fragment
SettingsActivity activity = (SettingsActivity) getActivity();
mSwitchBar = activity.getSwitchBar();
- mSwitch = mSwitchBar.getSwitch();
- mSwitch.setChecked(mNfcAdapter.isNdefPushEnabled());
- }
-
- @Override
- public void onResume() {
- super.onResume();
-
+ mSwitchBar.setChecked(mNfcAdapter.isNdefPushEnabled());
mSwitchBar.addOnSwitchChangeListener(this);
mSwitchBar.show();
}
@Override
- public void onPause() {
- super.onPause();
-
- mSwitchBar.removeOnSwitchChangeListener(this);
- mSwitchBar.hide();
- }
-
- @Override
public void onDestroyView() {
super.onDestroyView();
if (mOldActivityTitle != null) {
getActivity().getActionBar().setTitle(mOldActivityTitle);
}
+ mSwitchBar.removeOnSwitchChangeListener(this);
+ mSwitchBar.hide();
}
@Override
public void onSwitchChanged(Switch switchView, boolean desiredState) {
boolean success = false;
- mSwitch.setEnabled(false);
+ mSwitchBar.setEnabled(false);
if (desiredState) {
success = mNfcAdapter.enableNdefPush();
} else {
success = mNfcAdapter.disableNdefPush();
}
if (success) {
- mSwitch.setChecked(desiredState);
+ mSwitchBar.setChecked(desiredState);
}
- mSwitch.setEnabled(true);
+ mSwitchBar.setEnabled(true);
}
}