Skip to content

Commit 0941960

Browse files
committed
Remove ThreadSwitcher#initialize() method #3
1 parent b10af2f commit 0941960

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

Library/src/main/java/boxresin/library/android_thread_switcher/ThreadSwitcher.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
package boxresin.library.android_thread_switcher
22

33
import android.os.Handler
4-
import android.support.annotation.UiThread
4+
import android.os.Looper
55
import kotlin.concurrent.thread
66

77
/** A utility class to make it easy to switch between UI and Worker thread. */
88
object ThreadSwitcher
99
{
10-
private lateinit var uiHandler: Handler
10+
private val uiHandler: Handler by lazy { Handler(Looper.getMainLooper()) }
1111

12-
/** You must call it on the UI thread before using ThreadSwitcher. */
13-
@UiThread
14-
fun initialize()
15-
{
16-
uiHandler = Handler()
17-
}
1812

1913
fun newChain() = Chain { Unit }
2014

0 commit comments

Comments
 (0)