Search in sources :

Example 1 with SettingsFragment

use of forpdateam.ru.forpda.ui.fragments.settings.SettingsFragment 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);
}
Also used : NotificationsSettingsFragment(forpdateam.ru.forpda.ui.fragments.settings.NotificationsSettingsFragment) SettingsFragment(forpdateam.ru.forpda.ui.fragments.settings.SettingsFragment) PreferenceFragmentCompat(android.support.v7.preference.PreferenceFragmentCompat) Intent(android.content.Intent) NotificationsSettingsFragment(forpdateam.ru.forpda.ui.fragments.settings.NotificationsSettingsFragment) ActionBar(android.support.v7.app.ActionBar)

Aggregations

Intent (android.content.Intent)1 ActionBar (android.support.v7.app.ActionBar)1 PreferenceFragmentCompat (android.support.v7.preference.PreferenceFragmentCompat)1 NotificationsSettingsFragment (forpdateam.ru.forpda.ui.fragments.settings.NotificationsSettingsFragment)1 SettingsFragment (forpdateam.ru.forpda.ui.fragments.settings.SettingsFragment)1