Skip to content

Commit

Permalink
Merge pull request #12 from Kaufland/bugfix/wrong-circle-position-dyn…
Browse files Browse the repository at this point in the history
…amic-nav

# wrong circle position when navbar visibility changed
  • Loading branch information
sbra0902 authored Mar 11, 2019
2 parents 2d4c70d + ef22dd9 commit 6033652
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ public class CoachmarkView extends FrameLayout implements CoachmarkViewLayout, A

private View view;

private int windowHeight;

private View mActionDescription;

private View mDescription;
Expand Down Expand Up @@ -157,10 +155,6 @@ public void onAnimationFinished() {
}

public CoachmarkView show() {
DisplayMetrics metrics = new DisplayMetrics();
mWindowManager.getDefaultDisplay().getMetrics(metrics);

windowHeight = metrics.heightPixels;

WindowManager.LayoutParams mWindowParams = new WindowManager.LayoutParams();
mWindowParams.gravity = Gravity.TOP;
Expand All @@ -171,7 +165,11 @@ public CoachmarkView show() {
mWindowParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN;
mWindowParams.format = PixelFormat.TRANSLUCENT;

int flag = View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

setSystemUiVisibility(flag);
mIsInitialized = false;
mWindowManager.addView(this, mWindowParams);

Expand Down Expand Up @@ -222,7 +220,7 @@ public RectF calcCircleRectF() {
int[] xy = new int[2];
view.getLocationOnScreen(xy);
float centerX = xy[0] + view.getWidth() / 2;
float centerY = xy[1] - (windowHeight - getHeight()) + view.getHeight() / 2;
float centerY = xy[1] + view.getHeight() / 2;
return new RectF(centerX - radius, centerY - radius, centerX + radius, centerY + radius);
}

Expand Down

0 comments on commit 6033652

Please sign in to comment.