Methods Summary |
---|
protected void | onCreate(android.os.Bundle savedInstanceState)
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.settings);
PreferenceScreen prefSet = getPreferenceScreen();
mKeySoundPref = (CheckBoxPreference) prefSet
.findPreference(getString(R.string.setting_sound_key));
mVibratePref = (CheckBoxPreference) prefSet
.findPreference(getString(R.string.setting_vibrate_key));
mPredictionPref = (CheckBoxPreference) prefSet
.findPreference(getString(R.string.setting_prediction_key));
prefSet.setOnPreferenceChangeListener(this);
Settings.getInstance(PreferenceManager
.getDefaultSharedPreferences(getApplicationContext()));
updatePreference(prefSet, getString(R.string.setting_advanced_key));
updateWidgets();
|
protected void | onDestroy()
Settings.releaseInstance();
super.onDestroy();
|
protected void | onPause()
super.onPause();
Settings.setKeySound(mKeySoundPref.isChecked());
Settings.setVibrate(mVibratePref.isChecked());
Settings.setPrediction(mPredictionPref.isChecked());
Settings.writeBack();
|
public boolean | onPreferenceChange(android.preference.Preference preference, java.lang.Object newValue)
return true;
|
protected void | onResume()
super.onResume();
updateWidgets();
|
public void | updatePreference(android.preference.PreferenceGroup parentPref, java.lang.String prefKey)
Preference preference = parentPref.findPreference(prefKey);
if (preference == null) {
return;
}
Intent intent = preference.getIntent();
if (intent != null) {
PackageManager pm = getPackageManager();
List<ResolveInfo> list = pm.queryIntentActivities(intent, 0);
int listSize = list.size();
if (listSize == 0)
parentPref.removePreference(preference);
}
|
private void | updateWidgets()
mKeySoundPref.setChecked(Settings.getKeySound());
mVibratePref.setChecked(Settings.getVibrate());
mPredictionPref.setChecked(Settings.getPrediction());
|