Skip to content

Commit

Permalink
Better popup location
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonHalvdansson committed Sep 16, 2023
1 parent bb2bcb8 commit 119159f
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,10 @@ public boolean onMenuItemClick(MenuItem item) {
fieldPopup.setAccessible(true);
Object menuPopupHelper = fieldPopup.get(popupMenu);

//the reason for the -10 - height/3 thing is so match the popup location better
//with the press location - for some reason this is necessary.
int targetX = x - Utils.pxFromDpInt(getResources(), 56);
int targetY = y - topInset - Utils.pxFromDpInt(getResources(), 20);
int targetY = y - topInset - Utils.pxFromDpInt(getResources(), 10) - v.getHeight()/3;

menuPopupHelper.getClass().getDeclaredMethod("show", int.class, int.class).invoke(menuPopupHelper, targetX, targetY);
} catch (Exception e) {
Expand Down

0 comments on commit 119159f

Please sign in to comment.