Example usage for android.preference PreferenceCategory setTitle

List of usage examples for android.preference PreferenceCategory setTitle

Introduction

In this page you can find the example usage for android.preference PreferenceCategory setTitle.

Prototype

public void setTitle(CharSequence title) 

Source Link

Document

Sets the title for this Preference with a CharSequence.

Usage

From source file:org.segin.ttleditor.SettingsActivity.java

/**
 * Shows the simplified settings UI if the device configuration if the
 * device configuration dictates that a simplified, single-pane UI should be
 * shown.//from w w w. j a  v  a 2 s  .c o  m
 */
private void setupSimplePreferencesScreen() {
    if (!isSimplePreferences(this)) {
        return;
    }
    ActionBar actionBar = getActionBar();
    try {
        actionBar.setIcon(getResources().getDrawable(R.drawable.ic_settings));
    } catch (Exception e) {
        e.printStackTrace();
    }
    // In the simplified UI, fragments are not used at all and we instead
    // use the older PreferenceActivity APIs.

    // Add 'general' preferences.
    addPreferencesFromResource(R.xml.pref_general);

    // Add 'notifications' preferences, and a corresponding header.
    PreferenceCategory fakeHeader = new PreferenceCategory(this);
    fakeHeader.setTitle(R.string.pref_header_debug);
    getPreferenceScreen().addPreference(fakeHeader);
    addPreferencesFromResource(R.xml.pref_debug);

    // Bind the summaries of EditText/List/Dialog/Ringtone preferences to
    // their values. When their values change, their summaries are updated
    // to reflect the new value, per the Android Design guidelines.
    bindPreferenceSummaryToValue(findPreference("iface"));
    bindPreferenceSummaryToValue(findPreference("ttl"));
    Preference sharePref = (Preference) findPreference("share");
    sharePref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        public boolean onPreferenceClick(Preference preference) {
            Intent sendIntent = new Intent();
            sendIntent.setAction(Intent.ACTION_SEND);
            sendIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_text));
            sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_subject));
            sendIntent.setType("text/plain");
            startActivity(sendIntent);
            return true;
        }
    });

}

From source file:pro.jariz.reisplanner.SettingsActivity.java

/**
 * Shows the simplified settings UI if the device configuration if the
 * device configuration dictates that a simplified, single-pane UI should be
 * shown.//from   www .  j  a va  2 s . c  om
 */
private void setupSimplePreferencesScreen() {
    if (!isSimplePreferences(this)) {
        return;
    }

    // In the simplified UI, fragments are not used at all and we instead
    // use the older PreferenceActivity APIs.

    // Add 'general' preferences.
    addPreferencesFromResource(R.xml.pref_general);

    // Add 'notifications' preferences, and a corresponding header.
    PreferenceCategory fakeHeader = new PreferenceCategory(this);
    fakeHeader.setTitle(R.string.pref_header_notifications);
    getPreferenceScreen().addPreference(fakeHeader);
    addPreferencesFromResource(R.xml.pref_notification);

    // Add 'data and sync' preferences, and a corresponding header.
    fakeHeader = new PreferenceCategory(this);
    fakeHeader.setTitle(R.string.pref_header_data_sync);
    getPreferenceScreen().addPreference(fakeHeader);
    addPreferencesFromResource(R.xml.pref_data_sync);

    // Bind the summaries of EditText/List/Dialog/Ringtone preferences to
    // their values. When their values change, their summaries are updated
    // to reflect the new value, per the Android Design guidelines.
    bindPreferenceSummaryToValue(findPreference("example_text"));
    bindPreferenceSummaryToValue(findPreference("example_list"));
    bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
    bindPreferenceSummaryToValue(findPreference("sync_frequency"));
}

From source file:com.readystatesoftware.ghostlog.MainActivity.java

/**
 * Shows the simplified settings UI if the device configuration if the
 * device configuration dictates that a simplified, single-pane UI should be
 * shown./*from w  w w . j  a  v  a2s .co  m*/
 */
@SuppressWarnings("deprecation")
private void setupSimplePreferencesScreen() {
    if (!isSimplePreferences(this)) {
        return;
    }

    addPreferencesFromResource(R.xml.pref_blank);

    // Add 'filters' preferences.
    PreferenceCategory fakeHeader = new PreferenceCategory(this);
    fakeHeader.setTitle(R.string.filters);
    getPreferenceScreen().addPreference(fakeHeader);
    addPreferencesFromResource(R.xml.pref_filters);
    bindPreferenceSummaryToValue(findPreference(getString(R.string.pref_log_level)));
    setupTagFilterPreference(this, findPreference(getString(R.string.pref_tag_filter)));
    sTagFilterPref = findPreference(getString(R.string.pref_tag_filter));

    // Add 'appearance' preferences.
    fakeHeader = new PreferenceCategory(this);
    fakeHeader.setTitle(R.string.appearance);
    getPreferenceScreen().addPreference(fakeHeader);
    addPreferencesFromResource(R.xml.pref_appearance);

    // Add 'info' preferences.
    fakeHeader = new PreferenceCategory(this);
    fakeHeader.setTitle(R.string.information);
    getPreferenceScreen().addPreference(fakeHeader);
    addPreferencesFromResource(R.xml.pref_info);
    setupOpenSourceInfoPreference(this, findPreference(getString(R.string.pref_info_open_source)));
    setupVersionPref(this, findPreference(getString(R.string.pref_version)));

}

From source file:de.azapps.mirakel.settings.model_settings.special_list.SpecialListDetailFragment.java

@NonNull
private List<Preference> getPrefernces() {
    List<Preference> preferences = new ArrayList<>();

    PreferenceCategory summary = new PreferenceCategory(getActivity());
    summary.setTitle(R.string.special_list_summary);
    preferences.add(summary);/*from   w w w . ja  va 2 s.c o m*/

    final EditTextPreference name = getNamePreference();
    preferences.add(name);

    final CheckBoxPreference active = getIsActivePreference();
    preferences.add(active);

    if (!MirakelCommonPreferences.isDebug()) {
        final Preference where = getWhereStringPreference();
        preferences.add(where);
    }

    PreferenceCategory defaultValues = new PreferenceCategory(getActivity());
    defaultValues.setTitle(R.string.special_lists_defaults);
    preferences.add(defaultValues);

    final Preference defList = getDefaultListPreference();
    preferences.add(defList);

    final Preference defDate = getDefaultDatePreference();
    preferences.add(defDate);

    PreferenceCategory conditions = new PreferenceCategory(getActivity());
    conditions.setTitle(R.string.special_lists_condition_title);
    preferences.add(conditions);

    return preferences;
}

From source file:com.readystatesoftware.ghostlog.GhostLogSettingsFragment.java

/**
 * Shows the simplified settings UI if the device configuration if the
 * device configuration dictates that a simplified, single-pane UI should be
 * shown./*from   w  w  w  .ja  v  a  2  s .  c  o m*/
 */
@SuppressWarnings("deprecation")
private void setupSimplePreferencesScreen() {
    if (!isSimplePreferences(mContext)) {
        return;
    }

    addPreferencesFromResource(R.xml.pref_blank);

    // Add 'filters' preferences.
    PreferenceCategory fakeHeader = new PreferenceCategory(mContext);
    fakeHeader.setTitle(R.string.filters);
    getPreferenceScreen().addPreference(fakeHeader);
    addPreferencesFromResource(R.xml.pref_filters);
    bindPreferenceSummaryToValue(findPreference(getString(R.string.pref_log_level)));
    setupTagFilterPreference(mContext, findPreference(getString(R.string.pref_tag_filter)));
    sTagFilterPref = findPreference(getString(R.string.pref_tag_filter));

    // Add 'appearance' preferences.
    fakeHeader = new PreferenceCategory(mContext);
    fakeHeader.setTitle(R.string.appearance);
    getPreferenceScreen().addPreference(fakeHeader);
    addPreferencesFromResource(R.xml.pref_appearance);

    // Add 'info' preferences.
    fakeHeader = new PreferenceCategory(mContext);
    fakeHeader.setTitle(R.string.information);
    getPreferenceScreen().addPreference(fakeHeader);
    addPreferencesFromResource(R.xml.pref_info);
    setupOpenSourceInfoPreference(mContext, findPreference(getString(R.string.pref_info_open_source)));
    setupVersionPref(mContext, findPreference(getString(R.string.pref_version)));

}

From source file:com.reliqartz.firsttipcalc.gui.SettingsActivity.java

/**
 * Shows the simplified settings UI if the device configuration if the
 * device configuration dictates that a simplified, single-pane UI should be
 * shown.//from ww  w.  j av  a  2 s .  com
 */
@SuppressWarnings("deprecation")
private void setupSimplePreferencesScreen() {
    if (!isSimplePreferences(this)) {
        return;
    }

    // In the simplified UI, fragments are not used at all and we instead
    // use the older PreferenceActivity APIs.

    // Add 'general' preferences.
    // general preference xml already has a header. no fakeheader needed.
    addPreferencesFromResource(R.xml.pref_general);

    // Add 'bill splitting' preferences.
    PreferenceCategory fakeHeader = new PreferenceCategory(this);
    fakeHeader = new PreferenceCategory(this);
    fakeHeader.setTitle(R.string.pref_header_bill_splitting);
    getPreferenceScreen().addPreference(fakeHeader);
    addPreferencesFromResource(R.xml.pref_bill_splitting);

    // Add 'notifications' preferences, and a corresponding header.
    /*
     * PreferenceCategory fakeHeader = new PreferenceCategory(this);
     * fakeHeader.setTitle(R.string.pref_header_notifications);
     * getPreferenceScreen().addPreference(fakeHeader);
     * addPreferencesFromResource(R.xml.pref_notification);
     */

    // Add 'data and sync' preferences, and a corresponding header.
    fakeHeader = new PreferenceCategory(this);
    fakeHeader.setTitle(R.string.pref_header_about);
    getPreferenceScreen().addPreference(fakeHeader);
    addPreferencesFromResource(R.xml.pref_about);

    // Bind the summaries of EditText/List/Dialog/Ringtone preferences to
    // their values. When their values change, their summaries are updated
    // to reflect the new value, per the Android Design guidelines.
    bindPreferenceSummaryToValue(findPreference("pref_currency"));
    bindPreferenceSummaryToValue(findPreference("pref_base_tip"));
    // bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
}

From source file:com.uoit.freeroomfinder.SettingsActivity.java

/**
 * setupSimplePreferencesScreen Shows the simplified settings UI if the device configuration if
 * the device configuration dictates that a simplified, single-pane UI should be shown.
 */// www.  j  a va2 s. co m
@SuppressWarnings("deprecation")
private void setupSimplePreferencesScreen() {
    if (!isSimplePreferences(this)) {
        return;
    }

    // In the simplified UI, fragments are not used at all and we instead
    // use the older PreferenceActivity APIs.
    // Add 'general' preferences.
    addPreferencesFromResource(R.xml.pref_general);

    PreferenceDialog deleteAccount = (PreferenceDialog) this.findPreference("delete_account");

    DatabaseInterface dbi = new DatabaseInterface(getBaseContext());

    // Disable delete account if user does not have an account
    if (dbi.getUser() == null) {
        deleteAccount.setEnabled(false);
        deleteAccount.setSelectable(false);
    } else {
        deleteAccount.setEnabled(true);
        deleteAccount.setSelectable(true);
    }

    // Contains the logic for when the preferences dialog is closed.
    deleteAccount.setOnPreferenceDialogClosedListener(new OnPreferenceDialogClosedListener() {
        /*
         * (non-Javadoc)
         * 
         * @see com.uoit.freeroomfinder.preferences.OnPreferenceDialogClosedListener#
         * onPreferenceDialogClosed(boolean)
         */
        @Override
        public void onPreferenceDialogClosed(boolean positiveResult) {
            if (positiveResult) {
                DatabaseInterface dbi = new DatabaseInterface(getBaseContext());
                dbi.deleteAll();
            }
        }
    });

    // Add 'search' preferences, and a corresponding header.
    PreferenceCategory fakeHeader = new PreferenceCategory(this);
    fakeHeader.setTitle(R.string.pref_header_search);
    getPreferenceScreen().addPreference(fakeHeader);
    addPreferencesFromResource(R.xml.pref_search);

    // Contains the logic for setting the 24 hour clock preferences.
    findPreference("army_clock").setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
        /*
         * (non-Javadoc)
         * 
         * @see
         * android.preference.Preference.OnPreferenceChangeListener#onPreferenceChange(android
         * .preference.Preference, java.lang.Object)
         */
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            DateTimeUtility.setArmyClock(Boolean.valueOf(newValue.toString()));
            return true;
        }

    });

    // Add 'feedback' preferences, and a corresponding header.
    fakeHeader = new PreferenceCategory(this);
    fakeHeader.setTitle(R.string.pref_header_feedback);
    getPreferenceScreen().addPreference(fakeHeader);
    addPreferencesFromResource(R.xml.pref_feedback);

    findPreference("source_code").setOnPreferenceClickListener(new OnPreferenceClickListener() {
        /*
         * (non-Javadoc)
         * 
         * @see
         * android.preference.Preference.OnPreferenceClickListener#onPreferenceClick(android
         * .preference.Preference)
         */
        @Override
        public boolean onPreferenceClick(Preference preference) {
            Intent i = new Intent(Intent.ACTION_VIEW);
            i.setData(Uri.parse(SettingsActivity.this.getString(R.string.source_code_site)));
            SettingsActivity.this.startActivity(i);
            return true;
        }
    });

    /* Set an onclick listener for contact developers */
    findPreference("contact").setOnPreferenceClickListener(new OnPreferenceClickListener() {
        /*
         * (non-Javadoc)
         * 
         * @see
         * android.preference.Preference.OnPreferenceClickListener#onPreferenceClick(android
         * .preference.Preference)
         */
        @Override
        public boolean onPreferenceClick(Preference preference) {
            /**
             * Create the Intent
             */
            final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);

            /**
             * Fill it with Data
             */
            emailIntent.setType("plain/text");
            emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
                    SettingsActivity.this.getResources().getStringArray(R.array.dev_emails));
            emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Free Room Finder");
            emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "");

            /**
             * Send it off to the Activity-Chooser
             */
            SettingsActivity.this.startActivity(Intent.createChooser(emailIntent, "Email the developers..."));
            return true;
        }
    });
}

From source file:nya.miku.wishmaster.api.AbstractChanModule.java

/**
 *     ( ?/ )   ? ?-?/*from  w w  w .j a  va 2 s.c  o  m*/
 * @param group ,   ??? 
 */
protected void addProxyPreferences(PreferenceGroup group) {
    final Context context = group.getContext();
    PreferenceCategory proxyCat = new PreferenceCategory(context); //? ? ?
    proxyCat.setTitle(R.string.pref_cat_proxy);
    group.addPreference(proxyCat);
    CheckBoxPreference useProxyPref = new CheckBoxPreference(context); //? "?  ? "
    useProxyPref.setTitle(R.string.pref_use_proxy);
    useProxyPref.setSummary(R.string.pref_use_proxy_summary);
    useProxyPref.setKey(getSharedKey(PREF_KEY_USE_PROXY));
    useProxyPref.setDefaultValue(false);
    useProxyPref.setOnPreferenceChangeListener(updateHttpListener);
    proxyCat.addPreference(useProxyPref);
    EditTextPreference proxyHostPref = new EditTextPreference(context); //  ? ?-?
    proxyHostPref.setTitle(R.string.pref_proxy_host);
    proxyHostPref.setDialogTitle(R.string.pref_proxy_host);
    proxyHostPref.setSummary(R.string.pref_proxy_host_summary);
    proxyHostPref.setKey(getSharedKey(PREF_KEY_PROXY_HOST));
    proxyHostPref.setDefaultValue(DEFAULT_PROXY_HOST);
    proxyHostPref.getEditText().setSingleLine();
    proxyHostPref.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
    proxyHostPref.setOnPreferenceChangeListener(updateHttpListener);
    proxyCat.addPreference(proxyHostPref);
    proxyHostPref.setDependency(getSharedKey(PREF_KEY_USE_PROXY));
    EditTextPreference proxyHostPort = new EditTextPreference(context); //   ?-?
    proxyHostPort.setTitle(R.string.pref_proxy_port);
    proxyHostPort.setDialogTitle(R.string.pref_proxy_port);
    proxyHostPort.setSummary(R.string.pref_proxy_port_summary);
    proxyHostPort.setKey(getSharedKey(PREF_KEY_PROXY_PORT));
    proxyHostPort.setDefaultValue(DEFAULT_PROXY_PORT);
    proxyHostPort.getEditText().setSingleLine();
    proxyHostPort.getEditText().setInputType(InputType.TYPE_CLASS_NUMBER);
    proxyHostPort.setOnPreferenceChangeListener(updateHttpListener);
    proxyCat.addPreference(proxyHostPort);
    proxyHostPort.setDependency(getSharedKey(PREF_KEY_USE_PROXY));
}

From source file:com.probam.updater.activity.GooActivity.java

@SuppressWarnings("deprecation")
@Override//www. j a va  2  s  .c om
protected void onCreate(Bundle savedInstanceState) {

    boolean useDarkTheme = ManagerFactory.getPreferencesManager(this).isDarkTheme();
    setTheme(useDarkTheme ? R.style.DarkTheme : R.style.AppTheme);

    super.onCreate(savedInstanceState);

    addPreferencesFromResource(R.layout.empty_pref_screen);

    PreferenceScreen pScreen = getPreferenceScreen();
    mInfos = new HashMap<String, PackageInfo>();

    if (CURRENT_NAVIGATION == null) {

        Preference preference = null;

        preference = new Preference(this);
        preference.getExtras().putBoolean("BROWSING_ALL", false);
        preference.getExtras().putBoolean("FOLDER", true);
        preference.getExtras().putString("PATH", "/devs");
        preference.setKey(Constants.GOO_SEARCH_URL + "/devs&ro_board=" + mDevice);
        preference.setTitle(R.string.goo_browse_all_compatible);
        pScreen.addPreference(preference);

        preference = new Preference(this);
        preference.getExtras().putBoolean("BROWSING_ALL", true);
        preference.getExtras().putBoolean("FOLDER", true);
        preference.getExtras().putString("PATH", "/devs");
        preference.setKey(Constants.GOO_SEARCH_URL + "/devs");
        preference.setTitle(R.string.goo_browse_all);
        pScreen.addPreference(preference);

        preference = new Preference(this);
        preference.getExtras().putBoolean("BROWSING_ALL", false);
        preference.getExtras().putBoolean("FOLDER", false);
        preference.getExtras().putString("PATH", "");
        preference.setKey("watchlist");
        preference.setTitle(R.string.goo_browse_watchlist);
        pScreen.addPreference(preference);

    } else {

        if ("watchlist".equals(CURRENT_FOLDER)) {

            PreferenceCategory category = new PreferenceCategory(this);
            category.setKey("category");
            category.setTitle(
                    getResources().getString(R.string.goo_category_title, new Object[] { CURRENT_FOLDER }));
            pScreen.addPreference(category);
            refreshWatchlist();
        } else {

            PreferenceCategory category = new PreferenceCategory(this);
            category.setTitle(
                    getResources().getString(R.string.goo_category_title, new Object[] { CURRENT_FOLDER }));
            pScreen.addPreference(category);
            try {

                JSONObject object = (JSONObject) new JSONTokener(CURRENT_NAVIGATION).nextValue();
                JSONArray list = object.getJSONArray("list");

                for (int i = 0; i < list.length(); i++) {

                    JSONObject result = list.getJSONObject(i);
                    String fileName = result.optString("filename");

                    if (fileName != null && !"".equals(fileName.trim())) {

                        String path = result.optString("path");

                        if (!BROWSING_ALL && !mDevice.equals(result.optString("ro_board"))) {
                            continue;
                        }

                        GooPackage info = new GooPackage(result, -1);
                        mInfos.put(path, info);

                        Preference preference = new Preference(this);
                        preference.getExtras().putBoolean("FOLDER", false);
                        preference.setKey(path);
                        preference.setTitle(fileName);
                        preference.setSummary(path);
                        category.addPreference(preference);

                    } else {

                        String folder = result.optString("folder");
                        String folderName = folder.substring(folder.lastIndexOf("/") + 1);

                        Preference preference = new FolderPreference(this, folder, false);
                        preference.getExtras().putBoolean("BROWSING_ALL", BROWSING_ALL);
                        preference.getExtras().putBoolean("FOLDER", true);
                        preference.getExtras().putString("PATH", folder);
                        if (!BROWSING_ALL) {
                            preference.setKey(Constants.GOO_SEARCH_URL + folder + "&ro_board=" + mDevice);
                        } else {
                            preference.setKey(Constants.GOO_SEARCH_URL + folder);
                        }
                        preference.setTitle(folderName);
                        preference.setSummary(folder);
                        category.addPreference(preference);
                    }
                }
            } catch (Exception ex) {
                ex.printStackTrace();
                Toast.makeText(this, R.string.goo_browse_error, Toast.LENGTH_LONG).show();
            }
        }
    }
    if (DIALOG != null)
        DIALOG.dismiss();

    DIALOG = null;

    ListView listView = getListView();
    listView.setOnItemLongClickListener(new OnItemLongClickListener() {

        @Override
        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            ListView listView = (ListView) parent;
            ListAdapter listAdapter = listView.getAdapter();
            Object obj = listAdapter.getItem(position);
            if (obj != null && obj instanceof View.OnLongClickListener) {
                View.OnLongClickListener longListener = (View.OnLongClickListener) obj;
                return longListener.onLongClick(view);
            }
            return false;
        }
    });
}

From source file:com.door43.translationstudio.SettingsActivity.java

/**
 * Shows the simplified settings UI if the device configuration if the
 * device configuration dictates that a simplified, single-pane UI should be
 * shown.//from  w w  w . ja  v  a  2  s.  com
 */
private void setupSimplePreferencesScreen() {
    if (!isSimplePreferences(this)) {
        return;
    }

    // In the simplified UI, fragments are not used at all and we instead
    // use the older PreferenceActivity APIs.

    // Add 'general' preferences.
    addPreferencesFromResource(R.xml.general_preferences);

    // NOTE: this is a copy paste from GeneralPreferenceFragment
    // identify all typefaces in the assets directory
    AssetManager am = getResources().getAssets();
    String fileList[] = null;
    ArrayList<String> entries = new ArrayList<String>();
    ArrayList<String> entryValues = new ArrayList<String>();
    try {
        fileList = am.list("fonts");
    } catch (IOException e) {
        Logger.e(this.getClass().getName(), "failed to load font assets", e);
    }
    if (fileList != null) {
        for (int i = 0; i < fileList.length; i++) {
            File typeface = AppContext.context().getAssetAsFile("fonts/" + fileList[i]);
            if (typeface != null) {
                TTFAnalyzer analyzer = new TTFAnalyzer();
                String fontname = "";
                fontname = analyzer.getTtfFontName(typeface.getAbsolutePath());
                if (fontname == null) {
                    fontname = FilenameUtils.removeExtension(typeface.getName());
                }
                entries.add(fontname);
                entryValues.add(fileList[i]);
            }
        }
    }

    ListPreference pref = (ListPreference) findPreference(KEY_PREF_TRANSLATION_TYPEFACE);
    pref.setEntries(entries.toArray(new CharSequence[entries.size()]));
    pref.setEntryValues(entryValues.toArray(new CharSequence[entryValues.size()]));
    bindPreferenceSummaryToValue(pref);

    // Add 'sharing' preferences, and a corresponding header.
    //        PreferenceCategory preferenceHeader = new PreferenceCategory(this);
    //        preferenceHeader.setTitle(R.string.pref_header_sharing);
    //        getPreferenceScreen().addPreference(preferenceHeader);
    //        addPreferencesFromResource(R.xml.sharing_preferences);

    // Add 'server' preferences, and a corresponding header.
    PreferenceCategory preferenceHeader = new PreferenceCategory(this);
    preferenceHeader.setTitle(R.string.pref_header_synchronization);
    getPreferenceScreen().addPreference(preferenceHeader);
    addPreferencesFromResource(R.xml.server_preferences);

    // Add 'legal' preferences, and a corresponding header.
    preferenceHeader = new PreferenceCategory(this);
    preferenceHeader.setTitle(R.string.pref_header_legal);
    getPreferenceScreen().addPreference(preferenceHeader);
    addPreferencesFromResource(R.xml.legal_preferences);

    // add 'advanced' preferences and coresponding hreader
    preferenceHeader = new PreferenceCategory(this);
    preferenceHeader.setTitle(R.string.pref_header_advanced);
    getPreferenceScreen().addPreference(preferenceHeader);
    addPreferencesFromResource(R.xml.advanced_preferences);

    // bind the correct legal document to the preference intent
    bindPreferenceClickToLegalDocument(findPreference("license_agreement"), R.string.license);
    bindPreferenceClickToLegalDocument(findPreference("statement_of_faith"), R.string.statement_of_faith);
    bindPreferenceClickToLegalDocument(findPreference("translation_guidelines"),
            R.string.translation_guidlines);
    bindPreferenceClickToLegalDocument(findPreference("software_licenses"), R.string.software_licenses);

    // Bind the summaries of EditText/List/Dialog/Ringtone preferences to
    // their values. When their values change, their summaries are updated
    // to reflect the new value, per the Android Design guidelines.
    //        bindPreferenceSummaryToValue(findPreference(KEY_PREF_AUTOSAVE));
    bindPreferenceSummaryToValue(findPreference(KEY_PREF_AUTH_SERVER));
    bindPreferenceSummaryToValue(findPreference(KEY_PREF_GIT_SERVER));
    bindPreferenceSummaryToValue(findPreference(KEY_PREF_AUTH_SERVER_PORT));
    bindPreferenceSummaryToValue(findPreference(KEY_PREF_GIT_SERVER_PORT));
    //        bindPreferenceSummaryToValue(findPreference(KEY_PREF_EXPORT_FORMAT));
    bindPreferenceSummaryToValue(findPreference(KEY_PREF_MEDIA_SERVER));
    bindPreferenceSummaryToValue(findPreference(KEY_PREF_LOGGING_LEVEL));
    bindPreferenceSummaryToValue(findPreference(KEY_PREF_BACKUP_INTERVAL));
    bindPreferenceSummaryToValue(findPreference(KEY_PREF_TYPEFACE_SIZE));
}