1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-22 12:22:08 +01:00

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."); AppLog.v(this, "Fragment was not visible. Replace it.");
fm.beginTransaction().addToBackStack(null).replace(R.id.fragment_container, fragment, fragment.getFragmentTag()).commit(); fm.beginTransaction().addToBackStack(null).replace(R.id.fragment_container, fragment, fragment.getFragmentTag()).commit();
invalidateOptionsMenu(); invalidateOptionsMenu();
if (appSettings.isIntellihideToolbars() && fragment.isAllowedIntellihide()) {
this.enableToolbarHiding();
} else {
this.disableToolbarHiding();
}
} else { } else {
AppLog.v(this, "Fragment was already visible. Do nothing."); 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)); LocalBroadcastManager.getInstance(this).registerReceiver(brOpenExternalLink, new IntentFilter(ACTION_OPEN_EXTERNAL_URL));
invalidateOptionsMenu(); invalidateOptionsMenu();
this.appSettings = getAppSettings(); 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(); updateNavigationViewEntryVisibilities();
} }

View file

@ -282,4 +282,9 @@ public class PodSelectionFragment extends ThemedFragment implements SearchView.O
public boolean onBackPressed() { public boolean onBackPressed() {
return false; 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? * @return did we react to the back press?
*/ */
public abstract boolean onBackPressed(); public abstract boolean onBackPressed();
public boolean isAllowedIntellihide() {
return true;
}
} }