Search in sources :

Example 51 with FragmentTransaction

use of android.support.v4.app.FragmentTransaction in project fitscales by paulburton.

the class FitscalesActivity method oauthShowPage.

@Override
public void oauthShowPage(OAuthSyncService svc, String url) {
    FragmentTransaction trans = getSupportFragmentManager().beginTransaction();
    Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog");
    if (prev != null)
        trans.remove(prev);
    trans.addToBackStack(null);
    DialogFragment nfrag = OAuthDialogFragment.newInstance(url, svc);
    nfrag.show(trans, "dialog");
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) DialogFragment(android.support.v4.app.DialogFragment) Fragment(android.support.v4.app.Fragment) DialogFragment(android.support.v4.app.DialogFragment)

Example 52 with FragmentTransaction

use of android.support.v4.app.FragmentTransaction in project fitscales by paulburton.

the class FitscalesActivity method onBoardWeighIn.

@Override
public void onBoardWeighIn(float weight) {
    float prevWeight = Prefs.getLastWeight();
    SharedPreferences.Editor edit = FitscalesApplication.inst.prefs.edit();
    edit.putFloat(Prefs.KEY_LASTWEIGHT, weight);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
        edit.apply();
    else
        edit.commit();
    setScalePrev();
    FragmentTransaction trans = getSupportFragmentManager().beginTransaction();
    Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog");
    if (prev != null)
        trans.remove(prev);
    trans.addToBackStack(null);
    DialogFragment nfrag = WeighInDialogFragment.newInstance(weight, prevWeight);
    nfrag.show(trans, "dialog");
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) SharedPreferences(android.content.SharedPreferences) DialogFragment(android.support.v4.app.DialogFragment) Fragment(android.support.v4.app.Fragment) DialogFragment(android.support.v4.app.DialogFragment)

Example 53 with FragmentTransaction

use of android.support.v4.app.FragmentTransaction in project Libraries-for-Android-Developers by eoecn.

the class ActionBarImpl method selectTab.

@Override
public void selectTab(Tab tab) {
    if (getNavigationMode() != NAVIGATION_MODE_TABS) {
        mSavedTabPosition = tab != null ? tab.getPosition() : INVALID_POSITION;
        return;
    }
    FragmentTransaction trans = null;
    if (mActivity instanceof FragmentActivity) {
        trans = ((FragmentActivity) mActivity).getSupportFragmentManager().beginTransaction().disallowAddToBackStack();
    }
    if (mSelectedTab == tab) {
        if (mSelectedTab != null) {
            mSelectedTab.getCallback().onTabReselected(mSelectedTab, trans);
            mTabScrollView.animateToTab(tab.getPosition());
        }
    } else {
        mTabScrollView.setTabSelected(tab != null ? tab.getPosition() : Tab.INVALID_POSITION);
        if (mSelectedTab != null) {
            mSelectedTab.getCallback().onTabUnselected(mSelectedTab, trans);
        }
        mSelectedTab = (TabImpl) tab;
        if (mSelectedTab != null) {
            mSelectedTab.getCallback().onTabSelected(mSelectedTab, trans);
        }
    }
    if (trans != null && !trans.isEmpty()) {
        trans.commit();
    }
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) FragmentTransaction(android.support.v4.app.FragmentTransaction)

Example 54 with FragmentTransaction

use of android.support.v4.app.FragmentTransaction in project photo-picker-plus-android by chute.

the class FragmentUtil method replaceContentWithEmptyFragment.

public static void replaceContentWithEmptyFragment(FragmentActivity activity) {
    FragmentTransaction fragmentTransaction = activity.getSupportFragmentManager().beginTransaction();
    fragmentTransaction.replace(R.id.gcFragments, FragmentEmpty.newInstance(), TAG_FRAGMENT_EMPTY);
    fragmentTransaction.commit();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction)

Example 55 with FragmentTransaction

use of android.support.v4.app.FragmentTransaction in project android-betterpickers by code-troopers.

the class SampleHmsUsingFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.frame_layout);
    Fragment fragment = new SampleHmsFragment();
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    transaction.replace(R.id.frame, fragment);
    transaction.commit();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) SampleHmsFragment(com.codetroopers.betterpickers.sample.fragment.SampleHmsFragment) Fragment(android.support.v4.app.Fragment) SampleHmsFragment(com.codetroopers.betterpickers.sample.fragment.SampleHmsFragment)

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