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);
}
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);
}
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);
}
}
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);
}
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("");
}
}
Aggregations