Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有没有办法专门pop一个指定fragment? #1232

Closed
mikilangkilo opened this issue Dec 30, 2019 · 2 comments
Closed

有没有办法专门pop一个指定fragment? #1232

mikilangkilo opened this issue Dec 30, 2019 · 2 comments

Comments

@mikilangkilo
Copy link

Issues Guideline

Following information can help us to resolve the issue faster.

  • Library version 1.0.2x
  • Support-v4 version true
  • Logs no
  • Screenshots no

In addition, we do not accept issues unrelated to Fragmentation.

我们接了fragmentation,使用isupportfragment来做的插入。

但是发现只有pop()是回退的操作,因此在basefragment里面的onbackpressed()中执行了pop()做回退。

结果目前发现在monkey过程中,快速点击造成onbackpressed执行了2次,同时执行了2次pop,导致多回退了一个fragment。

请问有没有办法单独pop一个指定的当前的fragment?

@mikilangkilo
Copy link
Author

TransactionDelegate 这个类的的pop()方法中

void pop(final FragmentManager fm) {
        enqueue(fm, new Action(Action.ACTION_POP, fm) {
            @Override
            public void run() {
                handleAfterSaveInStateTransactionException(fm, "pop()");
                FragmentationMagician.popBackStackAllowingStateLoss(fm);
                removeTopFragment(fm);
            }
        });
    }

发现主要问题是这里没有做判断topfragment是否是当前framgent,导致当前fragment变动,快速点击触发的多余的action还是会执行。

另外大大真的不维护了吗??

@JantHsueh
Copy link

@GWYloved 这个应该是防抖动的操作,你的项目有使用SupportActivity(继承或者实现的方式)吗?

另外这个库,我在继续维护,已经发布了新版本#1237

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants