use of android.preference.Preference in project MWM-for-Android-Gen1 by MetaWatchOpenProjects.
the class Settings method onStart.
@Override
protected void onStart() {
Log.d(MetaWatch.TAG, "set onstart");
editTextMac = (EditTextPreference) preferenceScreen.findPreference("MAC");
editTextMac.setText(MetaWatchService.Preferences.watchMacAddress);
discovery = preferenceScreen.findPreference("Discovery");
discovery.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference arg0) {
Log.d(MetaWatch.TAG, "discovery click");
startActivity(new Intent(context, DeviceSelection.class));
return false;
}
});
super.onStart();
}
use of android.preference.Preference in project Xposed-Tinted-Status-Bar by MohammadAG.
the class SettingsActivity method onPostCreate.
@SuppressWarnings({ "deprecation" })
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
getPreferenceManager().setSharedPreferencesMode(MODE_WORLD_READABLE);
addPreferencesFromResource(R.xml.pref_general);
Preference copyrightPreference = findPreference("copyright_key");
copyrightPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
AlertDialog.Builder builder = new AlertDialog.Builder(SettingsActivity.this);
builder.setTitle("").setItems(R.array.my_apps, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Uri uri = null;
Intent intent = new Intent(Intent.ACTION_VIEW);
switch(which) {
case 0:
uri = Uri.parse(URL_MY_APPS);
intent.setPackage("com.android.vending");
break;
case 1:
uri = Uri.parse(URL_MY_MODULES);
break;
case 2:
uri = Uri.parse("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KGGZ5C3AVC8ZU");
break;
}
startActivity(intent.setData(uri));
}
});
builder.create().show();
return false;
}
});
Preference donatePreference = findPreference("donate_key");
donatePreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference arg0) {
Intent intent = new Intent(Intent.ACTION_VIEW).setData(Uri.parse(URL_DONATION_PACKAGE));
intent.setPackage("com.android.vending");
startActivity(intent);
return false;
}
});
if (Utils.isDonateVersionInstalled(getApplicationContext())) {
copyrightPreference.setTitle(R.string.app_name_donate_version);
donatePreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Toast.makeText(SettingsActivity.this, R.string.thank_you, Toast.LENGTH_SHORT).show();
return false;
}
});
donatePreference.setTitle(R.string.thank_you);
donatePreference.setSummary(R.string.thank_you_summary);
}
String[] colorKeys = { SettingsKeys.DEFAULT_STATUS_BAR_TINT, SettingsKeys.DEFAULT_STATUS_BAR_ICON_TINT, SettingsKeys.DEFAULT_STATUS_BAR_INVERTED_ICON_TINT, SettingsKeys.DEFAULT_NAV_BAR_TINT, SettingsKeys.DEFAULT_NAV_BAR_ICON_TINT, SettingsKeys.DEFAULT_NAV_BAR_IM_TINT, SettingsKeys.DEFAULT_NAV_BAR_ICON_IM_TINT };
intializeColorPreferences(colorKeys);
findPreference(SettingsKeys.LINK_PANEL_VIEW_COLORS).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
sendBroadcast(new Intent(Common.INTENT_SETTINGS_UPDATED));
return true;
}
});
ListPreference overlayTypePreference = (ListPreference) findPreference("pref_overlay_type");
final Preference overlayTransparencyPreference = findPreference("pref_semi_transparent_overlay_opacity");
if (overlayTypePreference.getValue().equals("semi_transparent"))
overlayTransparencyPreference.setEnabled(true);
overlayTypePreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (newValue.equals("semi_transparent"))
overlayTransparencyPreference.setEnabled(true);
else
overlayTransparencyPreference.setEnabled(false);
return true;
}
});
}
use of android.preference.Preference in project NimbusBase_Android_Tutorial by NimbusBase.
the class IndexFragment method initiatePreferenceScreen.
protected PreferenceScreen initiatePreferenceScreen(Base base, int preferencesResID) {
addPreferencesFromResource(preferencesResID);
final PreferenceScreen preferenceScreen = getPreferenceScreen();
final PreferenceCategory serverCate = getServerCategory(preferenceScreen);
serverCate.setOrderingAsAdded(true);
final Server[] servers = base.getServers();
for (int index = 0; index < servers.length; index++) {
final Server server = servers[index];
final ListItemServer item = new ListItemServer(getActivity(), server);
item.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
onServerItemStateChange((ListItemServer) preference, (Boolean) newValue);
return false;
}
});
item.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
onServerItemClick((ListItemServer) preference);
return true;
}
});
serverCate.addPreference(item);
onServerStateChange(server, index);
}
final PreferenceCategory databaseCate = getDatabaseCategory(preferenceScreen);
final PreferenceScreen playgroundItem = (PreferenceScreen) databaseCate.findPreference(getString(R.string.item_playground));
playgroundItem.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
return onPlaygroundItemClick(preference);
}
});
return preferenceScreen;
}
use of android.preference.Preference in project NimbusBase_Android_Tutorial by NimbusBase.
the class PGFragmentTable method reload.
protected void reload(List<? extends PGRecord> records) {
final PreferenceScreen preferenceScreen = getPreferenceScreen();
preferenceScreen.removeAll();
for (final PGRecord user : records) {
final PGListItemRecord item = new PGListItemRecord(getActivity(), user);
item.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
return onRecordPressed((PGListItemRecord) preference);
}
});
preferenceScreen.addPreference(item);
}
}
use of android.preference.Preference in project NimbusBase_Android_Tutorial by NimbusBase.
the class PGFragmentTable method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final ActionBar actionBar = getActivity().getActionBar();
if (actionBar != null)
actionBar.setTitle("Table " + mTableName);
final SQLiteDatabase database = mSQLiteOpenHelper.getReadableDatabase();
final List<MDLUser> records = MDLUser.fetchAll(database);
database.close();
if (!records.equals(mRecords)) {
this.mRecords = records;
reload(records);
final PreferenceScreen preferenceScreen = getPreferenceScreen();
preferenceScreen.removeAll();
for (final MDLUser user : records) {
final PGListItemRecord item = new PGListItemRecord(getActivity(), user);
item.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
return onRecordPressed((PGListItemRecord) preference);
}
});
preferenceScreen.addPreference(item);
}
}
}
Aggregations