diff options
author | Daniel Sandler <dsandler@google.com> | 2010-03-15 07:20:38 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-03-15 07:20:38 -0700 |
commit | dee13a94b142402d811c0003b1a0554876e4bb1b (patch) | |
tree | 6c9ca777ca51ef8ff1f892e882324f87ed0dc45b | |
parent | a6b9dcbb161e9d7ede0573397ee22d6c3f0bbcae (diff) | |
parent | c0a51abd857dd6962ba7a0bc7cf725fdd2519688 (diff) | |
download | packages_apps_settings-dee13a94b142402d811c0003b1a0554876e4bb1b.zip packages_apps_settings-dee13a94b142402d811c0003b1a0554876e4bb1b.tar.gz packages_apps_settings-dee13a94b142402d811c0003b1a0554876e4bb1b.tar.bz2 |
Merge "Disable dock audio settings if the dock doesn't have Bluetooth."
-rw-r--r-- | src/com/android/settings/DockSettings.java | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/src/com/android/settings/DockSettings.java b/src/com/android/settings/DockSettings.java index 795fb3c..0d46ce9 100644 --- a/src/com/android/settings/DockSettings.java +++ b/src/com/android/settings/DockSettings.java @@ -18,6 +18,7 @@ package com.android.settings; import android.app.AlertDialog; import android.app.Dialog; +import android.bluetooth.BluetoothDevice; import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.Context; @@ -91,19 +92,31 @@ public class DockSettings extends PreferenceActivity { private void handleDockChange(Intent intent) { if (mAudioSettings != null) { int dockState = intent.getIntExtra(Intent.EXTRA_DOCK_STATE, 0); - mDockIntent = intent; - int resId = R.string.dock_audio_summary_unknown; - switch (dockState) { - case Intent.EXTRA_DOCK_STATE_CAR: - resId = R.string.dock_audio_summary_car; - break; - case Intent.EXTRA_DOCK_STATE_DESK: - resId = R.string.dock_audio_summary_desk; - break; - case Intent.EXTRA_DOCK_STATE_UNDOCKED: - resId = R.string.dock_audio_summary_none; + + boolean isBluetooth = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE) != null; + + if (!isBluetooth) { + // No dock audio if not on Bluetooth. + mAudioSettings.setEnabled(false); + mAudioSettings.setSummary(R.string.dock_audio_summary_unknown); + } else { + mAudioSettings.setEnabled(true); + + mDockIntent = intent; + int resId = R.string.dock_audio_summary_unknown; + switch (dockState) { + case Intent.EXTRA_DOCK_STATE_CAR: + resId = R.string.dock_audio_summary_car; + break; + case Intent.EXTRA_DOCK_STATE_DESK: + resId = R.string.dock_audio_summary_desk; + break; + case Intent.EXTRA_DOCK_STATE_UNDOCKED: + resId = R.string.dock_audio_summary_none; + } + mAudioSettings.setSummary(resId); } - mAudioSettings.setSummary(resId); + if (dockState != Intent.EXTRA_DOCK_STATE_UNDOCKED) { // remove undocked dialog if currently showing. try { |