Search in sources :

Example 66 with FragmentTransaction

use of android.support.v4.app.FragmentTransaction in project Android-Developers-Samples by johnjohndoe.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    CardEmulationFragment fragment = new CardEmulationFragment();
    transaction.replace(R.id.sample_content_fragment, fragment);
    transaction.commit();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction)

Example 67 with FragmentTransaction

use of android.support.v4.app.FragmentTransaction in project Android-Developers-Samples by johnjohndoe.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    CardReaderFragment fragment = new CardReaderFragment();
    transaction.replace(R.id.sample_content_fragment, fragment);
    transaction.commit();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction)

Example 68 with FragmentTransaction

use of android.support.v4.app.FragmentTransaction in project Android-Developers-Samples by johnjohndoe.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    FragmentManager fm = getSupportFragmentManager();
    BatchStepSensorFragment fragment = (BatchStepSensorFragment) fm.findFragmentByTag(FRAGTAG);
    if (fragment == null) {
        FragmentTransaction transaction = fm.beginTransaction();
        fragment = new BatchStepSensorFragment();
        transaction.add(fragment, FRAGTAG);
        transaction.commit();
    }
    // Use fragment as click listener for cards, but must implement correct interface
    if (!(fragment instanceof OnCardClickListener)) {
        throw new ClassCastException("BatchStepSensorFragment must " + "implement OnCardClickListener interface.");
    }
    OnCardClickListener clickListener = (OnCardClickListener) fm.findFragmentByTag(FRAGTAG);
    mRetentionFragment = (StreamRetentionFragment) fm.findFragmentByTag(RETENTION_TAG);
    if (mRetentionFragment == null) {
        mRetentionFragment = new StreamRetentionFragment();
        fm.beginTransaction().add(mRetentionFragment, RETENTION_TAG).commit();
    } else {
        // If the retention fragment already existed, we need to pull some state.
        // pull state out
        CardStreamState state = mRetentionFragment.getCardStream();
        // dump it in CardStreamFragment.
        mCardStreamFragment = (CardStreamFragment) fm.findFragmentById(R.id.fragment_cardstream);
        mCardStreamFragment.restoreState(state, clickListener);
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) FragmentTransaction(android.support.v4.app.FragmentTransaction) CardStreamState(com.example.android.batchstepsensor.cardstream.CardStreamState) StreamRetentionFragment(com.example.android.batchstepsensor.cardstream.StreamRetentionFragment) OnCardClickListener(com.example.android.batchstepsensor.cardstream.OnCardClickListener)

Example 69 with FragmentTransaction

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

the class ExtensionsConfigurationActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_singlepane);
    setupActionBar();
    if (getIntent().hasExtra(SeriesGuideExtension.EXTRA_FROM_SERIESGUIDE_SETTINGS)) {
        // launch Amazon extension settings instead
        if (savedInstanceState == null) {
            AmazonConfigurationFragment f = new AmazonConfigurationFragment();
            android.app.FragmentTransaction ft = getFragmentManager().beginTransaction();
            ft.add(R.id.content_frame, f);
            ft.commit();
        }
    } else {
        if (savedInstanceState == null) {
            ExtensionsConfigurationFragment f = new ExtensionsConfigurationFragment();
            FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
            ft.add(R.id.content_frame, f);
            ft.commit();
        }
    }
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction)

Example 70 with FragmentTransaction

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

the class OverviewActivity method setupPanes.

private void setupPanes() {
    Fragment showsFragment = ShowFragment.newInstance(showTvdbId);
    FragmentTransaction ft1 = getSupportFragmentManager().beginTransaction();
    ft1.setCustomAnimations(R.anim.fade_in, R.anim.fade_out);
    ft1.replace(R.id.fragment_show, showsFragment);
    ft1.commit();
    Fragment overviewFragment = OverviewFragment.newInstance(showTvdbId);
    FragmentTransaction ft2 = getSupportFragmentManager().beginTransaction();
    ft2.setCustomAnimations(R.anim.fade_in, R.anim.fade_out);
    ft2.replace(R.id.fragment_overview, overviewFragment);
    ft2.commit();
    Fragment seasonsFragment = SeasonsFragment.newInstance(showTvdbId);
    FragmentTransaction ft3 = getSupportFragmentManager().beginTransaction();
    ft3.setCustomAnimations(R.anim.fade_in, R.anim.fade_out);
    ft3.replace(R.id.fragment_seasons, seasonsFragment);
    ft3.commit();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) RemoveShowDialogFragment(com.battlelancer.seriesguide.ui.dialogs.RemoveShowDialogFragment) Fragment(android.support.v4.app.Fragment) RemoveShowWorkerFragment(com.battlelancer.seriesguide.util.RemoveShowWorkerFragment)

Aggregations

FragmentTransaction (android.support.v4.app.FragmentTransaction)392 Fragment (android.support.v4.app.Fragment)135 FragmentManager (android.support.v4.app.FragmentManager)79 View (android.view.View)29 DialogFragment (android.support.v4.app.DialogFragment)27 FragmentActivity (android.support.v4.app.FragmentActivity)25 Bundle (android.os.Bundle)21 TextView (android.widget.TextView)19 FragmentTransaction (android.app.FragmentTransaction)18 Intent (android.content.Intent)18 Button (android.widget.Button)17 OnClickListener (android.view.View.OnClickListener)16 SherlockFragment (com.actionbarsherlock.app.SherlockFragment)12 ActionBar (android.support.v7.app.ActionBar)8 TargetApi (android.annotation.TargetApi)6 AppCompatActivity (android.support.v7.app.AppCompatActivity)6 Toolbar (android.support.v7.widget.Toolbar)6 FriendsTimeLineFragment (org.qii.weiciyuan.ui.maintimeline.FriendsTimeLineFragment)6 UserInfoFragment (org.qii.weiciyuan.ui.userinfo.UserInfoFragment)6 Transition (android.transition.Transition)5