diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index 01aa55c19e..c85104b11e 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -45,6 +45,7 @@ package org.qtproject.qt5.android; import android.app.Activity; import android.content.Context; import android.content.Intent; +import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Configuration; @@ -110,6 +111,7 @@ public class QtActivityDelegate private String m_mainLib; private long m_metaState; private int m_lastChar = 0; + private int m_softInputMode = 0; private boolean m_fullScreen = false; private boolean m_started = false; private HashMap m_surfaces = null; @@ -246,10 +248,12 @@ public class QtActivityDelegate if (m_imm == null) return; - if (height > m_layout.getHeight() * 2 / 3) - m_activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); - else + if (m_softInputMode == 0 && height > m_layout.getHeight() * 2 / 3) + m_activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); + else if (m_softInputMode == 0) m_activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); + else + m_activity.getWindow().setSoftInputMode(m_softInputMode); int initialCapsMode = 0; int imeOptions = android.view.inputmethod.EditorInfo.IME_ACTION_DONE; @@ -474,6 +478,12 @@ public class QtActivityDelegate else m_applicationParameters = ""; + try { + m_softInputMode = m_activity.getPackageManager().getActivityInfo(m_activity.getComponentName(), 0).softInputMode; + } catch (Exception e) { + e.printStackTrace(); + } + return true; }