Respect android:windowSoftInputMode in manifest.

Read and store softInputMode set at AndroidManifest.xml on QtActivityDelegate.
When showSoftwareKeyboard is requested setSoftInputMode for main window if
softInputMode is not defined fall back to old behavior.

Change-Id: I71cb27d4bdb4ae4e3c2a0706560173703a2f5a50
Task-number: QTBUG-34401
Reviewed-by: BogDan Vatra <bogdan@kde.org>
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
This commit is contained in:
Samuel Nevala 2014-09-03 13:27:27 +03:00
parent b9e3f59551
commit 105fa5b5d9

View File

@ -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<Integer, QtSurface> 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;
}