use of android.support.v4.preference.PreferenceFragmentCompat in project ForPDA by RadiationX.
the class SettingsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
currentThemeIsDark = App.get().isDarkTheme();
setTheme(currentThemeIsDark ? R.style.PreferenceAppThemeDark : R.style.PreferenceAppThemeLight);
setContentView(R.layout.activity_settings);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setTitle(R.string.activity_title_settings);
}
PreferenceFragmentCompat fragment = null;
Intent intent = getIntent();
if (intent != null) {
String settingsArgument = intent.getStringExtra(ARG_NEW_PREFERENCE_SCREEN);
if (settingsArgument != null) {
if (settingsArgument.equals(NotificationsSettingsFragment.PREFERENCE_SCREEN_NAME)) {
fragment = new NotificationsSettingsFragment();
}
}
}
if (fragment == null) {
fragment = new SettingsFragment();
}
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_content, fragment).commit();
/*View view = findViewById(R.id.fragment_content);
view.setBackgroundColor(Color.TRANSPARENT);
view.setBackgroundColor(Color.rgb(4, 26, 55));*/
App.get().addPreferenceChangeObserver(appThemeChangeObserver);
}
use of android.support.v4.preference.PreferenceFragmentCompat in project sms-backup-plus by jberkel.
the class MainActivity method onPreferenceStartFragment.
@Override
public boolean onPreferenceStartFragment(PreferenceFragmentCompat caller, Preference preference) {
if (LOCAL_LOGV) {
Log.v(TAG, "onPreferenceStartFragment(" + preference + ")");
}
final Fragment fragment = Fragment.instantiate(this, preference.getFragment(), new BundleBuilder().putString(SCREEN_TITLE, String.valueOf(preference.getTitle())).build());
showFragment(fragment, preference.getKey());
return true;
}
use of android.support.v4.preference.PreferenceFragmentCompat in project NewPipe by TeamNewPipe.
the class SettingsActivity method onPreferenceStartFragment.
@Override
public boolean onPreferenceStartFragment(PreferenceFragmentCompat caller, Preference preference) {
Fragment fragment = Fragment.instantiate(this, preference.getFragment(), preference.getExtras());
getSupportFragmentManager().beginTransaction().setCustomAnimations(R.animator.custom_fade_in, R.animator.custom_fade_out, R.animator.custom_fade_in, R.animator.custom_fade_out).replace(R.id.fragment_holder, fragment).addToBackStack(null).commit();
return true;
}
use of android.support.v4.preference.PreferenceFragmentCompat in project network-monitor by caarmen.
the class PreferenceFragmentCompatHack method onDisplayPreferenceDialog.
/**
* Displays preference dialogs which aren't supported by default in PreferenceFragmentCompat.
*
* @return true if we managed a preference which isn't supported by default, false otherwise.
*/
public static boolean onDisplayPreferenceDialog(PreferenceFragmentCompat preferenceFragmentCompat, Preference preference) {
FragmentManager fragmentManager = preferenceFragmentCompat.getFragmentManager();
if (fragmentManager == null)
return false;
DialogFragment dialogFragment = (DialogFragment) fragmentManager.findFragmentByTag(FRAGMENT_TAG_DIALOG);
if (dialogFragment != null)
return false;
// Hack to allow a MultiSelectListPreference
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH && preference instanceof MultiSelectListPreference) {
dialogFragment = MultiSelectListPreferenceDialogFragmentCompat.newInstance(preference.getKey());
} else // Hack to allow a PasswordPreference
if (preference instanceof PasswordPreference) {
dialogFragment = PasswordPreferenceDialogFragmentCompat.newInstance(preference.getKey());
}
// We've created our own fragment:
if (dialogFragment != null) {
dialogFragment.setTargetFragment(preferenceFragmentCompat, 0);
dialogFragment.show(fragmentManager, FRAGMENT_TAG_DIALOG);
return true;
}
return false;
}
Aggregations