本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
示例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();
}
示例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);
}
});
}
示例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) {
}
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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;
}
示例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;
}