Reset sticky navbar timeout when rotate btn shown

First revealing the navbar and then rotating in an
immersive sticky activity makes the rotate navbar button
hard to tap. Signal to the navbar to reset sticky hiding
timeouts if the button becomes visible or changes.

Change-Id: I381bbfd2e0192465b8358bedd213f23dde8ec982
Fixes: 78248328
Test: manual testing with custom immersive sticky activity
This commit is contained in:
Mike Digman
2018-04-19 10:50:35 -07:00
parent 069c5b58b0
commit 9b50b76700
2 changed files with 11 additions and 3 deletions

View File

@@ -546,7 +546,12 @@ public class NavigationBarFragment extends Fragment implements Callbacks {
// Set visibility, may fail if a11y service is active.
// If invisible, call will stop animation.
mNavigationBarView.setRotateButtonVisibility(true);
int appliedVisibility = mNavigationBarView.setRotateButtonVisibility(true);
if (appliedVisibility == View.VISIBLE) {
// If the button will actually become visible and the navbar is about to hide,
// tell the statusbar to keep it around for longer
mStatusBar.touchAutoHide();
}
} else { // Hide

View File

@@ -772,13 +772,13 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
if (setIcon) getRotateSuggestionButton().setImageDrawable(mRotateSuggestionIcon);
}
public void setRotateButtonVisibility(final boolean visible) {
public int setRotateButtonVisibility(final boolean visible) {
// Never show if a11y is visible
final boolean adjVisible = visible && !mShowAccessibilityButton;
final int vis = adjVisible ? View.VISIBLE : View.INVISIBLE;
// No need to do anything if the request matches the current state
if (vis == getRotateSuggestionButton().getVisibility()) return;
if (vis == getRotateSuggestionButton().getVisibility()) return vis;
getRotateSuggestionButton().setVisibility(vis);
mShowRotateButton = visible;
@@ -795,6 +795,9 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
// Hide/restore other button visibility, if necessary
updateNavButtonIcons();
// Return applied visibility
return vis;
}
public boolean isRotateButtonVisible() { return mShowRotateButton; }