Work toggle button staying at the top when moving keyboard down

- Same fix from implementation when implementing extendedFAB. ag/19223926
- Essentiall remove isEnabled() check since it is not needed
bug: 235873194
test: Manual - before: https://drive.google.com/file/d/1JjDSudWS56fiDyMnP8Btvy0pWFyUIXND/view?usp=sharing
after: https://drive.google.com/file/d/1Ja-OVpXKK1yUrixpU_V6WsLV0Ryw152w/view?usp=sharing

Change-Id: Ibca405deccfcd61845dd4f5952ad196af1ab3fe2
This commit is contained in:
Brandon Dayauon
2022-09-09 15:04:42 -07:00
parent 94a54203f3
commit fa6011fcdf

View File

@@ -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;
}