Skip to content
Snippets Groups Projects
Commit 4f4ca9f0 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Get correct currently displayed fragment

parent 773128bb
No related branches found
No related tags found
No related merge requests found
......@@ -702,8 +702,14 @@ public class MainActivity extends ContentActivity implements FilterQueryProvider
protected Fragment getCurrentFragment() {
return mCurrentFragment instanceof BaseBrowserFragment || currentIdIsExtension()
? getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder)
: mCurrentFragment;
? getFirstVisibleFragment() : mCurrentFragment;
}
private Fragment getFirstVisibleFragment() {
for (Fragment fragment : getSupportFragmentManager().getFragments())
if (!fragment.isHidden() && fragment.getClass().isInstance(mCurrentFragment))
return fragment;
return mCurrentFragment;
}
public boolean currentIdIsExtension() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment