Merge "Android: Fix constant resize of a large TextEdit on click"
This commit is contained in:
commit
153716a914
@ -57,6 +57,7 @@ import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.UriPermission;
|
||||
import android.graphics.Rect;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
@ -67,6 +68,7 @@ import android.content.ClipboardManager.OnPrimaryClipChangedListener;
|
||||
import android.content.ClipData;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.util.Log;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
@ -116,6 +118,7 @@ public class QtNative
|
||||
public static QtThread m_qtThread = new QtThread();
|
||||
private static HashMap<String, Uri> m_cachedUris = new HashMap<String, Uri>();
|
||||
private static ArrayList<String> m_knownDirs = new ArrayList<String>();
|
||||
private static final int KEYBOARD_HEIGHT_THRESHOLD = 100;
|
||||
|
||||
private static final Runnable runPendingCppRunnablesRunnable = new Runnable() {
|
||||
@Override
|
||||
@ -949,6 +952,17 @@ public class QtNative
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isSoftwareKeyboardVisible()
|
||||
{
|
||||
Activity activity = QtNative.activity();
|
||||
Rect r = new Rect();
|
||||
activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(r);
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
final int kbHeight = metrics.heightPixels - r.bottom;
|
||||
return (kbHeight >= KEYBOARD_HEIGHT_THRESHOLD);
|
||||
}
|
||||
|
||||
private static void notifyAccessibilityLocationChange()
|
||||
{
|
||||
runAction(new Runnable() {
|
||||
|
@ -58,7 +58,6 @@ using namespace QtAndroid;
|
||||
namespace QtAndroidInput
|
||||
{
|
||||
static bool m_ignoreMouseEvents = false;
|
||||
static bool m_softwareKeyboardVisible = false;
|
||||
static QRect m_softwareKeyboardRect;
|
||||
|
||||
static QList<QWindowSystemInterface::TouchPoint> m_touchPoints;
|
||||
@ -114,7 +113,7 @@ namespace QtAndroidInput
|
||||
|
||||
bool isSoftwareKeyboardVisible()
|
||||
{
|
||||
return m_softwareKeyboardVisible;
|
||||
return QJniObject::callStaticMethod<jboolean>(applicationClass(), "isSoftwareKeyboardVisible");
|
||||
}
|
||||
|
||||
QRect softwareKeyboardRect()
|
||||
@ -807,7 +806,6 @@ namespace QtAndroidInput
|
||||
|
||||
static void keyboardVisibilityChanged(JNIEnv */*env*/, jobject /*thiz*/, jboolean visibility)
|
||||
{
|
||||
m_softwareKeyboardVisible = visibility;
|
||||
if (!visibility)
|
||||
m_softwareKeyboardRect = QRect();
|
||||
|
||||
|
@ -890,10 +890,11 @@ void QAndroidInputContext::showInputPanel()
|
||||
m_updateCursorPosConnection = connect(qGuiApp->focusObject(), SIGNAL(cursorPositionChanged()), this, SLOT(updateCursorPosition()));
|
||||
|
||||
QRect rect = cursorRect();
|
||||
QtAndroidInput::showSoftwareKeyboard(rect.left(), rect.top(), rect.width(), rect.height(),
|
||||
screenInputItemRectangle().height(),
|
||||
query->value(Qt::ImHints).toUInt(),
|
||||
query->value(Qt::ImEnterKeyType).toUInt());
|
||||
if (!isInputPanelVisible())
|
||||
QtAndroidInput::showSoftwareKeyboard(rect.left(), rect.top(), rect.width(), rect.height(),
|
||||
screenInputItemRectangle().height(),
|
||||
query->value(Qt::ImHints).toUInt(),
|
||||
query->value(Qt::ImEnterKeyType).toUInt());
|
||||
}
|
||||
|
||||
QRect QAndroidInputContext::cursorRect()
|
||||
|
Loading…
Reference in New Issue
Block a user