Java Code Examples for android.support.v7.preference.PreferenceGroup#getContext()

The following examples show how to use android.support.v7.preference.PreferenceGroup#getContext() . 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;
    }
}