kandi background
Explore Kits

RxLifecycle | Lifecycle handling APIs for Android apps using RxJava | Reactive Programming library

 by   trello Java Version: v4.0.2 License: Apache-2.0

 by   trello Java Version: v4.0.2 License: Apache-2.0

Download this library from

kandi X-RAY | RxLifecycle Summary

RxLifecycle is a Java library typically used in Programming Style, Reactive Programming applications. RxLifecycle has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can download it from GitHub, Maven.
This library allows one to automatically complete sequences based on a second lifecycle stream. This capability is useful in Android, where incomplete subscriptions can cause memory leaks.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • RxLifecycle has a medium active ecosystem.
  • It has 7659 star(s) with 649 fork(s). There are 207 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 0 open issues and 176 have been closed. On average issues are closed in 106 days. There are no pull requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of RxLifecycle is v4.0.2
RxLifecycle Support
Best in #Reactive Programming
Average in #Reactive Programming
RxLifecycle Support
Best in #Reactive Programming
Average in #Reactive Programming

quality kandi Quality

  • RxLifecycle has 0 bugs and 0 code smells.
RxLifecycle Quality
Best in #Reactive Programming
Average in #Reactive Programming
RxLifecycle Quality
Best in #Reactive Programming
Average in #Reactive Programming

securitySecurity

  • RxLifecycle has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • RxLifecycle code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
RxLifecycle Security
Best in #Reactive Programming
Average in #Reactive Programming
RxLifecycle Security
Best in #Reactive Programming
Average in #Reactive Programming

license License

  • RxLifecycle is licensed under the Apache-2.0 License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
RxLifecycle License
Best in #Reactive Programming
Average in #Reactive Programming
RxLifecycle License
Best in #Reactive Programming
Average in #Reactive Programming

buildReuse

  • RxLifecycle releases are available to install and integrate.
  • Deployable package is available in Maven.
  • Build file is available. You can build the component from source.
  • Installation instructions are not available. Examples and code snippets are available.
  • It has 3801 lines of code, 380 functions and 67 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
RxLifecycle Reuse
Best in #Reactive Programming
Average in #Reactive Programming
RxLifecycle Reuse
Best in #Reactive Programming
Average in #Reactive Programming
Top functions reviewed by kandi - BETA

kandi has reviewed RxLifecycle and discovered the below as its top functions. This is intended to give you an instant insight into RxLifecycle implemented functionality, and help decide if they suit your requirements.

  • A helper method that takes a lifecycle event which takes a lifecycle event of a lifecycle event .
  • Returns true if the lifecycle transformer is equal to the given LifecycleTransformer .
  • Releases an event .
  • Binds a View to the View .
  • Subscribe an observer to the view .
  • On pause .
  • Checks that the value is not null .
  • Invoked when the view has been created .
  • On destroyView .
  • Bind lifecycle event

RxLifecycle Key Features

Lifecycle handling APIs for Android apps using RxJava

Usage

copy iconCopydownload iconDownload
myObservable
    .compose(RxLifecycle.bind(lifecycle))
    .subscribe();

Providers

copy iconCopydownload iconDownload
public class MyActivity extends RxActivity {
    @Override
    public void onResume() {
        super.onResume();
        myObservable
            .compose(bindToLifecycle())
            .subscribe();
    }
}

Kotlin

copy iconCopydownload iconDownload
myObservable
    .bindToLifecycle(myView)
    .subscribe { }

myObservable
    .bindUntilEvent(myRxActivity, STOP)
    .subscribe { }

Installation

copy iconCopydownload iconDownload
implementation 'com.trello.rxlifecycle4:rxlifecycle:4.0.2'

// If you want to bind to Android-specific lifecycles
implementation 'com.trello.rxlifecycle4:rxlifecycle-android:4.0.2'

// If you want pre-written Activities and Fragments you can subclass as providers
implementation 'com.trello.rxlifecycle4:rxlifecycle-components:4.0.2'

// If you want pre-written support preference Fragments you can subclass as providers
implementation 'com.trello.rxlifecycle4:rxlifecycle-components-preference:4.0.2'

// If you want to use Android Lifecycle for providers
implementation 'com.trello.rxlifecycle4:rxlifecycle-android-lifecycle:4.0.2'

// If you want to use Kotlin syntax
implementation 'com.trello.rxlifecycle4:rxlifecycle-kotlin:4.0.2'

// If you want to use Kotlin syntax with Android Lifecycle
implementation 'com.trello.rxlifecycle4:rxlifecycle-android-lifecycle-kotlin:4.0.2'

License

copy iconCopydownload iconDownload
Copyright (C) 2016 Trello

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

How to upgrade bluelinelabs/Conductor version 3.1.4 from version 3.0.0

copy iconCopydownload iconDownload
    fun Completable.autoDisposable(event: ControllerEvent? = null): CompletableSubscribeProxy =
    observeOn(AndroidSchedulers.mainThread())
        .autoDisposable(getScopeProvider(event))
    private val scopeProvider: ControllerScopeProvider by lazy { ControllerScopeProvider.from(this) }

    private val destroyScopeProvider: ControllerScopeProvider by lazy {
      ControllerScopeProvider.from(
        this,
        ControllerEvent.DESTROY
      )
    }
...
    private fun getScopeProvider(event: ControllerEvent?): ControllerScopeProvider =
    when (event) {
        null -> scopeProvider
        ControllerEvent.DETACH -> detachScopeProvider
        ControllerEvent.DESTROY_VIEW -> destroyViewScopeProvider
        ControllerEvent.DESTROY -> destroyScopeProvider
        else -> throw RuntimeException("Scope for event ${event.name} wasn't created")
    }
-----------------------
    fun Completable.autoDisposable(event: ControllerEvent? = null): CompletableSubscribeProxy =
    observeOn(AndroidSchedulers.mainThread())
        .autoDisposable(getScopeProvider(event))
    private val scopeProvider: ControllerScopeProvider by lazy { ControllerScopeProvider.from(this) }

    private val destroyScopeProvider: ControllerScopeProvider by lazy {
      ControllerScopeProvider.from(
        this,
        ControllerEvent.DESTROY
      )
    }
...
    private fun getScopeProvider(event: ControllerEvent?): ControllerScopeProvider =
    when (event) {
        null -> scopeProvider
        ControllerEvent.DETACH -> detachScopeProvider
        ControllerEvent.DESTROY_VIEW -> destroyViewScopeProvider
        ControllerEvent.DESTROY -> destroyScopeProvider
        else -> throw RuntimeException("Scope for event ${event.name} wasn't created")
    }
-----------------------
    fun Completable.autoDisposable(event: ControllerEvent? = null): CompletableSubscribeProxy =
    observeOn(AndroidSchedulers.mainThread())
        .autoDisposable(getScopeProvider(event))
    private val scopeProvider: ControllerScopeProvider by lazy { ControllerScopeProvider.from(this) }

    private val destroyScopeProvider: ControllerScopeProvider by lazy {
      ControllerScopeProvider.from(
        this,
        ControllerEvent.DESTROY
      )
    }
...
    private fun getScopeProvider(event: ControllerEvent?): ControllerScopeProvider =
    when (event) {
        null -> scopeProvider
        ControllerEvent.DETACH -> detachScopeProvider
        ControllerEvent.DESTROY_VIEW -> destroyViewScopeProvider
        ControllerEvent.DESTROY -> destroyScopeProvider
        else -> throw RuntimeException("Scope for event ${event.name} wasn't created")
    }

Community Discussions

Trending Discussions on RxLifecycle
  • How to upgrade bluelinelabs/Conductor version 3.1.4 from version 3.0.0
Trending Discussions on RxLifecycle

QUESTION

How to upgrade bluelinelabs/Conductor version 3.1.4 from version 3.0.0

Asked 2022-Mar-31 at 10:09

I'm trying to migrate from version 3.0.0 that used conductor-rxlifecycle to version 3.1.4 that is using conductor-archlifecycle and conductor-autodispose.

my current code has extension functions that binds to the lifecycle - and I'm trying to understand what is the code change needed to adjust it to archlifecycle and auto-dispose.

I would appreciate some help here - couldn't figure it out from the demo code.

conductor-archlifecycle demo

conductor-autodispose demo

protected fun <C : RxController> Completable.bindToController(controller: C): Completable =
    observeOn(AndroidSchedulers.mainThread()).compose(controller.bindToLifecycle<Any>())

protected fun <C : RxController> Completable.bindUntil(controller: C, event: ControllerEvent): Completable =
    observeOn(AndroidSchedulers.mainThread()).compose(controller.bindUntilEvent<Any>(event))

I assume that the controller type should be LifecycleController instead of RxController, but I don't understand what is the replacement of bindToLifecycle

I opened this issue , but I'm trying to get some help here as well

ANSWER

Answered 2022-Mar-31 at 10:09

This is the change I did to my code to match the new Conductor version:

The 2 functions above were replaced by this function:

    fun Completable.autoDisposable(event: ControllerEvent? = null): CompletableSubscribeProxy =
    observeOn(AndroidSchedulers.mainThread())
        .autoDisposable(getScopeProvider(event))

Note that the return type is now CompletableSubscribeProxy and not Completable so the location of the call in the chain might need to be changed.

I create different scopes:

    private val scopeProvider: ControllerScopeProvider by lazy { ControllerScopeProvider.from(this) }

    private val destroyScopeProvider: ControllerScopeProvider by lazy {
      ControllerScopeProvider.from(
        this,
        ControllerEvent.DESTROY
      )
    }
...

And this is how getScopeProvider looks

    private fun getScopeProvider(event: ControllerEvent?): ControllerScopeProvider =
    when (event) {
        null -> scopeProvider
        ControllerEvent.DETACH -> detachScopeProvider
        ControllerEvent.DESTROY_VIEW -> destroyViewScopeProvider
        ControllerEvent.DESTROY -> destroyScopeProvider
        else -> throw RuntimeException("Scope for event ${event.name} wasn't created")
    }

Source https://stackoverflow.com/questions/71557321

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install RxLifecycle

You can download it from GitHub, Maven.
You can use RxLifecycle like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the RxLifecycle component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

Support

For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Share this Page

share link
Consider Popular Reactive Programming Libraries
Compare Reactive Programming Libraries with Highest Support
Compare Reactive Programming Libraries with Highest Quality
Compare Reactive Programming Libraries with Highest Security
Compare Reactive Programming Libraries with Permissive License
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.