FileDocCategorySizeDatePackage
CameraSettings.javaAPI DocAndroid 1.5 API2977Wed May 06 22:42:42 BST 2009com.android.camera

CameraSettings

public class CameraSettings extends android.preference.PreferenceActivity implements android.content.SharedPreferences.OnSharedPreferenceChangeListener
CameraSettings

Fields Summary
public static final String
KEY_VIDEO_QUALITY
public static final boolean
DEFAULT_VIDEO_QUALITY_VALUE
private android.preference.ListPreference
mVideoQuality
Constructors Summary
public CameraSettings()


     
    
    
Methods Summary
private booleangetBooleanPreference(android.preference.ListPreference preference, boolean defaultValue)

        return getIntPreference(preference, defaultValue ? 1 : 0) != 0;
    
private static intgetIntPreference(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 voidinitUI()

        mVideoQuality = (ListPreference) findPreference(KEY_VIDEO_QUALITY);
        getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
    
public voidonCreate(android.os.Bundle icicle)
Called with the activity is first created.

        super.onCreate(icicle);
        addPreferencesFromResource(R.xml.camera_preferences);

        initUI();
    
protected voidonResume()

        super.onResume();
        updateVideoQuality();
    
public voidonSharedPreferenceChanged(android.content.SharedPreferences sharedPreferences, java.lang.String key)

           if (key.equals(KEY_VIDEO_QUALITY)) {
               updateVideoQuality();
           }

    
private voidupdateVideoQuality()

        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);