Add a checkbox to the Dock settings to control insertion/removal sound effects.
The sounds are present in the build but are turned off by default (and there isn't currently a UI to turn them on). (Mentioned in http://b/2469862) Change-Id: I9ded1d67cc19204113047aeb8fc8b0123cea1427
This commit is contained in:
@@ -1033,6 +1033,12 @@
|
|||||||
<string name="dock_not_found_title">Dock not found</string>
|
<string name="dock_not_found_title">Dock not found</string>
|
||||||
<!-- Dock not found dialog text -->
|
<!-- Dock not found dialog text -->
|
||||||
<string name="dock_not_found_text">The phone must be docked to configure dock audio</string>
|
<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-->
|
<!-- Acounts & Sync settings screen setting option name to go into the screen for data sync settings-->
|
||||||
<string name="sync_settings">Accounts & sync</string>
|
<string name="sync_settings">Accounts & sync</string>
|
||||||
|
@@ -26,4 +26,11 @@
|
|||||||
android:summary="@string/dock_settings_summary"
|
android:summary="@string/dock_settings_summary"
|
||||||
android:widgetLayout="@*android:layout/preference_dialog" />
|
android:widgetLayout="@*android:layout/preference_dialog" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
<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>
|
||||||
|
@@ -24,9 +24,11 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.preference.CheckBoxPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
|
import android.provider.Settings;
|
||||||
|
|
||||||
import com.android.settings.bluetooth.DockEventReceiver;
|
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 int DIALOG_NOT_DOCKED = 1;
|
||||||
private static final String KEY_AUDIO_SETTINGS = "dock_audio";
|
private static final String KEY_AUDIO_SETTINGS = "dock_audio";
|
||||||
|
private static final String KEY_DOCK_SOUNDS = "dock_sounds";
|
||||||
private Preference mAudioSettings;
|
private Preference mAudioSettings;
|
||||||
|
private CheckBoxPreference mDockSounds;
|
||||||
private Intent mDockIntent;
|
private Intent mDockIntent;
|
||||||
|
|
||||||
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
||||||
@@ -71,10 +75,17 @@ public class DockSettings extends PreferenceActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initDockSettings() {
|
private void initDockSettings() {
|
||||||
|
ContentResolver resolver = getContentResolver();
|
||||||
|
|
||||||
mAudioSettings = findPreference(KEY_AUDIO_SETTINGS);
|
mAudioSettings = findPreference(KEY_AUDIO_SETTINGS);
|
||||||
if (mAudioSettings != null) {
|
if (mAudioSettings != null) {
|
||||||
mAudioSettings.setSummary(R.string.dock_audio_summary_none);
|
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) {
|
private void handleDockChange(Intent intent) {
|
||||||
@@ -118,6 +129,9 @@ public class DockSettings extends PreferenceActivity {
|
|||||||
i.setClass(this, DockEventReceiver.class);
|
i.setClass(this, DockEventReceiver.class);
|
||||||
sendBroadcast(i);
|
sendBroadcast(i);
|
||||||
}
|
}
|
||||||
|
} else if (preference == mDockSounds) {
|
||||||
|
Settings.System.putInt(getContentResolver(), Settings.System.DOCK_SOUNDS_ENABLED,
|
||||||
|
mDockSounds.isChecked() ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user