Search in sources :

Example 1 with GeneralSettingsFragment

use of xyz.monkeytong.hongbao.fragments.GeneralSettingsFragment in project WeChatLuckyMoney by geeeeeeeeek.

the class SettingsActivity method prepareSettings.

private void prepareSettings() {
    String title, fragId;
    Bundle bundle = getIntent().getExtras();
    if (bundle != null) {
        title = bundle.getString("title");
        fragId = bundle.getString("frag_id");
    } else {
        title = getString(R.string.preference);
        fragId = "GeneralSettingsFragment";
    }
    TextView textView = (TextView) findViewById(R.id.settings_bar);
    textView.setText(title);
    FragmentManager fragmentManager = getFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    if ("GeneralSettingsFragment".equals(fragId)) {
        fragmentTransaction.replace(R.id.preferences_fragment, new GeneralSettingsFragment());
    } else if ("CommentSettingsFragment".equals(fragId)) {
        fragmentTransaction.replace(R.id.preferences_fragment, new CommentSettingsFragment());
    }
    fragmentTransaction.commit();
}
Also used : FragmentManager(android.app.FragmentManager) GeneralSettingsFragment(xyz.monkeytong.hongbao.fragments.GeneralSettingsFragment) CommentSettingsFragment(xyz.monkeytong.hongbao.fragments.CommentSettingsFragment) FragmentTransaction(android.app.FragmentTransaction) Bundle(android.os.Bundle) TextView(android.widget.TextView)

Aggregations

FragmentManager (android.app.FragmentManager)1 FragmentTransaction (android.app.FragmentTransaction)1 Bundle (android.os.Bundle)1 TextView (android.widget.TextView)1 CommentSettingsFragment (xyz.monkeytong.hongbao.fragments.CommentSettingsFragment)1 GeneralSettingsFragment (xyz.monkeytong.hongbao.fragments.GeneralSettingsFragment)1