Fixed #91 in a better way

This commit is contained in:
vanitasvitae 2016-10-27 12:55:42 +02:00
parent 6e1e473aff
commit d34c75a647
Signed by: vanitasvitae
GPG Key ID: DCCFB3302C9E4615
3 changed files with 14 additions and 10 deletions

View File

@ -313,6 +313,11 @@ public class MainActivity extends ThemedActivity
AppLog.v(this, "Fragment was not visible. Replace it.");
fm.beginTransaction().addToBackStack(null).replace(R.id.fragment_container, fragment, fragment.getFragmentTag()).commit();
invalidateOptionsMenu();
if (appSettings.isIntellihideToolbars() && fragment.isAllowedIntellihide()) {
this.enableToolbarHiding();
} else {
this.disableToolbarHiding();
}
} else {
AppLog.v(this, "Fragment was already visible. Do nothing.");
}
@ -576,16 +581,6 @@ public class MainActivity extends ThemedActivity
LocalBroadcastManager.getInstance(this).registerReceiver(brOpenExternalLink, new IntentFilter(ACTION_OPEN_EXTERNAL_URL));
invalidateOptionsMenu();
this.appSettings = getAppSettings();
boolean podSelection = getTopFragment() != null && getTopFragment().getFragmentTag().equals(PodSelectionFragment.TAG);
if (appSettings.isIntellihideToolbars()) {
if(podSelection) {
this.disableToolbarHiding();
} else {
this.enableToolbarHiding();
}
} else {
this.disableToolbarHiding();
}
updateNavigationViewEntryVisibilities();
}

View File

@ -282,4 +282,9 @@ public class PodSelectionFragment extends ThemedFragment implements SearchView.O
public boolean onBackPressed() {
return false;
}
@Override
public boolean isAllowedIntellihide() {
return false;
}
}

View File

@ -65,5 +65,9 @@ public abstract class CustomFragment extends Fragment {
* @return did we react to the back press?
*/
public abstract boolean onBackPressed();
public boolean isAllowedIntellihide() {
return true;
}
}