Make a condition positive (A3)

mSoundOn is much easier to understand than mSilentModeOn

Change-Id: Ie51c5c75fcad62e13e0fb578a266af80f15dc440
main
Jean Chalard 2012-03-07 12:40:20 +09:00
parent 793791cdf0
commit 2651b17fc4
1 changed files with 5 additions and 5 deletions

View File

@ -39,14 +39,14 @@ public class AudioAndHapticFeedbackManager extends BroadcastReceiver {
final private KeyboardSwitcher mKeyboardSwitcher;
final private AudioManager mAudioManager;
final private VibratorCompatWrapper mVibrator;
private boolean mSilentModeOn;
private boolean mSoundOn;
public AudioAndHapticFeedbackManager(final LatinIME latinIme,
final SettingsValues settingsValues, final KeyboardSwitcher keyboardSwitcher) {
mLatinIme = latinIme;
mSettingsValues = settingsValues;
mKeyboardSwitcher = keyboardSwitcher;
mSilentModeOn = true;
mSoundOn = false;
mVibrator = VibratorCompatWrapper.getInstance(mLatinIme);
mAudioManager = (AudioManager) mLatinIme.getSystemService(Context.AUDIO_SERVICE);
updateRingerMode();
@ -58,15 +58,15 @@ public class AudioAndHapticFeedbackManager extends BroadcastReceiver {
}
private boolean isSoundOn() {
return mSettingsValues.mSoundOn && !mSilentModeOn;
return mSettingsValues.mSoundOn && mSoundOn;
}
// update flags for silent mode
private void updateRingerMode() {
if (!mSettingsValues.mSoundOn || mAudioManager == null) {
mSilentModeOn = true;
mSoundOn = false;
} else {
mSilentModeOn = (mAudioManager.getRingerMode() != AudioManager.RINGER_MODE_NORMAL);
mSoundOn = (mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_NORMAL);
}
}