Skip to content

Commit

Permalink
Merge pull request #349 from skydoves/feature/overlay-gravity
Browse files Browse the repository at this point in the history
Add the possibility to change overlay window gravity (#347)
  • Loading branch information
skydoves authored Jul 16, 2022
2 parents e6c6ed3 + 2efafb0 commit 7fa3cc8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions balloon/api/balloon.api
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ public final class com/skydoves/balloon/Balloon$Builder {
public final fun getOnBalloonOverlayTouchListener ()Landroid/view/View$OnTouchListener;
public final fun getOnBalloonTouchListener ()Landroid/view/View$OnTouchListener;
public final fun getOverlayColor ()I
public final fun getOverlayGravity ()I
public final fun getOverlayPadding ()F
public final fun getOverlayPaddingColor ()I
public final fun getOverlayPosition ()Landroid/graphics/Point;
Expand Down Expand Up @@ -393,6 +394,8 @@ public final class com/skydoves/balloon/Balloon$Builder {
public final fun setOverlayColor (I)Lcom/skydoves/balloon/Balloon$Builder;
public final synthetic fun setOverlayColor (I)V
public final fun setOverlayColorResource (I)Lcom/skydoves/balloon/Balloon$Builder;
public final fun setOverlayGravity (I)Lcom/skydoves/balloon/Balloon$Builder;
public final synthetic fun setOverlayGravity (I)V
public final fun setOverlayPadding (F)Lcom/skydoves/balloon/Balloon$Builder;
public final synthetic fun setOverlayPadding (F)V
public final fun setOverlayPaddingColor (I)Lcom/skydoves/balloon/Balloon$Builder;
Expand Down
10 changes: 9 additions & 1 deletion balloon/src/main/kotlin/com/skydoves/balloon/Balloon.kt
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ public class Balloon private constructor(
} else {
overlayBinding.balloonOverlayView.anchorViewList = anchors.toList()
}
overlayWindow.showAtLocation(mainAnchor, Gravity.CENTER, 0, 0)
overlayWindow.showAtLocation(mainAnchor, builder.overlayGravity, 0, 0)
}
}

Expand Down Expand Up @@ -1685,6 +1685,9 @@ public class Balloon private constructor(
@set:JvmSynthetic
public var overlayShape: BalloonOverlayShape = BalloonOverlayOval

@set:JvmSynthetic
public var overlayGravity: Int = Gravity.CENTER

@set:JvmSynthetic
public var onBalloonClickListener: OnBalloonClickListener? = null

Expand Down Expand Up @@ -2381,6 +2384,11 @@ public class Balloon private constructor(
public fun setOverlayShape(value: BalloonOverlayShape): Builder =
apply { this.overlayShape = value }

/** sets the balloon overlay gravity. */
public fun setOverlayGravity(gravity: Int): Builder = apply {
this.overlayGravity = gravity
}

/** sets is status bar is visible or not in your screen. */
public fun setIsStatusBarVisible(value: Boolean): Builder = apply {
this.isStatusBarVisible = value
Expand Down

0 comments on commit 7fa3cc8

Please sign in to comment.