Disable filter suggestions by default and a preference to enable them

This commit is contained in:
Christopher Eby 2010-03-03 23:38:35 -06:00
parent 2dee7b190c
commit 32fd8ea975
3 changed files with 16 additions and 4 deletions

View File

@ -33,6 +33,9 @@
<string name="phone_input_title">Use Phone Dialer Input</string>
<string name="phone_input_summary">Enter filter text using buttons 1-9, where 1 matches 1, a, b or c, etc</string>
<string name="filter_suggestions_title">Use Suggestions in Filter Text</string>
<string name="filter_suggestions_summary">Use text suggestions when editing the filter text</string>
<string name="scrobble_title">Use ScrobbleDroid API</string>
<string name="scrobble_summary">Send song info to Last.FM scrobblers such as ScrobbleDroid and Simple Last.FM Scrobbler</string>
</resources>

View File

@ -33,6 +33,11 @@
android:title="@string/phone_input_title"
android:summary="@string/phone_input_summary"
android:defaultValue="false" />
<CheckBoxPreference
android:key="filter_suggestions"
android:title="@string/filter_suggestions_title"
android:summary="@string/filter_suggestions_summary"
android:defaultValue="false" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_misc">
<CheckBoxPreference

View File

@ -55,10 +55,14 @@ public class SongSelector extends Activity implements AdapterView.OnItemClickLis
mTextView = (TextView)findViewById(R.id.filter_text);
mTextView.addTextChangedListener(this);
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
boolean phoneInput = settings.getBoolean("phone_input", false);
int inputType = phoneInput ? InputType.TYPE_CLASS_PHONE
: InputType.TYPE_CLASS_TEXT;
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
int inputType;
if (settings.getBoolean("phone_input", false))
inputType = InputType.TYPE_CLASS_PHONE;
else if (!settings.getBoolean("filter_suggestions", false))
inputType = InputType.TYPE_TEXT_VARIATION_FILTER;
else
inputType = InputType.TYPE_CLASS_TEXT;
mTextView.setInputType(inputType);
}