mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-20 07:53:37 +02:00
Use ViewCompat to get keyboard status
This commit is contained in:
@@ -119,6 +119,7 @@ import androidx.constraintlayout.widget.Group;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
import androidx.core.view.MenuCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.cursoradapter.widget.SimpleCursorAdapter;
|
||||
import androidx.exifinterface.media.ExifInterface;
|
||||
@@ -5130,13 +5131,15 @@ public class FragmentCompose extends FragmentBase {
|
||||
EntityIdentity identity = (EntityIdentity) spIdentity.getSelectedItem();
|
||||
|
||||
View focus = view.findFocus();
|
||||
|
||||
boolean ime = true;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R)
|
||||
try {
|
||||
ime = view.getRootWindowInsets().isVisible(WindowInsetsCompat.Type.ime());
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
try {
|
||||
WindowInsetsCompat insets = ViewCompat.getRootWindowInsets(focus);
|
||||
if (insets != null)
|
||||
ime = insets.isVisible(WindowInsetsCompat.Type.ime());
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
|
||||
// Workaround underlines left by Android
|
||||
HtmlHelper.clearComposingText(etBody);
|
||||
|
||||
Reference in New Issue
Block a user