Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d719539f authored by Yigit Boyar's avatar Yigit Boyar
Browse files

Fix RTL bug for actionbar tooltips

Bug: 12570378
Change-Id: I13ba94c8b736a3a80a8d79e95bd18b93a1157303
parent 8f646128
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -265,13 +265,15 @@ public class ActionMenuItemView extends TextView
        final int width = getWidth();
        final int height = getHeight();
        final int midy = screenPos[1] + height / 2;
        int referenceX = screenPos[0] + width / 2;
        if (v.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR) {
            final int screenWidth = context.getResources().getDisplayMetrics().widthPixels;

            referenceX = screenWidth - referenceX; // mirror
        }
        Toast cheatSheet = Toast.makeText(context, mItemData.getTitle(), Toast.LENGTH_SHORT);
        if (midy < displayFrame.height()) {
            // Show along the top; follow action buttons
            cheatSheet.setGravity(Gravity.TOP | Gravity.END,
                    screenWidth - screenPos[0] - width / 2, height);
            cheatSheet.setGravity(Gravity.TOP | Gravity.END, referenceX, height);
        } else {
            // Show along the bottom center
            cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, height);