Search in sources :

Example 1 with PreferenceGroup

use of android.support.v7.preference.PreferenceGroup in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class LegalSettings method onCreate.

public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    addPreferencesFromResource(R.xml.about_legal);
    final Activity act = getActivity();
    // These are contained in the "container" preference group
    PreferenceGroup parentPreference = getPreferenceScreen();
    Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference, KEY_TERMS, Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
    Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference, KEY_LICENSE, Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
    Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference, KEY_COPYRIGHT, Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
    Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference, KEY_WEBVIEW_LICENSE, Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
}
Also used : Activity(android.app.Activity) PreferenceGroup(android.support.v7.preference.PreferenceGroup)

Example 2 with PreferenceGroup

use of android.support.v7.preference.PreferenceGroup in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ManageDomainUrls method onRebuildComplete.

@Override
public void onRebuildComplete(ArrayList<AppEntry> apps) {
    if (getContext() == null) {
        return;
    }
    final boolean disableWebActions = Global.getInt(getContext().getContentResolver(), Global.ENABLE_EPHEMERAL_FEATURE, 1) == 0;
    if (disableWebActions) {
        mDomainAppList = getPreferenceScreen();
    } else {
        final PreferenceGroup preferenceScreen = getPreferenceScreen();
        if (preferenceScreen.getPreferenceCount() == 0) {
            // add preferences
            final PreferenceCategory webActionCategory = new PreferenceCategory(getPrefContext());
            webActionCategory.setTitle(R.string.web_action_section_title);
            preferenceScreen.addPreference(webActionCategory);
            // toggle to enable / disable Web Actions [aka Instant Apps]
            mWebAction = new SwitchPreference(getPrefContext());
            mWebAction.setTitle(R.string.web_action_enable_title);
            mWebAction.setSummary(R.string.web_action_enable_summary);
            mWebAction.setChecked(Settings.Secure.getInt(getContentResolver(), Settings.Secure.WEB_ACTION_ENABLED, 1) != 0);
            mWebAction.setOnPreferenceChangeListener(this);
            webActionCategory.addPreference(mWebAction);
            // list to manage link handling per app
            mDomainAppList = new PreferenceCategory(getPrefContext());
            mDomainAppList.setTitle(R.string.domain_url_section_title);
            preferenceScreen.addPreference(mDomainAppList);
        }
    }
    rebuildAppList(mDomainAppList, apps);
}
Also used : PreferenceCategory(android.support.v7.preference.PreferenceCategory) SwitchPreference(android.support.v14.preference.SwitchPreference) PreferenceGroup(android.support.v7.preference.PreferenceGroup)

Example 3 with PreferenceGroup

use of android.support.v7.preference.PreferenceGroup in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class TrustAgentSettings method updateAgents.

private void updateAgents() {
    final Context context = getActivity();
    if (mAvailableAgents == null) {
        mAvailableAgents = findAvailableTrustAgents();
    }
    if (mLockPatternUtils == null) {
        mLockPatternUtils = new LockPatternUtils(getActivity());
    }
    loadActiveAgents();
    PreferenceGroup category = (PreferenceGroup) getPreferenceScreen().findPreference("trust_agents");
    category.removeAll();
    final EnforcedAdmin admin = RestrictedLockUtils.checkIfKeyguardFeaturesDisabled(context, DevicePolicyManager.KEYGUARD_DISABLE_TRUST_AGENTS, UserHandle.myUserId());
    final int count = mAvailableAgents.size();
    for (int i = 0; i < count; i++) {
        AgentInfo agent = mAvailableAgents.valueAt(i);
        final RestrictedSwitchPreference preference = new RestrictedSwitchPreference(getPrefContext());
        preference.useAdminDisabledSummary(true);
        agent.preference = preference;
        preference.setPersistent(false);
        preference.setTitle(agent.label);
        preference.setIcon(agent.icon);
        preference.setPersistent(false);
        preference.setOnPreferenceChangeListener(this);
        preference.setChecked(mActiveAgents.contains(agent.component));
        if (admin != null && mDpm.getTrustAgentConfiguration(null, agent.component) == null) {
            preference.setChecked(false);
            preference.setDisabledByAdmin(admin);
        }
        category.addPreference(agent.preference);
    }
}
Also used : Context(android.content.Context) RestrictedSwitchPreference(com.android.settingslib.RestrictedSwitchPreference) LockPatternUtils(com.android.internal.widget.LockPatternUtils) PreferenceGroup(android.support.v7.preference.PreferenceGroup) EnforcedAdmin(com.android.settingslib.RestrictedLockUtils.EnforcedAdmin)

Example 4 with PreferenceGroup

use of android.support.v7.preference.PreferenceGroup in project wire-android by wireapp.

the class DevicesPreferences method addClientToGroup.

private void addClientToGroup(final OtrClient otrClient, PreferenceGroup preferenceGroup) {
    DevicePreference preference = new DevicePreference(getContext());
    preference.setTitle(DevicesPreferencesUtil.getTitle(getActivity(), otrClient));
    preference.setKey(getString(R.string.pref_device_details_screen_key));
    preference.setSummary(DevicesPreferencesUtil.getSummary(getActivity(), otrClient, false));
    preference.setVerified(otrClient.getVerified() == Verification.VERIFIED);
    final PreferenceScreen preferenceScreen = new PreferenceScreen(getContext(), null);
    preferenceScreen.getExtras().putParcelable(DeviceDetailPreferences.PREFS_OTR_CLIENT, otrClient);
    preferenceScreen.setTitle(preference.getTitle());
    preferenceScreen.setKey(preference.getKey());
    preference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {

        @Override
        public boolean onPreferenceClick(Preference preference) {
            PreferenceManager preferenceManager = getPreferenceManager();
            if (preferenceManager != null) {
                PreferenceManager.OnNavigateToScreenListener listener = preferenceManager.getOnNavigateToScreenListener();
                if (listener != null) {
                    listener.onNavigateToScreen(preferenceScreen);
                    return true;
                }
            }
            return false;
        }
    });
    preferenceGroup.addPreference(preference);
}
Also used : PreferenceScreen(android.support.v7.preference.PreferenceScreen) Preference(android.support.v7.preference.Preference) PreferenceManager(android.support.v7.preference.PreferenceManager)

Example 5 with PreferenceGroup

use of android.support.v7.preference.PreferenceGroup in project wire-android by wireapp.

the class DevicesPreferences method updateOtrDevices.

private void updateOtrDevices() {
    PreferenceGroup otherOtrClientPreferenceGroup = (PreferenceGroup) findPreference(getString(R.string.pref_devices_other_devices_category_key));
    if (otherOtrClientPreferenceGroup == null) {
        return;
    }
    otherOtrClientPreferenceGroup.removeAll();
    if (otherClients == null) {
        return;
    }
    for (int i = 0; i < otherClients.size(); i++) {
        OtrClient otrClient = otherClients.get(i);
        addClientToGroup(otrClient, otherOtrClientPreferenceGroup);
    }
    if (otherClients.size() > 0) {
        addDeviceWarning(otherOtrClientPreferenceGroup);
        otherOtrClientPreferenceGroup.setTitle(getString(R.string.pref_devices_other_devices_category_title));
    } else {
        otherOtrClientPreferenceGroup.setTitle("");
    }
}
Also used : PreferenceGroup(android.support.v7.preference.PreferenceGroup) OtrClient(com.waz.api.OtrClient)

Aggregations

PreferenceGroup (android.support.v7.preference.PreferenceGroup)140 Preference (android.support.v7.preference.Preference)114 Context (android.content.Context)67 Test (org.junit.Test)54 PreferenceManager (android.support.v7.preference.PreferenceManager)50 ArrayList (java.util.ArrayList)50 UserInfo (android.content.pm.UserInfo)48 PreferenceScreen (android.support.v7.preference.PreferenceScreen)44 AccessiblePreferenceCategory (com.android.settings.AccessiblePreferenceCategory)42 Account (android.accounts.Account)36 AuthenticatorDescription (android.accounts.AuthenticatorDescription)36 UserHandle (android.os.UserHandle)36 Intent (android.content.Intent)27 SwitchPreference (android.support.v14.preference.SwitchPreference)21 PreferenceCategory (android.support.v7.preference.PreferenceCategory)20 PackageManager (android.content.pm.PackageManager)16 ResolveInfo (android.content.pm.ResolveInfo)16 TelephonyManager (android.telephony.TelephonyManager)16 RestrictedSwitchPreference (com.android.settingslib.RestrictedSwitchPreference)15 Activity (android.app.Activity)14