Example usage for android.preference PreferenceCategory setSummary

List of usage examples for android.preference PreferenceCategory setSummary

Introduction

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

Prototype

public void setSummary(CharSequence summary) 

Source Link

Document

Sets the summary for this Preference with a CharSequence.

Usage

From source file:com.aokp.romcontrol.github.tasks.DisplayProjectsListTask.java

private void addPropertiesToPreference(PreferenceCategory mProject, JSONObject projectsObject) {
    try {/*from  w  w w  .jav a2  s .  c  o m*/
        // extract info about each project
        final String projectName = projectsObject.getString("name");
        String projectDescription = projectsObject.getString("description");
        int githubProjectId = projectsObject.getInt("id");
        // apply info to our preference screen
        mProject.setKey(projectName);
        if (projectDescription.contains("") || projectDescription == null) {
            mProject.setTitle(projectName);
            mProject.setSummary(projectDescription);
        } else {
            mProject.setTitle(projectDescription);
            mProject.setSummary(projectName);
        }
        mProject.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference p) {
                FragmentTransaction transaction = mFragmentManager.beginTransaction();
                CommitsFragment commitFragment = new CommitsFragment(mAlertDialog, projectName);
                transaction.addToBackStack(null);
                transaction.replace(mId, commitFragment, projectName);
                transaction.commit();
                return true;
            }
        });
    } catch (JSONException badJsonRequest) {
        Log.e(TAG, "failed to parse required info about project", badJsonRequest);
    }
}