android.support.v14.preference.PreferenceFragment Java Examples

The following examples show how to use android.support.v14.preference.PreferenceFragment. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FakeSignatureGlobalUI.java    From haystack with GNU General Public License v3.0 6 votes vote down vote up
static SwitchPreference addPreference(PreferenceFragment fragment) {
    PreferenceGroup pg = (PreferenceGroup) fragment.findPreference(PREFERENCE_CATEGORY_KEY);
    if (pg != null) {
        //<5.1// CheckBoxPreference p = new CheckBoxPreference(pg.getContext());
        /*>5.1*/ SwitchPreference p = new SwitchPreference(pg.getContext());
        p.setKey(PREFERENCE_KEY);
        p.setTitle(PREFERENCE_TITLE);
        p.setSummary(PREFERENCE_SUMMARY);
        p.setPersistent(false);
        pg.addPreference(p);
        return p;
    } else {
        Log.e("FakeSignatureGlobalUI", "cannot find '" + PREFERENCE_CATEGORY_KEY +"' preference category");
        return null;
    }
}
 
Example #2
Source File: FakeSignatureGlobalUI.java    From haystack with GNU General Public License v3.0 6 votes vote down vote up
static CheckBoxPreference addPreference(PreferenceFragment fragment) {
//>5.1// static SwitchPreference addPreference(PreferenceFragment fragment) {
    PreferenceGroup pg = (PreferenceGroup) fragment.findPreference(PREFERENCE_CATEGORY_KEY);
    if (pg != null) {
        /*<5.1*/ CheckBoxPreference p = new CheckBoxPreference(pg.getContext());
        //>5.1// SwitchPreference p = new SwitchPreference(pg.getContext());
        p.setKey(PREFERENCE_KEY);
        p.setTitle(PREFERENCE_TITLE);
        p.setSummary(PREFERENCE_SUMMARY);
        p.setPersistent(false);
        pg.addPreference(p);
        return p;
    } else {
        Log.e("FakeSignatureGlobalUI", "cannot find '" + PREFERENCE_CATEGORY_KEY +"' preference category");
        return null;
    }
}
 
Example #3
Source File: FakeSignatureGlobalUI.java    From haystack with GNU General Public License v3.0 6 votes vote down vote up
static CheckBoxPreference addPreference(PreferenceFragment fragment) {
//>5.1// static SwitchPreference addPreference(PreferenceFragment fragment) {
    PreferenceGroup pg = (PreferenceGroup) fragment.findPreference(PREFERENCE_CATEGORY_KEY);
    if (pg != null) {
        /*<5.1*/ CheckBoxPreference p = new CheckBoxPreference(pg.getContext());
        //>5.1// SwitchPreference p = new SwitchPreference(pg.getContext());
        p.setKey(PREFERENCE_KEY);
        p.setTitle(PREFERENCE_TITLE);
        p.setSummary(PREFERENCE_SUMMARY);
        p.setPersistent(false);
        pg.addPreference(p);
        return p;
    } else {
        Log.e("FakeSignatureGlobalUI", "cannot find '" + PREFERENCE_CATEGORY_KEY +"' preference category");
        return null;
    }
}
 
Example #4
Source File: FakeSignatureGlobalUI.java    From haystack with GNU General Public License v3.0 6 votes vote down vote up
static SwitchPreference addPreference(PreferenceFragment fragment) {
    PreferenceGroup pg = (PreferenceGroup) fragment.findPreference(PREFERENCE_CATEGORY_KEY);
    if (pg != null) {
        //<5.1// CheckBoxPreference p = new CheckBoxPreference(pg.getContext());
        /*>5.1*/ SwitchPreference p = new SwitchPreference(pg.getContext());
        p.setKey(PREFERENCE_KEY);
        p.setTitle(PREFERENCE_TITLE);
        p.setSummary(PREFERENCE_SUMMARY);
        p.setPersistent(false);
        pg.addPreference(p);
        return p;
    } else {
        Log.e("FakeSignatureGlobalUI", "cannot find '" + PREFERENCE_CATEGORY_KEY +"' preference category");
        return null;
    }
}
 
Example #5
Source File: FakeSignatureGlobalUI.java    From haystack with GNU General Public License v3.0 6 votes vote down vote up
static SwitchPreference addPreference(PreferenceFragment fragment) {
    PreferenceGroup pg = (PreferenceGroup) fragment.findPreference(PREFERENCE_CATEGORY_KEY);
    if (pg != null) {
        //<5.1// CheckBoxPreference p = new CheckBoxPreference(pg.getContext());
        /*>5.1*/ SwitchPreference p = new SwitchPreference(pg.getContext());
        p.setKey(PREFERENCE_KEY);
        p.setTitle(PREFERENCE_TITLE);
        p.setSummary(PREFERENCE_SUMMARY);
        p.setPersistent(false);
        pg.addPreference(p);
        return p;
    } else {
        Log.e("FakeSignatureGlobalUI", "cannot find '" + PREFERENCE_CATEGORY_KEY +"' preference category");
        return null;
    }
}
 
Example #6
Source File: FakeSignatureGlobalUI.java    From haystack with GNU General Public License v3.0 6 votes vote down vote up
static SwitchPreference addPreference(PreferenceFragment fragment) {
    PreferenceGroup pg = (PreferenceGroup) fragment.findPreference(PREFERENCE_CATEGORY_KEY);
    if (pg != null) {
        //<5.1// CheckBoxPreference p = new CheckBoxPreference(pg.getContext());
        /*>5.1*/ SwitchPreference p = new SwitchPreference(pg.getContext());
        p.setKey(PREFERENCE_KEY);
        p.setTitle(PREFERENCE_TITLE);
        p.setSummary(PREFERENCE_SUMMARY);
        p.setPersistent(false);
        pg.addPreference(p);
        return p;
    } else {
        Log.e("FakeSignatureGlobalUI", "cannot find '" + PREFERENCE_CATEGORY_KEY +"' preference category");
        return null;
    }
}
 
Example #7
Source File: FakeSignatureGlobalUI.java    From haystack with GNU General Public License v3.0 6 votes vote down vote up
static CheckBoxPreference addPreference(PreferenceFragment fragment) {
//>5.1// static SwitchPreference addPreference(PreferenceFragment fragment) {
    PreferenceGroup pg = (PreferenceGroup) fragment.findPreference(PREFERENCE_CATEGORY_KEY);
    if (pg != null) {
        /*<5.1*/ CheckBoxPreference p = new CheckBoxPreference(pg.getContext());
        //>5.1// SwitchPreference p = new SwitchPreference(pg.getContext());
        p.setKey(PREFERENCE_KEY);
        p.setTitle(PREFERENCE_TITLE);
        p.setSummary(PREFERENCE_SUMMARY);
        p.setPersistent(false);
        pg.addPreference(p);
        return p;
    } else {
        Log.e("FakeSignatureGlobalUI", "cannot find '" + PREFERENCE_CATEGORY_KEY +"' preference category");
        return null;
    }
}
 
Example #8
Source File: FakeSignatureGlobalUI.java    From haystack with GNU General Public License v3.0 6 votes vote down vote up
static SwitchPreference addPreference(PreferenceFragment fragment) {
    PreferenceGroup pg = (PreferenceGroup) fragment.findPreference(PREFERENCE_CATEGORY_KEY);
    if (pg != null) {
        //<5.1// CheckBoxPreference p = new CheckBoxPreference(pg.getContext());
        /*>5.1*/ SwitchPreference p = new SwitchPreference(pg.getContext());
        p.setKey(PREFERENCE_KEY);
        p.setTitle(PREFERENCE_TITLE);
        p.setSummary(PREFERENCE_SUMMARY);
        p.setPersistent(false);
        pg.addPreference(p);
        return p;
    } else {
        Log.e("FakeSignatureGlobalUI", "cannot find '" + PREFERENCE_CATEGORY_KEY +"' preference category");
        return null;
    }
}
 
Example #9
Source File: SettingsFragment.java    From CumulusTV with MIT License 5 votes vote down vote up
private PreferenceFragment buildPreferenceFragment(int preferenceResId, String root) {
    PreferenceFragment fragment = new PrefFragment();
    Bundle args = new Bundle();
    args.putInt(PREFERENCE_RESOURCE_ID, preferenceResId);
    args.putString(PREFERENCE_ROOT, root);
    fragment.setArguments(args);
    return fragment;
}
 
Example #10
Source File: SettingsFragment.java    From CumulusTV with MIT License 5 votes vote down vote up
@Override
public boolean onPreferenceStartScreen(PreferenceFragment preferenceFragment,
                                       PreferenceScreen preferenceScreen) {
    PreferenceFragment frag = buildPreferenceFragment(R.xml.preferences,
            preferenceScreen.getKey());
    startPreferenceFragment(frag);
    return true;
}
 
Example #11
Source File: SettingsExampleFragment.java    From leanback-showcase with Apache License 2.0 5 votes vote down vote up
private PreferenceFragment buildPreferenceFragment(int preferenceResId, String root) {
    PreferenceFragment fragment = new PrefFragment();
    Bundle args = new Bundle();
    args.putInt("preferenceResource", preferenceResId);
    args.putString("root", root);
    fragment.setArguments(args);
    return fragment;
}
 
Example #12
Source File: SettingsExampleFragment.java    From leanback-showcase with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onPreferenceStartScreen(PreferenceFragment preferenceFragment,
                                       PreferenceScreen preferenceScreen) {
    PreferenceFragment frag = buildPreferenceFragment(R.xml.prefs, preferenceScreen.getKey());
    startPreferenceFragment(frag);
    return true;
}
 
Example #13
Source File: SettingsFragment.java    From TvAppRepo with Apache License 2.0 5 votes vote down vote up
private PreferenceFragment buildPreferenceFragment(int preferenceResId, String root) {
    PreferenceFragment fragment = new PrefFragment();
    Bundle args = new Bundle();
    args.putInt(PREFERENCE_RESOURCE_ID, preferenceResId);
    args.putString(PREFERENCE_ROOT, root);
    fragment.setArguments(args);
    return fragment;
}
 
Example #14
Source File: SettingsFragment.java    From TvAppRepo with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onPreferenceStartScreen(PreferenceFragment preferenceFragment,
                                       PreferenceScreen preferenceScreen) {
    PreferenceFragment frag = buildPreferenceFragment(R.xml.preferences,
            preferenceScreen.getKey());
    startPreferenceFragment(frag);
    return true;
}
 
Example #15
Source File: SettingsExampleFragment.java    From leanback-showcase with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onPreferenceStartFragment(PreferenceFragment preferenceFragment,
                                         Preference preference) {
    return false;
}
 
Example #16
Source File: SettingsExampleFragment.java    From leanback-showcase with Apache License 2.0 4 votes vote down vote up
@Override
public Preference findPreference(CharSequence prefKey) {
    return ((PreferenceFragment) fragments.peek()).findPreference(prefKey);
}
 
Example #17
Source File: SettingsFragment.java    From CumulusTV with MIT License 4 votes vote down vote up
@Override
public boolean onPreferenceStartFragment(PreferenceFragment preferenceFragment,
                                         Preference preference) {
    return false;
}
 
Example #18
Source File: SettingsFragment.java    From TvAppRepo with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onPreferenceStartFragment(PreferenceFragment preferenceFragment,
                                         Preference preference) {
    return false;
}