Merge "Work toggle button staying at the top when moving keyboard down" into tm-qpr-dev am: f17c581165

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/19914917

Change-Id: Ibeb53734770b3a854cb209e838fe06a6d3581ecd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Brandon Dayauon
2022-09-12 19:59:44 +00:00
committed by Automerger Merge Worker
@@ -170,12 +170,14 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi
@Override
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
if (Utilities.ATLEAST_R && isEnabled()) {
if (!Utilities.ATLEAST_R) {
return insets;
}
if (insets.isVisible(WindowInsets.Type.ime())) {
Insets keyboardInsets = insets.getInsets(WindowInsets.Type.ime());
setTranslationY(mInsets.bottom - keyboardInsets.bottom);
} else {
setTranslationY(0);
if (insets.isVisible(WindowInsets.Type.ime())) {
Insets keyboardInsets = insets.getInsets(WindowInsets.Type.ime());
setTranslationY(mInsets.bottom - keyboardInsets.bottom);
}
}
return insets;
}