mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-27 11:25:13 +01:00
Always inset keyboard
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user