RxBinding icon indicating copy to clipboard operation
RxBinding copied to clipboard

View.draws() never emits in API 25, does in API 28

Open DYJParker opened this issue 6 years ago • 1 comments

Current testbed app works fine on Pixel 3 and emulator both running API 28, but I had a critical bug appear when I tried it on a hardware tablet. Tablet was running API 25, so I spun up an equivalent emulator, and tracked the bug down to the fact that my UI changes go through a delaySubscription operator keyed to the .draws() of my custom view.

Between inserting doOnNext with logger methods into the stream going into the delaySubscription and adding similar doOnSubscribes to the state-stream coming in from the back end, it's clear that the `.draws() stream is simply never emitting on API 25.

Everything in the following executes on API 28, but on API 25 only the "setup in" and "Meta subscribed" logging extension functions are executed.

private fun setupInStreams() {
        logger("setup in")
        val delayStream =
            qenPage.draws()
                .doOnNext { iLogger("drawn", qenPage) }
                .delay(5, TimeUnit.MILLISECONDS)
                .doOnNext { iLogger("delayed", qenPage) }

        cd.addAll(
            vm.getTouchesOut()
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe {
                    qenPage.drawSegment(it)
                },
            vm.getMetaOut()
                .doOnSubscribe { logger("Meta pre-subscribed") }
                .observeOn(AndroidSchedulers.mainThread())
                .delaySubscription(delayStream)
                .doOnSubscribe { logger("Meta subscribed") }
                .subscribe {
                    iLogger("Main activity received", it)
                    when (it) {
                        is MetaState.ClearCurrentPage -> qenPage.clearPage()
                        is MetaState.SelectedPage -> qenPage.drawPage(it.content)
                    }.exhaustive
                }
        )
    }

DYJParker avatar Mar 19 '19 20:03 DYJParker

Hmm I mean this observable doesn't do much. It just attaches a draw listener to the view tree observer and emits whenever a callback happens. The test for it passes on API 25 and 28 as well.

On Tue, Mar 19, 2019 at 4:03 PM Dave Parker [email protected] wrote:

Current testbed app works fine on Pixel 3 and emulator both running API 28, but I had a critical bug appear when I tried it on a hardware tablet. Tablet was running API 25, so I spun up an equivalent emulator, and tracked the bug down to the fact that my UI changes go through a delaySubscription operator keyed to the .draws() of my custom view.

Between inserting doOnNext with logger methods into the stream going into the delaySubscription and adding similar doOnSubscribes to the state-stream coming in from the back end, it's clear that the `.draws() stream is simply never emitting on API 25.

Everything in the following executes on API 28, but on API 25 only the "setup in" and "Meta subscribed" logging extension functions are executed.

private fun setupInStreams() { logger("setup in") val delayStream = qenPage.draws() .doOnNext { iLogger("drawn", qenPage) } .delay(5, TimeUnit.MILLISECONDS) .doOnNext { iLogger("delayed", qenPage) }

    cd.addAll(
        vm.getTouchesOut()
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe {
                qenPage.drawSegment(it)
            },
        vm.getMetaOut()
            .doOnSubscribe { logger("Meta pre-subscribed") }
            .observeOn(AndroidSchedulers.mainThread())
            .delaySubscription(delayStream)
            .doOnSubscribe { logger("Meta subscribed") }
            .subscribe {
                iLogger("Main activity received", it)
                when (it) {
                    is MetaState.ClearCurrentPage -> qenPage.clearPage()
                    is MetaState.SelectedPage -> qenPage.drawPage(it.content)
                }.exhaustive
            }
    )
}

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JakeWharton/RxBinding/issues/506, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEEeC4EQfm8t-7gxbICyPyO7MUDBTIks5vYUKggaJpZM4b9AAL .

JakeWharton avatar Mar 22 '19 01:03 JakeWharton