Load preferences in onStart in song selector

So the app doesn't need to be restarted to reload these preferences
This commit is contained in:
Christopher Eby 2010-04-02 11:12:20 -05:00
parent 7791663e29
commit ededdcf716

View File

@ -106,18 +106,6 @@ public class SongSelector extends Dialog implements AdapterView.OnItemClickListe
mLimiterViews = (ViewGroup)findViewById(R.id.limiter_layout); mLimiterViews = (ViewGroup)findViewById(R.id.limiter_layout);
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getContext());
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;
mTextFilter.setInputType(inputType);
mDefaultAction = Integer.parseInt(settings.getString("default_action_int", "0"));
new Handler().post(new Runnable() { new Handler().post(new Runnable() {
public void run() public void run()
{ {
@ -131,6 +119,22 @@ public class SongSelector extends Dialog implements AdapterView.OnItemClickListe
}); });
} }
@Override
public void onStart()
{
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getContext());
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;
mTextFilter.setInputType(inputType);
mDefaultAction = Integer.parseInt(settings.getString("default_action_int", "0"));
}
@Override @Override
public boolean onKeyDown(int keyCode, KeyEvent event) public boolean onKeyDown(int keyCode, KeyEvent event)
{ {