Fixed Sound Settings summary text
The summary for Sound settings was not descriptive enough when the volume was set to 0% so additional strings were added. Now it will change let you know the status of the ringer and vibration settings when at 0% volume. Espresso tests added to test that text is properly updated in each of these states. Test: make SettingsTests Bug: 31099179 Change-Id: Id49e2d0c4b7ac0f17efcdaf31de48d5eb678ca46
This commit is contained in:
@@ -594,10 +594,21 @@ public class SoundSettings extends SettingsPreferenceFragment implements Indexab
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String percent = NumberFormat.getPercentInstance().format(
|
||||
(double) mAudioManager.getStreamVolume(AudioManager.STREAM_RING) / maxVolume);
|
||||
mSummaryLoader.setSummary(this,
|
||||
mContext.getString(R.string.sound_settings_summary, percent));
|
||||
final int ringerMode = mAudioManager.getRingerMode();
|
||||
int resId;
|
||||
String percent = "";
|
||||
if (ringerMode == mAudioManager.RINGER_MODE_SILENT) {
|
||||
resId = R.string.sound_settings_summary_silent;
|
||||
} else if (ringerMode == mAudioManager.RINGER_MODE_VIBRATE){
|
||||
resId = R.string.sound_settings_summary_vibrate;
|
||||
}
|
||||
else {
|
||||
percent = NumberFormat.getPercentInstance().format(
|
||||
(double) mAudioManager.getStreamVolume(
|
||||
AudioManager.STREAM_RING) / maxVolume);
|
||||
resId = R.string.sound_settings_summary;
|
||||
}
|
||||
mSummaryLoader.setSummary(this, mContext.getString(resId, percent));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user