Code example for EditTextPreference

Methods: setTextsetDependencysetOnPreferenceChangeListener

0
        storyFooterFontSizePreference = (EditTextPreference) findPreference(STORY_FOOTER_FONT_SIZE);
        storyAuthorColorPreference = (ColorPickerPreference) findPreference(STORY_FOOTER_AUTHOR_COLOR);
        storyDateColorPreference = (ColorPickerPreference) findPreference(STORY_FOOTER_DATE_COLOR);
         
        storyFooterUppercasePreference.setDependency(STORY_FOOTER_SHOW);
        storyFooterFontSizePreference.setDependency(STORY_FOOTER_SHOW);
        storyAuthorColorPreference.setDependency(STORY_FOOTER_SHOW);
        storyDateColorPreference.setDependency(STORY_FOOTER_SHOW);
         
        storyFooterShowPreference.setOnPreferenceChangeListener(this);
        storyFooterUppercasePreference.setOnPreferenceChangeListener(this);
        storyFooterFontSizePreference.setOnPreferenceChangeListener(this);
        storyAuthorColorPreference.setOnPreferenceChangeListener(this);
        storyDateColorPreference.setOnPreferenceChangeListener(this);
         
        //layout 
        storyLayoutPreference = (LayoutChoicePreference) findPreference(STORY_LAYOUT_CHOICE);
        widgetNumColumnsPreference = (ListPreference) findPreference(LAYOUT_NUM_COLUMNS);
        thumbnailSizePreference = (EditTextPreference) findPreference(STORY_LAYOUT_THUMBNAIL_SIZE);
         
        storyLayoutPreference.setOnPreferenceChangeListener(this);
        widgetNumColumnsPreference.setOnPreferenceChangeListener(this);
        thumbnailSizePreference.setOnPreferenceChangeListener(this);
         
        setPreferenceValues(); 
    } 
     
    private void setPreferenceValues()  
    { 
        themeNamePreference.setText(theme.getName());
         
        backgroundColorPreference.setValue(theme.getBackgroundColor());
        backgroundOpacityPreference.setText(Integer.toString(theme.getBackgroundOpacity()));
        roundedCornersPreference.setChecked(theme.isRoundedCorners());
        showTitlePreference.setChecked(theme.isShowWidgetTitle());
        widgetTitleColorPreference.setValue(theme.getWidgetTitleColor());
        dateFormatPreference.setText(theme.getDateFormat());
         
        storyTitleColorPreference.setValue(theme.getStoryTitleColor());
        storyTitleFontSizePreference.setText(Integer.toString(theme.getStoryTitleFontSize()));
        storyTitleHidePreference.setChecked(theme.isStoryTitleHide());
        storyTitleUppercasePreference.setChecked(theme.isStoryTitleUppercase());
        storyTitleMaxLinesPreference.setText(Integer.toString(theme.getStoryTitleMaxLines()));
         
        storyDescriptionColorPreference.setValue(theme.getStoryDescriptionColor());
        storyDescriptionFontSizePreference.setText(Integer.toString(theme.getStoryDescriptionFontSize()));
        storyDescriptionMaxWordsPreference.setText(Integer.toString(theme.getStoryDescriptionMaxWordCount()));
         
        storyFooterShowPreference.setChecked(theme.isShowFooter());
        storyFooterUppercasePreference.setChecked(theme.isFooterUppercase());
        storyFooterFontSizePreference.setText(Integer.toString(theme.getFooterFontSize()));
        storyAuthorColorPreference.setValue(theme.getStoryAuthorColor());
        storyDateColorPreference.setValue(theme.getStoryDateColor());
         
        storyLayoutPreference.setValue(theme.getLayout());
        widgetNumColumnsPreference.setValue(Integer.toString(theme.getNumColumns()));
Contextual code suggestions in your IDE  Get Codota for Java