Skip to content

Commit

Permalink
Add display cutout support for hint
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavpandey committed Dec 20, 2018
1 parent 45e02e9 commit d42f761
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -815,14 +815,14 @@ public static void show(@NonNull View anchor, @NonNull Toast toast, int offset)
final int screenWidth = anchor.getResources().getDisplayMetrics().widthPixels;
final int estimatedToastHeight = DynamicUnitUtils.convertDpToPixels(offset);

if (screenPos[1] < estimatedToastHeight) {
if (screenPos[1] < estimatedToastHeight + displayFrame.top) {
toast.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL,
viewCenterX - screenWidth / 2,
viewCenterX - screenWidth / 2 - displayFrame.left,
screenPos[1] - displayFrame.top
+ Math.max(viewHeight, estimatedToastHeight));
} else {
toast.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL,
viewCenterX - screenWidth / 2,
viewCenterX - screenWidth / 2 - displayFrame.left,
screenPos[1] - displayFrame.top
- Math.max(viewHeight, estimatedToastHeight));
}
Expand Down

0 comments on commit d42f761

Please sign in to comment.