We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
ThreadSwitcher#initialize()
1 parent b10af2f commit 0941960Copy full SHA for 0941960
Library/src/main/java/boxresin/library/android_thread_switcher/ThreadSwitcher.kt
@@ -1,20 +1,14 @@
1
package boxresin.library.android_thread_switcher
2
3
import android.os.Handler
4
-import android.support.annotation.UiThread
+import android.os.Looper
5
import kotlin.concurrent.thread
6
7
/** A utility class to make it easy to switch between UI and Worker thread. */
8
object ThreadSwitcher
9
{
10
- private lateinit var uiHandler: Handler
+ private val uiHandler: Handler by lazy { Handler(Looper.getMainLooper()) }
11
12
- /** You must call it on the UI thread before using ThreadSwitcher. */
13
- @UiThread
14
- fun initialize()
15
- {
16
- uiHandler = Handler()
17
- }
18
19
fun newChain() = Chain { Unit }
20
0 commit comments