Slide 1

Slide 1 text

©2018 Lang-8 Inc. ALL Rights Reserved. "QQ%PKP 5PTIJIJSP:BHJ "OESPJEͱඇಉظॲཧ ͱ$PSPVUJOF

Slide 2

Slide 2 text

©2018 Lang-8 Inc. ALL Rights Reserved. wീ໦ढ़޿ w!TZTZBHJ w$50PG w"OESPJE&OHJOFFS "CPVU.F

Slide 3

Slide 3 text

©2018 Lang-8 Inc. ALL Rights Reserved. "OESPJE%FW4VNNJUb IUUQTXXXZPVUVCFDPNXBUDI W&0KR0*8,R.

Slide 4

Slide 4 text

©2018 Lang-8 Inc. ALL Rights Reserved. w ,PUMJOͱ$PSPVUJOFͱ+FUQBDL w ͳͥ"OESPJEͰίϧʔνϯΛ࢖͍͍͔ͨ w "OESPJEͰίϧʔνϯΛ࢖͏४උ w ฒߦॲཧΛॻ͘ ௚ྻɺฒྻɺείʔϓͱྫ֎ w ͓·͚3YXJUI$PSPVUJOF w ͓·͚+FUQBDLXJUI$PSPVUJOF ࠓ೔࿩͢͜ͱ

Slide 5

Slide 5 text

©2018 Lang-8 Inc. ALL Rights Reserved. ,PUMJOͱ $PSPVUJOFͱ +FUQBDL

Slide 6

Slide 6 text

©2018 Lang-8 Inc. ALL Rights Reserved. ,PUMJO

Slide 7

Slide 7 text

©2018 Lang-8 Inc. ALL Rights Reserved. ,PUMJO w$PSPVUJOF 4UBCMF w,PUMJO/BUJWF#FUB w,UPS#FUB wΠϯϥΠϯΫϥεɺίϯτϥΫτɺXIFO ࣜͷαϒδΣΫτFUDʜ

Slide 8

Slide 8 text

©2018 Lang-8 Inc. ALL Rights Reserved. $PSPVUJOF w$PSPVUJOF4DPQFΛಋೖ͠طଘͷॻ͖ํ͕ EFQSFDBUFEʹ d w%JTQBUDIFSTΛಋೖ d wείʔϓͷྫ֎ͷ࢓༷͕มΘͬͨ d wFYQFSJNFOUBMQBDLBHFΛഇࢭ d IUUQTHJUIVCDPN,PUMJOLPUMJOYDPSPVUJOFTSFMFBTFT

Slide 9

Slide 9 text

©2018 Lang-8 Inc. ALL Rights Reserved. +FUQBDLXJUI$PSPVUJOF IUUQTEFWFMPQFSBOESPJEDPNKFUQBDLEPDTSFMFBTFOPUFT

Slide 10

Slide 10 text

©2018 Lang-8 Inc. ALL Rights Reserved. +FUQBDLXJUI$PSPVUJOF w8PSL.BOBHFSʹ$PSPVUJOF8PSLFSΛ௥Ճ w3PPNͰTVTQFOEؔ਺Λαϙʔτ w7JFX.PEFMʹWJFX.PEFM4DPQFΛ௥Ճ༧ఆ

Slide 11

Slide 11 text

©2018 Lang-8 Inc. ALL Rights Reserved. +FUQBDLXJUI$PSPVUJOF w8PSL.BOBHFSʹ$PSPVUJOF8PSLFSΛ௥Ճ w3PPNͰTVTQFOEؔ਺Λαϙʔτ w7JFX.PEFMʹWJFX.PEFM4DPQFΛ௥Ճ༧ఆ "OESPJEͰίϧʔνϯΛศརʹ࢖͏؀ڥ͕ ੔͑ΒΕ͍͍ͯͬͯΔɻ

Slide 12

Slide 12 text

©2018 Lang-8 Inc. ALL Rights Reserved. "OESPJE%FW4VNNJUb IUUQTXXXZPVUVCFDPNXBUDI W&0KR0*8,R.

Slide 13

Slide 13 text

©2018 Lang-8 Inc. ALL Rights Reserved. ͳͥ"OESPJEͰίϧʔνϯ Λ࢖͍͍ͨͷ͔

Slide 14

Slide 14 text

©2018 Lang-8 Inc. ALL Rights Reserved. w7JFXͷJOqBUF NFBTVSF MBZPVU Ϩϯ μϦϯάɺλονΠϕϯτͳͲදࣔʹؔΘΔ ॲཧΛ͢Δ w)[ͳΒϑϨʔϜNT͔͠ͳ͍ ϑϨʔ Ϝམͪ͸ମݧΛଛͶΔ w௕࣌ؒͷϒϩοΩϯά͸"/3ʹͳΔ "OESPJEͱ6*εϨου

Slide 15

Slide 15 text

©2018 Lang-8 Inc. ALL Rights Reserved. w$36% w%BUBCBTFɺ'JMF*0 w4ZOD w/FUXPSL*0 w$PNQVUF wෳࡶͳܭࢉ ΄ͱΜͲͷΞϓϦ͕ߦ͏ॏ͍ͨॲཧ

Slide 16

Slide 16 text

©2018 Lang-8 Inc. ALL Rights Reserved. w"TZOD5BTL w&YFDVUPST ͔ͳΓ௿ϨΠϠʔ w-PBEFST ݱࡏ͸ഇࢭ w'VUVSF NJO4EL7FSTJPOҎ্ w-JCSBSJFT 3Y+BWBɺ࣮࣭σϑΝΫτελϯμʔυ "OESPJEͷඇಉظॲཧ

Slide 17

Slide 17 text

©2018 Lang-8 Inc. ALL Rights Reserved. ͳͥίϧʔνϯΛ࢖͍͍͔ͨ

Slide 18

Slide 18 text

©2018 Lang-8 Inc. ALL Rights Reserved. ͳͥίϧʔνϯΛ࢖͍͍͔ͨ wݶΒΕͨϦιʔεͰεέʔϧͰ͖Δ

Slide 19

Slide 19 text

©2018 Lang-8 Inc. ALL Rights Reserved. εϨουͷ࣮ߦΠϝʔδ 5ISFBE1PPM 8PSLFS 8PSLFS 8PSLFS 8PSLFS εϨου .#d.#΄ ͲϝϞϦΛ࢖͏

Slide 20

Slide 20 text

©2018 Lang-8 Inc. ALL Rights Reserved. ίϧʔνϯͷ࣮ߦΠϝʔδ 5ISFBE1PPM 8PSLFS 8PSLFS 8PSLFS 8PSLFS $PSPVUJOF ʜ ʜ εϨου .#d.#΄ ͲϝϞϦΛ࢖͏ ͭͷίϧʔν ϯͰ,#΄Ͳɻ εϨουͰෳ ਺࣮ߦ͢Δɻ

Slide 21

Slide 21 text

©2018 Lang-8 Inc. ALL Rights Reserved. ͳͥίϧʔνϯΛ࢖͍͍͔ͨ wݶΒΕͨϦιʔεͰεέʔϧͰ͖Δ w εϨουd.#ʹରͯ͠ɺίϧʔνϯ͸,#ఔ౓ w؆୯ʹ࢖͑Δ ಡΈॻ͖ͷ͠΍͢͞

Slide 22

Slide 22 text

©2018 Lang-8 Inc. ALL Rights Reserved. wҰ࣌ఀࢭՄೳͳܭࢉΠϯελϯε wεϨουͱಉ͡Α͏ʹϥΠϑαΠ ΫϧΛ࣋ͭ wܧଓঢ়گΛ࣋ͭϓϩάϥϜ͕༰қ ʹهड़Ͱ͖Δ ίϧʔνϯͱ͸

Slide 23

Slide 23 text

©2018 Lang-8 Inc. ALL Rights Reserved. ܧଓঢ়گΛ࣋ͭϓϩάϥϜͱ͸ fun getProfile(id: Int, f: (Profile) -> Unit) fun loadProfile(id: Int) { getProfile(token) { profile -> showProfile(profile) } }

Slide 24

Slide 24 text

©2018 Lang-8 Inc. ALL Rights Reserved. ܧଓঢ়گΛ࣋ͭϓϩάϥϜͱ͸ fun getProfile(id: Int, f: (Profile) -> Unit) fun loadProfile(id: Int) { getProfile(token) { profile -> showProfile(profile) } } "1*ʹϦΫΤετͯ݁͠ՌΛฦؔ͢਺

Slide 25

Slide 25 text

©2018 Lang-8 Inc. ALL Rights Reserved. ܧଓঢ়گΛ࣋ͭϓϩάϥϜͱ͸ fun getProfile(id: Int, f: (Profile) -> Unit) fun loadProfile(id: Int) { getProfile(token) { profile -> showProfile(profile) } } ׬ྃ࣌ͷίʔϧόοΫΛҾ਺ʹऔΔ

Slide 26

Slide 26 text

©2018 Lang-8 Inc. ALL Rights Reserved. ܧଓঢ়گΛ࣋ͭϓϩάϥϜͱ͸ fun getProfile(id: Int, f: (Profile) -> Unit) fun loadProfile(id: Int) { getProfile(token) { profile -> showProfile(profile) } } ίʔϧόοΫʹଓ͖ͷॲཧΛॻ͘

Slide 27

Slide 27 text

©2018 Lang-8 Inc. ALL Rights Reserved. ܧଓঢ়گΛ࣋ͭϓϩάϥϜͱ͸ fun getProfile(id: Int, f: (Profile) -> Unit) fun loadProfile(id: Int) { getProfile(token) { profile -> showProfile(profile) } } ίʔϧόοΫʹଓ͖ͷॲཧΛॻ͘ ܧଓঢ়گΛ࣋ͭϓϩάϥϜ

Slide 28

Slide 28 text

©2018 Lang-8 Inc. ALL Rights Reserved. ܧଓঢ়گΛ࣋ͭϓϩάϥϜΛ༰қʹهड़͢Δ suspend fun getProfile(id: Int): Profile suspend fun loadProfile(id: Int) { val profile = getProfile(token) showProfile(profile) }

Slide 29

Slide 29 text

©2018 Lang-8 Inc. ALL Rights Reserved. ܧଓঢ়گΛ࣋ͭϓϩάϥϜΛ༰қʹهड़͢Δ suspend fun getProfile(id: Int): Profile suspend fun loadProfile(id: Int) { val profile = getProfile(token) showProfile(profile) } ϫʔΧʔεϨουͰಈ࡞ 6*εϨουͰಈ࡞

Slide 30

Slide 30 text

©2018 Lang-8 Inc. ALL Rights Reserved. ͳͥίϧʔνϯΛ࢖͍͍͔ͨ wݶΒΕͨϦιʔεͰεέʔϧͰ͖Δ w εϨουd.#ʹରͯ͠ɺίϧʔνϯ͸,#ఔ౓ w؆୯ʹ࢖͑Δ ಡΈॻ͖ͷ͠΍͢͞ wܰྔͳϥΠϒϥϦ

Slide 31

Slide 31 text

©2018 Lang-8 Inc. ALL Rights Reserved. ίϧʔνϯ͸ϥΠϒϥϦͰఏڙ͞Ε͍ͯΔ IUUQTHJUIVCDPN,PUMJOLPUMJOYDPSPVUJOFT

Slide 32

Slide 32 text

©2018 Lang-8 Inc. ALL Rights Reserved. ίϧʔνϯ͸ϥΠϒϥϦͰఏڙ͞Ε͍ͯΔ IUUQTHJUIVCDPN,PUMJOLPUMJOYDPSPVUJOFT dependencies { implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.1' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.1' implementation ‘org.jetbrains.kotlinx:kotlinx-coroutines-rx2:1.0.1' }

Slide 33

Slide 33 text

©2018 Lang-8 Inc. ALL Rights Reserved. ίϧʔνϯ͸ϥΠϒϥϦͰఏڙ͞Ε͍ͯΔ dependencies { implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.1' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.1' implementation ‘org.jetbrains.kotlinx:kotlinx-coroutines-rx2:1.0.1' } wKBS,# wBQL,# wPQUJNJ[F࠷খ,#

Slide 34

Slide 34 text

©2018 Lang-8 Inc. ALL Rights Reserved. ͳͥίϧʔνϯΛ࢖͍͍͔ͨ wݶΒΕͨϦιʔεͰεέʔϧͰ͖Δ w εϨουd.#ʹରͯ͠ɺίϧʔνϯ͸,#ఔ౓ w؆୯ʹ࢖͑Δ ಡΈॻ͖ͷ͠΍͢͞ wܰྔͳϥΠϒϥϦ w KBS,# BQL,# PQUJNJ[F࠷খ,#

Slide 35

Slide 35 text

©2018 Lang-8 Inc. ALL Rights Reserved. "OESPJEͰίϧʔνϯΛ࢖͏४උ

Slide 36

Slide 36 text

©2018 Lang-8 Inc. ALL Rights Reserved. $PSPVUJOF4DPQFΛ༻ҙ͢Δ

Slide 37

Slide 37 text

©2018 Lang-8 Inc. ALL Rights Reserved. w$PSPVUJOF4DPQF͸ίϧʔνϯͷ࣮ߦ؀ڥ $PSPVUJOF4DPQFΛ༻ҙ͢Δ

Slide 38

Slide 38 text

©2018 Lang-8 Inc. ALL Rights Reserved. w$PSPVUJOF4DPQF͸ίϧʔνϯͷ࣮ߦ؀ڥ wىಈͨ͠ίϧʔνϯ͸$PSPVUJOF4DPQFͷ ࢠʹͳΔ $PSPVUJOF4DPQFΛ༻ҙ͢Δ

Slide 39

Slide 39 text

©2018 Lang-8 Inc. ALL Rights Reserved. w$PSPVUJOF4DPQF͸ίϧʔνϯͷ࣮ߦ؀ڥ wىಈͨ͠ίϧʔνϯ͸$PSPVUJOF4DPQFͷ ࢠʹͳΔ w$PSPVUJOF4DPQF͕ऴྃ͢Δͱࢠίϧʔν ϯ΋ऴྃ͢Δ $PSPVUJOF4DPQFΛ༻ҙ͢Δ

Slide 40

Slide 40 text

©2018 Lang-8 Inc. ALL Rights Reserved. w$PSPVUJOF4DPQF͸ίϧʔνϯͷ࣮ߦ؀ڥ wىಈͨ͠ίϧʔνϯ͸$PSPVUJOF4DPQFͷ ࢠʹͳΔ w$PSPVUJOF4DPQF͕ऴྃ͢Δͱࢠίϧʔν ϯ΋ऴྃ͢Δ wϥΠϑαΠΫϧʹ߹Θͤͯ$PSPVUJOF4DPQF Λ༻ҙ͢Δ $PSPVUJOF4DPQFΛ༻ҙ͢Δ

Slide 41

Slide 41 text

©2018 Lang-8 Inc. ALL Rights Reserved. $PSPVUJOF4DPQFΛ࣮૷͢Δ class MainActivity : AppCompatActivity(), CoroutineScope { val job = Job() override val coroutineContext: CoroutineContext get() = Dispatchers.Main + job

Slide 42

Slide 42 text

©2018 Lang-8 Inc. ALL Rights Reserved. $PSPVUJOF4DPQFΛ࣮૷͢Δ class MainActivity : AppCompatActivity(), CoroutineScope { val job = Job() override val coroutineContext: CoroutineContext get() = Dispatchers.Main + job public interface CoroutineScope { public val coroutineContext: CoroutineContext }

Slide 43

Slide 43 text

©2018 Lang-8 Inc. ALL Rights Reserved. $PSPVUJOF4DPQFΛ࣮૷͢Δ class MainActivity : AppCompatActivity(), CoroutineScope { val job = Job() override val coroutineContext: CoroutineContext get() = Dispatchers.Main + job

Slide 44

Slide 44 text

©2018 Lang-8 Inc. ALL Rights Reserved. $PSPVUJOF4DPQFΛ࣮૷͢Δ class MainActivity : AppCompatActivity(), CoroutineScope { val job = Job() override val coroutineContext: CoroutineContext get() = Dispatchers.Main + job

Slide 45

Slide 45 text

©2018 Lang-8 Inc. ALL Rights Reserved. $PSPVUJOF4DPQFΛ࣮૷͢Δ class MainActivity : AppCompatActivity(), CoroutineScope { val job = Job() override val coroutineContext: CoroutineContext get() = Dispatchers.Main + job ࣮ߦ؀ڥΛઃఆ͢Δ

Slide 46

Slide 46 text

©2018 Lang-8 Inc. ALL Rights Reserved. %JTQBUDIFS͸࣮ߦ؀ڥΛ࢘Δ wίϧʔνϯΛ࣮ߦ͢ΔεϨου΍࣮ߦεέδϡʔ ϧΛ؅ཧ͢Δ w%JTQBUDIFSTΦϒδΣΫτʹ·ͱ·͍ͬͯΔ w༻్ʹ߹Θͤͯ੾Γସ͑Δ

Slide 47

Slide 47 text

©2018 Lang-8 Inc. ALL Rights Reserved. %JTQBUDIFST.BJO wϝΠϯεϨουͰ࣮ߦ͢Δ w"OESPJEͷ৔߹͸6*εϨου)BOEMFS wLPUMJOYDPSPVUJOFTBOESPJE͕ඞཁ

Slide 48

Slide 48 text

©2018 Lang-8 Inc. ALL Rights Reserved. %JTQBUDIFST%FGBVMU wܭࢉ༻εϨουϓʔϧ w$16ίΞ਺෼֬อ͞Ε͍ͯΔ wԿ΋ࢦఆ͠ͳ͍৔߹࢖ΘΕΔ

Slide 49

Slide 49 text

©2018 Lang-8 Inc. ALL Rights Reserved. %JTQBUDIFST*0 w*0ʹ࠷దԽͨ͠εϨουϓʔϧ w࠷௿ฒߦ w%FGBVMUͱεϨουϓʔϧͱڞ༗͍ͯ͠ ΔͷͰߴ଎ Β͍͠ˣ IUUQTHJUIVCDPN,PUMJOLPUMJOYDPSPVUJOFTCMPCNBTUFSDPSFLPUMJOYDPSPVUJOFTDPSFTSDTDIFEVMJOH$PSPVUJOF4DIFEVMFSLU

Slide 50

Slide 50 text

©2018 Lang-8 Inc. ALL Rights Reserved. $PSPVUJOF4DPQFΛ࣮૷͢Δ class MainActivity : AppCompatActivity(), CoroutineScope { val job = Job() override val coroutineContext: CoroutineContext get() = Dispatchers.Main + job

Slide 51

Slide 51 text

©2018 Lang-8 Inc. ALL Rights Reserved. $PSPVUJOF4DPQFΛ࣮૷͢Δ class MainActivity : AppCompatActivity(), CoroutineScope { val job = Job() override val coroutineContext: CoroutineContext get() = Dispatchers.Main + job ࢠίϧʔνϯͷϋϯυϥ

Slide 52

Slide 52 text

©2018 Lang-8 Inc. ALL Rights Reserved. $PSPVUJOF4DPQFΛ࣮૷͢Δ class MainActivity : AppCompatActivity(), CoroutineScope { val job = Job() override val coroutineContext: CoroutineContext get() = Dispatchers.Main + job override fun onResume() { super.onResume() launch { var count = 0 while (true) { delay(1000) println("hi! ${count++}") } } }

Slide 53

Slide 53 text

©2018 Lang-8 Inc. ALL Rights Reserved. $PSPVUJOF4DPQFΛ࣮૷͢Δ class MainActivity : AppCompatActivity(), CoroutineScope { val job = Job() override val coroutineContext: CoroutineContext get() = Dispatchers.Main + job override fun onResume() { super.onResume() launch { var count = 0 while (true) { delay(1000) println("hi! ${count++}") } } } ίϧʔνϯΛىಈ

Slide 54

Slide 54 text

©2018 Lang-8 Inc. ALL Rights Reserved. $PSPVUJOF4DPQFΛ࣮૷͢Δ class MainActivity : AppCompatActivity(), CoroutineScope { val job = Job() override val coroutineContext: CoroutineContext get() = Dispatchers.Main + job override fun onResume() { super.onResume() launch { var count = 0 while (true) { delay(1000) println("hi! ${count++}") } } } NTఀࢭͯ͠࠶։͢Δ

Slide 55

Slide 55 text

©2018 Lang-8 Inc. ALL Rights Reserved. $PSPVUJOF4DPQFΛ࣮૷͢Δ class MainActivity : AppCompatActivity(), CoroutineScope { val job = Job() override val coroutineContext: CoroutineContext get() = Dispatchers.Main + job override fun onResume() { super.onResume() launch { var count = 0 while (true) { delay(1000) println("hi! ${count++}") } } }

Slide 56

Slide 56 text

©2018 Lang-8 Inc. ALL Rights Reserved. $PSPVUJOF4DPQFΛ࣮૷͢Δ override fun onPause() { job.cancelChildren() super.onPause() }

Slide 57

Slide 57 text

©2018 Lang-8 Inc. ALL Rights Reserved. $PSPVUJOF4DPQFΛ࣮૷͢Δ override fun onPause() { job.cancelChildren() super.onPause() } ࢠίϧʔνϯΛ͢΂ͯ Ωϟϯηϧ ऴྃ ͢Δ

Slide 58

Slide 58 text

©2018 Lang-8 Inc. ALL Rights Reserved. $PSPVUJOF4DPQFΛ࣮૷͢Δ override fun onPause() { job.cancelChildren() super.onPause() }

Slide 59

Slide 59 text

©2018 Lang-8 Inc. ALL Rights Reserved. $PSPVUJOF4DPQFΛ࣮૷͢Δ class MainActivity : AppCompatActivity(), CoroutineScope { val job = Job() override val coroutineContext: CoroutineContext get() = Dispatchers.Main + job override fun onResume() { super.onResume() launch {/*…*/} } override fun onPause() { job.cancelChildren() super.onPause() } }

Slide 60

Slide 60 text

©2018 Lang-8 Inc. ALL Rights Reserved. 7JFX.PEFMͱ$PSPVUJOF4DPQF WJFXNPEFMLUYIUUQSBOESPJEDPN w֦ுϓϩύςΟʮWJFX.PEFM4DPQFʯ͕௥Ճ༧ఆ

Slide 61

Slide 61 text

©2018 Lang-8 Inc. ALL Rights Reserved. "OESPJEͰίϧʔνϯΛ࢖͏४උ wίϧʔνϯΛ࣮ߦ͢Δʹ͸ $PSPVUJOF4DPQF͕ඞཁ wϥΠϑαΠΫϧΛ࣋ͭίϯϙʔωϯτͰ $PSPVUJOF4DPQFΛ࣮૷͢Δ w࣮ߦ؀ڥͷઃఆͱΩϟϯηϧॲཧΛ͢Δ

Slide 62

Slide 62 text

©2018 Lang-8 Inc. ALL Rights Reserved. ฒߦॲཧΛॻ͘ ௚ྻɺฒྻɺείʔϓͱྫ֎

Slide 63

Slide 63 text

©2018 Lang-8 Inc. ALL Rights Reserved. ίϧʔνϯϏϧμʔͱ TVTQFOEؔ਺

Slide 64

Slide 64 text

©2018 Lang-8 Inc. ALL Rights Reserved. ίϧʔνϯϏϧμʔͱ͸ wίϧʔνϯΛ։࢝͢Δؔ਺

Slide 65

Slide 65 text

©2018 Lang-8 Inc. ALL Rights Reserved. ίϧʔνϯϏϧμʔͱ͸ wίϧʔνϯΛ։࢝͢Δؔ਺ wMBVODIؔ਺໭Γ஋Λ࣋ͨͳ͍ wBTZODؔ਺໭Γ஋Λ࣋ͭ

Slide 66

Slide 66 text

©2018 Lang-8 Inc. ALL Rights Reserved. ίϧʔνϯϏϧμʔͱ͸ wίϧʔνϯΛ։࢝͢Δؔ਺ wMBVODIؔ਺໭Γ஋Λ࣋ͨͳ͍ wBTZODؔ਺໭Γ஋Λ࣋ͭ w$PSPVUJOF4DPQFͷ֦ுؔ਺

Slide 67

Slide 67 text

©2018 Lang-8 Inc. ALL Rights Reserved. ίϧʔνϯϏϧμʔͱ͸ wίϧʔνϯΛ։࢝͢Δؔ਺ wMBVODIؔ਺໭Γ஋Λ࣋ͨͳ͍ wBTZODؔ਺໭Γ஋Λ࣋ͭ w$PSPVUJOF4DPQFͷ֦ுؔ਺ w౉ͨ͠ϥϜμࣜΛίϧʔνϯͱ͠ ͯىಈ͢Δ

Slide 68

Slide 68 text

©2018 Lang-8 Inc. ALL Rights Reserved. TVTQFOEؔ਺ͱ͸ wεϨουΛϒϩοΩϯά͢Δ͜ͱͳ͘ॲཧΛఀ ࢭͰ͖Δؔ਺

Slide 69

Slide 69 text

©2018 Lang-8 Inc. ALL Rights Reserved. TVTQFOEؔ਺ͱ͸ wεϨουΛϒϩοΩϯά͢Δ͜ͱͳ͘ॲཧΛఀ ࢭͰ͖Δؔ਺ wίʔϧόοΫͷΑ͏ʹ͋ͱͰఀࢭҐஔ͔Β࠶։ Ͱ͖Δ

Slide 70

Slide 70 text

©2018 Lang-8 Inc. ALL Rights Reserved. TVTQFOEؔ਺ͱ͸ wεϨουΛϒϩοΩϯά͢Δ͜ͱͳ͘ॲཧΛఀ ࢭͰ͖Δؔ਺ wίʔϧόοΫͷΑ͏ʹ͋ͱͰఀࢭҐஔ͔Β࠶։ Ͱ͖Δ wTVTQFOEؔ਺͸ଞͷTVTQFOEؔ਺͔ΒͷΈ ݺͼग़͕͠Ͱ͖Δ

Slide 71

Slide 71 text

©2018 Lang-8 Inc. ALL Rights Reserved. TVTQFOEؔ਺ͱ͸ wεϨουΛϒϩοΩϯά͢Δ͜ͱͳ͘ॲཧΛఀ ࢭͰ͖Δؔ਺ wίʔϧόοΫͷΑ͏ʹ͋ͱͰఀࢭҐஔ͔Β࠶։ Ͱ͖Δ wTVTQFOEؔ਺͸ଞͷTVTQFOEؔ਺͔ΒͷΈ ݺͼग़͕͠Ͱ͖Δ wίϧʔνϯϏϧμʔʹΘͨ͢ϥϜμࣜ͸ TVTQFOEϥϜμʹͳ͍ͬͯΔɻ

Slide 72

Slide 72 text

©2018 Lang-8 Inc. ALL Rights Reserved. ඇಉظॲཧΛॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) { requestProfile(id) } fun showProfile(id: Int) { launch { try { val profile = getProfile(id) view.showProfile(profile) } catch(e:CancellationException) { // no op } catch (e: Exception) { view.showError(e) } } }

Slide 73

Slide 73 text

©2018 Lang-8 Inc. ALL Rights Reserved. ඇಉظॲཧΛॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) { requestProfile(id) } fun showProfile(id: Int) { launch { try { val profile = getProfile(id) view.showProfile(profile) } catch(e:CancellationException) { // no op } catch (e: Exception) { view.showError(e) } } } ͜͜ͰॲཧΛதஅ͠ɺ࠶։࣌ʹ1SPpMFΛฦؔ͢਺

Slide 74

Slide 74 text

©2018 Lang-8 Inc. ALL Rights Reserved. ඇಉظॲཧΛॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) { requestProfile(id) } fun showProfile(id: Int) { launch { try { val profile = getProfile(id) view.showProfile(profile) } catch(e:CancellationException) { // no op } catch (e: Exception) { view.showError(e) } } } ίϧʔνϯͷ࣮ߦ؀ڥΛ੾Γସ͑ΔTVTVQFOEؔ਺

Slide 75

Slide 75 text

©2018 Lang-8 Inc. ALL Rights Reserved. ඇಉظॲཧΛॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) { requestProfile(id) } fun showProfile(id: Int) { launch { try { val profile = getProfile(id) view.showProfile(profile) } catch(e:CancellationException) { // no op } catch (e: Exception) { view.showError(e) } } } ίϧʔνϯͷ࣮ߦ؀ڥΛ੾Γସ͑ΔTVTVQFOEؔ਺ ͜͜Ͱ͸ϫʔΧʔεϨουͰಈ͘ઃఆΛ͍ͯ͠Δ

Slide 76

Slide 76 text

©2018 Lang-8 Inc. ALL Rights Reserved. ඇಉظॲཧΛॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) { requestProfile(id) } fun showProfile(id: Int) { launch { try { val profile = getProfile(id) view.showProfile(profile) } catch(e:CancellationException) { // no op } catch (e: Exception) { view.showError(e) } } } "1*ϦΫΤετɻϒϩοΩϯά͢Δॲཧ

Slide 77

Slide 77 text

©2018 Lang-8 Inc. ALL Rights Reserved. ඇಉظॲཧΛॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) { requestProfile(id) } fun showProfile(id: Int) { launch { try { val profile = getProfile(id) view.showProfile(profile) } catch(e:CancellationException) { // no op } catch (e: Exception) { view.showError(e) } } } ίϧʔνϯΛىಈ %JTQBUDIFST.BJOKPCͱ͢Δ

Slide 78

Slide 78 text

©2018 Lang-8 Inc. ALL Rights Reserved. ඇಉظॲཧΛॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) { requestProfile(id) } fun showProfile(id: Int) { launch { try { val profile = getProfile(id) view.showProfile(profile) } catch(e:CancellationException) { // no op } catch (e: Exception) { view.showError(e) } } }

Slide 79

Slide 79 text

©2018 Lang-8 Inc. ALL Rights Reserved. ඇಉظॲཧΛॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) { requestProfile(id) } fun showProfile(id: Int) { launch { try { val profile = getProfile(id) view.showProfile(profile) } catch(e:CancellationException) { // no op } catch (e: Exception) { view.showError(e) } } } ᶃݺͼग़ͯ͠தஅ͢Δ

Slide 80

Slide 80 text

©2018 Lang-8 Inc. ALL Rights Reserved. ඇಉظॲཧΛॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) { requestProfile(id) } fun showProfile(id: Int) { launch { try { val profile = getProfile(id) view.showProfile(profile) } catch(e:CancellationException) { // no op } catch (e: Exception) { view.showError(e) } } } ᶃݺͼग़ͯ͠தஅ͢Δ ϫʔΧʔεϨουͰಈ࡞

Slide 81

Slide 81 text

©2018 Lang-8 Inc. ALL Rights Reserved. ඇಉظॲཧΛॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) { requestProfile(id) } fun showProfile(id: Int) { launch { try { val profile = getProfile(id) view.showProfile(profile) } catch(e:CancellationException) { // no op } catch (e: Exception) { view.showError(e) } } } ᶃݺͼग़ͯ͠தஅ͢Δ ϫʔΧʔεϨουͰಈ࡞ ᶄ࠶։ͯ͠୅ೖ

Slide 82

Slide 82 text

©2018 Lang-8 Inc. ALL Rights Reserved. ඇಉظॲཧΛॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) { requestProfile(id) } fun showProfile(id: Int) { launch { try { val profile = getProfile(id) view.showProfile(profile) } catch(e:CancellationException) { // no op } catch (e: Exception) { view.showError(e) } } } ᶃݺͼग़ͯ͠தஅ͢Δ ϫʔΧʔεϨουͰಈ࡞ ᶄ࠶։ͯ͠୅ೖ 6*εϨουͰಈ࡞

Slide 83

Slide 83 text

©2018 Lang-8 Inc. ALL Rights Reserved. ඇಉظॲཧΛॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) { requestProfile(id) } fun showProfile(id: Int) { launch { try { val profile = getProfile(id) view.showProfile(profile) } catch(e:CancellationException) { // no op } catch (e: Exception) { view.showError(e) } } } ᶃݺͼग़ͯ͠தஅ͢Δ ϫʔΧʔεϨουͰಈ࡞ ᶄ࠶։ͯ͠୅ೖ 6*εϨουͰಈ࡞ ᶅ7JFXʹ൓ө

Slide 84

Slide 84 text

©2018 Lang-8 Inc. ALL Rights Reserved. ඇಉظॲཧΛॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) { requestProfile(id) } fun showProfile(id: Int) { launch { try { val profile = getProfile(id) view.showProfile(profile) } catch(e:CancellationException) { // no op } catch (e: Exception) { view.showError(e) } } } ᶃݺͼग़ͯ͠தஅ͢Δ ϫʔΧʔεϨουͰಈ࡞ ᶄ࠶։ͯ͠୅ೖ 6*εϨουͰಈ࡞ ᶅ7JFXʹ൓ө ྫ֎࣌͸ͬͪ͜

Slide 85

Slide 85 text

©2018 Lang-8 Inc. ALL Rights Reserved. ඇಉظॲཧΛॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) { requestProfile(id) } fun showProfile(id: Int) { launch { try { val profile = getProfile(id) view.showProfile(profile) } catch(e:CancellationException) { // no op } catch (e: Exception) { view.showError(e) } } } ᶃݺͼग़ͯ͠தஅ͢Δ ϫʔΧʔεϨουͰಈ࡞ ᶄ࠶։ͯ͠୅ೖ 6*εϨουͰಈ࡞ ᶅ7JFXʹ൓ө ྫ֎࣌͸ͬͪ͜ Ωϟϯηϧ είʔϓ͕ऴྃͨ͠ ͸ͬͪ͜

Slide 86

Slide 86 text

©2018 Lang-8 Inc. ALL Rights Reserved. ඇಉظॲཧΛॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) { requestProfile(id) } fun showProfile(id: Int) { launch { try { val profile = getProfile(id) view.showProfile(profile) } catch(e:CancellationException) { // no op } catch (e: Exception) { view.showError(e) } } }

Slide 87

Slide 87 text

©2018 Lang-8 Inc. ALL Rights Reserved. ௚ྻʹॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) { requestProfile(id) } suspend fun getTicketCount(id: Int): Int = withContext(Dispatchers.IO) { requestTicketCount(id) } fun showProfile(id: Int) { launch { try { val profile = getProfile(id) val ticketCount = getTicketCount(id) view.showProfile(profile, ticketCount) } catch (e: Exception) { view.showError(e) } } }

Slide 88

Slide 88 text

©2018 Lang-8 Inc. ALL Rights Reserved. ௚ྻʹॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) { requestProfile(id) } suspend fun getTicketCount(id: Int): Int = withContext(Dispatchers.IO) { requestTicketCount(id) } fun showProfile(id: Int) { launch { try { val profile = getProfile(id) val ticketCount = getTicketCount(id) view.showProfile(profile, ticketCount) } catch (e: Exception) { view.showError(e) } } }

Slide 89

Slide 89 text

©2018 Lang-8 Inc. ALL Rights Reserved. ඇಉظॲཧΛॻ͘ wXJUI$POUFYUؔ਺Λ࢖ͬͯίϧʔνϯͷ࣮ߦ ؀ڥΛ੾Γସ͑Δ w௚ྻͰ࣮ߦ͢Δ৔߹͸୯७ʹฒ΂Δ͚ͩͰྑ͍ wΤϥʔͱΩϟϯηϧ͸USZDBUDIͰॲཧ͢Δ wඇಉظॲཧͷ΄ͱΜͲ͸͜ΕͰରԠͰ͖Δ͸ͣ

Slide 90

Slide 90 text

©2018 Lang-8 Inc. ALL Rights Reserved. ฒྻʹॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) {…} suspend fun getTicketCount(id: Int): Int = withContext(Dispatchers.IO) {…} fun showProfile(id: Int) { launch { try { coroutineScope { val profile = async { getProfile(id) } val tickets = async { getTicket(id) } view.showProfile(profile.await(), tickets.await()) } } catch (e: Exception) { view.showError(e) } } }

Slide 91

Slide 91 text

©2018 Lang-8 Inc. ALL Rights Reserved. ฒྻʹॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) {…} suspend fun getTicketCount(id: Int): Int = withContext(Dispatchers.IO) {…} fun showProfile(id: Int) { launch { try { coroutineScope { val profile = async { getProfile(id) } val tickets = async { getTicket(id) } view.showProfile(profile.await(), tickets.await()) } } catch (e: Exception) { view.showError(e) } } }

Slide 92

Slide 92 text

©2018 Lang-8 Inc. ALL Rights Reserved. ฒྻʹॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) {…} suspend fun getTicketCount(id: Int): Int = withContext(Dispatchers.IO) {…} fun showProfile(id: Int) { launch { try { coroutineScope { val profile = async { getProfile(id) } val tickets = async { getTicket(id) } view.showProfile(profile.await(), tickets.await()) } } catch (e: Exception) { view.showError(e) } } } DPSPVUJOF4DPQFؔ਺Λ࢖ͬͯ ࢠείʔϓΛ։࢝͢Δ

Slide 93

Slide 93 text

©2018 Lang-8 Inc. ALL Rights Reserved. ฒྻʹॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) {…} suspend fun getTicketCount(id: Int): Int = withContext(Dispatchers.IO) {…} fun showProfile(id: Int) { launch { try { coroutineScope { val profile = async { getProfile(id) } val tickets = async { getTicket(id) } view.showProfile(profile.await(), tickets.await()) } } catch (e: Exception) { view.showError(e) } } } BTZODؔ਺ͰίϧʔνϯΛෳ਺ىಈ͢Δ

Slide 94

Slide 94 text

©2018 Lang-8 Inc. ALL Rights Reserved. ฒྻʹॻ͘ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) {…} suspend fun getTicketCount(id: Int): Int = withContext(Dispatchers.IO) {…} fun showProfile(id: Int) { launch { try { coroutineScope { val profile = async { getProfile(id) } val tickets = async { getTicket(id) } view.showProfile(profile.await(), tickets.await()) } } catch (e: Exception) { view.showError(e) } } } ଴ͪ߹ΘͤΔ

Slide 95

Slide 95 text

©2018 Lang-8 Inc. ALL Rights Reserved. DPSPVUJOF4DPQFؔ਺͕ͳ͔ͬͨΒ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) {…} suspend fun getTicketCount(id: Int): Int = withContext(Dispatchers.IO) {…} fun showProfile(id: Int) { launch { try { val profile = async { getProfile(id) } val tickets = async { getTicket(profile.id) } view.showProfile(profile.await(), tickets.await()) } catch (e: Exception) { view.showError(e) } } }

Slide 96

Slide 96 text

©2018 Lang-8 Inc. ALL Rights Reserved. DPSPVUJOF4DPQFؔ਺͕ͳ͔ͬͨΒ suspend fun getProfile(id: Int): Profile = withContext(Dispatchers.IO) {…} suspend fun getTicketCount(id: Int): Int = withContext(Dispatchers.IO) {…} fun showProfile(id: Int) { launch { try { val profile = async { getProfile(id) } val tickets = async { getTicket(profile.id) } view.showProfile(profile.await(), tickets.await()) } catch (e: Exception) { view.showError(e) } } }

Slide 97

Slide 97 text

©2018 Lang-8 Inc. ALL Rights Reserved. ฒߦੑͷߏ଄Խ IUUQTNFEJVNDPN!FMJ[BSPWTUSVDUVSFEDPODVSSFODZEBB

Slide 98

Slide 98 text

©2018 Lang-8 Inc. ALL Rights Reserved. ฒߦੑͷߏ଄Խ IUUQTWPSQVTPSHCMPHOPUFTPOTUSVDUVSFEDPODVSSFODZPSHPTUBUFNFOUDPOTJEFSFEIBSNGVM

Slide 99

Slide 99 text

©2018 Lang-8 Inc. ALL Rights Reserved. wߏ଄Խϓϩάϥϛϯάͷฒߦੑ൛ wฒߦॲཧʹ͓͚ΔHPUPͷΑ͏ͳ ΋ͷΛͳٞ͘͢࿦ w$PSPVUJOF4DPQF͸͜ͷٞ࿦ Λجʹಋೖ͞Εͨ ฒߦੑͷߏ଄Խͬͯʁ

Slide 100

Slide 100 text

©2018 Lang-8 Inc. ALL Rights Reserved. ฒߦੑʹ͓͚ΔHPUP void save(int data, File file) { try (FileOutputStream out = new FileOutputStream(file);) { new Thread() { @Override public void run() { try { out.write(data); } catch (IOException e) { // error } } }.start(); } catch (IOException e) { // error } }

Slide 101

Slide 101 text

©2018 Lang-8 Inc. ALL Rights Reserved. ฒߦੑʹ͓͚ΔHPUP void save(int data, File file) { try (FileOutputStream out = new FileOutputStream(file);) { new Thread() { @Override public void run() { try { out.write(data); } catch (IOException e) { // error } } }.start(); } catch (IOException e) { // error } } USZXJUISFTPVSDFTͰϑΝΠϧΛ։͘

Slide 102

Slide 102 text

©2018 Lang-8 Inc. ALL Rights Reserved. void save(int data, File file) { try (FileOutputStream out = new FileOutputStream(file);) { new Thread() { @Override public void run() { try { out.write(data); } catch (IOException e) { // error } } }.start(); } catch (IOException e) { // error } } ฒߦੑʹ͓͚ΔHPUP USZXJUISFTPVSDFTͷதͰεϨου Λىಈͯ͠PVUʹ৮ͬͯ΋ඞͣDMPTFࡁ ΈͳͷͰΤϥʔʹͳΔ

Slide 103

Slide 103 text

©2018 Lang-8 Inc. ALL Rights Reserved. wฒߦ෼ذͷ։࢝ͱऴྃΛͻͱ·ͱ·Γͷ୯Ґ ʹͯ͠ɺͦΕΒΛ֊૚ߏ଄ʹ͢Δ ฒߦੑʹ͓͚ΔHPUPΛ๷͙ΞΠσΞ ฒߦ෼ذͷ·ͱ·Γ $PSPVUJOF4DPQF

Slide 104

Slide 104 text

©2018 Lang-8 Inc. ALL Rights Reserved. ฒߦੑͷߏ଄ԽͷΠϝʔδ

Slide 105

Slide 105 text

©2018 Lang-8 Inc. ALL Rights Reserved. ฒߦੑΛߏ଄Խ͢Δ fun showProfile(id: Int) { launch { try { coroutineScope { val profile = async { getProfile(id) } val tickets = async { getTicket(id) } view.showProfile(profile.await(), tickets.await()) } } catch (e: Exception) { view.showError(e) } } }

Slide 106

Slide 106 text

©2018 Lang-8 Inc. ALL Rights Reserved. ฒߦੑΛߏ଄Խ͢Δ fun showProfile(id: Int) { launch { try { coroutineScope { val profile = async { getProfile(id) } val tickets = async { getTicket(id) } view.showProfile(profile.await(), tickets.await()) } } catch (e: Exception) { view.showError(e) } } } 1BSFOU4DPQF $IJME4DPQF MBVODI BTZOD BTZOD

Slide 107

Slide 107 text

©2018 Lang-8 Inc. ALL Rights Reserved. είʔϓͱྫ֎ 1BSFOU4DPQF $IJME4DPQF MBVODI BTZOD BTZOD

Slide 108

Slide 108 text

©2018 Lang-8 Inc. ALL Rights Reserved. είʔϓͱྫ֎ 1BSFOU4DPQF $IJME4DPQF MBVODI BTZOD BTZOD

Slide 109

Slide 109 text

©2018 Lang-8 Inc. ALL Rights Reserved. είʔϓͱྫ֎ 1BSFOU4DPQF $IJME4DPQF MBVODI BTZOD BTZOD είʔϓ಺ͷฒߦ෼ذͷ͍ͣΕ͔͕ΤϥʔʹͳΔͱ είʔϓશମ͕Τϥʔ Ωϟϯηϧ ʹͳΔ

Slide 110

Slide 110 text

©2018 Lang-8 Inc. ALL Rights Reserved. DPSPVUJOF4DPQFؔ਺ fun showProfile(id: Int) { launch { try { coroutineScope { val profile = async { getProfile(id) } val tickets = async { getTicket(profile.id) } view.showProfile(profile.await(), tickets.await()) } } catch (e: Exception) { view.showError(e) } } } UISPX&YDFQUJPO

Slide 111

Slide 111 text

©2018 Lang-8 Inc. ALL Rights Reserved. DPSPVUJOF4DPQFؔ਺ fun showProfile(id: Int) { launch { try { coroutineScope { val profile = async { getProfile(id) } val tickets = async { getTicket(profile.id) } view.showProfile(profile.await(), tickets.await()) } } catch (e: Exception) { view.showError(e) } } } ࢠείʔϓ͕ऴྃ͠ྫ֎͕ඈΜͰ͘Δ

Slide 112

Slide 112 text

©2018 Lang-8 Inc. ALL Rights Reserved. DPSPVUJOF4DPQFؔ਺͕ͳ͔ͬͨΒ fun showProfile(id: Int) { launch { try { val profile = async { requestProfile(id) } val tickets = async { requestTicket(profile.id) } view.showProfile(profile.await(), tickets.await()) } catch (e: Exception) { view.showError(e) } } }

Slide 113

Slide 113 text

©2018 Lang-8 Inc. ALL Rights Reserved. 1BSFOU4DPQF MBVODI BTZOD BTZOD DPSPVUJOF4DPQFؔ਺͕ͳ͔ͬͨΒ

Slide 114

Slide 114 text

©2018 Lang-8 Inc. ALL Rights Reserved. 1BSFOU4DPQF MBVODI BTZOD BTZOD DPSPVUJOF4DPQFؔ਺͕ͳ͔ͬͨΒ

Slide 115

Slide 115 text

©2018 Lang-8 Inc. ALL Rights Reserved. ฒྻॲཧΛॻ͘ wίϧʔνϯͷதͰίϧʔνϯ ෼ذ Λىಈ͢Δ৔ ߹͸DPSPVUJOF4DPQFؔ਺Λ࢖͏ είʔϓͷ ֊૚ߏ଄Λߟ͑Δ wMBVODIBTZODΛωετͯ͠Δ࣌͸஫ҙ w෼ذ͕Τϥʔʹͳͬͯ΋είʔϓΛܧଓͰ͖Δ TVQFSWJTPS4DPQFؔ਺͕͋Δ ࠓճ͸লུ IUUQTLPUMJOHJUIVCJPLPUMJOYDPSPVUJOFTLPUMJOYDPSPVUJOFTDPSFLPUMJOYDPSPVUJOFTTVQFSWJTPSTDPQFIUNM

Slide 116

Slide 116 text

©2018 Lang-8 Inc. ALL Rights Reserved. 3YXJUI$PSPVUJOF

Slide 117

Slide 117 text

©2018 Lang-8 Inc. ALL Rights Reserved.

Slide 118

Slide 118 text

©2018 Lang-8 Inc. ALL Rights Reserved.

Slide 119

Slide 119 text

©2018 Lang-8 Inc. ALL Rights Reserved.

Slide 120

Slide 120 text

©2018 Lang-8 Inc. ALL Rights Reserved.

Slide 121

Slide 121 text

©2018 Lang-8 Inc. ALL Rights Reserved.

Slide 122

Slide 122 text

©2018 Lang-8 Inc. ALL Rights Reserved. 3Y+BWBͱͷ౷߹ wLPUMJOYDPSPVUJOFTSYΛ࢖͏ w4JOHMF .BZCF $PNQMFUBCMFͳͲΛ TVTQFOEؔ਺ʹͰ͖Δ wTVTQFOEؔ਺Λ4JOHMF .BZCF $PNQMFUBCMFͳͲͰ͖Δ IUUQTHJUIVCDPN,PUMJOLPUMJOYDPSPVUJOFTUSFFNBTUFSSFBDUJWFLPUMJOYDPSPVUJOFTSY

Slide 123

Slide 123 text

©2018 Lang-8 Inc. ALL Rights Reserved. 4JOHMFΛTVTQFOEؔ਺ʹ͢Δ interface RemoteService { @GET("/profile") fun getProfile(id: Int): Single }

Slide 124

Slide 124 text

©2018 Lang-8 Inc. ALL Rights Reserved. 4JOHMFΛTVTQFOEؔ਺ʹ͢Δ interface RemoteService { @GET("/profile") fun getProfile(id: Int): Single } val profile = withContext { service.getProfile(id).await() } 4JOHMFͷ֦ுؔ਺ʹ BXBJU ͕௥Ճ͞Ε͍ͯΔ

Slide 125

Slide 125 text

©2018 Lang-8 Inc. ALL Rights Reserved. TVTQFOEؔ਺Λ4JOHMFʹ͢Δ fun getProfile(id: Int): Single { return rxSingle { Profile(id) } } TVTQFOEϥϜμΛड͚औͬͯ݁ՌΛ 4JOHMFͰฦؔ͢਺

Slide 126

Slide 126 text

©2018 Lang-8 Inc. ALL Rights Reserved. TVTQFOEؔ਺Λ4JOHMFʹ͢Δ fun getProfile(id: Int): Single { return rxSingle { Profile(id) } } TVTQFOEϥϜμΛड͚औͬͯ݁ՌΛ 4JOHMFͰฦؔ͢਺ Τϥʔʹͳͬͯ΋਌είʔϓΛ Ωϟϯηϧ͠ͳ͍

Slide 127

Slide 127 text

©2018 Lang-8 Inc. ALL Rights Reserved. 3Y+BWBXJUI$PSPVUJPOF w LPUMJOYDPSPVUJOFTSYͰ૬ޓͷΠϯςάϨʔγϣ ϯ͕Մೳ w ྫ͑͹ෳࡶʹ߹੒͕ඞཁͳՕॴͳͲ͸ίϧʔνϯͰϑϥο τʹॻ͍ͯ࠷ޙʹ4JOHMFʹ͢Δͱ͔͕͍͍͔΋ w ରཱ͢Δ΋ͷͰ͸ͳ͍ͷͰ͍͍ײ͡ʹ࢖͏ͷ͕ྑ͍ ͓͢ ͢Ί͸4JOHMF .BZCF $PNQMFUBCMFͷஔ͖׵͑

Slide 128

Slide 128 text

©2018 Lang-8 Inc. ALL Rights Reserved. +FUQBDLXJUI$PSPVUJOF

Slide 129

Slide 129 text

©2018 Lang-8 Inc. ALL Rights Reserved. 8PSL.BOBHFSͱίϧʔνϯ wBMQIBͰ$PSPVUJOF8PSLFSΛ௥Ճ

Slide 130

Slide 130 text

©2018 Lang-8 Inc. ALL Rights Reserved. 8PSL.BOBHFSͱ$PSPVUJOF8PSLFS class MyWorker(context: Context, param: WorkerParameters) : CoroutineWorker(context, param) { override val coroutineContext = Dispatchers.IO override suspend fun doWork(): Payload { return Payload(Result.SUCCESS) } }

Slide 131

Slide 131 text

©2018 Lang-8 Inc. ALL Rights Reserved. 8PSL.BOBHFSͱ$PSPVUJOF8PSLFS class MyWorker(context: Context, param: WorkerParameters) : CoroutineWorker(context, param) { override val coroutineContext = Dispatchers.IO override suspend fun doWork(): Payload { return Payload(Result.SUCCESS) } } EP8PSLؔ਺͕TVTQFOEؔ਺ʹͳΔ

Slide 132

Slide 132 text

©2018 Lang-8 Inc. ALL Rights Reserved. 8PSL.BOBHFSͱ$PSPVUJOF8PSLFS class MyWorker(context: Context, param: WorkerParameters) : CoroutineWorker(context, param) { override val coroutineContext = Dispatchers.IO override suspend fun doWork(): Payload { return Payload(Result.SUCCESS) } } ΦʔόʔϥΠυͰ͖Δɻ σϑΥϧτ͸%JTQBUDIFST%FGBVMU

Slide 133

Slide 133 text

©2018 Lang-8 Inc. ALL Rights Reserved. 8PSL.BOBHFSͱ$PSPVUJOF8PSLFS class MyWorker(context: Context, param: WorkerParameters) : CoroutineWorker(context, param) { override val coroutineContext = Dispatchers.IO override suspend fun doWork(): Payload { return Payload(Result.SUCCESS) } } ໭Γ஋͕8PSLFSͱ͸ҟͳΔɻ PVUQVU%BUBΛ໌ࣔతʹ౉͢ඞཁ͕͋Δ

Slide 134

Slide 134 text

©2018 Lang-8 Inc. ALL Rights Reserved. 8PSL.BOBHFSͱ$PSPVUJOF8PSLFS class MyWorker(context: Context, param: WorkerParameters) : CoroutineWorker(context, param) { override val coroutineContext = Dispatchers.IO override suspend fun doWork(): Payload { return Payload(Result.SUCCESS) } } ໭Γ஋͕8PSLFSͱ͸ҟͳΔɻ PVUQVU%BUBΛ໌ࣔతʹ౉͢ඞཁ͕͋Δ public Payload(@NonNull Result result, @NonNull Data output) { mResult = result; mOutput = output; }

Slide 135

Slide 135 text

©2018 Lang-8 Inc. ALL Rights Reserved. 3PPNͱίϧʔνϯ w BMQIBͰ%"0ͰTVTQFOEؔ਺Λαϙʔτ

Slide 136

Slide 136 text

©2018 Lang-8 Inc. ALL Rights Reserved. 3PPNͱTVTQFOEؔ਺ @Dao interface UserDao { @Insert suspend fun insert(user: User) @Update suspend fun update(user: User) @Query("SELECT * FROM user") suspend fun getAllUsers(): List @Delete suspend fun delete(user: User) }

Slide 137

Slide 137 text

©2018 Lang-8 Inc. ALL Rights Reserved. 3PPNͱTVTQFOEؔ਺ val job = Job() val scope = CoroutineScope(Dispatchers.Main + job) scope.launch { try { val dao = db.userDao() dao.insert(User(firstName = "Jack", lastName = "Jill")) // do something } catch (e: java.lang.Exception) { // insert error } }

Slide 138

Slide 138 text

©2018 Lang-8 Inc. ALL Rights Reserved. 3PPNͱTVTQFOEؔ਺ val job = Job() val scope = CoroutineScope(Dispatchers.Main + job) scope.launch { try { val dao = db.userDao() dao.insert(User(firstName = "Jack", lastName = "Jill")) // do something } catch (e: java.lang.Exception) { // insert error } } ಺෦ͰXJUI$POUFYUؔ਺͕ݺͼग़͞ΕΔ

Slide 139

Slide 139 text

©2018 Lang-8 Inc. ALL Rights Reserved. 3PPNͱTVTQFOEؔ਺ val job = Job() val scope = CoroutineScope(Dispatchers.Main + job) scope.launch { try { val dao = db.userDao() dao.insert(User(firstName = "Jack", lastName = "Jill")) // do something } catch (e: java.lang.Exception) { // insert error } } ಺෦ͰXJUI$POUFYUؔ਺͕ݺͼग़͞ΕΔ 3PPNͷ2VFSZ&YFDVUPSΛ %JTQBUDIFSʹ͍ͯ͠Δ

Slide 140

Slide 140 text

©2018 Lang-8 Inc. ALL Rights Reserved. TVTQFOEؔ਺ͱ2VFSZ&YFDVUPS val db = Room.databaseBuilder( applicationContext, AppDatabase::class.java, "database-name" ).apply { val dispatcher = Dispatchers.IO if (dispatcher is ExecutorCoroutineDispatcher) { setQueryExecutor(dispatcher.executor) } }.build()

Slide 141

Slide 141 text

©2018 Lang-8 Inc. ALL Rights Reserved. TVTQFOEؔ਺ͱ2VFSZ&YFDVUPS val db = Room.databaseBuilder( applicationContext, AppDatabase::class.java, "database-name" ).apply { val dispatcher = Dispatchers.IO if (dispatcher is ExecutorCoroutineDispatcher) { setQueryExecutor(dispatcher.executor) } }.build() 3PPN#VJMEFSͰ&YFDVUPSΛઃఆͰ͖Δ

Slide 142

Slide 142 text

©2018 Lang-8 Inc. ALL Rights Reserved. ·ͱΊ w ίϧʔνϯ͸লϝϞϦɺॻ͖΍͍͢ ಡΈ΍͍͢ ɺϥΠϒϥϦͱ ͯ͠΋ܰྔ w $PSPVUJOF4DPQFͱϥΠϑαΠΫϧΛ࣋ͭίϯϙʔωϯτΛ૊ Έ߹Θͤͯ࢖͏ w ୯७ͳඇಉظॲཧ͸XJUI$POUFYUؔ਺Ͱେ఍͸ΧόʔͰ͖Δ w ฒྻͰίϧʔνϯΛىಈ͢Δ৔߹͸είʔϓͷ֊૚Λҙࣝ͢Δඞ ཁ͕͋Δɻ w 3Yͱ͸ରཱ͠ͳ͍ɻҰ෦ͷॲཧ͕ஔ͖׵͕͑Ͱ͖Δ͔΋ w +FUQBDLͰ΋ଓʑαϙʔτ͕ਐΜͰಋೖ͠΍͘͢ͳ͖͍ͬͯͯΔ

Slide 143

Slide 143 text

©2018 Lang-8 Inc. ALL Rights Reserved. ©2018 Lang-8 Inc. ALL Rights Reserved. ͋Γ͕ͱ͏͍͟͝·ͨ͠