Always inset keyboard

pull/215/head
M66B 7 months ago
parent 9e131fb359
commit 00d08c72f4

@ -180,32 +180,31 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
return WindowInsetsCompat.CONSUMED;
});
if (this instanceof ActivityCompose)
ViewCompat.setWindowInsetsAnimationCallback(
holder,
new WindowInsetsAnimationCompat.Callback(WindowInsetsAnimationCompat.Callback.DISPATCH_MODE_STOP) {
@NonNull
@Override
public WindowInsetsCompat onProgress(
@NonNull WindowInsetsCompat windowInsets,
@NonNull List<WindowInsetsAnimationCompat> runningAnimations) {
try {
// https://developer.android.com/develop/ui/views/layout/sw-keyboard
for (WindowInsetsAnimationCompat animation : runningAnimations)
if ((animation.getTypeMask() & WindowInsetsCompat.Type.ime()) != 0) {
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
int bottom = windowInsets.getInsets(WindowInsetsCompat.Type.ime()).bottom;
int pad = bottom - insets.bottom;
holder.setPaddingRelative(0, 0, 0, pad < 0 ? 0 : pad);
break;
}
} catch (Throwable ex) {
Log.e(ex);
}
return windowInsets;
ViewCompat.setWindowInsetsAnimationCallback(
holder,
new WindowInsetsAnimationCompat.Callback(WindowInsetsAnimationCompat.Callback.DISPATCH_MODE_STOP) {
@NonNull
@Override
public WindowInsetsCompat onProgress(
@NonNull WindowInsetsCompat windowInsets,
@NonNull List<WindowInsetsAnimationCompat> runningAnimations) {
try {
// https://developer.android.com/develop/ui/views/layout/sw-keyboard
for (WindowInsetsAnimationCompat animation : runningAnimations)
if ((animation.getTypeMask() & WindowInsetsCompat.Type.ime()) != 0) {
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
int bottom = windowInsets.getInsets(WindowInsetsCompat.Type.ime()).bottom;
int pad = bottom - insets.bottom;
holder.setPaddingRelative(0, 0, 0, pad < 0 ? 0 : pad);
break;
}
} catch (Throwable ex) {
Log.e(ex);
}
});
return windowInsets;
}
});
super.setContentView(holder);

Loading…
Cancel
Save