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


Java FragmentTransaction.remove方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:23,代码来源:AlbumCommentDetailActivity.java

示例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);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:20,代码来源:ArchosMiniPlayer.java

示例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");
}
 
开发者ID:pchmn,项目名称:MaterialChipsInput,代码行数:19,代码来源:MainActivity.java

示例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();
}
 
开发者ID:nekocode,项目名称:Hubs,代码行数:27,代码来源:ExFragmentPagerAdapter.java

示例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();
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:25,代码来源:EditorActivity.java

示例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();
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:18,代码来源:AlbumHalfCommentController.java

示例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);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:18,代码来源:CastPlayerActivity.java

示例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();


    }
 
开发者ID:QuixomTech,项目名称:DeviceInfo,代码行数:27,代码来源:FragmentUtil.java

示例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;
}
 
开发者ID:Axe-Ishmael,项目名称:Blockly,代码行数:21,代码来源:BlocklyActivityHelper.java

示例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);
}
 
开发者ID:m2049r,项目名称:xmrwallet,代码行数:10,代码来源:AboutFragment.java

示例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();
}
 
开发者ID:StringflowServer,项目名称:Beach-Android,代码行数:12,代码来源:PollActivity.java

示例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);
}
 
开发者ID:MindorksOpenSource,项目名称:android-mvvm-architecture,代码行数:10,代码来源:BaseDialog.java

示例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);
    }
}
 
开发者ID:Sherchen,项目名称:AnimationsDemo,代码行数:8,代码来源:FragmentNavigator.java

示例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);
}
 
开发者ID:m2049r,项目名称:xmrwallet,代码行数:10,代码来源:DonationFragment.java

示例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;
}
 
开发者ID:Axe-Ishmael,项目名称:Blockly,代码行数:16,代码来源:BlocklyActivityHelper.java


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