Use a ListPreference for tone frequency, which is more typical
This commit is contained in:
parent
77b8463ed9
commit
2e346a9c6f
3 changed files with 28 additions and 10 deletions
|
@ -360,9 +360,11 @@ data class DitDahGeneratorSettings(var context : Context? = null) {
|
|||
init {
|
||||
if(context != null) {
|
||||
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
toneFrequency = sharedPreferences.getInt(context!!.getString(R.string.setting_tone_key), toneFrequency)
|
||||
wordsPerMinute = sharedPreferences.getInt(context!!.getString(R.string.setting_wpm_key), wordsPerMinute)
|
||||
farnsworthWordsPerMinute = sharedPreferences.getInt(context!!.getString(R.string.setting_effective_wpm_key), farnsworthWordsPerMinute)
|
||||
|
||||
// This one is a little strange; the ListPreference stores a string, which we need to parse
|
||||
toneFrequency = sharedPreferences.getString(context!!.getString(R.string.setting_tone_key), toneFrequency.toString())!!.toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
<string name="setting_effective_wpm_label">Effective Words per Minute</string>
|
||||
<string name="setting_effective_wpm_summary">Allows extra spacing between characters</string>
|
||||
|
||||
|
||||
<string name="setting_tone_key">sender_tone</string>
|
||||
<string name="setting_wpm_key">sender_wpm</string>
|
||||
<string name="setting_effective_wpm_key">sender_effective_wpm</string>
|
||||
|
@ -34,4 +33,24 @@
|
|||
<string name="setting_koch_lesson_vary_label">Variable group length</string>
|
||||
<string name="setting_koch_lesson_vary_off">Always groups of 5</string>
|
||||
<string name="setting_koch_lesson_vary_on">Groups between 2 and 6 characters</string>
|
||||
|
||||
<string-array name="tone_frequency_strings">
|
||||
<item>400Hz</item>
|
||||
<item>450Hz</item>
|
||||
<item>500Hz</item>
|
||||
<item>550Hz</item>
|
||||
<item>600Hz</item>
|
||||
<item>650Hz</item>
|
||||
<item>700Hz</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="tone_frequency_values">
|
||||
<item>400</item>
|
||||
<item>450</item>
|
||||
<item>500</item>
|
||||
<item>550</item>
|
||||
<item>600</item>
|
||||
<item>650</item>
|
||||
<item>700</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
|
|
@ -10,15 +10,12 @@
|
|||
android:summaryOn="YEAH"
|
||||
android:title="Switch preference" />
|
||||
|
||||
<SeekBarPreference
|
||||
<ListPreference
|
||||
android:defaultValue="600"
|
||||
android:max="900"
|
||||
app:defaultValue="650"
|
||||
app:key="@string/setting_tone_key"
|
||||
app:min="500"
|
||||
app:seekBarIncrement="50"
|
||||
app:showSeekBarValue="true"
|
||||
app:title="@string/setting_tone_frequency_label" />
|
||||
android:entries="@array/tone_frequency_strings"
|
||||
android:entryValues="@array/tone_frequency_values"
|
||||
android:key="@string/setting_tone_key"
|
||||
android:title="@string/setting_tone_frequency_label" />
|
||||
|
||||
<SeekBarPreference
|
||||
android:defaultValue="600"
|
||||
|
|
Loading…
Reference in a new issue