summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/RingerVolumePreference.java
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2010-09-11 14:17:31 -0700
committerAmith Yamasani <yamasani@google.com>2010-09-11 14:58:01 -0700
commit60133dd03657354e06fa3aa7e6041862f8ce20a8 (patch)
tree91d3ebe624068a8061ce1055facf21e8a9690335 /src/com/android/settings/RingerVolumePreference.java
parentcc0e4db618d9bab9fc759c55ca49913704d2a7f0 (diff)
downloadpackages_apps_Settings-60133dd03657354e06fa3aa7e6041862f8ce20a8.tar.gz
packages_apps_Settings-60133dd03657354e06fa3aa7e6041862f8ce20a8.tar.bz2
packages_apps_Settings-60133dd03657354e06fa3aa7e6041862f8ce20a8.zip
Conditionally remove settings that aren't required on the tablet.
Bug: 2985267 Changes not done : SD card related stuff, as we need some way still to figure out if there is a real SD card in the device. Change-Id: I21c41f18ebe6c050981918481a7f6d69f04b65d0
Diffstat (limited to 'src/com/android/settings/RingerVolumePreference.java')
-rw-r--r--src/com/android/settings/RingerVolumePreference.java27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/com/android/settings/RingerVolumePreference.java b/src/com/android/settings/RingerVolumePreference.java
index 3ecd81969..4479cb0c4 100644
--- a/src/com/android/settings/RingerVolumePreference.java
+++ b/src/com/android/settings/RingerVolumePreference.java
@@ -45,6 +45,12 @@ public class RingerVolumePreference extends VolumePreference implements
R.id.media_volume_seekbar,
R.id.alarm_volume_seekbar
};
+
+ private static final int[] NEED_VOICE_CAPABILITY_ID = new int[] {
+ com.android.internal.R.id.seekbar, R.id.notification_volume_title,
+ R.id.notification_volume_seekbar
+ };
+
private static final int[] SEEKBAR_TYPE = new int[] {
AudioManager.STREAM_NOTIFICATION,
AudioManager.STREAM_MUSIC,
@@ -83,17 +89,28 @@ public class RingerVolumePreference extends VolumePreference implements
getContext().getContentResolver(),
Settings.System.NOTIFICATIONS_USE_RING_VOLUME, 1) == 1);
setNotificationVolumeVisibility(!mNotificationsUseRingVolumeCheckbox.isChecked());
+ disableSettingsThatNeedVoice(view);
+ }
+
+ private void disableSettingsThatNeedVoice(View parent) {
+ final boolean voiceCapable = getContext().getResources()
+ .getBoolean(com.android.internal.R.bool.config_voice_capable);
+ if (!voiceCapable) {
+ for (int id : NEED_VOICE_CAPABILITY_ID) {
+ parent.findViewById(id).setVisibility(View.GONE);
+ }
+ }
}
@Override
protected void onDialogClosed(boolean positiveResult) {
super.onDialogClosed(positiveResult);
-
+
if (!positiveResult) {
for (SeekBarVolumizer vol : mSeekBarVolumizer) {
if (vol != null) vol.revertVolume();
}
- }
+ }
cleanup();
}
@@ -102,13 +119,13 @@ public class RingerVolumePreference extends VolumePreference implements
super.onActivityStop();
cleanup();
}
-
+
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
setNotificationVolumeVisibility(!isChecked);
-
+
Settings.System.putInt(getContext().getContentResolver(),
Settings.System.NOTIFICATIONS_USE_RING_VOLUME, isChecked ? 1 : 0);
-
+
if (isChecked) {
// The user wants the notification to be same as ring, so do a
// one-time sync right now