本文整理汇总了Java中android.support.v4.app.FragmentTransaction.remove方法的典型用法代码示例。如果您正苦于以下问题:Java FragmentTransaction.remove方法的具体用法?Java FragmentTransaction.remove怎么用?Java FragmentTransaction.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.app.FragmentTransaction
的用法示例。
在下文中一共展示了FragmentTransaction.remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showCommentSoftKeyboard
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
private void showCommentSoftKeyboard(int voteState, String hint, boolean isComment, boolean isVote, boolean isVideoshotBack) {
FragmentManager fm = getSupportFragmentManager();
if (fm != null) {
FragmentTransaction ft = fm.beginTransaction();
sCommentSoftKeyboard = (HalfPlaySoftKeyboardFragment) fm.findFragmentByTag("showSoftKeybord");
if (sCommentSoftKeyboard == null) {
sCommentSoftKeyboard = new HalfPlaySoftKeyboardFragment();
} else {
ft.remove(sCommentSoftKeyboard);
}
Bundle bundle = new Bundle();
bundle.putString(HalfPlaySoftKeyboardFragment.BUNDLE_KEY_HINT, hint);
bundle.putInt(HalfPlaySoftKeyboardFragment.VOTE_STATE, voteState);
bundle.putBoolean(AlbumHalfCommentInterface.BUNDLE_KEY_IS_COMMENT, isComment);
bundle.putBoolean(AlbumHalfCommentInterface.BUNDLE_KEY_IS_VOTE, isVote);
bundle.putInt(HalfPlaySoftKeyboardFragment.TYPE_ININTIAL_COMMENT, 2);
bundle.putBoolean(AlbumHalfCommentInterface.BUNDLE_KEY_VIDEOSHOT_RETURN, isVideoshotBack);
sCommentSoftKeyboard.setMyBundleParam(bundle);
ft.add(sCommentSoftKeyboard, "showSoftKeybord");
ft.commitAllowingStateLoss();
}
}
示例2: showTracksChooserDialog
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
private void showTracksChooserDialog()
throws TransientNetworkDisconnectionException, NoConnectionException {
if(!(getContext() instanceof FragmentActivity))
throw new IllegalStateException("Activity needs to be FragmentActivity");
FragmentTransaction transaction = ((FragmentActivity)getContext()).getSupportFragmentManager().beginTransaction();
Fragment prev = ((FragmentActivity)getContext()).getSupportFragmentManager().findFragmentByTag(DIALOG_TAG);
if (prev != null) {
transaction.remove(prev);
}
transaction.addToBackStack(null);
// Create and show the dialog.
/* <--archos changes> */
ArchosTracksChooserDialog dialogFragment = ArchosTracksChooserDialog
.newInstance(ArchosVideoCastManager.getInstance().getMediaInfo());
/* <!--archos changes> */
dialogFragment.show(transaction, DIALOG_TAG);
}
示例3: showDialog
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
@OnClick(R.id.dialog_fragment)
public void showDialog() {
mStackLevel++;
// 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 = getSupportFragmentManager().beginTransaction();
Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog");
if (prev != null) {
ft.remove(prev);
}
ft.addToBackStack(null);
// Create and show the dialog.
MyDialogFragment newFragment = MyDialogFragment.newInstance(mStackLevel);
newFragment.show(ft, "ok");
}
示例4: hackRecreateFragment
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
/**
* Trick:
* Manually recreate fragment when corresponding data changed
*/
public void hackRecreateFragment(int position) {
final FragmentTransaction transaction = mFragmentManager.beginTransaction();
final String tag = makeFragmentTag(mContainerId, getItemId(position));
final Fragment oldFrg = mFragmentManager.findFragmentByTag(tag);
if (oldFrg != null) {
final Fragment newFrg = getItem(position);
transaction.remove(oldFrg);
transaction.add(mContainerId, newFrg, tag);
if (oldFrg != mCurrentPrimaryItem) {
newFrg.setMenuVisibility(false);
newFrg.setUserVisibleHint(false);
} else {
newFrg.setMenuVisibility(true);
newFrg.setUserVisibleHint(true);
}
}
transaction.commitNowAllowingStateLoss();
}
示例5: showAPIDrawer
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
/**
* Toggle API drawer
*/
public void showAPIDrawer(boolean b) {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_out_left,
R.anim.slide_out_left);
if (b) {
webviewFragment = new APIWebviewFragment();
Bundle bundle = new Bundle();
bundle.putString("url", "http://localhost:8585/reference.html");
webviewFragment.setArguments(bundle);
ft.add(R.id.fragmentWebview, webviewFragment).addToBackStack(null);
editorFragment.getView().animate().translationX(-50).setDuration(500).start();
} else {
editorFragment.getView().animate().translationX(0).setDuration(500).start();
ft.remove(webviewFragment);
}
ft.commit();
}
示例6: logoutLikeDialog
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
private void logoutLikeDialog() {
if (PreferencesManager.getInstance().isLogoutCommentLikeDialogVisible()) {
FragmentManager fm = ((FragmentActivity) this.context).getSupportFragmentManager();
if (fm != null) {
FragmentTransaction ft = fm.beginTransaction();
this.mLikeFragment = (HalfPlayCommentLikeFragment) fm.findFragmentByTag("showLikeLogout");
if (this.mLikeFragment == null) {
this.mLikeFragment = new HalfPlayCommentLikeFragment();
} else {
ft.remove(this.mLikeFragment);
}
ft.add(this.mLikeFragment, "showLikeLogout");
ft.commitAllowingStateLoss();
}
}
PreferencesManager.getInstance().setLogoutCommentLikeCount();
}
示例7: showTracksChooserDialog
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
private void showTracksChooserDialog()
throws TransientNetworkDisconnectionException, NoConnectionException {
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
Fragment prev = getSupportFragmentManager().findFragmentByTag(DIALOG_TAG);
if (prev != null) {
transaction.remove(prev);
}
transaction.addToBackStack(null);
// Create and show the dialog.
/* <--archos changes> */
ArchosTracksChooserDialog dialogFragment = ArchosTracksChooserDialog
.newInstance(ArchosVideoCastManager.getInstance().getMediaInfo());
/* <!--archos changes> */
dialogFragment.show(transaction, DIALOG_TAG);
}
示例8: clearBackStackFragmets
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
public void clearBackStackFragmets(FragmentManager fragmentManager)
{
// in my case I get the support fragment manager, it should work with the native one too
// FragmentManager fragmentManager = getSupportFragmentManager();
// this will clear the back stack and displays no animation on the screen
fragmentManager.popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
// fragmentManager.popBackStackImmediate(SplashFragment.class.getCanonicalName(),FragmentManager.POP_BACK_STACK_INCLUSIVE);
List<Fragment> fragmentList = fragmentManager.getFragments();
if (fragmentList != null && !fragmentList.isEmpty())
{
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
for (Fragment fragment : fragmentList)
{
if (fragment != null)
{
fragmentTransaction.remove(fragment);
}
}
fragmentTransaction.commit();
}
// Methods.hideKeyboard();
}
示例9: showDialogFragment
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
/**
* Shows a dialog UI to the user. Only one dialog will be shown at a time and if there is
* already an existing one it will be replaced. This can be used for showing application or
* block specific UIs, such as a mutator UI. When the user finishes using the fragment
* {@link #closeDialogFragment()} should be called.
*
* @param fragment The fragment to show.
*/
public void showDialogFragment(@NonNull DialogFragment fragment) {
if (fragment == mDialogFragment) {
return;
}
FragmentTransaction ft = mActivity.getSupportFragmentManager().beginTransaction();
if (mDialogFragment != null) {
ft.remove(mDialogFragment);
}
fragment.show(ft, "blockly_dialog");
mDialogFragment = fragment;
}
示例10: display
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
public static void display(FragmentManager fm) {
FragmentTransaction ft = fm.beginTransaction();
Fragment prev = fm.findFragmentByTag(TAG);
if (prev != null) {
ft.remove(prev);
}
AboutFragment.newInstance().show(ft, TAG);
}
示例11: closeFragment
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
private void closeFragment(){
isFragmentOpen = false;
scrollViewPoll.setVisibility(View.VISIBLE);
ivNext.setVisibility(View.INVISIBLE);
tvHeader.setText(getIntent().getStringExtra("poll").toUpperCase());
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
Fragment fragment = fragmentManager.findFragmentById(R.id.fragmentContainer);
fragmentTransaction.remove(fragment);
fragmentTransaction.commit();
}
示例12: show
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
public void show(FragmentManager fragmentManager, String tag) {
FragmentTransaction transaction = fragmentManager.beginTransaction();
Fragment prevFragment = fragmentManager.findFragmentByTag(tag);
if (prevFragment != null) {
transaction.remove(prevFragment);
}
transaction.addToBackStack(null);
show(transaction, tag);
}
示例13: remove
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
private void remove(int position, FragmentTransaction transaction) {
String tag = mAdapter.getTag(position);
Fragment fragment = mFragmentManager.findFragmentByTag(tag);
if (fragment != null) {
transaction.remove(fragment);
}
}
示例14: display
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
public static void display(FragmentManager fm) {
FragmentTransaction ft = fm.beginTransaction();
Fragment prev = fm.findFragmentByTag(TAG);
if (prev != null) {
ft.remove(prev);
}
DonationFragment.newInstance().show(ft, TAG);
}
示例15: closeDialogFragment
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
/**
* Closes the currently open {@link DialogFragment} if there is one.
*
* @return True if there was a dialog and it was closed, false otherwise.
*/
public boolean closeDialogFragment() {
if (mDialogFragment != null) {
FragmentTransaction ft = mActivity.getSupportFragmentManager().beginTransaction();
ft.remove(mDialogFragment);
ft.commit();
mDialogFragment = null;
return true;
}
return false;
}