While not showing Balloon in my FragmentActivity when I tap the phone system back button the Activity is being finished and the app goes to background.
But while showing Balloon in this FragmentActivity when I tap the phone system back button I am only dismissing the Balloon, and not finishing the Activity in which the Balloon is being shown (as in the previous scenario)
Code:
@MainThread
fun ComponentActivity.topTooltip(): Lazy<Balloon> {
return ActivityBalloonLazy(this, this, TopTooltipFactory::class)
}
class TopTooltipFactory : TooltipFactory() {
override fun create(context: Context, lifecycle: LifecycleOwner?): Balloon {
return baseBalloon(context, lifecycle).setArrowOrientation(BOTTOM).build()
}
}
abstract class TooltipFactory : Balloon.Factory() {
@Suppress("MagicNumber")
fun baseBalloon(context: Context, lifecycle: LifecycleOwner?): Balloon.Builder {
return Balloon.Builder(context)
.setLayout(R.layout.my_layout)
.setMarginLeft(16)
.setMarginRight(16)
.setCornerRadius(8f)
.setArrowSize(12)
.setArrowConstraints(ALIGN_ANCHOR)
.setArrowColorResource(R.color.blue)
.setBackgroundDrawableResource(R.drawable.tooltip_background)
.setBalloonAnimation(FADE)
.setElevation(0)
.setDismissWhenClicked(true)
.setLifecycleOwner(lifecycle)
}
}
interface IMyView {
fun onCreate(view: View)
fun showTooltip()
}
class MyView @Inject constructor(
activity: FragmentActivity
) : IMyView {
private lateinit var view: View
private val tooltip by activity.topTooltip()
override fun onCreate(view: View) {
this.view = view
}
override fun showTooltip() {
val image: BottomNavigationItemView = ///
tooltip.apply {
//
show(image)
}
}
}
Expected Behavior:
As a user when I try to click the phone back button I should be able to finish my current activity (only one on the stack) despite the Balloon is being shown, instead of only dismissing the current Balloon and not finishing my activity.
@skydoves Is it possible to fulfill my requirements with the library?
Please complete the following information:
Describe the Bug:
While not showing Balloon in my
FragmentActivity
when I tap the phone system back button the Activity is being finished and the app goes to background. But while showing Balloon in thisFragmentActivity
when I tap the phone system back button I am only dismissing theBalloon
, and not finishing the Activity in which the Balloon is being shown (as in the previous scenario)Code:
Expected Behavior:
As a user when I try to click the phone back button I should be able to finish my current activity (only one on the stack) despite the Balloon is being shown, instead of only dismissing the current Balloon and not finishing my activity.
@skydoves Is it possible to fulfill my requirements with the library?