Use ViewCompat to get keyboard status

pull/217/head
M66B 11 months ago
parent 20a248f5c1
commit dca266d069

@ -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);

Loading…
Cancel
Save