Merge change I82be95f6 into eclair
* changes: Feature #2296147 Settings for Car/Desk Dock on certain devices
This commit is contained in:
@@ -18,4 +18,6 @@
|
||||
<!-- Whether or not there is a notification led that is too intrusive to be pulsing
|
||||
constantly -->
|
||||
<bool name="has_intrusive_led">false</bool>
|
||||
<!-- Whether or not the dock settings are to be displayed for this device when docked -->
|
||||
<bool name="has_dock_settings">false</bool>
|
||||
</resources>
|
||||
|
@@ -894,6 +894,8 @@
|
||||
<string name="media_volume_title">Media volume</string>
|
||||
<!-- Sound settings screen, setting option summary text -->
|
||||
<string name="media_volume_summary">Set volume for music and videos</string>
|
||||
<!-- Sound settings screen, dock settings -->
|
||||
<string name="dock_settings_title">Dock settings</string>
|
||||
<!-- Sound settings screen, setting check box label -->
|
||||
<string name="dtmf_tone_enable_title">Audible touch tones</string>
|
||||
<!-- Sound settings screen, setting option summary text when check box is selected -->
|
||||
|
@@ -25,6 +25,7 @@
|
||||
android:title="@string/silent_mode_title"
|
||||
android:summary="@string/silent_mode_summary"
|
||||
android:persistent="false"
|
||||
android:order="1"
|
||||
android:disableDependentsState="true" />
|
||||
|
||||
<com.android.settings.RingerVolumePreference
|
||||
@@ -34,6 +35,7 @@
|
||||
android:dialogTitle="@string/ring_volume_title"
|
||||
android:persistent="false"
|
||||
android:dependency="silent"
|
||||
android:order="2"
|
||||
android:streamType="ring" />
|
||||
|
||||
<VolumePreference
|
||||
@@ -42,8 +44,19 @@
|
||||
android:summary="@string/media_volume_summary"
|
||||
android:dialogTitle="@string/media_volume_title"
|
||||
android:persistent="false"
|
||||
android:order="3"
|
||||
android:streamType="music" />
|
||||
|
||||
<PreferenceScreen
|
||||
android:key="dock_settings"
|
||||
android:order="4"
|
||||
android:title="@string/dock_settings_title">
|
||||
<intent
|
||||
android:action="android.intent.action.MAIN"
|
||||
android:targetPackage="com.android.settings"
|
||||
android:targetClass="com.android.settings.bluetooth.DockSettingsActivity" />
|
||||
</PreferenceScreen>
|
||||
|
||||
<com.android.settings.DefaultRingtonePreference
|
||||
android:key="ringtone"
|
||||
android:title="@string/ringtone_title"
|
||||
@@ -51,12 +64,14 @@
|
||||
android:dialogTitle="@string/ringtone_title"
|
||||
android:persistent="false"
|
||||
android:dependency="silent"
|
||||
android:order="5"
|
||||
android:ringtoneType="ringtone" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="vibrate"
|
||||
android:title="@string/vibrate_title"
|
||||
android:summary="@string/vibrate_summary"
|
||||
android:order="6"
|
||||
android:persistent="false" />
|
||||
|
||||
<com.android.settings.DefaultRingtonePreference
|
||||
@@ -66,12 +81,14 @@
|
||||
android:dialogTitle="@string/notification_sound_dialog_title"
|
||||
android:dependency="silent"
|
||||
android:persistent="false"
|
||||
android:order="7"
|
||||
android:ringtoneType="notification" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="notification_pulse"
|
||||
android:title="@string/notification_pulse_title"
|
||||
android:summary="@string/notification_pulse_summary"
|
||||
android:order="8"
|
||||
android:persistent="false" />
|
||||
|
||||
<CheckBoxPreference
|
||||
@@ -80,6 +97,7 @@
|
||||
android:summaryOn="@string/dtmf_tone_enable_summary_on"
|
||||
android:summaryOff="@string/dtmf_tone_enable_summary_off"
|
||||
android:dependency="silent"
|
||||
android:order="9"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
@@ -88,6 +106,7 @@
|
||||
android:summaryOn="@string/sound_effects_enable_summary_on"
|
||||
android:summaryOff="@string/sound_effects_enable_summary_off"
|
||||
android:dependency="silent"
|
||||
android:order="10"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
@@ -96,6 +115,7 @@
|
||||
android:summaryOn="@string/haptic_feedback_enable_summary_on"
|
||||
android:summaryOff="@string/haptic_feedback_enable_summary_off"
|
||||
android:dependency="silent"
|
||||
android:order="11"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
@@ -104,6 +124,7 @@
|
||||
android:summaryOn="@string/play_media_notification_sounds_enable_summary_on"
|
||||
android:summaryOff="@string/play_media_notification_sounds_enable_summary_off"
|
||||
android:dependency="silent"
|
||||
android:order="12"
|
||||
android:defaultValue="true" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
@@ -60,11 +60,15 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements
|
||||
private static final String KEY_EMERGENCY_TONE = "emergency_tone";
|
||||
private static final String KEY_SOUND_SETTINGS = "sound_settings";
|
||||
private static final String KEY_NOTIFICATION_PULSE = "notification_pulse";
|
||||
private static final String KEY_DOCK_SETTINGS = "dock_settings";
|
||||
|
||||
private CheckBoxPreference mSilent;
|
||||
|
||||
private CheckBoxPreference mPlayMediaNotificationSounds;
|
||||
|
||||
private Preference mDockSettings;
|
||||
private boolean mHasDockSettings;
|
||||
|
||||
private IMountService mMountService = null;
|
||||
|
||||
/*
|
||||
@@ -90,10 +94,16 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements
|
||||
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent.getAction().equals(AudioManager.RINGER_MODE_CHANGED_ACTION)) {
|
||||
updateState(false);
|
||||
} else if (intent.getAction().equals(Intent.ACTION_DOCK_EVENT)) {
|
||||
handleDockChange(intent);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private PreferenceGroup mSoundSettings;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -147,12 +157,12 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements
|
||||
emergencyTonePreference.setOnPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
PreferenceGroup soundSettings = (PreferenceGroup) findPreference(KEY_SOUND_SETTINGS);
|
||||
mSoundSettings = (PreferenceGroup) findPreference(KEY_SOUND_SETTINGS);
|
||||
mNotificationPulse = (CheckBoxPreference)
|
||||
soundSettings.findPreference(KEY_NOTIFICATION_PULSE);
|
||||
if (mNotificationPulse != null && soundSettings != null &&
|
||||
mSoundSettings.findPreference(KEY_NOTIFICATION_PULSE);
|
||||
if (mNotificationPulse != null &&
|
||||
getResources().getBoolean(R.bool.has_intrusive_led) == false) {
|
||||
soundSettings.removePreference(mNotificationPulse);
|
||||
mSoundSettings.removePreference(mNotificationPulse);
|
||||
} else {
|
||||
try {
|
||||
mNotificationPulse.setChecked(Settings.System.getInt(resolver,
|
||||
@@ -162,6 +172,8 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements
|
||||
Log.e(TAG, Settings.System.NOTIFICATION_LIGHT_PULSE + " not found");
|
||||
}
|
||||
}
|
||||
|
||||
initDockSettings();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -171,6 +183,12 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements
|
||||
updateState(true);
|
||||
|
||||
IntentFilter filter = new IntentFilter(AudioManager.RINGER_MODE_CHANGED_ACTION);
|
||||
if (mHasDockSettings) {
|
||||
if (mDockSettings != null) {
|
||||
mSoundSettings.removePreference(mDockSettings);
|
||||
}
|
||||
filter.addAction(Intent.ACTION_DOCK_EVENT);
|
||||
}
|
||||
registerReceiver(mReceiver, filter);
|
||||
}
|
||||
|
||||
@@ -181,6 +199,31 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements
|
||||
unregisterReceiver(mReceiver);
|
||||
}
|
||||
|
||||
private void initDockSettings() {
|
||||
mDockSettings = mSoundSettings.findPreference(KEY_DOCK_SETTINGS);
|
||||
mHasDockSettings = getResources().getBoolean(R.bool.has_dock_settings);
|
||||
if (mDockSettings != null) {
|
||||
mSoundSettings.removePreference(mDockSettings);
|
||||
// Don't care even if we dock
|
||||
if (getResources().getBoolean(R.bool.has_dock_settings) == false) {
|
||||
mDockSettings = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handleDockChange(Intent intent) {
|
||||
if (mHasDockSettings && mDockSettings != null) {
|
||||
int dockState = intent.getIntExtra(Intent.EXTRA_DOCK_STATE, 0);
|
||||
if (dockState != Intent.EXTRA_DOCK_STATE_UNDOCKED) {
|
||||
// Show dock settings item
|
||||
mSoundSettings.addPreference(mDockSettings);
|
||||
} else {
|
||||
// Remove dock settings item
|
||||
mSoundSettings.removePreference(mDockSettings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateState(boolean force) {
|
||||
final int ringerMode = mAudioManager.getRingerMode();
|
||||
final boolean silentOrVibrateMode =
|
||||
|
Reference in New Issue
Block a user