Disable On/OFF switch before action

Bug: 8715336

Change-Id: I3d4b05ae9dfe109af0b9b06340d52004b73ad0f4
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
This commit is contained in:
Dmitry Shmidt
2013-05-16 11:29:55 -07:00
parent b555cebe63
commit 70c35ef071

View File

@@ -119,11 +119,10 @@ public class WifiEnabler implements CompoundButton.OnCheckedChangeListener {
mWifiManager.setWifiApEnabled(null, false);
}
if (mWifiManager.setWifiEnabled(isChecked)) {
// Intent has been taken into account, disable until new state is active
mSwitch.setEnabled(false);
} else {
mSwitch.setEnabled(false);
if (!mWifiManager.setWifiEnabled(isChecked)) {
// Error
mSwitch.setEnabled(true);
Toast.makeText(mContext, R.string.wifi_error, Toast.LENGTH_SHORT).show();
}
}