当前位置: 首页>>代码示例>>Java>>正文


Java FragmentManager.executePendingTransactions方法代码示例

本文整理汇总了Java中android.support.v4.app.FragmentManager.executePendingTransactions方法的典型用法代码示例。如果您正苦于以下问题:Java FragmentManager.executePendingTransactions方法的具体用法?Java FragmentManager.executePendingTransactions怎么用?Java FragmentManager.executePendingTransactions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.app.FragmentManager的用法示例。


在下文中一共展示了FragmentManager.executePendingTransactions方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onEventMainThread

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
public void onEventMainThread(ThrowableFailureEvent event) {
    if (!isInExecutionScope(executionScope, event)) {
        return;
    }
    checkLogException(event);
    // Execute pending commits before finding to avoid multiple error fragments being shown
    FragmentManager fm = getFragmentManager();
    fm.executePendingTransactions();

    DialogFragment existingFragment = (DialogFragment) fm.findFragmentByTag(TAG_ERROR_DIALOG);
    if (existingFragment != null) {
        // Just show the latest error
        existingFragment.dismiss();
    }

    android.support.v4.app.DialogFragment errorFragment = (android.support.v4.app.DialogFragment) factory
            .prepareErrorFragment(event, finishAfterDialog, argumentsForErrorDialog);
    if (errorFragment != null) {
        errorFragment.show(fm, TAG_ERROR_DIALOG);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:ErrorDialogManager.java

示例2: onEventMainThread

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
public void onEventMainThread(ThrowableFailureEvent event) {
    if (!isInExecutionScope(executionScope, event)) {
        return;
    }
    checkLogException(event);
    // Execute pending commits before finding to avoid multiple error fragments being shown
    FragmentManager fm = getFragmentManager();
    fm.executePendingTransactions();

    DialogFragment existingFragment = (DialogFragment) fm.findFragmentByTag(TAG_ERROR_DIALOG);
    if (existingFragment != null) {
        // Just show the latest error
        existingFragment.dismiss();
    }

    DialogFragment errorFragment = (DialogFragment) factory
            .prepareErrorFragment(event, finishAfterDialog, argumentsForErrorDialog);
    if (errorFragment != null) {
        errorFragment.show(fm, TAG_ERROR_DIALOG);
    }
}
 
开发者ID:devzwy,项目名称:KUtils,代码行数:22,代码来源:ErrorDialogManager.java

示例3: startLogin

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
/***
 * 跳转到登录
 * requestCode=1111
 */
public static void startLogin(FragmentActivity context, ActivityResultListner listener) {
    //先看activity是否添加过该fragment, 添加根据Tag找出 ,没有就添加
    FragmentManager manager = context.getSupportFragmentManager();
    MyFragment myFragment = null;
    Fragment loginf = manager.findFragmentByTag(MyFragment.LOGIN + "");
    if (loginf == null) {
        myFragment = new MyFragment();
        manager.beginTransaction().add(myFragment, MyFragment.LOGIN + "").commit();
        //这句是让commit立即生效,不然运行会报错,fragment还没有被attach
        manager.executePendingTransactions();
    } else {
        myFragment = (MyFragment) loginf;
    }
    //设置监听
    myFragment.setListener(listener);
    Intent intent = new Intent(context, loginActivity.class);
    myFragment.startActivityForResult(intent, MyFragment.LOGIN);
}
 
开发者ID:While1true,项目名称:JSSample,代码行数:23,代码来源:ActivityUtils.java

示例4: startWithPop

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
void startWithPop(final FragmentManager fragmentManager, SupportFragment from, SupportFragment to, String toFragmentTag) {
    fragmentManager.executePendingTransactions();
    if (from.isHidden()) {
        Log.e(TAG, from.getClass().getSimpleName() + " is hidden, " + "the transaction of startWithPop() is invalid!");
        return;
    }

    SupportFragment preFragment = getPreFragment(from);
    handlePopAnim(preFragment, from, to);

    FragmentTransaction removeFt = fragmentManager.beginTransaction().remove(from);
    supportCommit(fragmentManager, removeFt);
    debouncePop(from, fragmentManager);

    FragmentTransaction ft = fragmentManager.beginTransaction()
            .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
            .add(from.getContainerId(), to, toFragmentTag)
            .addToBackStack(toFragmentTag);

    if (preFragment != null) {
        ft.hide(preFragment);
    }

    supportCommit(fragmentManager, ft);
    fragmentManager.executePendingTransactions();
}
 
开发者ID:LonelyMushroom,项目名称:aarLibrary,代码行数:27,代码来源:FragmentationDelegate.java

示例5: popToFix

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
/**
 * To fix the FragmentManagerImpl.mAvailIndices incorrect ordering when pop() multiple Fragments
 * on pre-support-v4-25.4.0
 */
private void popToFix(String fragmentTag, int flag, final FragmentManager fragmentManager) {
    if (FragmentationHack.getActiveFragments(fragmentManager) == null) return;

    mSupport.getSupportDelegate().mPopMultipleNoAnim = true;
    fragmentManager.popBackStackImmediate(fragmentTag, flag);
    fragmentManager.executePendingTransactions();
    mSupport.getSupportDelegate().mPopMultipleNoAnim = false;

    mHandler.post(new Runnable() {
        @Override
        public void run() {
            FragmentationHack.reorderIndices(fragmentManager);
        }
    });
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:20,代码来源:TransactionDelegate.java

示例6: changeFragment

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
public static void changeFragment(FragmentActivity activity, Fragment nextFragment, boolean addToBackStack) {
        String name = nextFragment.getClass().getSimpleName();

        final FragmentManager fragmentManager = activity.getSupportFragmentManager();

        final FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.setCustomAnimations(R.anim.slide_left_in, R.anim.slide_right_in, R.anim.slide_left_out, R.anim.slide_right_out);

        fragmentTransaction.replace(R.id.frame_content, nextFragment);

        if (addToBackStack) {
            fragmentTransaction.addToBackStack(name);
        }
        try {
            fragmentTransaction.commitAllowingStateLoss();
            fragmentManager.executePendingTransactions();
        } catch (IllegalStateException e) {
        }

}
 
开发者ID:Ubudu,项目名称:GoogleMapsLayout-Android,代码行数:21,代码来源:FragmentUtils.java

示例7: getRxFacebookAuthFragment

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
/**
 * Get instance of RxSmartLockPasswordsFragment
 *
 * @return a RxSmartLockPasswordsFragment
 */
private RxSmartLockPasswordsFragment getRxFacebookAuthFragment(Builder builder) {
    FragmentManager fragmentManager = mActivity.getSupportFragmentManager();

    // prevent fragment manager already executing transaction
    int stackCount = fragmentManager.getBackStackEntryCount();
    if( fragmentManager.getFragments() != null )
        fragmentManager = fragmentManager.getFragments().get( stackCount > 0 ? stackCount-1 : stackCount ).getChildFragmentManager();

    RxSmartLockPasswordsFragment rxSmartLockPasswordsFragment = (RxSmartLockPasswordsFragment)
            fragmentManager.findFragmentByTag(RxSmartLockPasswordsFragment.TAG);

    if (rxSmartLockPasswordsFragment == null) {
        rxSmartLockPasswordsFragment = RxSmartLockPasswordsFragment.newInstance(builder);
        fragmentManager
                .beginTransaction()
                .add(rxSmartLockPasswordsFragment, RxSmartLockPasswordsFragment.TAG)
                .commit();
        fragmentManager.executePendingTransactions();
    }
    return rxSmartLockPasswordsFragment;
}
 
开发者ID:pchmn,项目名称:RxSocialAuth,代码行数:27,代码来源:RxSmartLockPasswords.java

示例8: getRxGoogleAuthFragment

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
/**
 * Get instance of RxGoogleAuthFragment
 *
 * @return a RxGoogleAuthFragment
 */
private RxGoogleAuthFragment getRxGoogleAuthFragment(Builder builder) {
    FragmentManager fragmentManager = mActivity.getSupportFragmentManager();

    // prevent fragment manager already executing transaction
    int stackCount = fragmentManager.getBackStackEntryCount();
    if( fragmentManager.getFragments() != null )
        fragmentManager = fragmentManager.getFragments().get( stackCount > 0 ? stackCount-1 : stackCount ).getChildFragmentManager();

    RxGoogleAuthFragment rxGoogleAuthFragment = (RxGoogleAuthFragment)
            mActivity.getSupportFragmentManager().findFragmentByTag(RxGoogleAuthFragment.TAG);

    if (rxGoogleAuthFragment == null) {
        rxGoogleAuthFragment = RxGoogleAuthFragment.newInstance(builder);
        fragmentManager
                .beginTransaction()
                .add(rxGoogleAuthFragment, RxGoogleAuthFragment.TAG)
                .commit();
        fragmentManager.executePendingTransactions();
    }
    return rxGoogleAuthFragment;
}
 
开发者ID:pchmn,项目名称:RxSocialAuth,代码行数:27,代码来源:RxGoogleAuth.java

示例9: attachTo

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
public static void attachTo(Activity activity, Object executionScope, boolean finishAfterDialog,
        Bundle argumentsForErrorDialog) {
    FragmentManager fm = ((FragmentActivity) activity).getSupportFragmentManager();
    SupportManagerFragment fragment = (SupportManagerFragment) fm.findFragmentByTag(TAG_ERROR_DIALOG_MANAGER);
    if (fragment == null) {
        fragment = new SupportManagerFragment();
        fm.beginTransaction().add(fragment, TAG_ERROR_DIALOG_MANAGER).commit();
        fm.executePendingTransactions();
    }
    fragment.finishAfterDialog = finishAfterDialog;
    fragment.argumentsForErrorDialog = argumentsForErrorDialog;
    fragment.executionScope = executionScope;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:ErrorDialogManager.java

示例10: onCreate

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.simple_scroll_activity);
    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
    FragmentManager fm = getSupportFragmentManager();
    if (fm.findFragmentByTag(ViewPagerTabFragmentParentFragment.FRAGMENT_TAG) == null) {
        FragmentTransaction ft = fm.beginTransaction();
        ft.add(R.id.fragment, new ViewPagerTabFragmentParentFragment(),
                ViewPagerTabFragmentParentFragment.FRAGMENT_TAG);
        ft.commit();
        fm.executePendingTransactions();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:ScrollObservablesActivity.java

示例11: from

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
@NonNull
static ResolutionFragment from(@NonNull FragmentManager fragmentManager) {
  ResolutionFragment resolutionFragment = (ResolutionFragment) fragmentManager.findFragmentByTag(TAG);
  if (resolutionFragment == null) {
    resolutionFragment = new ResolutionFragment();
    fragmentManager
        .beginTransaction()
        .add(resolutionFragment, TAG)
        .commit();
    fragmentManager.executePendingTransactions();
  }
  return resolutionFragment;
}
 
开发者ID:JetradarMobile,项目名称:android-rxlocationsettings,代码行数:14,代码来源:RxLocationSettings.java

示例12: openDialogInternal

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
@Override
protected DialogFragment openDialogInternal(FragmentManager fm) {
    if (fm.findFragmentByTag(DIALOG_FRAGMENT_TAG) != null) return null;

    Fragment fragment = new Fragment(this);
    MediaRouteSelector selector = mediaSource().buildRouteSelector();
    if (selector == null) return null;

    fragment.setRouteSelector(selector);
    fragment.show(fm, DIALOG_FRAGMENT_TAG);
    fm.executePendingTransactions();

    return fragment;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:15,代码来源:MediaRouteChooserDialogManager.java

示例13: openDialogInternal

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
@Override
protected DialogFragment openDialogInternal(FragmentManager fm) {
    if (fm.findFragmentByTag(DIALOG_FRAGMENT_TAG) != null) return null;

    Fragment fragment = new Fragment(this, mCallback);
    MediaRouteSelector selector = mediaSource().buildRouteSelector();
    if (selector == null) return null;

    androidMediaRouter().addCallback(selector, mCallback);

    fragment.show(fm, DIALOG_FRAGMENT_TAG);
    fm.executePendingTransactions();

    return fragment;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:16,代码来源:MediaRouteControllerDialogManager.java

示例14: getDetatchedValuesFragment

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
private ValuesFragment getDetatchedValuesFragment(boolean popBackStack) {
    FragmentManager fm = getSupportFragmentManager();
    ValuesFragment valuesFragment = (ValuesFragment) getSupportFragmentManager().findFragmentByTag(VALUES_FRAGMENT);
    if (valuesFragment == null) {
        valuesFragment = new ValuesFragment();
    } else {
        if (popBackStack) {
            fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
        }
        fm.beginTransaction().remove(valuesFragment).commit();
        fm.executePendingTransactions();
    }
    return valuesFragment;
}
 
开发者ID:rjaros87,项目名称:pm-home-station,代码行数:15,代码来源:MainActivity.java


注:本文中的android.support.v4.app.FragmentManager.executePendingTransactions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。