Skip to content

Commit 86c8340

Browse files
author
Kaushik Gopal
committed
fix: using example
1 parent dfb7b0a commit 86c8340

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

app/src/main/kotlin/com/morihacky/android/rxjava/fragments/UsingFragment.kt

+3-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import io.reactivex.Flowable
1515
import io.reactivex.functions.Consumer
1616
import io.reactivex.functions.Function
1717
import org.reactivestreams.Publisher
18-
import timber.log.Timber
1918
import java.util.*
2019
import java.util.concurrent.Callable
2120

@@ -58,16 +57,16 @@ class UsingFragment : BaseFragment() {
5857

5958
inner class Realm {
6059
init {
61-
Timber.d("--- initializing Realm instance")
60+
_log("initializing Realm instance")
6261
}
6362

6463
fun doSomething() {
65-
Timber.d("--- do something with Realm instance")
64+
_log("do something with Realm instance")
6665
}
6766

6867
fun clear() {
6968
// notice how this is called even before you manually "dispose"
70-
Timber.d("--- cleaning up the resources (happens before a manual 'dispose'")
69+
_log("cleaning up the resources (happens before a manual 'dispose'")
7170
}
7271
}
7372

app/src/main/res/values/strings.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<string name="msg_demo_timing">BTN 1: run single task once (after 2s complete)\nBTN 2: run task every 1s (start delay of 1s) toggle \nBTN 3: run task every 1s (start immediately) toggle \nBTN 4: run task 5 times every 3s (then complete) \nBTN 5: run task A, pause for sometime, then proceed with Task B</string>
4343
<string name="msg_demo_rotation_persist">This is an example of starting an Observable and using the result across rotations. There are many ways to do this, we use a retained fragment in this example</string>
4444
<string name="msg_demo_network_detector">This is a demo of how to use Subjects to detect Network connectivity\nToggle your Wifi/Network on or off and notice the logs</string>
45-
<string name="msg_demo_using">This is a demo of the somewhat unknown operator "using".\n\nmsg_demo_usingYou typically use it for managing setup/teardown of resources. Classic cases are DB connections (like Realm), sockets, locks etc.\n\nTap the button and look at the logcat. Particularly notice how the Realm instance is self-contained. That is, it is auto-disposed right after use.</string>
45+
<string name="msg_demo_using">This is a demo of the somewhat unknown operator "using".\n\nYou typically use it for managing setup/teardown of resources. Classic cases are DB connections (like Realm), sockets, locks etc.\n\nTap the button and look at the logcat. Particularly notice how the Realm instance is self-contained. That is, it is auto-disposed right after use.</string>
4646
<string name="msg_demo_multicast_publishRefCount">RefCount starts the upstream right away and gets disposed off, when all subscribers stop. Hit S1, Hit S2, Hit S1, Hit S2. Hit S1/S2 now and notice the stream starts all over.</string>
4747
<string name="msg_demo_multicast_publishAutoConnect">AutoConnect(2) waits for a min. subscriber count, before starting the upstream. Hit S1 (notice events don\'t start), Hit S2 (notice events now start), Hit S1 (notice that unsubscribing doesn\'t affect upstream), Hit S2, wait for sometime and hit S1 again (notice source stream doesn\'t restart)</string>
4848
<string name="msg_demo_multicast_replayAutoConnect">Replay caches the last item. Hit S1, Hit S2, event starts, Hit S2, wait a bit, Hit S2 again (notice it starts with the last item that S1 saw - courtesy Replay). Hit S2, Hit S1, wait a bit. Hit S1 again (notice event upstream continues and doesn\'t restart)</string>

0 commit comments

Comments
 (0)