Merge "Work toggle button staying at the top when moving keyboard down" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f17c581165
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user