Giter VIP home page Giter VIP logo

Comments (9)

skydoves avatar skydoves commented on July 24, 2024

Could you please rebuild it using the setLifecycleOwner method?
The lifecycleOwner should be viewlifecycleowner, not fragment's lifecycle owner.

from balloon.

serdei85 avatar serdei85 commented on July 24, 2024
class InPlayerEmptyFoldersListBalloonFactory : Balloon.Factory() {

  override fun create(context: Context, lifecycle: LifecycleOwner?): Balloon {
    val textForm = textForm(context) {
      setTextResource(R.string.emptylistfolder)
      setTextSize(15f)
    }

    return createBalloon(context) {
        setArrowSize(10)
        setArrowPosition(0.5f)
        setCornerRadius(10f)
        setTextForm(textForm)
        setArrowOrientation(ArrowOrientation.BOTTOM)
        setIconDrawableResource(R.drawable.icon_24dp_warning)
        setTextColorResource(R.color.textColor)
        setBackgroundColorResource(R.color.colorBalloon)
        setPadding(6)
        setDismissWhenTouchOutside(true)
        setBalloonAnimation(BalloonAnimation.ELASTIC)
        setLifecycleOwner(lifecycle)
        build()
    }
  }
}

Here is my factory. I'm using setLifecycleOwner method. What should I change exactly?

from balloon.

skydoves avatar skydoves commented on July 24, 2024

Hmm, I think it is caused because the context is already destroyed in the fragment but tried to create or dismiss the balloon. I recommend to use viewLifecycleOwner or requireActivity() as a parameter instead of this, requireContext(), lifecycleOwner.

from balloon.

serdei85 avatar serdei85 commented on July 24, 2024

Sorry, I newbie in android, I can't figure out where should I modify exactly.

So I have an instance:

private val inPlayerEmptyFoldersListBalloonFactory by balloon(InPlayerEmptyFoldersListBalloonFactory::class)

and a showing:

binding.fixpointForBalloonToFolders.showAlignTop(inPlayerEmptyFoldersListBalloonFactory!!)

and a factory class:

class InPlayerEmptyFoldersListBalloonFactory : Balloon.Factory() {
  override fun create(context: Context, lifecycle: LifecycleOwner?): Balloon {

    return createBalloon(context) {
    ...
        setLifecycleOwner(lifecycle)
        build()
    }
  }
}

And I can't modify the constructor or the lifecycle parameter of setLifeCycleOwner.

Thank you for your patience.

from balloon.

serdei85 avatar serdei85 commented on July 24, 2024

Please, can you tell me what should I modify exactly in the methods?

from balloon.

skydoves avatar skydoves commented on July 24, 2024

Hi, it will be included in the next release: 34d0b5a
But I think the best way is to dismiss balloon when touched outside.

from balloon.

serdei85 avatar serdei85 commented on July 24, 2024

Hi!

Ok, thank you, I'll check it.

setDismissWhenTouchOutside(true) is in the factory but it's not solve the problem.

As you see on my gif, there will be two "false" balloon from previous page with setDismissWhenTouchOutside(true) and you have to touch outside three times before you can continue to use the app.

Is it not possible that the problem is the animation time? When the balloon start to pop up but it isn't ready yet then it's locking on the screen when you swipe in this exact time.

If the balloon is ready, you can't swipe with the first touch, because the first touch is dismissing the balloon (btw it's embarrassing a little, it will better if the touch would dismiss all balloons and start swiping).

from balloon.

skydoves avatar skydoves commented on July 24, 2024

Released a new version 1.2.0.
Please try using a new version :)

from balloon.

serdei85 avatar serdei85 commented on July 24, 2024

Sorry, I created my own message boxes, which are part of the actual page so it hasn't got swipe or dismiss problems.

from balloon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.