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

This commit is contained in:
Brandon Dayauon
2022-09-12 19:15:20 +00:00
committed by Android (Google) Code Review
@@ -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;
}