Last active
October 10, 2017 04:41
Revisions
-
dmytrodanylyk revised this gist
Oct 10, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ private fun loadData() = launch(uiContext) { val result = task.await() // non ui thread, suspend until task is finished view.showData(result) // ui thread } catch (e: RuntimeException) { e.printStackTrace() } } -
dmytrodanylyk revised this gist
Oct 10, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ private fun loadData() = launch(uiContext) { view.showLoading() // ui thread try { val task = async(bgContext) { dataProvider.loadData("Task") } val result = task.await() // non ui thread, suspend until task is finished view.showData(result) // ui thread -
dmytrodanylyk created this gist
Oct 9, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ private fun loadData() = launch(uiContext) { view.showLoading() // ui thread try { val task = async(ioContext) { dataProvider.loadData("Task") } val result = task.await() // non ui thread, suspend until task is finished view.showData(result) // ui thread } catch (e: IllegalArgumentException) { e.printStackTrace() } }