Search in sources :

Example 1 with PreferenceFragment

use of android.preference.PreferenceFragment in project ListenerMusicPlayer by hefuyicoder.

the class SettingActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle(R.string.settings);
    PreferenceFragment fragment = new SettingFragment();
    FragmentManager fragmentManager = getFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.fragment_container, fragment).commit();
}
Also used : FragmentManager(android.app.FragmentManager) SettingFragment(io.hefuyi.listener.ui.fragment.SettingFragment) PreferenceFragment(android.preference.PreferenceFragment) Toolbar(android.support.v7.widget.Toolbar)

Example 2 with PreferenceFragment

use of android.preference.PreferenceFragment in project Auto.js by hyb1996.

the class SettingsActivity method setupViews.

private void setupViews() {
    setContentView(R.layout.activity_settings);
    getFragmentManager().beginTransaction().replace(R.id.fragment_setting, new PreferenceFragment()).commit();
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle(R.string.text_settings);
    setSupportActionBar(toolbar);
    toolbar.setNavigationOnClickListener(v -> finish());
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
Also used : PreferenceFragment(android.preference.PreferenceFragment) Toolbar(android.support.v7.widget.Toolbar)

Example 3 with PreferenceFragment

use of android.preference.PreferenceFragment in project Talon-for-Twitter by klinker24.

the class SectionsPagerAdapter method getItem.

@Override
public Fragment getItem(int position) {
    PreferenceFragment fragment = new PrefFragment();
    Bundle args = new Bundle();
    args.putInt("position", position);
    fragment.setArguments(args);
    return fragment;
}
Also used : Bundle(android.os.Bundle) PreferenceFragment(android.preference.PreferenceFragment)

Example 4 with PreferenceFragment

use of android.preference.PreferenceFragment in project android-uploader by nightscout.

the class SettingsActivityTest method setUpPreferenceFragment.

private PreferenceFragment setUpPreferenceFragment(Class<? extends PreferenceFragment> clazz) {
    PreferenceFragment instance;
    try {
        instance = clazz.newInstance();
    } catch (InstantiationException | IllegalAccessException e) {
        throw new RuntimeException(e);
    }
    FragmentTestUtil.startVisibleFragment(instance);
    return instance;
}
Also used : PreferenceFragment(android.preference.PreferenceFragment)

Example 5 with PreferenceFragment

use of android.preference.PreferenceFragment in project Timber by naman14.

the class SettingsActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    if (PreferencesUtility.getInstance(this).getTheme().equals("dark"))
        setTheme(R.style.AppThemeNormalDark);
    else if (PreferencesUtility.getInstance(this).getTheme().equals("black"))
        setTheme(R.style.AppThemeNormalBlack);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    action = getIntent().getAction();
    if (action.equals(Constants.SETTINGS_STYLE_SELECTOR)) {
        getSupportActionBar().setTitle(R.string.now_playing);
        String what = getIntent().getExtras().getString(Constants.SETTINGS_STYLE_SELECTOR_WHAT);
        Fragment fragment = StyleSelectorFragment.newInstance(what);
        FragmentManager fragmentManager = getSupportFragmentManager();
        fragmentManager.beginTransaction().add(R.id.fragment_container, fragment).commit();
    } else {
        getSupportActionBar().setTitle(R.string.settings);
        PreferenceFragment fragment = new SettingsFragment();
        android.app.FragmentManager fragmentManager = getFragmentManager();
        fragmentManager.beginTransaction().replace(R.id.fragment_container, fragment).commit();
    }
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) SettingsFragment(com.naman14.timber.fragments.SettingsFragment) PreferenceFragment(android.preference.PreferenceFragment) StyleSelectorFragment(com.naman14.timber.subfragments.StyleSelectorFragment) PreferenceFragment(android.preference.PreferenceFragment) Fragment(androidx.fragment.app.Fragment) SettingsFragment(com.naman14.timber.fragments.SettingsFragment) Toolbar(androidx.appcompat.widget.Toolbar)

Aggregations

PreferenceFragment (android.preference.PreferenceFragment)5 Toolbar (android.support.v7.widget.Toolbar)2 FragmentManager (android.app.FragmentManager)1 Bundle (android.os.Bundle)1 Toolbar (androidx.appcompat.widget.Toolbar)1 Fragment (androidx.fragment.app.Fragment)1 FragmentManager (androidx.fragment.app.FragmentManager)1 SettingsFragment (com.naman14.timber.fragments.SettingsFragment)1 StyleSelectorFragment (com.naman14.timber.subfragments.StyleSelectorFragment)1 SettingFragment (io.hefuyi.listener.ui.fragment.SettingFragment)1