Android: Ensure that Layout params are applied on editText
Make sure that the Layout parameters are applied to the editText before opening the Popup (in openContextMenu method). Without them, it may cause incorrect behavior. Especially in the case of the error: "E BufferLayer: dimension too large 212x9957 E SurfaceFlinger: createBufferLayer() failed (Invalid argument) E SurfaceComposerClinet: SurfaceComposerClien::createSurface error Invalid argument" It may cause crash. Fixes: QTBUG-129770 Change-Id: Ib9ef4b5b77fb1faf196e56431976c2a0e6e4a1e2 Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 0d4778497ee13f93ecaff9036ee7f5f6d24bb2a3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
6f56cc73ce
commit
4cbef8822a
@ -310,6 +310,12 @@ class QtActivityDelegate extends QtActivityDelegateBase
|
||||
return;
|
||||
}
|
||||
m_layout.setLayoutParams(focusedEditText, new QtLayout.LayoutParams(w, h, x, y), false);
|
||||
focusedEditText.requestLayout();
|
||||
focusedEditText.getViewTreeObserver().addOnGlobalLayoutListener(
|
||||
new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
focusedEditText.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
PopupMenu popup = new PopupMenu(m_activity, focusedEditText);
|
||||
QtActivityDelegate.this.onCreatePopupMenu(popup.getMenu());
|
||||
popup.setOnMenuItemClickListener(menuItem ->
|
||||
@ -317,6 +323,8 @@ class QtActivityDelegate extends QtActivityDelegateBase
|
||||
popup.setOnDismissListener(popupMenu ->
|
||||
m_activity.onContextMenuClosed(popupMenu.getMenu()));
|
||||
popup.show();
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
}
|
||||
// QtMenuInterface implementation end
|
||||
|
Loading…
x
Reference in New Issue
Block a user