List of usage examples for android.preference PreferenceGroup getContext
public Context getContext()
From source file:com.silentcircle.silenttext.util.DeviceUtils.java
public static void putDebugInformation(PreferenceGroup container) { if (container == null) { return;/*from www . jav a2 s . c o m*/ } container.removeAll(); PreferenceTreeBuilder tree = new PreferenceTreeBuilder(container); JSONObject json = getDebugInformationJSON(container.getContext()); tree.addString("Application Version", json, "application", "version_name"); tree.addInt("Version Code", json, "application", "version_code"); tree.addString("Build Date", json, "build", "date"); tree.addString("Build Version", json, "build", "version"); tree.addString("Commit", json, "build", "commit"); tree.addString("Installed", json, "application", "installed"); tree.addString("Last Updated", json, "application", "updated"); tree.addString("Locale", json, "device", "locale"); tree.addString("Screen Orientation", json, "device", "orientation"); tree.open("Hardware"); tree.addString("Android Version", json, "android", "version"); tree.addString("API Level", json, "android", "api"); tree.addString("Build Version", json, "android", "build"); tree.addString("Manufacturer", json, "device", "manufacturer"); tree.addString("Model", json, "device", "model"); tree.add("Screen Dimensions", getScreenDimensionsLabel(json)); tree.add("Device Encryption", getEncryptionLabel(json)); tree.close(); tree.open("Jabber / XMPP"); tree.addString("Domain", json, "configuration", "xmpp.service_name"); tree.addBoolean("Auto-detect", json, "configuration", "xmpp.perform_srv_lookup"); tree.addString("Host", json, "configuration", "xmpp.host"); tree.addInt("Port", json, "configuration", "xmpp.port"); tree.addBoolean("Run in background", json, "configuration", "xmpp.background"); tree.addBoolean("Online", json, "connection", "xmpp", "online"); tree.addString("Status", json, "connection", "xmpp", "status"); tree.addString("Host", json, "connection", "xmpp", "host"); tree.addInt("Port", json, "connection", "xmpp", "port"); tree.addString("Username", json, "connection", "xmpp", "user"); tree.close(); tree.open("Accounts Web API"); tree.addString("Domain", json, "configuration", "api.service_name"); tree.addBoolean("Auto-detect", json, "configuration", "api.perform_srv_lookup"); tree.addString("Host", json, "configuration", "api.host"); tree.addInt("Port", json, "configuration", "api.port"); tree.close(); tree.open("Miscellaneous"); tree.addBoolean("Debug Mode", json, "configuration", "debug"); tree.addBoolean("Experimental", json, "configuration", "experimental"); tree.addBoolean("Generate Default Avatars", json, "configuration", "feature.generate_default_avatars"); tree.addBoolean("Check User Availability", json, "configuration", "feature.check_user_availability"); tree.addBoolean("Validate Certificates", json, "configuration", "validate_certificates"); tree.addBoolean("Passphrase Active", json, "configuration", "passcode_set"); tree.addBoolean("SCimp PKI Enabled", json, "configuration", "scimp.enable_pki"); tree.addBoolean("Logging Enabled", json, "configuration", "logging_enabled"); tree.addBoolean("Silent Contacts (v1)", json, "configuration", "silent_contacts_v1"); tree.addBoolean("Silent Contacts (v2)", json, "configuration", "silent_contacts_v2"); tree.addBoolean("Silent Phone", json, "configuration", "silent_phone"); tree.addString("GCM Sender ID", json, "configuration", "gcm.sender_id"); tree.addString("GCM Target", json, "configuration", "gcm.target"); tree.addString("SCloud URL", json, "configuration", "scloud.url"); tree.close(); tree.addString("Timestamp", json, "timestamp"); }
From source file:nya.miku.wishmaster.chans.nullchan.NullchanoneModule.java
private void addDomainPreference(PreferenceGroup group) { Context context = group.getContext(); EditTextPreference domainPref = new EditTextPreference(context); domainPref.setTitle(R.string.pref_domain); domainPref.setDialogTitle(R.string.pref_domain); domainPref.setKey(getSharedKey(PREF_KEY_DOMAIN)); domainPref.getEditText().setHint(CHAN_DOMAIN); domainPref.getEditText().setSingleLine(); domainPref.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI); group.addPreference(domainPref);//from w ww . j a v a2 s . c o m }
From source file:nya.miku.wishmaster.chans.endchan.EndChanModule.java
private void addDomainPreferences(PreferenceGroup group) { Context context = group.getContext(); Preference.OnPreferenceChangeListener updateDomainListener = new Preference.OnPreferenceChangeListener() { @Override/*from w w w . j a va2s. c o m*/ public boolean onPreferenceChange(Preference preference, Object newValue) { if (preference.getKey().equals(getSharedKey(PREF_KEY_DOMAIN))) { updateDomain((String) newValue); return true; } return false; } }; PreferenceCategory domainCat = new PreferenceCategory(context); domainCat.setTitle(R.string.makaba_prefs_domain_category); group.addPreference(domainCat); EditTextPreference domainPref = new EditTextPreference(context); domainPref.setTitle(R.string.pref_domain); domainPref.setDialogTitle(R.string.pref_domain); domainPref.setSummary(resources.getString(R.string.pref_domain_summary, DOMAINS_HINT)); domainPref.setKey(getSharedKey(PREF_KEY_DOMAIN)); domainPref.getEditText().setHint(DEFAULT_DOMAIN); domainPref.getEditText().setSingleLine(); domainPref.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI); domainPref.setOnPreferenceChangeListener(updateDomainListener); domainCat.addPreference(domainPref); }
From source file:com.nttec.everychan.chans.synch.SynchModule.java
@Override public void addPreferencesOnScreen(PreferenceGroup preferenceGroup) { Context context = preferenceGroup.getContext(); ListPreference domainPref = new LazyPreferences.ListPreference(context); domainPref.setKey(getSharedKey(PREF_KEY_DOMAIN)); domainPref.setTitle(R.string.pref_domain); domainPref.setSummary(resources.getString(R.string.pref_domain_summary, DOMAINS_HINT)); domainPref.setDialogTitle(R.string.pref_domain); domainPref.setEntries(DOMAINS);//from w ww. java 2s . c om domainPref.setEntryValues(DOMAINS); domainPref.setDefaultValue(DOMAINS[0]); preferenceGroup.addPreference(domainPref); super.addPreferencesOnScreen(preferenceGroup); }
From source file:com.nttec.everychan.chans.nullchan.NullchanccModule.java
private void addDomainPreference(PreferenceGroup group) { Context context = group.getContext(); EditTextPreference domainPref = new EditTextPreference(context); domainPref.setTitle(R.string.pref_domain); domainPref.setSummary(resources.getString(R.string.pref_domain_summary, DOMAINS_HINT)); domainPref.setDialogTitle(R.string.pref_domain); domainPref.setKey(getSharedKey(PREF_KEY_DOMAIN)); domainPref.getEditText().setHint(DEFAULT_DOMAIN); domainPref.getEditText().setSingleLine(); domainPref.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI); group.addPreference(domainPref);//from w w w . j av a 2 s . c o m }
From source file:nya.miku.wishmaster.api.AbstractWakabaModule.java
@Override public void addPreferencesOnScreen(PreferenceGroup preferenceGroup) { Context context = preferenceGroup.getContext(); addPasswordPreference(preferenceGroup); if (canHttps()) { CheckBoxPreference httpsPref = new CheckBoxPreference(context); httpsPref.setTitle(R.string.pref_use_https); httpsPref.setSummary(R.string.pref_use_https_summary); httpsPref.setKey(getSharedKey(PREF_KEY_USE_HTTPS)); httpsPref.setDefaultValue(useHttpsDefaultValue()); preferenceGroup.addPreference(httpsPref); addUnsafeSslPreference(preferenceGroup, getSharedKey(PREF_KEY_USE_HTTPS)); }/*from ww w . ja v a 2 s . co m*/ addProxyPreferences(preferenceGroup); }
From source file:nya.miku.wishmaster.chans.tirech.TirechModule.java
@Override public void addPreferencesOnScreen(PreferenceGroup preferenceGroup) { Context context = preferenceGroup.getContext(); EditTextPreference domainPref = new EditTextPreference(context); domainPref.setTitle(R.string.pref_domain); domainPref.setDialogTitle(R.string.pref_domain); domainPref.setSummary(resources.getString(R.string.pref_domain_summary, DOMAINS_HINT)); domainPref.setKey(getSharedKey(PREF_KEY_DOMAIN)); domainPref.getEditText().setHint(DEFAULT_DOMAIN); domainPref.getEditText().setSingleLine(); domainPref.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI); preferenceGroup.addPreference(domainPref); addPasswordPreference(preferenceGroup); addCloudflareRecaptchaFallbackPreference(preferenceGroup); addProxyPreferences(preferenceGroup); }
From source file:nya.miku.wishmaster.api.AbstractChanModule.java
/** * ( ?/ ) ? ? ? ? ?//*from ww w . jav a 2s . c om*/ * @param group , ??? */ protected void addPasswordPreference(PreferenceGroup group) { final Context context = group.getContext(); EditTextPreference passwordPref = new EditTextPreference(context); // ? passwordPref.setTitle(R.string.pref_password_title); passwordPref.setDialogTitle(R.string.pref_password_title); passwordPref.setSummary(R.string.pref_password_summary); passwordPref.setKey(getSharedKey(PREF_KEY_PASSWORD)); passwordPref.getEditText() .setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); passwordPref.getEditText().setSingleLine(); passwordPref.getEditText().setFilters(new InputFilter[] { new InputFilter.LengthFilter(255) }); group.addPreference(passwordPref); }
From source file:nya.miku.wishmaster.api.AbstractChanModule.java
/** * ( ?/ ) -? " SSL"/*from www.jav a 2 s .c o m*/ * @param group , ??? * @param dependencyKey -?? ? , null */ protected void addUnsafeSslPreference(PreferenceGroup group, String dependencyKey) { final Context context = group.getContext(); CheckBoxPreference unsafeSslPref = new CheckBoxPreference(context); //? " SSL" unsafeSslPref.setTitle(R.string.pref_ignore_ssl_errors); unsafeSslPref.setSummary(R.string.pref_ignore_ssl_errors_summary); unsafeSslPref.setKey(getSharedKey(PREF_KEY_UNSAFE_SSL)); unsafeSslPref.setDefaultValue(false); unsafeSslPref.setOnPreferenceChangeListener(updateHttpListener); group.addPreference(unsafeSslPref); if (dependencyKey != null) unsafeSslPref.setDependency(dependencyKey); }