private void initBluetoothConfigurationValues() {
String[] values;
- String[] titles;
+ String[] summaries;
int index;
// Init the Codec Type - Default
values = getResources().getStringArray(R.array.bluetooth_a2dp_codec_values);
- titles = getResources().getStringArray(R.array.bluetooth_a2dp_codec_titles);
+ summaries = getResources().getStringArray(R.array.bluetooth_a2dp_codec_summaries);
index = 0;
mBluetoothSelectA2dpCodec.setValue(values[index]);
- mBluetoothSelectA2dpCodec.setSummary(titles[index]);
+ mBluetoothSelectA2dpCodec.setSummary(summaries[index]);
// Init the Sample Rate - Default
values = getResources().getStringArray(R.array.bluetooth_a2dp_codec_sample_rate_values);
- titles = getResources().getStringArray(R.array.bluetooth_a2dp_codec_sample_rate_titles);
+ summaries = getResources().getStringArray(R.array.bluetooth_a2dp_codec_sample_rate_summaries);
index = 0;
mBluetoothSelectA2dpSampleRate.setValue(values[index]);
- mBluetoothSelectA2dpSampleRate.setSummary(titles[index]);
+ mBluetoothSelectA2dpSampleRate.setSummary(summaries[index]);
// Init the Bits Per Sample - Default
values = getResources().getStringArray(R.array.bluetooth_a2dp_codec_bits_per_sample_values);
- titles = getResources().getStringArray(R.array.bluetooth_a2dp_codec_bits_per_sample_titles);
+ summaries = getResources().getStringArray(R.array.bluetooth_a2dp_codec_bits_per_sample_summaries);
index = 0;
mBluetoothSelectA2dpBitsPerSample.setValue(values[index]);
- mBluetoothSelectA2dpBitsPerSample.setSummary(titles[index]);
+ mBluetoothSelectA2dpBitsPerSample.setSummary(summaries[index]);
// Init the Channel Mode - Default
values = getResources().getStringArray(R.array.bluetooth_a2dp_codec_channel_mode_values);
- titles = getResources().getStringArray(R.array.bluetooth_a2dp_codec_channel_mode_titles);
+ summaries = getResources().getStringArray(R.array.bluetooth_a2dp_codec_channel_mode_summaries);
index = 0;
mBluetoothSelectA2dpChannelMode.setValue(values[index]);
- mBluetoothSelectA2dpChannelMode.setSummary(titles[index]);
+ mBluetoothSelectA2dpChannelMode.setSummary(summaries[index]);
// Init the LDAC Playback Quality - High
values = getResources().getStringArray(R.array.bluetooth_a2dp_codec_ldac_playback_quality_values);
- titles = getResources().getStringArray(R.array.bluetooth_a2dp_codec_ldac_playback_quality_titles);
+ summaries = getResources().getStringArray(R.array.bluetooth_a2dp_codec_ldac_playback_quality_summaries);
index = 0;
mBluetoothSelectA2dpLdacPlaybackQuality.setValue(values[index]);
- mBluetoothSelectA2dpLdacPlaybackQuality.setSummary(titles[index]);
+ mBluetoothSelectA2dpLdacPlaybackQuality.setSummary(summaries[index]);
}
private void updateBluetoothA2dpConfigurationValues() {
int index;
- String[] titles;
+ String[] summaries;
BluetoothCodecConfig codecConfig = null;
+ String streaming;
synchronized (mBluetoothA2dpLock) {
if (mBluetoothA2dp != null) {
break;
}
if (index >= 0) {
- titles = getResources().getStringArray(R.array.bluetooth_a2dp_codec_titles);
- mBluetoothSelectA2dpCodec.setSummary("Streaming: " + titles[index]);
+ summaries = getResources().getStringArray(R.array.bluetooth_a2dp_codec_summaries);
+ streaming = getResources().getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
+ mBluetoothSelectA2dpCodec.setSummary(streaming);
}
// Update the Sample Rate
break;
}
if (index >= 0) {
- titles = getResources().getStringArray(R.array.bluetooth_a2dp_codec_sample_rate_titles);
- mBluetoothSelectA2dpSampleRate.setSummary("Streaming: " + titles[index]);
+ summaries = getResources().getStringArray(R.array.bluetooth_a2dp_codec_sample_rate_summaries);
+ streaming = getResources().getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
+ mBluetoothSelectA2dpSampleRate.setSummary(streaming);
}
// Update the Bits Per Sample
break;
}
if (index >= 0) {
- titles = getResources().getStringArray(R.array.bluetooth_a2dp_codec_bits_per_sample_titles);
- mBluetoothSelectA2dpBitsPerSample.setSummary("Streaming: " + titles[index]);
+ summaries = getResources().getStringArray(R.array.bluetooth_a2dp_codec_bits_per_sample_summaries);
+ streaming = getResources().getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
+ mBluetoothSelectA2dpBitsPerSample.setSummary(streaming);
}
// Update the Channel Mode
break;
}
if (index >= 0) {
- titles = getResources().getStringArray(R.array.bluetooth_a2dp_codec_channel_mode_titles);
- mBluetoothSelectA2dpChannelMode.setSummary("Streaming: " + titles[index]);
+ summaries = getResources().getStringArray(R.array.bluetooth_a2dp_codec_channel_mode_summaries);
+ streaming = getResources().getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
+ mBluetoothSelectA2dpChannelMode.setSummary(streaming);
}
// Update the LDAC Playback Quality
- index = -1;
- switch ((int)codecConfig.getCodecSpecific1()) {
- case 1000:
- index = 0;
- break;
- case 1001:
- index = 1;
- break;
- case 1002:
- index = 2;
+ // The actual values are 0, 1, 2 - those are extracted
+ // as mod-10 remainders of a larger value.
+ // The reason is because within BluetoothCodecConfig we cannot use
+ // a codec-specific value of zero.
+ index = (int)codecConfig.getCodecSpecific1();
+ if (index > 0) {
+ index %= 10;
+ } else {
+ index = -1;
+ }
+ switch (index) {
+ case 0:
+ case 1:
+ case 2:
break;
default:
+ index = -1;
break;
}
if (index >= 0) {
- titles = getResources().getStringArray(R.array.bluetooth_a2dp_codec_ldac_playback_quality_titles);
- mBluetoothSelectA2dpLdacPlaybackQuality.setSummary("Streaming: " + titles[index]);
+ summaries = getResources().getStringArray(R.array.bluetooth_a2dp_codec_ldac_playback_quality_summaries);
+ streaming = getResources().getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
+ mBluetoothSelectA2dpLdacPlaybackQuality.setSummary(streaming);
}
}
private void writeBluetoothConfigurationOption(Preference preference,
Object newValue) {
- String[] titles;
+ String[] summaries;
int index;
int codecTypeValue = BluetoothCodecConfig.SOURCE_CODEC_TYPE_INVALID;
int codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT;
codecType = newValue.toString();
index = mBluetoothSelectA2dpCodec.findIndexOfValue(newValue.toString());
if (index >= 0) {
- titles = getResources().getStringArray(R.array.bluetooth_a2dp_codec_titles);
- mBluetoothSelectA2dpCodec.setSummary(titles[index]);
+ summaries = getResources().getStringArray(R.array.bluetooth_a2dp_codec_summaries);
+ mBluetoothSelectA2dpCodec.setSummary(summaries[index]);
}
}
index = mBluetoothSelectA2dpCodec.findIndexOfValue(codecType);
sampleRate = newValue.toString();
index = mBluetoothSelectA2dpSampleRate.findIndexOfValue(newValue.toString());
if (index >= 0) {
- titles = getResources().getStringArray(R.array.bluetooth_a2dp_codec_sample_rate_titles);
- mBluetoothSelectA2dpSampleRate.setSummary(titles[index]);
+ summaries = getResources().getStringArray(R.array.bluetooth_a2dp_codec_sample_rate_summaries);
+ mBluetoothSelectA2dpSampleRate.setSummary(summaries[index]);
}
}
index = mBluetoothSelectA2dpSampleRate.findIndexOfValue(sampleRate);
bitsPerSample = newValue.toString();
index = mBluetoothSelectA2dpBitsPerSample.findIndexOfValue(newValue.toString());
if (index >= 0) {
- titles = getResources().getStringArray(R.array.bluetooth_a2dp_codec_bits_per_sample_titles);
- mBluetoothSelectA2dpBitsPerSample.setSummary(titles[index]);
+ summaries = getResources().getStringArray(R.array.bluetooth_a2dp_codec_bits_per_sample_summaries);
+ mBluetoothSelectA2dpBitsPerSample.setSummary(summaries[index]);
}
}
index = mBluetoothSelectA2dpBitsPerSample.findIndexOfValue(bitsPerSample);
channelMode = newValue.toString();
index = mBluetoothSelectA2dpChannelMode.findIndexOfValue(newValue.toString());
if (index >= 0) {
- titles = getResources().getStringArray(R.array.bluetooth_a2dp_codec_channel_mode_titles);
- mBluetoothSelectA2dpChannelMode.setSummary(titles[index]);
+ summaries = getResources().getStringArray(R.array.bluetooth_a2dp_codec_channel_mode_summaries);
+ mBluetoothSelectA2dpChannelMode.setSummary(summaries[index]);
}
}
index = mBluetoothSelectA2dpChannelMode.findIndexOfValue(channelMode);
ldacPlaybackQuality = newValue.toString();
index = mBluetoothSelectA2dpLdacPlaybackQuality.findIndexOfValue(newValue.toString());
if (index >= 0) {
- titles = getResources().getStringArray(R.array.bluetooth_a2dp_codec_ldac_playback_quality_titles);
- mBluetoothSelectA2dpLdacPlaybackQuality.setSummary(titles[index]);
+ summaries = getResources().getStringArray(R.array.bluetooth_a2dp_codec_ldac_playback_quality_summaries);
+ mBluetoothSelectA2dpLdacPlaybackQuality.setSummary(summaries[index]);
}
}
index = mBluetoothSelectA2dpLdacPlaybackQuality.findIndexOfValue(ldacPlaybackQuality);
switch (index) {
case 0:
- codecSpecific1Value = 1000;
- break;
case 1:
- codecSpecific1Value = 1001;
- break;
case 2:
- codecSpecific1Value = 1002;
+ codecSpecific1Value = 1000 + index;
break;
default:
break;