Commit ac08450b authored by Friedrich Horschig's avatar Friedrich Horschig Committed by Commit Bot

[Android] Revert bottom controls adjustment for accessory

Since crrev.com/c/1233716, the keyboard accessory doesn't affect the
bottom controls anymore - which is largely correct since it uses a
separate mechanism to reserve that space.
Unfortunatly, the BottomToolbar (Chrome Duet feature) doesn't recognize
the opened accessory sheet as a keyboard and reserves space for bottom
controls that don't exist.

This will change when the way keyboards are detected is reworked in
crrev.com/c/1286426 but until this and its ancestor lands, the effects
of the accessory on the bottom controls are reintroduces with this CL.

Bug: 894747
Change-Id: I0467d10700c597cfe5fbf8a6463b220268ad6160
Reviewed-on: https://chromium-review.googlesource.com/c/1288592Reviewed-by: default avatarIoana Pandele <ioanap@chromium.org>
Commit-Queue: Friedrich Horschig [CEST] <fhorschig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600738}
parent 96329911
...@@ -47,6 +47,7 @@ class ManualFillingMediator ...@@ -47,6 +47,7 @@ class ManualFillingMediator
this::onKeyboardVisibilityChanged; this::onKeyboardVisibilityChanged;
private Supplier<InsetObserverView> mInsetObserverViewSupplier; private Supplier<InsetObserverView> mInsetObserverViewSupplier;
private boolean mShouldShow = false; private boolean mShouldShow = false;
private @Px int mPreviousControlHeight; // TODO(fhorschig): Remove after crrev.com/c/1286426.
private final KeyboardExtensionSizeManager mKeyboardExtensionSizeManager = private final KeyboardExtensionSizeManager mKeyboardExtensionSizeManager =
new KeyboardExtensionSizeManager(); new KeyboardExtensionSizeManager();
...@@ -159,6 +160,7 @@ class ManualFillingMediator ...@@ -159,6 +160,7 @@ class ManualFillingMediator
@Override @Override
public void didSelectTab(Tab tab, @TabModel.TabSelectionType int type, int lastId) { public void didSelectTab(Tab tab, @TabModel.TabSelectionType int type, int lastId) {
mActiveBrowserTab = tab; mActiveBrowserTab = tab;
mPreviousControlHeight = mActivity.getFullscreenManager().getBottomControlsHeight();
restoreCachedState(tab); restoreCachedState(tab);
} }
...@@ -284,6 +286,8 @@ class ManualFillingMediator ...@@ -284,6 +286,8 @@ class ManualFillingMediator
} }
mKeyboardAccessory.requestShowing(); mKeyboardAccessory.requestShowing();
mKeyboardExtensionSizeManager.setKeyboardExtensionHeight(calculateAccessoryBarHeight()); mKeyboardExtensionSizeManager.setKeyboardExtensionHeight(calculateAccessoryBarHeight());
// TODO(fhorschig): Remove after crrev.com/c/1286426:
mActivity.getFullscreenManager().setBottomControlsHeight(0);
mKeyboardAccessory.closeActiveTab(); mKeyboardAccessory.closeActiveTab();
updateInfobarState(true); updateInfobarState(true);
mKeyboardAccessory.setBottomOffset(0); mKeyboardAccessory.setBottomOffset(0);
...@@ -315,6 +319,7 @@ class ManualFillingMediator ...@@ -315,6 +319,7 @@ class ManualFillingMediator
if (mWindowAndroid.getKeyboardDelegate().isKeyboardShowing(mActivity, contentView)) { if (mWindowAndroid.getKeyboardDelegate().isKeyboardShowing(mActivity, contentView)) {
return; // If the keyboard is showing or is starting to show, the sheet closes gently. return; // If the keyboard is showing or is starting to show, the sheet closes gently.
} }
mActivity.getFullscreenManager().setBottomControlsHeight(mPreviousControlHeight);
mKeyboardExtensionSizeManager.setKeyboardExtensionHeight(0); mKeyboardExtensionSizeManager.setKeyboardExtensionHeight(0);
mKeyboardAccessory.closeActiveTab(); mKeyboardAccessory.closeActiveTab();
updateInfobarState(false); updateInfobarState(false);
...@@ -349,6 +354,8 @@ class ManualFillingMediator ...@@ -349,6 +354,8 @@ class ManualFillingMediator
mKeyboardAccessory.setBottomOffset(newControlsOffset); mKeyboardAccessory.setBottomOffset(newControlsOffset);
mKeyboardExtensionSizeManager.setKeyboardExtensionHeight( mKeyboardExtensionSizeManager.setKeyboardExtensionHeight(
mKeyboardAccessory.isShown() ? newControlsHeight : 0); mKeyboardAccessory.isShown() ? newControlsHeight : 0);
mActivity.getFullscreenManager().setBottomControlsHeight(
mKeyboardAccessory.isShown() ? 0 : mPreviousControlHeight);
mActivity.getFullscreenManager().updateViewportSize(); mActivity.getFullscreenManager().updateViewportSize();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment