use of android.support.v4.preference.PreferenceFragmentCompat in project wire-android by wireapp.
the class ZetaPreferencesActivity method onPreferenceDisplayDialog.
@Override
public boolean onPreferenceDisplayDialog(PreferenceFragmentCompat preferenceFragmentCompat, Preference preference) {
final String key = preference.getKey();
final DialogFragment f;
if (preference.getKey().equals(getString(R.string.pref_options_ringtones_ping_key)) || preference.getKey().equals(getString(R.string.pref_options_ringtones_text_key)) || preference.getKey().equals(getString(R.string.pref_options_ringtones_ringtone_key))) {
final int defaultId = preference.getExtras().getInt(WireRingtonePreferenceDialogFragment.EXTRA_DEFAULT);
f = WireRingtonePreferenceDialogFragment.newInstance(key, defaultId);
} else {
return false;
}
f.setTargetFragment(preferenceFragmentCompat, 0);
f.show(getSupportFragmentManager(), key);
return true;
}
use of android.support.v4.preference.PreferenceFragmentCompat in project TumCampusApp by TCA-Team.
the class UserPreferencesActivity method onPreferenceStartScreen.
@Override
public boolean onPreferenceStartScreen(PreferenceFragmentCompat preferenceFragmentCompat, PreferenceScreen preferenceScreen) {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
SettingsFragment fragment = new SettingsFragment();
Bundle args = new Bundle();
args.putString(PreferenceFragmentCompat.ARG_PREFERENCE_ROOT, preferenceScreen.getKey());
fragment.setArguments(args);
ft.replace(R.id.settings_frame, fragment, preferenceScreen.getKey());
ft.addToBackStack(preferenceScreen.getKey());
ft.commit();
return true;
}
use of android.support.v4.preference.PreferenceFragmentCompat in project Douya by DreaminginCodeZH.
the class LicensesDialogPreference method onDisplayPreferenceDialog.
/**
* Users should override {@link PreferenceFragmentCompat#onDisplayPreferenceDialog(Preference)}
* and check the return value of this method, only call through to super implementation if
* {@code false} is returned.
*
* @param preferenceFragment The preference fragment
* @param preference The preference, as in
* {@link PreferenceFragmentCompat#onDisplayPreferenceDialog(Preference)}
* @return Whether the call has been handled by this method.
*/
public static boolean onDisplayPreferenceDialog(PreferenceFragmentCompat preferenceFragment, Preference preference) {
if (preference instanceof LicensesDialogPreference) {
// getChildFragmentManager() will lead to looking for target fragment in the child
// fragment manager.
FragmentManager fragmentManager = preferenceFragment.getFragmentManager();
if (fragmentManager.findFragmentByTag(DIALOG_FRAGMENT_TAG) == null) {
LicensesDialogFragment dialogFragment = new LicensesDialogFragment.Builder(preferenceFragment.getActivity()).setNotices(R.raw.licenses).setUseAppCompat(true).build();
dialogFragment.setTargetFragment(preferenceFragment, 0);
dialogFragment.show(fragmentManager, DIALOG_FRAGMENT_TAG);
}
return true;
}
return false;
}
use of android.support.v4.preference.PreferenceFragmentCompat in project wire-android by wireapp.
the class ZetaPreferencesActivity method onBuildPreferenceFragment.
@Override
public PreferenceFragmentCompat onBuildPreferenceFragment(PreferenceScreen preferenceScreen) {
final String rootKey = preferenceScreen.getKey();
final Bundle extras = preferenceScreen.getExtras();
final PreferenceFragmentCompat instance;
if (rootKey.equals(getString(R.string.pref_account_screen_key))) {
instance = AccountPreferences.newInstance(rootKey, extras);
} else if (rootKey.equals(getString(R.string.pref_about_screen_key))) {
instance = AboutPreferences.newInstance(rootKey, extras);
} else if (rootKey.equals(getString(R.string.pref_options_screen_key))) {
instance = OptionsPreferences.newInstance(rootKey, extras);
} else if (rootKey.equals(getString(R.string.pref_support_screen_key))) {
instance = SupportPreferences.newInstance(rootKey, extras);
} else if (rootKey.equals(getString(R.string.pref_advanced_screen_key))) {
instance = AdvancedPreferences.newInstance(rootKey, extras);
} else if (rootKey.equals(getString(R.string.pref_developer_screen_key))) {
instance = DeveloperPreferences.newInstance(rootKey, extras);
} else if (rootKey.equals(getString(R.string.pref_devices_screen_key))) {
instance = DevicesPreferences.newInstance(rootKey, extras);
} else if (rootKey.equals(getString(R.string.pref_device_details_screen_key))) {
instance = DeviceDetailPreferences.newInstance(rootKey, extras);
} else {
instance = RootPreferences.newInstance(rootKey, extras);
}
resetIntentExtras(preferenceScreen);
return instance;
}
use of android.support.v4.preference.PreferenceFragmentCompat in project twicalico by moko256.
the class SettingsActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeAsUpIndicator(R.drawable.ic_back_white_24dp);
if (savedInstanceState == null) {
PreferenceFragmentCompat fragment = new SettingsFragment();
if (getIntent() != null) {
String title = getIntent().getStringExtra("title");
if (title != null) {
actionBar.setTitle(title);
}
String key = getIntent().getStringExtra(PreferenceFragmentCompat.ARG_PREFERENCE_ROOT);
if (key != null) {
Bundle args = new Bundle();
args.putString(PreferenceFragmentCompat.ARG_PREFERENCE_ROOT, key);
fragment.setArguments(args);
}
}
getSupportFragmentManager().beginTransaction().add(R.id.activity_settings_container, fragment).commit();
}
}
Aggregations