Kotlin Fest 2018 わいわい報告会 / mochicoroutines

6eecc52120fba9d87d982684211182ec?s=47 mochico
September 11, 2018

Kotlin Fest 2018 わいわい報告会 / mochicoroutines

Kotlin Fest 2018 わいわい報告会 - connpass : https://connpass.com/event/100752/
各セッションの紹介と、Kotlin コルーチンを 理解しよう - Speaker Deck : https://speakerdeck.com/sys1yagi/kotlin-korutinwo-li-jie-siyou のお話をきいて試してみた内容の紹介をしました。

6eecc52120fba9d87d982684211182ec?s=128

mochico

September 11, 2018
Tweet

Transcript

  1. 6.
  2. 10.
  3. 23.

    IUUQTTQFBLFSEFDLDPNTZTZBHJLPUMJOLPSVUJOXPMJKJFTJZPV ©2018 Lang-8 Inc. ALL Rights Reserved. ܧଓঢ়گΛ༰қʹॻ͘ ίϧʔνϯ BTZODBXBJU

    fun loadProfile(id: Int) { getProfile(token) { profile -> showProgile(profile) } } ίʔϧόοΫελΠϧ fun loadProfile(id: Int) { val profile = getProfile(id).await() showProfile(profile) } ˞ٖࣅίʔυͰ͢
  4. 26.

    IUUQTTQFBLFSEFDLDPNTZTZBHJLPUMJOLPSVUJOXPMJKJFTJZPV ©2018 Lang-8 Inc. ALL Rights Reserved. PO"DUJWJUZ3FTVMUΛTVTQFOE launch(UI) {

    val result = activityResult(intent) if (result.isOk) { // ok val data: Intent? = result.flatMap() } else { // ng } } IUUQTHJUIVCDPNQEWSJF[FBOESPJEDPSPVUJOFT BOESPJEDPSPVUJOFTͱ͍͏αʔυύʔςΟϥΠϒϥϦ͕ ఏڙɻSFRVFTU1FSNJTTJPO΋͋ΔΑ
  5. 28.
  6. 29.

    橆㞮圓眠 kotlin_version = ‘1.2.61’ kotlin { experimental { coroutines 'enable'

    } } implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core: 0.25.3'
  7. 30.

    橆㞮圓眠 kotlin_version = ‘1.2.61’ kotlin { experimental { coroutines 'enable'

    } } implementation ‘org.jetbrains.kotlinx:kotlinx-coroutines-core:0.25.3' implementation 'net.devrieze:android-coroutines:0.7.0'
  8. 32.

    PO"DUJWJUZ3FTVMU startActivityForResult( requestIntent, REQUEST_CODE) override fun onActivityResult(requestCode: Int, resultCode: Int,

    data: Intent?) { super.onActivityResult(requestCode, resultCode, data) when (requestCode) { REQUEST_CODE -> { if (resultCode == Activity.RESULT_OK) { data ?: return setResult(RESULT_OK, data) finish() } } } }
  9. 33.

    PO"DUJWJUZ3FTVMU launch(UI) { val result = activityResult(requestIntent) if (result.isOk) {

    // ok val data: Intent? = result.flatMap() setResult(RESULT_OK, data) finish() } else { // ng } }