Upgrade to Pro — share decks privately, control downloads, hide ads and more …

droidkaigi-2018

Yuya Kaido
February 09, 2018

 droidkaigi-2018

Yuya Kaido

February 09, 2018
Tweet

More Decks by Yuya Kaido

Other Decks in Programming

Transcript

  1.  ࣗݾ঺հ • yuyakaido • eureka, Inc. • Android Engineer

    • DroidKaigi 2016 • ๻͕ςετ͓͡͞ΜʹͳͬͨܦҢͱ΍ͬͨ͜ͱ • DroidKaigi 2017 • Error Handling in RxJava
  2.  ϚϧνϩάΠϯ࣮૷ͷઃܭํ਑ • ҰൠతͳΞϓϦ͸ɺActivity - ViewModel - Repositoryͱ ͍ͬͨϨΠϠʔʹͳΔ͜ͱ͕ଟ͍ •

    ෳ਺ΞΧ΢ϯτͰಉ࣌ϩάΠϯ͕ඞཁͳΞϓϦͰ͸ɺ RepositoryҎԼΛΞΧ΢ϯτ୯ҐͰ؅ཧ͢Δͱ͍͍
  3.  Πϯελϯε؅ཧ • ֤ϨΠϠʔͷΠϯελϯε͸ϥΠϑαΠΫϧ͕ҟͳΔ • Application • ΞϓϦىಈʙऴྃ·Ͱ • Account

    • ϩάΠϯʙϩάΞ΢τ·Ͱ • ࣗલͰΠϯελϯε؅ཧΛ࣮૷ͯ͠΋͍͍͕ɺDagger ͳͲͷDIίϯςφΛ࢖͏ͱָʹ࣮૷Ͱ͖Δ
  4.  Account • 1ͭͷΞΧ΢ϯτΛදݱ͢ΔΫϥε • ΞΧ΢ϯτ୯ҐͰσʔλ΍ඇಉظॲཧΛ؅ཧ͢Δ class Account(val twitter: TwitterSession)

    { @Inject lateinit var repository: TweetRepository @Inject lateinit var preference: AccountPreference @Inject lateinit var disposables: CompositeDisposable fun onLoggedIn() // ΞΧ΢ϯτͷϩάΠϯॲཧ fun onLoggedOut() // ΞΧ΢ϯτͷϩάΞ΢τॲཧ fun save() // ΞΧ΢ϯτΛอଘ͢Δ fun delete() // ΞΧ΢ϯτΛ࡟আ͢Δ }
  5.  Account • 1ͭͷΞΧ΢ϯτΛදݱ͢ΔΫϥε • ΞΧ΢ϯτ୯ҐͰσʔλ΍ඇಉظॲཧΛ؅ཧ͢Δ class Account(val twitter: TwitterSession)

    { @Inject lateinit var repository: TweetRepository @Inject lateinit var preference: AccountPreference @Inject lateinit var disposables: CompositeDisposable fun onLoggedIn() // ΞΧ΢ϯτͷϩάΠϯॲཧ fun onLoggedOut() // ΞΧ΢ϯτͷϩάΞ΢τॲཧ fun save() // ΞΧ΢ϯτΛอଘ͢Δ fun delete() // ΞΧ΢ϯτΛ࡟আ͢Δ }
  6.  Account • 1ͭͷΞΧ΢ϯτΛදݱ͢ΔΫϥε • ΞΧ΢ϯτ୯ҐͰσʔλ΍ඇಉظॲཧΛ؅ཧ͢Δ class Account(val twitter: TwitterSession)

    { @Inject lateinit var repository: TweetRepository @Inject lateinit var preference: AccountPreference @Inject lateinit var disposables: CompositeDisposable fun onLoggedIn() // ΞΧ΢ϯτͷϩάΠϯॲཧ fun onLoggedOut() // ΞΧ΢ϯτͷϩάΞ΢τॲཧ fun save() // ΞΧ΢ϯτΛอଘ͢Δ fun delete() // ΞΧ΢ϯτΛ࡟আ͢Δ }
  7.  Account • 1ͭͷΞΧ΢ϯτΛදݱ͢ΔΫϥε • ΞΧ΢ϯτ୯ҐͰσʔλ΍ඇಉظॲཧΛ؅ཧ͢Δ class Account(val twitter: TwitterSession)

    { @Inject lateinit var repository: TweetRepository @Inject lateinit var preference: AccountPreference @Inject lateinit var disposables: CompositeDisposable fun onLoggedIn() // ΞΧ΢ϯτͷϩάΠϯॲཧ fun onLoggedOut() // ΞΧ΢ϯτͷϩάΞ΢τॲཧ fun save() // ΞΧ΢ϯτΛอଘ͢Δ fun delete() // ΞΧ΢ϯτΛ࡟আ͢Δ }
  8.  Account • 1ͭͷΞΧ΢ϯτΛදݱ͢ΔΫϥε • ΞΧ΢ϯτ୯ҐͰσʔλ΍ඇಉظॲཧΛ؅ཧ͢Δ class Account(val twitter: TwitterSession)

    { @Inject lateinit var repository: TweetRepository @Inject lateinit var preference: AccountPreference @Inject lateinit var disposables: CompositeDisposable fun onLoggedIn() // ΞΧ΢ϯτͷϩάΠϯॲཧ fun onLoggedOut() // ΞΧ΢ϯτͷϩάΞ΢τॲཧ fun save() // ΞΧ΢ϯτΛอଘ͢Δ fun delete() // ΞΧ΢ϯτΛ࡟আ͢Δ }
  9.  Account • 1ͭͷΞΧ΢ϯτΛදݱ͢ΔΫϥε • ΞΧ΢ϯτ୯ҐͰσʔλ΍ඇಉظॲཧΛ؅ཧ͢Δ class Account(val twitter: TwitterSession)

    { @Inject lateinit var repository: TweetRepository @Inject lateinit var preference: AccountPreference @Inject lateinit var disposables: CompositeDisposable fun onLoggedIn() // ΞΧ΢ϯτͷϩάΠϯॲཧ fun onLoggedOut() // ΞΧ΢ϯτͷϩάΞ΢τॲཧ fun save() // ΞΧ΢ϯτΛอଘ͢Δ fun delete() // ΞΧ΢ϯτΛ࡟আ͢Δ }
  10.  Account • 1ͭͷΞΧ΢ϯτΛදݱ͢ΔΫϥε • ΞΧ΢ϯτ୯ҐͰσʔλ΍ඇಉظॲཧΛ؅ཧ͢Δ class Account(val twitter: TwitterSession)

    { @Inject lateinit var repository: TweetRepository @Inject lateinit var preference: AccountPreference @Inject lateinit var disposables: CompositeDisposable fun onLoggedIn() // ΞΧ΢ϯτͷϩάΠϯॲཧ fun onLoggedOut() // ΞΧ΢ϯτͷϩάΞ΢τॲཧ fun save() // ΞΧ΢ϯτΛอଘ͢Δ fun delete() // ΞΧ΢ϯτΛ࡟আ͢Δ }
  11.  Account • 1ͭͷΞΧ΢ϯτΛදݱ͢ΔΫϥε • ΞΧ΢ϯτ୯ҐͰσʔλ΍ඇಉظॲཧΛ؅ཧ͢Δ class Account(val twitter: TwitterSession)

    { @Inject lateinit var repository: TweetRepository @Inject lateinit var preference: AccountPreference @Inject lateinit var disposables: CompositeDisposable fun onLoggedIn() // ΞΧ΢ϯτͷϩάΠϯॲཧ fun onLoggedOut() // ΞΧ΢ϯτͷϩάΞ΢τॲཧ fun save() // ΞΧ΢ϯτΛอଘ͢Δ fun delete() // ΞΧ΢ϯτΛ࡟আ͢Δ }
  12.  Account • 1ͭͷΞΧ΢ϯτΛදݱ͢ΔΫϥε • ΞΧ΢ϯτ୯ҐͰσʔλ΍ඇಉظॲཧΛ؅ཧ͢Δ class Account(val twitter: TwitterSession)

    { @Inject lateinit var repository: TweetRepository @Inject lateinit var preference: AccountPreference @Inject lateinit var disposables: CompositeDisposable fun onLoggedIn() // ΞΧ΢ϯτͷϩάΠϯॲཧ fun onLoggedOut() // ΞΧ΢ϯτͷϩάΞ΢τॲཧ fun save() // ΞΧ΢ϯτΛอଘ͢Δ fun delete() // ΞΧ΢ϯτΛ࡟আ͢Δ }
  13.  AccountPreference • ΞΧ΢ϯτݻ༗ͷ৘ใΛอଘ͢ΔͨΊͷΫϥε • SharedPreferenceΛ༻͍࣮ͯ૷ • ΞΧ΢ϯτຖʹϑΝΠϧΛ෼ׂ class AccountPreference

    @Inject constructor( private val preference: SharedPreferences) { fun load(): Account // ΞΧ΢ϯτΛಡΈࠐΉ fun save(account: Account) // ΞΧ΢ϯτΛอଘ͢Δ fun delete() // ΞΧ΢ϯτΛ࡟আ͢Δ }
  14.  OkHttpClient • HTTP௨৴Λ͢ΔͨΊͷΫϥε • ೝূ৘ใ͸ΞΧ΢ϯτݻ༗ͷ΋ͷͰ͋ΔͨΊɺ AccountScopeͰ؅ཧ @Module class AccountModule(private

    val account: Account) { @AccountScope @Provides fun provideOkHttpClient(): OkHttpClient { val consumer = OkHttpOAuthConsumer( BuildConfig.TWITTER_CONSUMER_KEY, BuildConfig.TWITTER_CONSUMER_SECRET) consumer.setTokenWithSecret( account.twitter.authToken.token, account.twitter.authToken.secret) return OkHttpClient.Builder() .addInterceptor(SigningInterceptor(consumer)) .build() } }
  15.  OkHttpClient • HTTP௨৴Λ͢ΔͨΊͷΫϥε • ೝূ৘ใ͸ΞΧ΢ϯτݻ༗ͷ΋ͷͰ͋ΔͨΊɺ AccountScopeͰ؅ཧ @Module class AccountModule(private

    val account: Account) { @AccountScope @Provides fun provideOkHttpClient(): OkHttpClient { val consumer = OkHttpOAuthConsumer( BuildConfig.TWITTER_CONSUMER_KEY, BuildConfig.TWITTER_CONSUMER_SECRET) consumer.setTokenWithSecret( account.twitter.authToken.token, account.twitter.authToken.secret) return OkHttpClient.Builder() .addInterceptor(SigningInterceptor(consumer)) .build() } }
  16.  OkHttpClient • HTTP௨৴Λ͢ΔͨΊͷΫϥε • ೝূ৘ใ͸ΞΧ΢ϯτݻ༗ͷ΋ͷͰ͋ΔͨΊɺ AccountScopeͰ؅ཧ @Module class AccountModule(private

    val account: Account) { @AccountScope @Provides fun provideOkHttpClient(): OkHttpClient { val consumer = OkHttpOAuthConsumer( BuildConfig.TWITTER_CONSUMER_KEY, BuildConfig.TWITTER_CONSUMER_SECRET) consumer.setTokenWithSecret( account.twitter.authToken.token, account.twitter.authToken.secret) return OkHttpClient.Builder() .addInterceptor(SigningInterceptor(consumer)) .build() } }
  17.  Retrofit • ΈΜͳେ޷͖Retrofit • OkHttpClient͕ΞΧ΢ϯτݻ༗ͷ΋ͷͰ͋ΔͨΊɺ Retrofit΋AccountScopeͰ؅ཧ @Module class AccountModule(private

    val account: Account) { @AccountScope @Provides fun provideRetrofit(client: OkHttpClient): Retrofit { return Retrofit.Builder() .baseUrl("https://api.twitter.com/1.1/") .client(client) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .addConverterFactory(GsonConverterFactory.create()) .build() } }
  18.  Retrofit • ΈΜͳେ޷͖Retrofit • OkHttpClient͕ΞΧ΢ϯτݻ༗ͷ΋ͷͰ͋ΔͨΊɺ Retrofit΋AccountScopeͰ؅ཧ @Module class AccountModule(private

    val account: Account) { @AccountScope @Provides fun provideRetrofit(client: OkHttpClient): Retrofit { return Retrofit.Builder() .baseUrl("https://api.twitter.com/1.1/") .client(client) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .addConverterFactory(GsonConverterFactory.create()) .build() } }
  19.  Retrofit • ΈΜͳେ޷͖Retrofit • OkHttpClient͕ΞΧ΢ϯτݻ༗ͷ΋ͷͰ͋ΔͨΊɺ Retrofit΋AccountScopeͰ؅ཧ @Module class AccountModule(private

    val account: Account) { @AccountScope @Provides fun provideRetrofit(client: OkHttpClient): Retrofit { return Retrofit.Builder() .baseUrl("https://api.twitter.com/1.1/") .client(client) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .addConverterFactory(GsonConverterFactory.create()) .build() } }
  20.  TwitterClient • Twitter APIΛୟͨ͘ΊͷΫϥε • Retrofit͕ΞΧ΢ϯτݻ༗ͷ΋ͷͰ͋ΔͨΊɺ TwitterClient΋AccountScopeͰ؅ཧ interface TwitterClient

    { @GET("statuses/user_timeline.json") fun getUserTimeline(): Observable<List<Tweet>> } @Module class AccountModule(private val account: Account) { @AccountScope @Provides fun provideTwitterClient(retrofit: Retrofit): TwitterClient { return retrofit.create(TwitterClient::class.java) } }
  21.  TwitterClient • Twitter APIΛୟͨ͘ΊͷΫϥε • Retrofit͕ΞΧ΢ϯτݻ༗ͷ΋ͷͰ͋ΔͨΊɺ TwitterClient΋AccountScopeͰ؅ཧ interface TwitterClient

    { @GET("statuses/user_timeline.json") fun getUserTimeline(): Observable<List<Tweet>> } @Module class AccountModule(private val account: Account) { @AccountScope @Provides fun provideTwitterClient(retrofit: Retrofit): TwitterClient { return retrofit.create(TwitterClient::class.java) } }
  22.  TwitterClient • Twitter APIΛୟͨ͘ΊͷΫϥε • Retrofit͕ΞΧ΢ϯτݻ༗ͷ΋ͷͰ͋ΔͨΊɺ TwitterClient΋AccountScopeͰ؅ཧ interface TwitterClient

    { @GET("statuses/user_timeline.json") fun getUserTimeline(): Observable<List<Tweet>> } @Module class AccountModule(private val account: Account) { @AccountScope @Provides fun provideTwitterClient(retrofit: Retrofit): TwitterClient { return retrofit.create(TwitterClient::class.java) } }
  23.  TweetRepository • TweetΛऔಘ͢ΔͨΊͷΫϥε • TwitterClient͕ΞΧ΢ϯτݻ༗ͳ΋ͷͰ͋ΔͨΊɺ AccountScopeͰ؅ཧ @AccountScope class TweetRepository

    @Inject constructor( private val client: TwitterClient) { fun getUserTimeline(): Observable<List<Tweet>> }
  24.  TweetRepository • TweetΛऔಘ͢ΔͨΊͷΫϥε • TwitterClient͕ΞΧ΢ϯτݻ༗ͳ΋ͷͰ͋ΔͨΊɺ AccountScopeͰ؅ཧ @AccountScope class TweetRepository

    @Inject constructor( private val client: TwitterClient) { fun getUserTimeline(): Observable<List<Tweet>> }
  25.  LoggedInAccount • ϩάΠϯࡁΈΞΧ΢ϯτΛ؅ཧ͢ΔͨΊͷΫϥε class LoggedInAccount @Inject constructor( private val

    application: Application, private val preference: AppPreference) { private val accounts = BehaviorRelay.createDefault( preference.accounts()) private var current = BehaviorRelay.createDefault( Pack(accounts.value.firstOrNull())) fun current(): Observable<Pack<Account?>> // ݱࡏબ୒தͷΞΧ΢ϯτΛฦ٫ fun accounts(): Observable<List<Account>> // ϩάΠϯࡁΈͷΞΧ΢ϯτΛฦ٫ fun switchTo(index: Int) // ΞΧ΢ϯτΛ੾Γସ͑Δ fun add(account: Account) // ΞΧ΢ϯτΛ௥Ճ͢Δ fun remove(account: Account) // ΞΧ΢ϯτΛ࡟আ͢Δ }
  26.  LoggedInAccount • ϩάΠϯࡁΈΞΧ΢ϯτΛ؅ཧ͢ΔͨΊͷΫϥε class LoggedInAccount @Inject constructor( private val

    application: Application, private val preference: AppPreference) { private val accounts = BehaviorRelay.createDefault( preference.accounts()) private var current = BehaviorRelay.createDefault( Pack(accounts.value.firstOrNull())) fun current(): Observable<Pack<Account?>> // ݱࡏબ୒தͷΞΧ΢ϯτΛฦ٫ fun accounts(): Observable<List<Account>> // ϩάΠϯࡁΈͷΞΧ΢ϯτΛฦ٫ fun switchTo(index: Int) // ΞΧ΢ϯτΛ੾Γସ͑Δ fun add(account: Account) // ΞΧ΢ϯτΛ௥Ճ͢Δ fun remove(account: Account) // ΞΧ΢ϯτΛ࡟আ͢Δ }
  27.  LoggedInAccount • ϩάΠϯࡁΈΞΧ΢ϯτΛ؅ཧ͢ΔͨΊͷΫϥε class LoggedInAccount @Inject constructor( private val

    application: Application, private val preference: AppPreference) { private val accounts = BehaviorRelay.createDefault( preference.accounts()) private var current = BehaviorRelay.createDefault( Pack(accounts.value.firstOrNull())) fun current(): Observable<Pack<Account?>> // ݱࡏબ୒தͷΞΧ΢ϯτΛฦ٫ fun accounts(): Observable<List<Account>> // ϩάΠϯࡁΈͷΞΧ΢ϯτΛฦ٫ fun switchTo(index: Int) // ΞΧ΢ϯτΛ੾Γସ͑Δ fun add(account: Account) // ΞΧ΢ϯτΛ௥Ճ͢Δ fun remove(account: Account) // ΞΧ΢ϯτΛ࡟আ͢Δ }
  28.  LoggedInAccount • ϩάΠϯࡁΈΞΧ΢ϯτΛ؅ཧ͢ΔͨΊͷΫϥε class LoggedInAccount @Inject constructor( private val

    application: Application, private val preference: AppPreference) { private val accounts = BehaviorRelay.createDefault( preference.accounts()) private var current = BehaviorRelay.createDefault( Pack(accounts.value.firstOrNull())) fun current(): Observable<Pack<Account?>> // ݱࡏબ୒தͷΞΧ΢ϯτΛฦ٫ fun accounts(): Observable<List<Account>> // ϩάΠϯࡁΈͷΞΧ΢ϯτΛฦ٫ fun switchTo(index: Int) // ΞΧ΢ϯτΛ੾Γସ͑Δ fun add(account: Account) // ΞΧ΢ϯτΛ௥Ճ͢Δ fun remove(account: Account) // ΞΧ΢ϯτΛ࡟আ͢Δ }
  29.  LoggedInAccount • ϩάΠϯࡁΈΞΧ΢ϯτΛ؅ཧ͢ΔͨΊͷΫϥε class LoggedInAccount @Inject constructor( private val

    application: Application, private val preference: AppPreference) { private val accounts = BehaviorRelay.createDefault( preference.accounts()) private var current = BehaviorRelay.createDefault( Pack(accounts.value.firstOrNull())) fun current(): Observable<Pack<Account?>> // ݱࡏબ୒தͷΞΧ΢ϯτΛฦ٫ fun accounts(): Observable<List<Account>> // ϩάΠϯࡁΈͷΞΧ΢ϯτΛฦ٫ fun switchTo(index: Int) // ΞΧ΢ϯτΛ੾Γସ͑Δ fun add(account: Account) // ΞΧ΢ϯτΛ௥Ճ͢Δ fun remove(account: Account) // ΞΧ΢ϯτΛ࡟আ͢Δ }
  30.  LoggedInAccount • ϩάΠϯࡁΈΞΧ΢ϯτΛ؅ཧ͢ΔͨΊͷΫϥε class LoggedInAccount @Inject constructor( private val

    application: Application, private val preference: AppPreference) { private val accounts = BehaviorRelay.createDefault( preference.accounts()) private var current = BehaviorRelay.createDefault( Pack(accounts.value.firstOrNull())) fun current(): Observable<Pack<Account?>> // ݱࡏબ୒தͷΞΧ΢ϯτΛฦ٫ fun accounts(): Observable<List<Account>> // ϩάΠϯࡁΈͷΞΧ΢ϯτΛฦ٫ fun switchTo(index: Int) // ΞΧ΢ϯτΛ੾Γସ͑Δ fun add(account: Account) // ΞΧ΢ϯτΛ௥Ճ͢Δ fun remove(account: Account) // ΞΧ΢ϯτΛ࡟আ͢Δ }
  31.  LoggedInAccount • ϩάΠϯࡁΈΞΧ΢ϯτΛ؅ཧ͢ΔͨΊͷΫϥε class LoggedInAccount @Inject constructor( private val

    application: Application, private val preference: AppPreference) { private val accounts = BehaviorRelay.createDefault( preference.accounts()) private var current = BehaviorRelay.createDefault( Pack(accounts.value.firstOrNull())) fun current(): Observable<Pack<Account?>> // ݱࡏબ୒தͷΞΧ΢ϯτΛฦ٫ fun accounts(): Observable<List<Account>> // ϩάΠϯࡁΈͷΞΧ΢ϯτΛฦ٫ fun switchTo(index: Int) // ΞΧ΢ϯτΛ੾Γସ͑Δ fun add(account: Account) // ΞΧ΢ϯτΛ௥Ճ͢Δ fun remove(account: Account) // ΞΧ΢ϯτΛ࡟আ͢Δ }
  32.  LoggedInAccount • ϩάΠϯࡁΈΞΧ΢ϯτΛ؅ཧ͢ΔͨΊͷΫϥε class LoggedInAccount @Inject constructor( private val

    application: Application, private val preference: AppPreference) { private val accounts = BehaviorRelay.createDefault( preference.accounts()) private var current = BehaviorRelay.createDefault( Pack(accounts.value.firstOrNull())) fun current(): Observable<Pack<Account?>> // ݱࡏબ୒தͷΞΧ΢ϯτΛฦ٫ fun accounts(): Observable<List<Account>> // ϩάΠϯࡁΈͷΞΧ΢ϯτΛฦ٫ fun switchTo(index: Int) // ΞΧ΢ϯτΛ੾Γସ͑Δ fun add(account: Account) // ΞΧ΢ϯτΛ௥Ճ͢Δ fun remove(account: Account) // ΞΧ΢ϯτΛ࡟আ͢Δ }
  33.  LoggedInAccount • ϩάΠϯࡁΈΞΧ΢ϯτΛ؅ཧ͢ΔͨΊͷΫϥε class LoggedInAccount @Inject constructor( private val

    application: Application, private val preference: AppPreference) { private val accounts = BehaviorRelay.createDefault( preference.accounts()) private var current = BehaviorRelay.createDefault( Pack(accounts.value.firstOrNull())) fun current(): Observable<Pack<Account?>> // ݱࡏબ୒தͷΞΧ΢ϯτΛฦ٫ fun accounts(): Observable<List<Account>> // ϩάΠϯࡁΈͷΞΧ΢ϯτΛฦ٫ fun switchTo(index: Int) // ΞΧ΢ϯτΛ੾Γସ͑Δ fun add(account: Account) // ΞΧ΢ϯτΛ௥Ճ͢Δ fun remove(account: Account) // ΞΧ΢ϯτΛ࡟আ͢Δ }
  34.  AppPreference • ϩάΠϯࡁΈΞΧ΢ϯτΛอଘ͢ΔΫϥε • SharedPreferenceΛ༻͍࣮ͯ૷ class AppPreference @Inject constructor(

    private val application: Application, private val preference: SharedPreferences) { fun accounts(): List<Account> // ΞΧ΢ϯτϦετΛฦ٫ fun save(account: Account) // ΞΧ΢ϯτΛอଘ fun delete(account: Account) // ΞΧ΢ϯτΛ࡟আ }
  35.  AppPreference • ϩάΠϯࡁΈΞΧ΢ϯτΛอଘ͢ΔΫϥε • SharedPreferenceΛ༻͍࣮ͯ૷ class AppPreference @Inject constructor(

    private val application: Application, private val preference: SharedPreferences) { fun accounts(): List<Account> // ΞΧ΢ϯτϦετΛฦ٫ fun save(account: Account) // ΞΧ΢ϯτΛอଘ fun delete(account: Account) // ΞΧ΢ϯτΛ࡟আ }
  36.  AppPreference • ϩάΠϯࡁΈΞΧ΢ϯτΛอଘ͢ΔΫϥε • SharedPreferenceΛ༻͍࣮ͯ૷ class AppPreference @Inject constructor(

    private val application: Application, private val preference: SharedPreferences) { fun accounts(): List<Account> // ΞΧ΢ϯτϦετΛฦ٫ fun save(account: Account) // ΞΧ΢ϯτΛอଘ fun delete(account: Account) // ΞΧ΢ϯτΛ࡟আ }
  37.  AppPreference • ϩάΠϯࡁΈΞΧ΢ϯτΛอଘ͢ΔΫϥε • SharedPreferenceΛ༻͍࣮ͯ૷ class AppPreference @Inject constructor(

    private val application: Application, private val preference: SharedPreferences) { fun accounts(): List<Account> // ΞΧ΢ϯτϦετΛฦ٫ fun save(account: Account) // ΞΧ΢ϯτΛอଘ fun delete(account: Account) // ΞΧ΢ϯτΛ࡟আ }
  38.  AppPreference • ϩάΠϯࡁΈΞΧ΢ϯτΛอଘ͢ΔΫϥε • SharedPreferenceΛ༻͍࣮ͯ૷ class AppPreference @Inject constructor(

    private val application: Application, private val preference: SharedPreferences) { fun accounts(): List<Account> // ΞΧ΢ϯτϦετΛฦ٫ fun save(account: Account) // ΞΧ΢ϯτΛอଘ fun delete(account: Account) // ΞΧ΢ϯτΛ࡟আ }
  39.  ·ͱΊ • ϚϧνϩάΠϯ࣮૷ͰΑ͋͘Δ໰୊ • ผΞΧ΢ϯτ΁ͷׯব • ίʔυͷෳࡶԽ • σʔλΞΫηε΍ඇಉظॲཧΛ൐͏෦෼ΛΞΧ΢ϯτ୯

    ҐͰߏங͢Δ͜ͱͰ҆શ͔ͭγϯϓϧʹ࣮૷Մೳ • αϯϓϧΞϓϦ • ෳ਺ΞΧ΢ϯτͰϩάΠϯՄೳͳTwitterΫϥΠΞϯτ • ΞΧ΢ϯτ୯ҐͰσʔλ΍ඇಉظॲཧΛ؅ཧ͢ΔͱΠ Πײ͡ʹ