Giter Site home page Giter Site logo

Comments (7)

ZacSweers avatar ZacSweers commented on April 28, 2024

I think we should provide some examples of how to hook one up, but I don't think we should ship something first party. Especially with support library variants out there, kind of makes a mess and most people just implement it in their own base classes I think. Can revisit if Android APIs improve in the future for external observation.

from autodispose.

tadfisher avatar tadfisher commented on April 28, 2024

Activities have ActivityLifecycleCallbacks.

from autodispose.

ZacSweers avatar ZacSweers commented on April 28, 2024

True, but we can't query the current state of the activity for lifecycle resolution :/. Most we could do would basically be to dispose on destroy, but wouldn't be able to tell if we're already after the lifecycle

from autodispose.

tadfisher avatar tadfisher commented on April 28, 2024

Do you need to query the current state of the activity? You should get all edges of the state machine in the callbacks instance, and infer state from that. Unless there are edge cases I'm not thinking of.

from autodispose.

ZacSweers avatar ZacSweers commented on April 28, 2024

Say you subscribe after onDestroy, how would you know since no callbacks would ever fire?

from autodispose.

microstudent avatar microstudent commented on April 28, 2024

I think some code in Glide do the similar things.
ManagerRetriever.java#319
It attach a Invisible fragment to activity or fragment, as it can receive the lifecycle callback form them.

from autodispose.

ZacSweers avatar ZacSweers commented on April 28, 2024

You can get callbacks, but you can't query the current state right?

from autodispose.

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.