question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

setOnBalloonOverlayClickListener does not work

See original GitHub issue

setOnBalloonOverlayClickListener does not work. The listener block assigned was not invoked.

  • Library Version v1.3.1 Update example EditBalloonFactory code to the following and add setOnBalloonOverlayClickListener
  override fun create(context: Context, lifecycle: LifecycleOwner?): Balloon {
    return Balloon.Builder(context)
      .setText("You can edit your profile now!")
      .setArrowSize(10)
      .setWidthRatio(1.0f)
      .setHeight(BalloonSizeSpec.WRAP)
      .setArrowPositionRules(ArrowPositionRules.ALIGN_ANCHOR)
      .setArrowPosition(0.5f)
      .setPadding(12)
      .setMarginRight(12)
      .setMarginLeft(12)
      .setTextSize(15f)
      .isRtlSupport(BalloonUtils.isRtlLayout())
      .setCornerRadius(8f)
      .setTextColorResource(R.color.white_87)
      .setIconDrawableResource(R.drawable.ic_edit)
      .setBackgroundColorResource(R.color.skyBlue)
      .setBalloonAnimation(BalloonAnimation.ELASTIC)
      .setIsVisibleOverlay(true)
      .setOverlayColorResource(R.color.overlay)
      .setOverlayPadding(6f)
      .setOverlayShape(BalloonOverlayRoundRect(12f, 12f))
      .setLifecycleOwner(lifecycle)
      .setDismissWhenClicked(true)
      .setOnBalloonDismissListener {
        Toast.makeText(context.applicationContext, "dismissed", Toast.LENGTH_SHORT).show()
      }.setOnBalloonOverlayClickListener { 
        Toast.makeText(context.applicationContext, "overlay", Toast.LENGTH_SHORT).show()
      }.build()
  }
}

Build and run the sample app. Click on the Edit Profile button Balloon is shown with overlay on top of the button Click on the overlay on top of the Edit Profile button

** Observed ** Balloon dismissed with no overlay toast

Expected Behavior: overlay toast is displayed before dismissing balloon.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
abhimuktheeswararcommented, Oct 7, 2021

Hi, Thanks for this awesome library. Our requirement is: when clicking on the anchor view, which is highlighted, we need a callback (listener). But when clicking outside, the ballon should dismiss. Some like this will do:

setIsVisibleOverlay(true)
setDismissWhenTouchOutside(false)
setDismissWhenOverlayClicked(false)
setOnHighlightedViewClickListener {
    Toast.makeText(context.applicationContext, "setOnHighlightedViewClickListener", Toast.LENGTH_SHORT).show()
}

1reaction
skydovescommented, May 13, 2021

Hi, @NattyBadWolf You can implement it using the below codes.

setIsVisibleOverlay(true)
setDismissWhenTouchOutside(false)
setDismissWhenOverlayClicked(false)
setOnBalloonOverlayClickListener {
    Toast.makeText(context.applicationContext, "setOnBalloonOverlayClickListener", Toast.LENGTH_SHORT).show()
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

clicking in ballon in mapview should start another activity
setOnBallonTapListener (overlayIndex, new OnBalloonTapListener() { @Override public void onBalloonTap(int ... It works for me very fine.
Read more >
setOnBalloonDismissListener
setOnBalloonDismissListener ... fun setOnBalloonDismissListener(onBalloonDismissListener: OnBalloonDismissListener?) ... sets a OnBalloonDismissListener to the ...
Read more >
Untitled
Disability rights protests, Aeroderivative turbines don't have, ... Light level overlay 1.4.6, The first miracle of mary mackillop, Stream main event live, ...
Read more >
National Fire Incident Reporting System Complete Reference ...
ment was the first in-depth discussion of this country's fire problem. ... In this event, create an EMS incident ... Balloon construction.
Read more >
Tissue Engineered Skin Substitutes - Cigna
language and coverage determinations do not apply to those clients. ... In the event of a conflict, a customer's benefit.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found