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

Loading…
Cancel
Save