Search in sources :

Example 21 with FragmentManager

use of android.support.v4.app.FragmentManager in project SeriesGuide by UweTrottmann.

the class AddListDialogFragment method showAddListDialog.

/**
     * Display a dialog which allows to edit the title of this list or remove it.
     */
public static void showAddListDialog(FragmentManager fm) {
    // DialogFragment.show() will take care of adding the fragment
    // in a transaction. We also want to remove any currently showing
    // dialog, so make our own transaction and take care of that here.
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag("addlistdialog");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);
    // Create and show the dialog.
    DialogFragment newFragment = AddListDialogFragment.newInstance();
    newFragment.show(ft, "addlistdialog");
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) AppCompatDialogFragment(android.support.v7.app.AppCompatDialogFragment) DialogFragment(android.support.v4.app.DialogFragment) AppCompatDialogFragment(android.support.v7.app.AppCompatDialogFragment) DialogFragment(android.support.v4.app.DialogFragment) Fragment(android.support.v4.app.Fragment)

Example 22 with FragmentManager

use of android.support.v4.app.FragmentManager in project Signal-Android by WhisperSystems.

the class ApplicationPreferencesActivity method onSupportNavigateUp.

@Override
public boolean onSupportNavigateUp() {
    FragmentManager fragmentManager = getSupportFragmentManager();
    if (fragmentManager.getBackStackEntryCount() > 0) {
        fragmentManager.popBackStack();
    } else {
        Intent intent = new Intent(this, ConversationListActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intent);
        finish();
    }
    return true;
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) Intent(android.content.Intent)

Example 23 with FragmentManager

use of android.support.v4.app.FragmentManager in project MVCHelper by LuckyJayce.

the class ProxyActivity method onCreate.

protected void onCreate(android.os.Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_proxy);
    View headLayout = findViewById(R.id.proxy_head_layout);
    TextView titleTextView = (TextView) findViewById(R.id.proxy_title_textView);
    backView = findViewById(R.id.proxy_back_view);
    String title = getIntent().getStringExtra(INTENT_STRING_FRAGMENT_TITLE);
    if (TextUtils.isEmpty(title)) {
        headLayout.setVisibility(View.GONE);
    } else {
        headLayout.setVisibility(View.VISIBLE);
        titleTextView.setText(title);
    }
    try {
        @SuppressWarnings("unchecked") Class<Fragment> fragmentClass = (Class<Fragment>) Class.forName(getIntent().getStringExtra(INTENT_STRING_FRAGMENT_NAME));
        FragmentManager fragmentManager = getSupportFragmentManager();
        Fragment fragment = fragmentManager.findFragmentById(R.id.proxy_fragment);
        if (fragment == null || !fragment.getClass().equals(fragmentClass)) {
            fragment = fragmentClass.newInstance();
            fragment.setArguments(new Bundle(getIntent().getExtras()));
            fragmentManager.beginTransaction().replace(R.id.proxy_fragment, fragment).commitAllowingStateLoss();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    backView.setOnClickListener(onClickListener);
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) Bundle(android.os.Bundle) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) Fragment(android.support.v4.app.Fragment)

Example 24 with FragmentManager

use of android.support.v4.app.FragmentManager in project ViewPagerIndicator by LuckyJayce.

the class FirstLayerFragment method onCreateViewLazy.

@Override
protected void onCreateViewLazy(Bundle savedInstanceState) {
    super.onCreateViewLazy(savedInstanceState);
    setContentView(R.layout.fragment_tabmain);
    Resources res = getResources();
    Bundle bundle = getArguments();
    tabName = bundle.getString(INTENT_STRING_TABNAME);
    index = bundle.getInt(INTENT_INT_INDEX);
    ViewPager viewPager = (ViewPager) findViewById(R.id.fragment_tabmain_viewPager);
    Indicator indicator = (Indicator) findViewById(R.id.fragment_tabmain_indicator);
    switch(index) {
        case 0:
            indicator.setScrollBar(new ColorBar(getApplicationContext(), Color.RED, 5));
            break;
        case 1:
            indicator.setScrollBar(new ColorBar(getApplicationContext(), Color.RED, 0, Gravity.CENTENT_BACKGROUND));
            break;
        case 2:
            indicator.setScrollBar(new ColorBar(getApplicationContext(), Color.RED, 5, Gravity.TOP));
            break;
        case 3:
            indicator.setScrollBar(new LayoutBar(getApplicationContext(), R.layout.layout_slidebar, Gravity.CENTENT_BACKGROUND));
            break;
    }
    float unSelectSize = 16;
    float selectSize = unSelectSize * 1.2f;
    int selectColor = res.getColor(R.color.tab_top_text_2);
    int unSelectColor = res.getColor(R.color.tab_top_text_1);
    indicator.setOnTransitionListener(new OnTransitionTextListener().setColor(selectColor, unSelectColor).setSize(selectSize, unSelectSize));
    viewPager.setOffscreenPageLimit(4);
    indicatorViewPager = new IndicatorViewPager(indicator, viewPager);
    inflate = LayoutInflater.from(getApplicationContext());
    // 注意这里 的FragmentManager 是 getChildFragmentManager(); 因为是在Fragment里面
    // 而在activity里面用FragmentManager 是 getSupportFragmentManager()
    indicatorViewPager.setAdapter(new MyAdapter(getChildFragmentManager()));
    Log.d("cccc", "Fragment 将要创建View " + this);
}
Also used : IndicatorViewPager(com.shizhefei.view.indicator.IndicatorViewPager) Bundle(android.os.Bundle) OnTransitionTextListener(com.shizhefei.view.indicator.transition.OnTransitionTextListener) Resources(android.content.res.Resources) LayoutBar(com.shizhefei.view.indicator.slidebar.LayoutBar) IndicatorViewPager(com.shizhefei.view.indicator.IndicatorViewPager) ViewPager(android.support.v4.view.ViewPager) Indicator(com.shizhefei.view.indicator.Indicator) ColorBar(com.shizhefei.view.indicator.slidebar.ColorBar)

Example 25 with FragmentManager

use of android.support.v4.app.FragmentManager in project Signal-Android by WhisperSystems.

the class MmsPreferencesActivity method onCreate.

@Override
protected void onCreate(Bundle icicle, @NonNull MasterSecret masterSecret) {
    this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    Fragment fragment = new MmsPreferencesFragment();
    FragmentManager fragmentManager = getSupportFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    fragmentTransaction.replace(android.R.id.content, fragment);
    fragmentTransaction.commit();
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) FragmentTransaction(android.support.v4.app.FragmentTransaction) Fragment(android.support.v4.app.Fragment)

Aggregations

FragmentManager (android.support.v4.app.FragmentManager)265 FragmentTransaction (android.support.v4.app.FragmentTransaction)98 Fragment (android.support.v4.app.Fragment)76 View (android.view.View)46 TextView (android.widget.TextView)34 OnClickListener (android.view.View.OnClickListener)24 Bundle (android.os.Bundle)23 Intent (android.content.Intent)20 ImageView (android.widget.ImageView)15 ScrollView (android.widget.ScrollView)14 DialogFragment (android.support.v4.app.DialogFragment)13 ListFragment (android.support.v4.app.ListFragment)12 Button (android.widget.Button)11 FragmentActivity (android.support.v4.app.FragmentActivity)6 ArrayList (java.util.ArrayList)6 ViewPager (android.support.v4.view.ViewPager)5 UiThreadTest (android.test.UiThreadTest)5 BackStackEntry (android.support.v4.app.FragmentManager.BackStackEntry)4 AppCompatActivity (android.support.v7.app.AppCompatActivity)4 Time (android.text.format.Time)4