use of android.support.v7.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.v7.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();
}
}
use of android.support.v7.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);
}
Aggregations