Disabled keyboard inset animation

pull/215/head
M66B 6 months ago
parent 27bea3a1c1
commit ce80f00313

@ -170,6 +170,11 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
mlp.bottomMargin = insets.bottom; mlp.bottomMargin = insets.bottom;
v.setLayoutParams(mlp); v.setLayoutParams(mlp);
if (ActivityBase.this instanceof ActivityCompose) {
int bottom = windowInsets.getInsets(WindowInsetsCompat.Type.ime()).bottom;
v.setPaddingRelative(0, 0, 0, bottom - insets.bottom);
}
if (edge_to_edge) if (edge_to_edge)
for (View child : Helper.getViewsWithTag(v, "inset")) { for (View child : Helper.getViewsWithTag(v, "inset")) {
mlp = (ViewGroup.MarginLayoutParams) child.getLayoutParams(); mlp = (ViewGroup.MarginLayoutParams) child.getLayoutParams();
@ -184,31 +189,32 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
return WindowInsetsCompat.CONSUMED; return WindowInsetsCompat.CONSUMED;
}); });
ViewCompat.setWindowInsetsAnimationCallback( if (false)
holder, ViewCompat.setWindowInsetsAnimationCallback(
new WindowInsetsAnimationCompat.Callback(WindowInsetsAnimationCompat.Callback.DISPATCH_MODE_STOP) { holder,
@NonNull new WindowInsetsAnimationCompat.Callback(WindowInsetsAnimationCompat.Callback.DISPATCH_MODE_STOP) {
@Override @NonNull
public WindowInsetsCompat onProgress( @Override
@NonNull WindowInsetsCompat windowInsets, public WindowInsetsCompat onProgress(
@NonNull List<WindowInsetsAnimationCompat> runningAnimations) { @NonNull WindowInsetsCompat windowInsets,
try { @NonNull List<WindowInsetsAnimationCompat> runningAnimations) {
// https://developer.android.com/develop/ui/views/layout/sw-keyboard try {
for (WindowInsetsAnimationCompat animation : runningAnimations) // https://developer.android.com/develop/ui/views/layout/sw-keyboard
if ((animation.getTypeMask() & WindowInsetsCompat.Type.ime()) != 0) { for (WindowInsetsAnimationCompat animation : runningAnimations)
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()); if ((animation.getTypeMask() & WindowInsetsCompat.Type.ime()) != 0) {
int bottom = windowInsets.getInsets(WindowInsetsCompat.Type.ime()).bottom; Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
int pad = bottom - insets.bottom; int bottom = windowInsets.getInsets(WindowInsetsCompat.Type.ime()).bottom;
holder.setPaddingRelative(0, 0, 0, pad < 0 ? 0 : pad); int pad = bottom - insets.bottom;
break; holder.setPaddingRelative(0, 0, 0, pad < 0 ? 0 : pad);
} break;
} catch (Throwable ex) { }
Log.e(ex); } catch (Throwable ex) {
Log.e(ex);
}
return windowInsets;
} }
});
return windowInsets;
}
});
super.setContentView(holder); super.setContentView(holder);

Loading…
Cancel
Save