Methods Summary |
---|
private boolean | getBooleanPreference(android.preference.ListPreference preference, boolean defaultValue)
return getIntPreference(preference, defaultValue ? 1 : 0) != 0;
|
private static int | getIntPreference(android.preference.ListPreference preference, int defaultValue)
String s = preference.getValue();
int result = defaultValue;
try {
result = Integer.parseInt(s);
} catch (NumberFormatException e) {
// Ignore, result is already the default value.
}
return result;
|
private void | initUI()
mVideoQuality = (ListPreference) findPreference(KEY_VIDEO_QUALITY);
getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
|
public void | onCreate(android.os.Bundle icicle)Called with the activity is first created.
super.onCreate(icicle);
addPreferencesFromResource(R.xml.camera_preferences);
initUI();
|
protected void | onResume()
super.onResume();
updateVideoQuality();
|
public void | onSharedPreferenceChanged(android.content.SharedPreferences sharedPreferences, java.lang.String key)
if (key.equals(KEY_VIDEO_QUALITY)) {
updateVideoQuality();
}
|
private void | updateVideoQuality()
boolean vidQualityValue = getBooleanPreference(mVideoQuality, DEFAULT_VIDEO_QUALITY_VALUE);
int vidQualityIndex = vidQualityValue ? 1 : 0;
String[] vidQualities =
getResources().getStringArray(R.array.pref_camera_videoquality_entries);
String vidQuality = vidQualities[vidQualityIndex];
mVideoQuality.setSummary(vidQuality);
|