summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVova Mshanetskiy <vovams163@gmail.com>2019-05-07 15:26:32 +0300
committerVova Mshanetskiy <vovams163@gmail.com>2019-05-10 20:24:07 +0000
commit341c9106881810962f253c1502d2c4f6da90e149 (patch)
treea7456bf51028d1ec34c46fac43c6283a69748cca
parentc905ff4392ee0f71b5b003ee3ed4fa42f4e3f8f1 (diff)
Android: Fix wrong height of text editor context menu in some locales
Combined width of all four buttons (cut, copy, paste, select all) is greater than width of the screen in some locales and/or on some devices. This was causing width of the last button to be set to zero and height of the whole popup to grow too much due to word wrapping in the last button. The context menu used to look something like this then: Cut Copy Paste S e l e c t a l l This commit disables word wrapping and enables text ellipsizing for button labels. This fixes height of the popup. In the long term though Qt will probably have to implement an overflow button like in Android's built context menu. The linked bug report contains before and after screenshots. Fixes: QTBUG-72933 Change-Id: I8e270dbf8ca66f99748cdc531a77e11a5ab11c2b Reviewed-by: BogDan Vatra <bogdan@kdab.com>
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/EditContextView.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/android/jar/src/org/qtproject/qt5/android/EditContextView.java b/src/android/jar/src/org/qtproject/qt5/android/EditContextView.java
index 6d9987ca2a..104132934d 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/EditContextView.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/EditContextView.java
@@ -41,6 +41,7 @@ package org.qtproject.qt5.android;
import android.content.Context;
+import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
@@ -73,7 +74,7 @@ public class EditContextView extends LinearLayout implements View.OnClickListene
m_buttonId = stringId;
setText(stringId);
setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
- ViewGroup.LayoutParams.WRAP_CONTENT));
+ ViewGroup.LayoutParams.WRAP_CONTENT, 1));
setGravity(Gravity.CENTER);
setTextColor(getResources().getColor(R.color.widget_edittext_dark));
EditContextView.this.setBackground(getResources().getDrawable(R.drawable.editbox_background_normal));
@@ -81,6 +82,8 @@ public class EditContextView extends LinearLayout implements View.OnClickListene
int hPadding = (int)(16 * scale + 0.5f);
int vPadding = (int)(8 * scale + 0.5f);
setPadding(hPadding, vPadding, hPadding, vPadding);
+ setSingleLine();
+ setEllipsize(TextUtils.TruncateAt.END);
setOnClickListener(EditContextView.this);
}
}