diff options
-rw-r--r-- | res/values/strings.xml | 6 | ||||
-rw-r--r-- | res/xml/dock_settings.xml | 9 | ||||
-rw-r--r-- | src/com/android/settings/DockSettings.java | 14 |
3 files changed, 28 insertions, 1 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index 49231d1..f06211c 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1033,6 +1033,12 @@ <string name="dock_not_found_title">Dock not found</string> <!-- Dock not found dialog text --> <string name="dock_not_found_text">The phone must be docked to configure dock audio</string> + <!-- Dock settings screen, dock events SFX setting check box label --> + <string name="dock_sounds_enable_title">Dock insertion sound</string> + <!-- Dock settings screen, setting option summary text when check box is selected --> + <string name="dock_sounds_enable_summary_on">Play sound when inserting or removing phone from dock</string> + <!-- Sound settings screen, setting option summary text when check box is clear --> + <string name="dock_sounds_enable_summary_off">Don't play sound when inserting or removing phone from dock</string> <!-- Acounts & Sync settings screen setting option name to go into the screen for data sync settings--> <string name="sync_settings">Accounts & sync</string> diff --git a/res/xml/dock_settings.xml b/res/xml/dock_settings.xml index 43e9fa5..d3d6e43 100644 --- a/res/xml/dock_settings.xml +++ b/res/xml/dock_settings.xml @@ -26,4 +26,11 @@ android:summary="@string/dock_settings_summary" android:widgetLayout="@*android:layout/preference_dialog" /> -</PreferenceScreen>
\ No newline at end of file + <CheckBoxPreference + android:key="dock_sounds" + android:title="@string/dock_sounds_enable_title" + android:summaryOn="@string/dock_sounds_enable_summary_on" + android:summaryOff="@string/dock_sounds_enable_summary_off" + android:defaultValue="false" /> + +</PreferenceScreen> diff --git a/src/com/android/settings/DockSettings.java b/src/com/android/settings/DockSettings.java index fe9aeb7..795fb3c 100644 --- a/src/com/android/settings/DockSettings.java +++ b/src/com/android/settings/DockSettings.java @@ -24,9 +24,11 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; +import android.preference.CheckBoxPreference; import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.PreferenceScreen; +import android.provider.Settings; import com.android.settings.bluetooth.DockEventReceiver; @@ -34,7 +36,9 @@ public class DockSettings extends PreferenceActivity { private static final int DIALOG_NOT_DOCKED = 1; private static final String KEY_AUDIO_SETTINGS = "dock_audio"; + private static final String KEY_DOCK_SOUNDS = "dock_sounds"; private Preference mAudioSettings; + private CheckBoxPreference mDockSounds; private Intent mDockIntent; private BroadcastReceiver mReceiver = new BroadcastReceiver() { @@ -71,10 +75,17 @@ public class DockSettings extends PreferenceActivity { } private void initDockSettings() { + ContentResolver resolver = getContentResolver(); + mAudioSettings = findPreference(KEY_AUDIO_SETTINGS); if (mAudioSettings != null) { mAudioSettings.setSummary(R.string.dock_audio_summary_none); } + + mDockSounds = (CheckBoxPreference) findPreference(KEY_DOCK_SOUNDS); + mDockSounds.setPersistent(false); + mDockSounds.setChecked(Settings.System.getInt(resolver, + Settings.System.DOCK_SOUNDS_ENABLED, 0) != 0); } private void handleDockChange(Intent intent) { @@ -118,6 +129,9 @@ public class DockSettings extends PreferenceActivity { i.setClass(this, DockEventReceiver.class); sendBroadcast(i); } + } else if (preference == mDockSounds) { + Settings.System.putInt(getContentResolver(), Settings.System.DOCK_SOUNDS_ENABLED, + mDockSounds.isChecked() ? 1 : 0); } return true; |