mirror of https://github.com/M66B/FairEmail.git
Always inset keyboard
This commit is contained in:
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…
Reference in New Issue