├── .gitattributes
├── KotlinSamples-master
├── .idea
│ ├── codeStyles
│ │ ├── Project.xml
│ │ └── codeStyleConfig.xml
│ ├── gradle.xml
│ ├── misc.xml
│ ├── runConfigurations.xml
│ └── vcs.xml
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── main
│ │ │ └── kotlin
│ │ │ └── ExampleInstrumentedTest.kt
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── main
│ │ │ │ └── kotlin
│ │ │ │ ├── chapter1
│ │ │ │ ├── section1
│ │ │ │ │ └── lightweight.kt
│ │ │ │ ├── section2
│ │ │ │ │ └── introduction_to_concurrency.kt
│ │ │ │ ├── section3
│ │ │ │ │ └── cpu_bound.kt
│ │ │ │ ├── section4
│ │ │ │ │ ├── atomicity_violation.kt
│ │ │ │ │ ├── deadlock.kt
│ │ │ │ │ └── race_condition.kt
│ │ │ │ └── section5
│ │ │ │ │ ├── explicit.kt
│ │ │ │ │ └── readable.kt
│ │ │ │ ├── chapter2
│ │ │ │ ├── async
│ │ │ │ │ └── async.kt
│ │ │ │ ├── dispatcher
│ │ │ │ │ └── launch.kt
│ │ │ │ └── launch
│ │ │ │ │ └── launch.kt
│ │ │ │ ├── chapter3
│ │ │ │ ├── deferred
│ │ │ │ │ ├── deferred.kt
│ │ │ │ │ └── exception
│ │ │ │ │ │ ├── await
│ │ │ │ │ │ ├── await.kt
│ │ │ │ │ │ └── trycatch
│ │ │ │ │ │ │ └── trycatch.kt
│ │ │ │ │ │ └── exception.kt
│ │ │ │ ├── finalstate
│ │ │ │ │ └── job_final_state.kt
│ │ │ │ └── job
│ │ │ │ │ ├── cancellation
│ │ │ │ │ ├── cancel.kt
│ │ │ │ │ ├── cancelled
│ │ │ │ │ │ ├── cancelled.kt
│ │ │ │ │ │ └── exception
│ │ │ │ │ │ │ └── handler
│ │ │ │ │ │ │ ├── handler.kt
│ │ │ │ │ │ │ └── oncompletion
│ │ │ │ │ │ │ └── on_completion.kt
│ │ │ │ │ └── withcause
│ │ │ │ │ │ └── cancel_with_cause.kt
│ │ │ │ │ ├── job.kt
│ │ │ │ │ └── lazy
│ │ │ │ │ ├── join
│ │ │ │ │ └── join_start.kt
│ │ │ │ │ ├── lazy.kt
│ │ │ │ │ └── start
│ │ │ │ │ └── lazy_start.kt
│ │ │ │ ├── chapter4
│ │ │ │ ├── client
│ │ │ │ │ ├── deferred
│ │ │ │ │ │ └── deferred_impl.kt
│ │ │ │ │ └── suspending
│ │ │ │ │ │ └── suspend_impl.kt
│ │ │ │ ├── context
│ │ │ │ │ ├── dispatcher
│ │ │ │ │ │ └── dispatcher.kt
│ │ │ │ │ ├── exception
│ │ │ │ │ │ └── exception_handling.kt
│ │ │ │ │ ├── mix
│ │ │ │ │ │ ├── join
│ │ │ │ │ │ │ └── join.kt
│ │ │ │ │ │ └── separate
│ │ │ │ │ │ │ └── separate.kt
│ │ │ │ │ ├── noncancellable
│ │ │ │ │ │ └── noncancellable.kt
│ │ │ │ │ └── switch
│ │ │ │ │ │ └── switch.kt
│ │ │ │ └── suspending
│ │ │ │ │ └── suspending.kt
│ │ │ │ ├── chapter5
│ │ │ │ ├── iterator
│ │ │ │ │ ├── examples.kt
│ │ │ │ │ └── fibonacci
│ │ │ │ │ │ └── fibonacci_iterator.kt
│ │ │ │ ├── producer
│ │ │ │ │ ├── examples.kt
│ │ │ │ │ └── fibonacci
│ │ │ │ │ │ └── fibonacci.kt
│ │ │ │ └── sequence
│ │ │ │ │ ├── examples.kt
│ │ │ │ │ └── fibonacci
│ │ │ │ │ └── sequence.kt
│ │ │ │ ├── chapter6
│ │ │ │ ├── buffered
│ │ │ │ │ ├── array
│ │ │ │ │ │ └── array.kt
│ │ │ │ │ ├── conflated
│ │ │ │ │ │ └── conflated.kt
│ │ │ │ │ └── linked
│ │ │ │ │ │ └── linked.kt
│ │ │ │ ├── interaction
│ │ │ │ │ ├── receive
│ │ │ │ │ │ └── receive.kt
│ │ │ │ │ └── send
│ │ │ │ │ │ └── send.kt
│ │ │ │ └── unbufffered
│ │ │ │ │ └── rendezvous
│ │ │ │ │ └── rendezvous.kt
│ │ │ │ ├── chapter7
│ │ │ │ ├── actor
│ │ │ │ │ ├── actor.kt
│ │ │ │ │ ├── actor_counter.kt
│ │ │ │ │ └── interaction
│ │ │ │ │ │ └── actor_samples.kt
│ │ │ │ ├── atomic
│ │ │ │ │ └── atomic.kt
│ │ │ │ ├── atomicity
│ │ │ │ │ └── atomicity_violation.kt
│ │ │ │ ├── confinement
│ │ │ │ │ └── thread_confinement.kt
│ │ │ │ ├── mutex
│ │ │ │ │ ├── interaction
│ │ │ │ │ │ └── mutex_interaction.kt
│ │ │ │ │ └── mutex.kt
│ │ │ │ └── volatile
│ │ │ │ │ ├── incorrect
│ │ │ │ │ └── volatile.kt
│ │ │ │ │ └── volatile.kt
│ │ │ │ └── chapter8
│ │ │ │ ├── debugging.kt
│ │ │ │ └── test_feature.kt
│ │ └── res
│ │ │ ├── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── drawable
│ │ │ └── ic_launcher_background.xml
│ │ │ ├── layout
│ │ │ └── activity_main.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── main
│ │ └── kotlin
│ │ └── ExampleUnitTest.kt
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── LICENSE
└── RssReader-master
├── .gitignore
├── .idea
├── codeStyles
│ ├── Project.xml
│ └── codeStyleConfig.xml
├── gradle.xml
├── misc.xml
├── runConfigurations.xml
└── vcs.xml
├── Chapter2
└── RssReader
│ ├── .gitignore
│ ├── .idea
│ ├── codeStyles
│ │ ├── Project.xml
│ │ └── codeStyleConfig.xml
│ ├── gradle.xml
│ ├── misc.xml
│ ├── runConfigurations.xml
│ └── vcs.xml
│ ├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── co
│ │ │ └── starcarr
│ │ │ └── rssreader
│ │ │ └── ExampleInstrumentedTest.kt
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── co
│ │ │ │ └── starcarr
│ │ │ │ └── rssreader
│ │ │ │ └── MainActivity.kt
│ │ └── res
│ │ │ ├── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── drawable
│ │ │ └── ic_launcher_background.xml
│ │ │ ├── layout
│ │ │ └── activity_main.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── co
│ │ └── starcarr
│ │ └── rssreader
│ │ └── ExampleUnitTest.kt
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
├── Chapter3
└── RssReader
│ ├── .gitignore
│ ├── .idea
│ ├── .name
│ ├── codeStyles
│ │ ├── Project.xml
│ │ └── codeStyleConfig.xml
│ ├── gradle.xml
│ ├── misc.xml
│ ├── runConfigurations.xml
│ └── vcs.xml
│ ├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── co
│ │ │ └── starcarr
│ │ │ └── rssreader
│ │ │ └── ExampleInstrumentedTest.kt
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── co
│ │ │ │ └── starcarr
│ │ │ │ └── rssreader
│ │ │ │ └── MainActivity.kt
│ │ └── res
│ │ │ ├── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── drawable
│ │ │ └── ic_launcher_background.xml
│ │ │ ├── layout
│ │ │ └── activity_main.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── co
│ │ └── starcarr
│ │ └── rssreader
│ │ └── ExampleUnitTest.kt
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
├── Chapter4
└── RssReader
│ ├── .gitignore
│ ├── .idea
│ ├── .name
│ ├── codeStyles
│ │ ├── Project.xml
│ │ └── codeStyleConfig.xml
│ ├── gradle.xml
│ ├── misc.xml
│ ├── runConfigurations.xml
│ └── vcs.xml
│ ├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── co
│ │ │ └── starcarr
│ │ │ └── rssreader
│ │ │ └── ExampleInstrumentedTest.kt
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── co
│ │ │ │ └── starcarr
│ │ │ │ └── rssreader
│ │ │ │ ├── MainActivity.kt
│ │ │ │ ├── adapter
│ │ │ │ └── ArticleAdapter.kt
│ │ │ │ └── model
│ │ │ │ └── model.kt
│ │ └── res
│ │ │ ├── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── drawable
│ │ │ └── ic_launcher_background.xml
│ │ │ ├── layout
│ │ │ ├── activity_main.xml
│ │ │ └── article.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── co
│ │ └── starcarr
│ │ └── rssreader
│ │ └── ExampleUnitTest.kt
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
├── Chapter5
└── RssReader
│ ├── .gitignore
│ ├── .idea
│ ├── .name
│ ├── codeStyles
│ │ ├── Project.xml
│ │ └── codeStyleConfig.xml
│ ├── gradle.xml
│ ├── misc.xml
│ ├── runConfigurations.xml
│ └── vcs.xml
│ ├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── co
│ │ │ └── starcarr
│ │ │ └── rssreader
│ │ │ └── ExampleInstrumentedTest.kt
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── co
│ │ │ │ └── starcarr
│ │ │ │ └── rssreader
│ │ │ │ ├── MainActivity.kt
│ │ │ │ ├── adapter
│ │ │ │ └── ArticleAdapter.kt
│ │ │ │ ├── model
│ │ │ │ └── model.kt
│ │ │ │ └── producer
│ │ │ │ └── ArticleProducer.kt
│ │ └── res
│ │ │ ├── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── drawable
│ │ │ └── ic_launcher_background.xml
│ │ │ ├── layout
│ │ │ ├── activity_main.xml
│ │ │ └── article.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── co
│ │ └── starcarr
│ │ └── rssreader
│ │ └── ExampleUnitTest.kt
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
├── Chapter6
└── RssReader
│ ├── .gitignore
│ ├── .idea
│ ├── .name
│ ├── codeStyles
│ │ ├── Project.xml
│ │ └── codeStyleConfig.xml
│ ├── gradle.xml
│ ├── misc.xml
│ ├── runConfigurations.xml
│ └── vcs.xml
│ ├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── co
│ │ │ └── starcarr
│ │ │ └── rssreader
│ │ │ └── ExampleInstrumentedTest.kt
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── co
│ │ │ │ └── starcarr
│ │ │ │ └── rssreader
│ │ │ │ ├── MainActivity.kt
│ │ │ │ ├── SearchActivity.kt
│ │ │ │ ├── adapter
│ │ │ │ └── ArticleAdapter.kt
│ │ │ │ ├── model
│ │ │ │ └── model.kt
│ │ │ │ ├── producer
│ │ │ │ └── ArticleProducer.kt
│ │ │ │ └── search
│ │ │ │ └── Searcher.kt
│ │ └── res
│ │ │ ├── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── drawable
│ │ │ └── ic_launcher_background.xml
│ │ │ ├── layout
│ │ │ ├── activity_main.xml
│ │ │ ├── activity_search.xml
│ │ │ └── article.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── co
│ │ └── starcarr
│ │ └── rssreader
│ │ └── ExampleUnitTest.kt
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
└── Chapter7
└── RssReader
├── .gitignore
├── .idea
├── .name
├── codeStyles
│ ├── Project.xml
│ └── codeStyleConfig.xml
├── gradle.xml
├── misc.xml
├── runConfigurations.xml
└── vcs.xml
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── co
│ │ └── starcarr
│ │ └── rssreader
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── co
│ │ │ └── starcarr
│ │ │ └── rssreader
│ │ │ ├── MainActivity.kt
│ │ │ ├── SearchActivity.kt
│ │ │ ├── adapter
│ │ │ └── ArticleAdapter.kt
│ │ │ ├── model
│ │ │ └── model.kt
│ │ │ ├── producer
│ │ │ └── ArticleProducer.kt
│ │ │ └── search
│ │ │ ├── ResultsCounter.kt
│ │ │ └── Searcher.kt
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── activity_search.xml
│ │ └── article.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── co
│ └── starcarr
│ └── rssreader
│ └── ExampleUnitTest.kt
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/KotlinSamples-master/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/KotlinSamples-master/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
--------------------------------------------------------------------------------
/KotlinSamples-master/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | 1.8
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/KotlinSamples-master/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/KotlinSamples-master/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/KotlinSamples-master/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/KotlinSamples-master/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 |
5 | android {
6 | compileSdkVersion 29
7 | buildToolsVersion "29.0.3"
8 |
9 | defaultConfig {
10 | applicationId "main.kotlin"
11 | minSdkVersion 24
12 | targetSdkVersion 29
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 |
26 | }
27 |
28 | dependencies {
29 | implementation fileTree(dir: 'libs', include: ['*.jar'])
30 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
31 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
32 | implementation 'androidx.appcompat:appcompat:1.1.0'
33 | implementation 'androidx.core:core-ktx:1.2.0'
34 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
35 | testImplementation 'junit:junit:4.12'
36 | androidTestImplementation 'androidx.test.ext:junit:1.1.1'
37 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
38 | }
39 |
--------------------------------------------------------------------------------
/KotlinSamples-master/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/androidTest/java/main/kotlin/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("main.kotlin", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter1/section1/lightweight.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter1.section1
2 |
3 | import kotlinx.coroutines.*
4 |
5 | import kotlin.system.measureTimeMillis
6 |
7 | /**
8 | * Init, suspend, and resume three coroutines. They will
9 | * potentially be resumed in different threads than the ones
10 | * they were created on.
11 | */
12 | fun main(args: Array) = runBlocking {
13 | println("${Thread.activeCount()} threads active at the start")
14 | val time = measureTimeMillis {
15 | createCoroutines(3)
16 | }
17 | println("${Thread.activeCount()} threads active at end")
18 | println("Took $time ms")
19 | }
20 |
21 | suspend fun createCoroutines(amount: Int) {
22 | val jobs = ArrayList()
23 | for (i in 1..amount) {
24 | jobs += GlobalScope.launch {
25 | println("Started $i in ${Thread.currentThread().name}")
26 | delay(1000)
27 |
28 | println("Finished $i in ${Thread.currentThread().name}")
29 | }
30 | }
31 | jobs.forEach {
32 | it.join()
33 | }
34 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter1/section3/cpu_bound.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter1.section3
2 |
3 | val words = listOf("level", "pope", "needle", "Anna", "Pete", "noon", "stats")
4 |
5 | /**
6 | * CPU-bound algorithm.
7 | */
8 | fun main(args: Array) {
9 | filterPalindromes(words).forEach {
10 | println(it)
11 | }
12 | }
13 |
14 | fun filterPalindromes(words: List) : List {
15 | return words.filter { isPalindrome(it) }
16 | }
17 |
18 | fun isPalindrome(word: String) : Boolean {
19 | val lcWord = word.toLowerCase()
20 | return lcWord == lcWord.reversed()
21 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter1/section4/atomicity_violation.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter1.section4
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.async
5 | import kotlinx.coroutines.runBlocking
6 |
7 | // This method will often print values lower than 2100
8 | fun main(args: Array) = runBlocking {
9 | val workerA = asyncIncrement(2000)
10 | val workerB = asyncIncrement(100)
11 |
12 | workerA.await()
13 | workerB.await()
14 |
15 | print("counter [$counter]")
16 | }
17 |
18 | var counter = 0
19 |
20 | fun asyncIncrement(by: Int) = GlobalScope.async {
21 | for (i in 0 until by) {
22 | counter++
23 | }
24 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter1/section4/deadlock.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter1.section4
2 |
3 | import kotlinx.coroutines.*
4 |
5 | lateinit var jobA : Job
6 | lateinit var jobB : Job
7 |
8 | // This will never complete execution.
9 | fun main(args: Array) = runBlocking {
10 | jobA = launch {
11 | delay(1000)
12 | // wait for JobB to finish
13 | jobB.join()
14 | }
15 |
16 | jobB = launch {
17 | // wait for JobA to finish
18 | jobA.join()
19 | }
20 |
21 | // wait for JobA to finish
22 | jobA.join()
23 | println("Finished")
24 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter1/section4/race_condition.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter1.section4
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.async
5 | import kotlinx.coroutines.delay
6 | import kotlinx.coroutines.runBlocking
7 |
8 | data class UserInfo(val name: String, val lastName: String, val id: Int)
9 |
10 | lateinit var user: UserInfo
11 |
12 | /**
13 | * This will crash because the information is not ready by the
14 | * time we try to use it.
15 | */
16 |
17 | fun main(args: Array) = runBlocking {
18 | asyncGetUserInfo(1)
19 | // Do some other operations
20 | delay(1000)
21 |
22 | println("User ${user.id} is ${user.name}")
23 | }
24 |
25 | fun asyncGetUserInfo(id: Int) = GlobalScope.async {
26 | delay(1100)
27 | user = UserInfo(id = id, name = "Susan", lastName = "Calvin")
28 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter1/section5/explicit.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter1.section5
2 |
3 | import kotlinx.coroutines.async
4 | import kotlinx.coroutines.delay
5 | import kotlinx.coroutines.runBlocking
6 | import kotlin.system.measureTimeMillis
7 |
8 | /**
9 | * In this example, `async()` is being used to indicate
10 | * explicitly that it's an asynchronous operation.
11 | */
12 | fun main(args: Array) = runBlocking {
13 | val time = measureTimeMillis {
14 | val name = async { getName() }
15 | val lastName = async { getLastName() }
16 |
17 | println("Hello, ${name.await()} ${lastName.await()}")
18 | }
19 |
20 | println("Execution took $time ms")
21 | }
22 |
23 | suspend fun getName(): String {
24 | delay(1000)
25 | return "Susan"
26 | }
27 |
28 | suspend fun getLastName(): String {
29 | delay(1000)
30 | return "Calvin"
31 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter1/section5/readable.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter1.section5
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.async
5 |
6 | /**
7 | * This file contains logic that is asynchronous
8 | * but can be read easily.
9 | */
10 |
11 | class Profile(userInfo: UserInfo, contactInfo: ContactInfo)
12 | class UserInfo(name:String, lastName: String)
13 | class ContactInfo(address: String, zipCode: Int)
14 |
15 | suspend fun getProfile(id: Int): Profile {
16 | val basicUserInfo = asyncGetUserInfo(id)
17 | val contactInfo = asyncGetContactInfo(id)
18 |
19 | return createProfile(basicUserInfo.await(), contactInfo.await())
20 | }
21 |
22 | private fun asyncGetUserInfo(id: Int) = GlobalScope.async {
23 | // Block the thread for one second
24 | // to simulate a service call
25 | Thread.sleep(1000)
26 |
27 | UserInfo("Susan", "Calvin")
28 | }
29 |
30 | private fun asyncGetContactInfo(id: Int) = GlobalScope.async {
31 | // Block the thread for one second
32 | // to simulate a service call
33 | Thread.sleep(1000)
34 | ContactInfo("False Street 123", 11111)
35 | }
36 |
37 | private fun createProfile(userInfo: UserInfo, contactInfo: ContactInfo): Profile {
38 | return Profile(userInfo, contactInfo)
39 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter2/async/async.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter2.async
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.InternalCoroutinesApi
5 | import kotlinx.coroutines.async
6 | import kotlinx.coroutines.runBlocking
7 |
8 | /**
9 | * Async examples
10 | */
11 | @InternalCoroutinesApi
12 | fun main(args: Array) = runBlocking {
13 | val task = GlobalScope.async {
14 | doSomething()
15 | }
16 |
17 | // This code will have the exception be propagated
18 | task.await()
19 | println("Completed")
20 |
21 |
22 | // This code will wait for the async to end and validate its output.
23 | // Comment line `15` for this to work
24 | task.join()
25 |
26 | // If the code below executes the `else` branch, please replace
27 | // `isCancelled` with `isCompletedExceptionally`. For more info see
28 | // https://github.com/Kotlin/kotlinx.coroutines/issues/220
29 | if (task.isCancelled) {
30 | val exception = task.getCancellationException()
31 | println("Error with message: ${exception.cause}")
32 | } else {
33 | println("Success")
34 | }
35 | }
36 |
37 | fun doSomething() {
38 | throw UnsupportedOperationException("Can't do")
39 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter2/dispatcher/launch.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter2.dispatcher
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.launch
5 | import kotlinx.coroutines.newSingleThreadContext
6 | import kotlinx.coroutines.runBlocking
7 |
8 | // Use a ThreadPoolDispatcher to run the coroutine
9 | fun main(args: Array) = runBlocking {
10 | val netDispatcher = newSingleThreadContext(name = "ServiceCall")
11 |
12 | val task = GlobalScope.launch(netDispatcher) {
13 | printCurrentThread()
14 | }
15 |
16 | task.join()
17 | }
18 |
19 | fun printCurrentThread() {
20 | println("Running in thread [${Thread.currentThread().name}]")
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter2/launch/launch.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter2.launch
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.delay
5 | import kotlinx.coroutines.launch
6 | import kotlinx.coroutines.runBlocking
7 |
8 | // Use laynch to start a coroutine that crashes.
9 | fun main(args: Array) = runBlocking {
10 |
11 | val task = GlobalScope.launch {
12 | doSomething()
13 | }
14 |
15 | task.join()
16 | println("completed")
17 | }
18 |
19 | suspend fun doSomething() {
20 | delay(100)
21 | println("Half-way to crash")
22 | delay(100)
23 | throw UnsupportedOperationException("Can't do")
24 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter3/deferred/deferred.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter3.deferred
2 |
3 | import kotlinx.coroutines.CompletableDeferred
4 | import kotlinx.coroutines.GlobalScope
5 | import kotlinx.coroutines.async
6 | import kotlinx.coroutines.runBlocking
7 |
8 | /**
9 | * Examples of how to instantiate a Deferred
10 | */
11 | fun main(args: Array) = runBlocking {
12 | // Create a Deferred using `async`
13 | val headlines = GlobalScope.async {
14 | getHeadlines()
15 | }
16 |
17 | // Wait for it to complete
18 | headlines.await()
19 |
20 | // Create a Deferred using the factory function
21 | val deferred = CompletableDeferred()
22 | }
23 |
24 | fun getHeadlines() {
25 | // Nothing to do here
26 | }
27 |
28 | // Dummy class
29 | class Article
30 |
31 | // A deferred can be created using the constructor as well
32 | val articles = CompletableDeferred>()
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter3/deferred/exception/await/await.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter3.deferred.exception.await
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.async
5 | import kotlinx.coroutines.delay
6 | import kotlinx.coroutines.runBlocking
7 |
8 | /**
9 | * In this example the exception will be propagated because we
10 | * are calling await()
11 | */
12 | fun main(args: Array) = runBlocking {
13 | val deferred = GlobalScope.async {
14 | TODO("Not implemented yet!")
15 | }
16 |
17 | // Let it fail
18 | deferred.await()
19 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter3/deferred/exception/await/trycatch/trycatch.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter3.deferred.exception.await.trycatch
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.async
5 | import kotlinx.coroutines.runBlocking
6 |
7 | /**
8 | * In this example with handle an exception by using a
9 | * try-catch block
10 | */
11 | fun main(args: Array) = runBlocking {
12 | val deferred = GlobalScope.async {
13 | TODO("Not implemented yet!")
14 | }
15 |
16 | try {
17 | deferred.await()
18 | } catch (throwable: Throwable) {
19 | println("Deferred cancelled due to ${throwable.message}")
20 | }
21 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter3/deferred/exception/exception.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter3.deferred.exception
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.async
5 | import kotlinx.coroutines.delay
6 | import kotlinx.coroutines.runBlocking
7 |
8 | /**
9 | * In this example the exception will not be propagated
10 | * because `await()` isn't being called
11 | */
12 | fun main(args: Array) = runBlocking {
13 | val deferred = GlobalScope.async {
14 | TODO("Not implemented yet!")
15 | }
16 |
17 | // Wait for it to fail
18 | delay(2000)
19 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter3/finalstate/job_final_state.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter3.finalstate
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.delay
5 | import kotlinx.coroutines.launch
6 | import kotlinx.coroutines.runBlocking
7 | import kotlin.system.measureTimeMillis
8 |
9 | /**
10 | * This code tries to restart a Job by calling start() once
11 | * it has reached a final state. Notice that calling start()
12 | * has no effect since the state of a Job can only move forward
13 | */
14 | fun main(args: Array) = runBlocking {
15 | val time = measureTimeMillis {
16 | val job = GlobalScope.launch {
17 | delay(2000)
18 | }
19 |
20 | // Wait for it to complete once
21 | job.join()
22 |
23 | // Restart the Job
24 | job.start()
25 | job.join()
26 | }
27 |
28 | println("Took $time ms")
29 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter3/job/cancellation/cancel.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter3.job.cancellation
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.delay
5 | import kotlinx.coroutines.launch
6 | import kotlinx.coroutines.runBlocking
7 |
8 | /**
9 | * This code cancels a Job without a cause
10 | */
11 | fun main(args: Array) = runBlocking {
12 | val job = GlobalScope.launch {
13 | // Do some work here
14 | delay(5000)
15 | }
16 |
17 | // timeout for the operation
18 | delay(2000)
19 | job.cancel()
20 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter3/job/cancellation/cancelled/cancelled.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter3.job.cancellation.cancelled
2 |
3 | import kotlinx.coroutines.*
4 |
5 | @InternalCoroutinesApi
6 | fun main(args: Array) = runBlocking {
7 | val job = GlobalScope.launch {
8 | delay(5000)
9 | }
10 |
11 | delay(2000)
12 |
13 | // cancel
14 | //job.cancel(cause = Exception("Tired of waiting"))
15 |
16 | val cancellation = job.getCancellationException()
17 | cancellation.cause // Exception("Tired of waiting")
18 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter3/job/cancellation/cancelled/exception/handler/handler.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter3.job.cancellation.cancelled.exception.handler
2 |
3 | import kotlinx.coroutines.*
4 | import kotlin.coroutines.CoroutineContext
5 |
6 | /**
7 | * Handle the exception in a Job using
8 | * a CoroutineExceptionHandler
9 | */
10 | fun main(args: Array) = runBlocking {
11 | val exceptionHandler = CoroutineExceptionHandler {
12 | _: CoroutineContext, throwable: Throwable ->
13 | println("Job cancelled due to ${throwable.message}")
14 | }
15 |
16 | GlobalScope.launch(exceptionHandler) {
17 | TODO("Not implemented yet!")
18 | }
19 |
20 | delay(2000)
21 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter3/job/cancellation/cancelled/exception/handler/oncompletion/on_completion.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter3.job.cancellation.cancelled.exception.handler.oncompletion
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.delay
5 | import kotlinx.coroutines.launch
6 | import kotlinx.coroutines.runBlocking
7 |
8 | /**
9 | * Handle the exception of a Job using `invokeOnCompletion`
10 | */
11 | fun main(args: Array) = runBlocking {
12 | GlobalScope.launch {
13 | TODO("Not implemented yet!")
14 | }.invokeOnCompletion { cause ->
15 | cause?.let {
16 | println("Job cancelled due to ${it.message}")
17 | }
18 | }
19 |
20 | delay(2000)
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter3/job/cancellation/withcause/cancel_with_cause.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter3.job.cancellation.withcause
2 |
3 | import kotlinx.coroutines.*
4 | import java.lang.Exception
5 |
6 | /**
7 | * This passes a cause when cancelling a Job
8 | */
9 | @InternalCoroutinesApi
10 | fun main(args: Array) = runBlocking {
11 | val job = GlobalScope.launch {
12 | // Do some work here
13 | delay(5000)
14 | }
15 |
16 | delay(2000)
17 |
18 | // cancel with a cause
19 | job.cancel(cause = CancellationException("Tired of waiting"))
20 |
21 | val cancellation = job.getCancellationException()
22 | print(cancellation.message)
23 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter3/job/job.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter3.job
2 |
3 | import kotlinx.coroutines.*
4 |
5 | /**
6 | * This code instantiates a Job by using launch
7 | * and another by using the factory function. Notice
8 | * that in both cases they will be started automatically
9 | */
10 | fun main(args: Array) = runBlocking {
11 | val job = GlobalScope.launch {
12 | TODO("Not implemented yet!")
13 | }
14 |
15 | val job2 = Job()
16 |
17 | delay(500)
18 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter3/job/lazy/join/join_start.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter3.job.lazy.join
2 |
3 | import kotlinx.coroutines.*
4 |
5 | /**
6 | * This code start a job lazily, and waits for its execution to complete
7 | */
8 | fun main(args: Array) = runBlocking {
9 | val job = GlobalScope.launch(start = CoroutineStart.LAZY) {
10 | delay(3000)
11 | }
12 |
13 | job.join()
14 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter3/job/lazy/lazy.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter3.job.lazy
2 |
3 | import kotlinx.coroutines.*
4 |
5 | /**
6 | * This code creates a Job that will not be started
7 | * automatically. Notice that since the Job is never
8 | * actually started, the exception is not propagated
9 | */
10 | fun main(args: Array) = runBlocking {
11 | GlobalScope.launch(start = CoroutineStart.LAZY) {
12 | TODO("Not implemented yet!")
13 | }
14 |
15 | delay(500)
16 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter3/job/lazy/start/lazy_start.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter3.job.lazy.start
2 |
3 | import kotlinx.coroutines.CoroutineStart
4 | import kotlinx.coroutines.GlobalScope
5 | import kotlinx.coroutines.delay
6 | import kotlinx.coroutines.launch
7 |
8 | /**
9 | * This code start a coroutine lazily but doesn't wait
10 | * for it to complete, so the log entry is never printed.
11 | */
12 | fun main(args: Array) {
13 | val job = GlobalScope.launch(start = CoroutineStart.LAZY) {
14 | delay(3000)
15 | println("job completed")
16 | }
17 |
18 | job.start()
19 | }
20 |
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter4/client/deferred/deferred_impl.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter4.client.deferred
2 |
3 | import kotlinx.coroutines.Deferred
4 | import kotlinx.coroutines.GlobalScope
5 | import kotlinx.coroutines.async
6 | import kotlinx.coroutines.runBlocking
7 |
8 | /**
9 | * Implementation using deferred.
10 | */
11 | fun main(args: Array) = runBlocking {
12 | val client : ProfileServiceRepository = ProfileServiceClient()
13 |
14 | val profile = client.asyncFetchByIdAsync(12).await()
15 | println(profile)
16 | }
17 |
18 | data class Profile(val id: Long, val name: String, val age: Int)
19 |
20 | interface ProfileServiceRepository {
21 | fun asyncFetchByNameAsync(name: String) : Deferred
22 | fun asyncFetchByIdAsync(id: Long) : Deferred
23 | }
24 |
25 | class ProfileServiceClient : ProfileServiceRepository {
26 | override fun asyncFetchByNameAsync(name: String) = GlobalScope.async {
27 | Profile(1, name, 28)
28 | }
29 |
30 | override fun asyncFetchByIdAsync(id: Long) = GlobalScope.async {
31 | Profile(id, "Susan", 28)
32 | }
33 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter4/client/suspending/suspend_impl.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter4.client.suspending
2 |
3 | import kotlinx.coroutines.runBlocking
4 |
5 | /**
6 | * Implementation using suspending functions.
7 | */
8 | fun main(args: Array) = runBlocking {
9 | val repository: ProfileServiceRepository = ProfileServiceClient()
10 |
11 | val profile = repository.fetchById(12)
12 | println(profile)
13 | }
14 |
15 | data class Profile(val id: Long, val name: String, val age: Int)
16 |
17 | interface ProfileServiceRepository {
18 | suspend fun fetchByName(name: String) : Profile
19 | suspend fun fetchById(id: Long) : Profile
20 | }
21 |
22 | class ProfileServiceClient : ProfileServiceRepository {
23 | override suspend fun fetchByName(name: String) : Profile {
24 | return Profile(1, name, 28)
25 | }
26 |
27 | override suspend fun fetchById(id: Long) : Profile {
28 | return Profile(id, "Susan", 28)
29 | }
30 |
31 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter4/context/dispatcher/dispatcher.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter4.context.dispatcher
2 |
3 | import kotlinx.coroutines.*
4 |
5 | /**
6 | * This file contains examples of different types of dispatchers
7 | */
8 | fun main(args: Array) {
9 | commonPool()
10 | defaultDispatcher()
11 | unconfined()
12 | singleThread()
13 | threadPool()
14 | }
15 |
16 | fun commonPool() = runBlocking {
17 | GlobalScope.launch(Dispatchers.Default) {
18 | println("Running in ${Thread.currentThread().name}")
19 | }.join()
20 | }
21 |
22 | fun defaultDispatcher() = runBlocking {
23 | GlobalScope.launch {
24 | println("Running in ${Thread.currentThread().name}")
25 | }.join()
26 |
27 | GlobalScope.launch(Dispatchers.Default) {
28 | println("Running in ${Thread.currentThread().name}")
29 | }.join()
30 | }
31 |
32 | fun unconfined() = runBlocking {
33 | GlobalScope.launch(Dispatchers.Unconfined) {
34 | println("Starting in ${Thread.currentThread().name}")
35 | delay(500)
36 | println("Resuming in ${Thread.currentThread().name}")
37 | }.join()
38 | }
39 |
40 | fun singleThread() = runBlocking {
41 | val dispatcher = newSingleThreadContext("myThread")
42 |
43 | GlobalScope.launch(dispatcher) {
44 | println("Starting in ${Thread.currentThread().name}")
45 | delay(500)
46 | println("Resuming in ${Thread.currentThread().name}")
47 | }.join()
48 | }
49 |
50 | fun threadPool() = runBlocking {
51 | val dispatcher = newFixedThreadPoolContext(4, "myPool")
52 |
53 | GlobalScope.launch(dispatcher) {
54 | println("Starting in ${Thread.currentThread().name}")
55 | delay(500)
56 | println("Resuming in ${Thread.currentThread().name}")
57 | }.join()
58 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter4/context/exception/exception_handling.kt:
--------------------------------------------------------------------------------
1 | package chapter4.context.exception
2 |
3 | import kotlinx.coroutines.*
4 |
5 | /**
6 | * Using CoroutineExceptionHandler to log an exception.
7 | */
8 | fun main(args: Array) = runBlocking {
9 | val handler = CoroutineExceptionHandler { context, throwable ->
10 | println("Error captured in $context")
11 | println("Message: ${throwable.message}")
12 | }
13 |
14 | GlobalScope.launch(handler) {
15 | TODO("Not implemented yet!")
16 | }
17 |
18 | // wait for the error to happen
19 | delay(500)
20 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter4/context/mix/join/join.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter4.context.mix.join
2 |
3 | import kotlinx.coroutines.*
4 |
5 | /**
6 | * Join two contexts using the `+` operator
7 | */
8 | fun main(args: Array) = runBlocking {
9 | val dispatcher = newSingleThreadContext("myDispatcher")
10 | val handler = CoroutineExceptionHandler { _, throwable ->
11 | println("Error captured")
12 | println("Message: ${throwable.message}")
13 | }
14 |
15 | // Combine two contexts together
16 | val context = dispatcher + handler
17 |
18 | GlobalScope.launch(context) {
19 | println("Running in ${Thread.currentThread().name}")
20 | TODO("Not implemented!")
21 | }.join()
22 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter4/context/mix/separate/separate.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter4.context.mix.separate
2 |
3 | import kotlinx.coroutines.*
4 |
5 | /**
6 | * Use `minusKey()` to separate two contexts previously joined.
7 | */
8 | fun main(args: Array) = runBlocking {
9 | val dispatcher = newSingleThreadContext("myDispatcher")
10 | val handler = CoroutineExceptionHandler { _, throwable ->
11 | println("Error captured")
12 | println("Message: ${throwable.message}")
13 | }
14 |
15 | // Combine two contexts together
16 | val context = dispatcher + handler
17 |
18 | // Remove one element from the context
19 | val tmpCtx = context.minusKey(dispatcher.key)
20 |
21 | GlobalScope.launch(tmpCtx) {
22 | println("Running in ${Thread.currentThread().name}")
23 | TODO("Not implemented!")
24 | }.join()
25 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter4/context/switch/switch.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter4.context.switch
2 |
3 | import kotlinx.coroutines.*
4 |
5 | /**
6 | * Switch context using `withContext` instead of the complete
7 | * coroutine builder
8 | */
9 | fun main(args: Array) = runBlocking {
10 | before()
11 | after()
12 | }
13 |
14 | suspend fun before() {
15 | val dispatcher = newSingleThreadContext("myThread")
16 | val name = GlobalScope.async(dispatcher) {
17 | // Do important operation here
18 | "Susan Calvin"
19 | }.await()
20 |
21 | println("User: $name")
22 | }
23 |
24 | suspend fun after() {
25 | val dispatcher = newSingleThreadContext("myThread")
26 | val name = withContext(dispatcher) {
27 | // Do important operation here
28 | "Susan Calvin"
29 | }
30 |
31 | println("User: $name")
32 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter4/suspending/suspending.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter4.suspending
2 |
3 | import kotlinx.coroutines.delay
4 | import kotlinx.coroutines.runBlocking
5 |
6 | /**
7 | * Basic suspending function.
8 | */
9 | fun main(args: Array) {
10 | runBlocking {
11 | greetDelayed(1000)
12 | }
13 | }
14 |
15 | suspend fun greetDelayed(delayMillis: Int) {
16 | //delay(delayMillis)
17 | println("Hello, World!")
18 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter5/iterator/fibonacci/fibonacci_iterator.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter5.iterator.fibonacci
2 |
3 | import kotlinx.coroutines.runBlocking
4 | import kotlin.sequences.iterator
5 |
6 | /**
7 | * Implementation of a Fibonacci sequence using
8 | * an iterator.
9 | */
10 | fun main(args: Array) = runBlocking {
11 | val fibonacci = iterator {
12 | yield(1L)
13 | var current = 1L
14 | var next = 1L
15 | while (true) {
16 | yield(next)
17 | val tmpNext = current + next
18 | current = next
19 | next = tmpNext
20 | }
21 | }
22 |
23 | for (i in 0..91) {
24 | println("$i is ${fibonacci.next()}")
25 | }
26 | }
27 |
28 |
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter5/producer/fibonacci/fibonacci.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter5.producer.fibonacci
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.channels.consumeEach
5 | import kotlinx.coroutines.channels.produce
6 | import kotlinx.coroutines.channels.take
7 | import kotlinx.coroutines.newSingleThreadContext
8 | import kotlinx.coroutines.runBlocking
9 |
10 | val context = newSingleThreadContext("myThread")
11 |
12 | /**
13 | * Fibonacci sequence using a producer.
14 | */
15 | val fibonacci = GlobalScope.produce(context) {
16 | send(1L)
17 | var current = 1L
18 | var next = 1L
19 | while (true) {
20 | send(next)
21 | val tmpNext = current + next
22 | current = next
23 | next = tmpNext
24 | }
25 | }
26 |
27 | fun main(args: Array) = runBlocking {
28 | fibonacci.take(10).consumeEach {
29 | println(it)
30 | }
31 | }
32 |
33 |
34 |
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter5/sequence/examples.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter5.sequence
2 |
3 | import kotlin.sequences.sequence
4 |
5 | /**
6 | * Interacting with sequences.
7 | */
8 | fun main(args: Array) {
9 | simpleSequences()
10 | readingAllTheValues()
11 | elementAt()
12 | elementAtOrElse()
13 | elementAtOrNull()
14 | groupOfElements()
15 | stateless()
16 | }
17 |
18 | fun simpleSequences() {
19 | val sequence = iterator {
20 | yield(1)
21 | }
22 |
23 | val sequence2 : Sequence = sequence {
24 | yield("A")
25 | yield(1)
26 | yield(32L)
27 | }
28 | }
29 |
30 | val sequence = sequence {
31 | yield(1)
32 | yield(1)
33 | yield(2)
34 | yield(3)
35 | yield(5)
36 | yield(8)
37 | yield(13)
38 | yield(21)
39 | }
40 |
41 | fun readingAllTheValues() {
42 | sequence.forEach {
43 | print("$it ")
44 | }
45 |
46 | println()
47 | sequence.forEachIndexed { index, value ->
48 | println("element at $index is $value")
49 | }
50 | }
51 |
52 | fun elementAt() {
53 | println(sequence.elementAt(4))
54 | }
55 |
56 | fun elementAtOrElse() {
57 | println(sequence.elementAtOrElse(10, { it * 2 }))
58 | }
59 |
60 | fun elementAtOrNull() {
61 | println(sequence.elementAtOrNull(10))
62 | }
63 |
64 | fun groupOfElements() {
65 | val firstFive = sequence.take(5)
66 | println(firstFive.joinToString())
67 | }
68 |
69 | fun stateless() {
70 | val sequence = sequence {
71 | for (i in 0..9) {
72 | println("Yielding $i")
73 | yield(i)
74 | }
75 | }
76 |
77 | println("Requesting index 1")
78 | sequence.elementAt(1)
79 |
80 | println("Requesting index 2")
81 | sequence.elementAt(2)
82 |
83 | println("Taking 3")
84 | sequence.take(3).joinToString()
85 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter5/sequence/fibonacci/sequence.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter5.sequence.fibonacci
2 |
3 | import kotlin.sequences.sequence
4 |
5 | // Fibonacci sequence using a sequence.
6 | fun main(args: Array) {
7 |
8 | val fibonacci = sequence {
9 | yield(1L)
10 | var current = 1L
11 | var next = 1L
12 | while (true) {
13 | yield(next)
14 | val tmpNext = current + next
15 | current = next
16 | next = tmpNext
17 | }
18 | }
19 |
20 | println(fibonacci.elementAt(1))
21 | println(fibonacci.elementAt(2))
22 | val indexed = fibonacci.take(50).withIndex()
23 |
24 | for ((index, value) in indexed) {
25 | println("$index: $value")
26 | }
27 |
28 |
29 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter6/buffered/array/array.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter6.buffered.array
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.channels.Channel
5 | import kotlinx.coroutines.channels.take
6 | import kotlinx.coroutines.delay
7 | import kotlinx.coroutines.launch
8 | import kotlinx.coroutines.runBlocking
9 | import kotlin.system.measureTimeMillis
10 |
11 | /**
12 | * Creating an ArrayChannel
13 | */
14 | fun main(args: Array) = runBlocking {
15 | val time = measureTimeMillis {
16 | val channel = Channel(4)
17 | val sender = GlobalScope.launch {
18 | repeat(10) {
19 | channel.send(it)
20 | println("Sent $it")
21 | }
22 | }
23 |
24 | delay(500)
25 |
26 | println("Taking two")
27 | channel.take(2).receive()
28 |
29 | delay(500)
30 | }
31 |
32 | println("Took ${time}ms")
33 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter6/buffered/conflated/conflated.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter6.buffered.conflated
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.channels.Channel
5 | //import kotlinx.coroutines.channels.ConflatedChannel
6 | import kotlinx.coroutines.channels.take
7 | import kotlinx.coroutines.delay
8 | import kotlinx.coroutines.launch
9 | import kotlinx.coroutines.runBlocking
10 | import kotlin.system.measureTimeMillis
11 |
12 | /**
13 | * Creating a Conflated channel.
14 | */
15 | fun main(args: Array) = runBlocking {
16 | val time = measureTimeMillis {
17 | val channel = Channel(Channel.CONFLATED)
18 | GlobalScope.launch {
19 | repeat(5) {
20 | channel.send(it)
21 | println("Sent $it")
22 | }
23 | }
24 | delay(500)
25 | val element = channel.receive()
26 | println("Received $element")
27 | }
28 |
29 | println("Took ${time}ms")
30 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter6/buffered/linked/linked.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter6.buffered.linked
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.channels.Channel
5 | import kotlinx.coroutines.delay
6 | import kotlinx.coroutines.launch
7 | import kotlinx.coroutines.runBlocking
8 | import kotlin.system.measureTimeMillis
9 |
10 | /**
11 | * Creating a LinkedListChannel
12 | */
13 | fun main(args: Array) = runBlocking {
14 | val time = measureTimeMillis {
15 | val channel = Channel(Channel.UNLIMITED)
16 | val sender = GlobalScope.launch {
17 | repeat(5) {
18 | println("Sending $it")
19 | channel.send(it)
20 | }
21 | }
22 |
23 | delay(500)
24 | }
25 |
26 | println("Took ${time}ms")
27 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter6/interaction/receive/receive.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter6.interaction.receive
2 |
3 | import kotlinx.coroutines.channels.Channel
4 | import kotlinx.coroutines.channels.ClosedReceiveChannelException
5 | import kotlinx.coroutines.runBlocking
6 |
7 | /**
8 | * Interaction with a ReceiveChannel
9 | */
10 | fun main(args: Array) = runBlocking {
11 | isClosedForReceive()
12 | receiveException()
13 | isEmpty()
14 | }
15 |
16 | fun isClosedForReceive() {
17 | val channel = Channel()
18 | channel.isClosedForReceive // false
19 | channel.close()
20 | channel.isClosedForReceive // true
21 | }
22 |
23 | suspend fun receiveException() {
24 | val channel = Channel()
25 | channel.close()
26 |
27 | try {
28 | channel.receive()
29 | } catch (e: ClosedReceiveChannelException) {
30 | println("ClosedReceiveChannelException handled")
31 | }
32 | }
33 |
34 | suspend fun isEmpty() {
35 | val channel = Channel(1)
36 | channel.isEmpty // true
37 | channel.send(10)
38 | channel.isEmpty // false
39 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter6/unbufffered/rendezvous/rendezvous.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter6.unbufffered.rendezvous
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.channels.Channel
5 | import kotlinx.coroutines.launch
6 | import kotlinx.coroutines.runBlocking
7 | import kotlin.system.measureTimeMillis
8 |
9 | /**
10 | * Creating a RendezvousChannel.
11 | */
12 | fun main(args: Array) = runBlocking {
13 | val time = measureTimeMillis {
14 | val channel = Channel()
15 | val sender = GlobalScope.launch {
16 | repeat(10) {
17 | channel.send(it)
18 | println("Sent $it")
19 | }
20 | }
21 |
22 | channel.receive()
23 | channel.receive()
24 | }
25 |
26 | println("Took ${time}ms")
27 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter7/actor/actor.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter7.actor
2 |
3 | import android.provider.Settings
4 | import kotlinx.coroutines.Dispatchers
5 | import kotlinx.coroutines.GlobalScope
6 | import kotlinx.coroutines.async
7 | import kotlinx.coroutines.runBlocking
8 |
9 | // This method will use an actor to print the correct value always
10 | fun main(args: Array) = runBlocking {
11 | val workerA = asyncIncrement(2000)
12 | val workerB = asyncIncrement(100)
13 | val workerC = asyncDecrement(1000)
14 |
15 | workerA.await()
16 | workerB.await()
17 | workerC.await()
18 |
19 | print("counter [${getCounter()}]")
20 | }
21 |
22 | fun asyncIncrement(by: Int) = GlobalScope.async {
23 | for (i in 0 until by) {
24 | actorCounter.send(Action.INCREASE)
25 | }
26 | }
27 |
28 | fun asyncDecrement(by: Int) = GlobalScope.async(Dispatchers.Default) {
29 | for (i in 0 until by) {
30 | actorCounter.send(Action.DECREASE)
31 | }
32 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter7/actor/actor_counter.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter7.actor
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.channels.actor
5 | import kotlinx.coroutines.newSingleThreadContext
6 |
7 | /**
8 | * The contents of this classes are used in
9 | * `actor.kt`
10 | */
11 | private var counter = 0
12 | private val context = newSingleThreadContext("actor")
13 |
14 | enum class Action {
15 | INCREASE,
16 | DECREASE
17 | }
18 |
19 | fun getCounter() = counter
20 |
21 | val actorCounter = GlobalScope.actor(context) {
22 | for (msg in channel) {
23 | when(msg) {
24 | Action.INCREASE -> counter++
25 | Action.DECREASE -> counter--
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter7/actor/interaction/actor_samples.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter7.actor.interaction
2 |
3 | import kotlinx.coroutines.CoroutineStart
4 | import kotlinx.coroutines.GlobalScope
5 | import kotlinx.coroutines.channels.actor
6 | import kotlinx.coroutines.newFixedThreadPoolContext
7 | import kotlinx.coroutines.runBlocking
8 |
9 | /**
10 | * Interacting with an actor.
11 | */
12 | fun main(args: Array) = runBlocking {
13 | bufferedActor()
14 | actorWithContext()
15 | lazyActor()
16 | }
17 |
18 | suspend fun bufferedActor() {
19 | val bufferedPrinter = GlobalScope.actor(capacity = 10) {
20 | for (msg in channel) {
21 | println(msg)
22 | }
23 | }
24 |
25 | bufferedPrinter.send("hello")
26 | bufferedPrinter.send("world")
27 |
28 | bufferedPrinter.close()
29 | }
30 |
31 | suspend fun actorWithContext() {
32 | val dispatcher = newFixedThreadPoolContext(3, "pool")
33 | val actor = GlobalScope.actor(dispatcher) {
34 | for (msg in channel) {
35 | println("Running in ${Thread.currentThread().name}")
36 | }
37 | }
38 |
39 | for (i in 1..10) {
40 | actor.send("a")
41 | }
42 | }
43 |
44 | suspend fun lazyActor() {
45 | val actor = GlobalScope.actor(start = CoroutineStart.LAZY) {
46 | for (msg in channel) {
47 | println(msg)
48 | }
49 | }
50 |
51 | actor.send("hello lazy")
52 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter7/atomic/atomic.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter7.atomic
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.async
5 | import kotlinx.coroutines.runBlocking
6 | import java.util.concurrent.atomic.AtomicInteger
7 |
8 | // This method will print the correct value `2100`
9 | // because it's calculated using an AtomicInteger.
10 | fun main(args: Array) = runBlocking {
11 | val workerA = asyncIncrement(2000)
12 | val workerB = asyncIncrement(100)
13 |
14 | workerA.await()
15 | workerB.await()
16 |
17 | print("counter [$counter]")
18 | }
19 |
20 | var counter = AtomicInteger()
21 |
22 | fun asyncIncrement(by: Int) = GlobalScope.async {
23 | for (i in 0 until by) {
24 | counter.incrementAndGet()
25 | }
26 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter7/atomicity/atomicity_violation.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter7.atomicity
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.async
5 | import kotlinx.coroutines.runBlocking
6 |
7 | // This method will print values lower than 2100 often,
8 | // because of an atomicity violation on this implementation.
9 | fun main(args: Array) = runBlocking {
10 | val workerA = asyncIncrement(2000)
11 | val workerB = asyncIncrement(100)
12 |
13 | workerA.await()
14 | workerB.await()
15 |
16 | print("counter [$counter]")
17 | }
18 |
19 | var counter = 0
20 |
21 | fun asyncIncrement(by: Int) = GlobalScope.async {
22 | for (i in 0 until by) {
23 | counter++
24 | }
25 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter7/confinement/thread_confinement.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter7.confinement
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.async
5 | import kotlinx.coroutines.newSingleThreadContext
6 | import kotlinx.coroutines.runBlocking
7 |
8 | // This implementation executes all the increments in the same
9 | // thread, so it will always increase up to 2100
10 | fun main(args: Array) = runBlocking {
11 | val workerA = asyncIncrement(2000)
12 | val workerB = asyncIncrement(100)
13 |
14 | workerA.await()
15 | workerB.await()
16 |
17 | print("counter [$counter]")
18 | }
19 |
20 | var counter = 0
21 | val context = newSingleThreadContext("counter")
22 |
23 | fun asyncIncrement(by: Int) = GlobalScope.async(context) {
24 | for (i in 0 until by) {
25 | counter++
26 | }
27 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter7/mutex/interaction/mutex_interaction.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter7.mutex.interaction
2 |
3 | import kotlinx.coroutines.runBlocking
4 | import kotlinx.coroutines.sync.Mutex
5 | import kotlinx.coroutines.sync.withLock
6 |
7 | // Interacting with a mutex.
8 | fun main(args: Array) = runBlocking {
9 | useWithLock()
10 | manualLock()
11 | isLocked()
12 | tryLockFalse()
13 | tryLockTrue()
14 | }
15 |
16 | suspend fun useWithLock() {
17 | val mutex = Mutex()
18 | mutex.withLock {
19 | // This will be atomic
20 | }
21 | }
22 |
23 | suspend fun manualLock() {
24 | val mutex = Mutex()
25 |
26 | mutex.lock()
27 | print("I am now an atomic block")
28 | mutex.unlock()
29 | }
30 |
31 | suspend fun isLocked() {
32 | val mutex = Mutex()
33 |
34 | mutex.lock()
35 | mutex.isLocked // true
36 | mutex.unlock()
37 | }
38 |
39 | suspend fun tryLockFalse() {
40 | val mutex = Mutex()
41 | mutex.lock()
42 | val lockedByMe = mutex.tryLock() // false
43 | mutex.unlock()
44 | }
45 |
46 | fun tryLockTrue() {
47 | val mutex = Mutex()
48 |
49 | val lockedByMe = mutex.tryLock() // true
50 | mutex.unlock()
51 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter7/mutex/mutex.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter7.mutex
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.async
5 | import kotlinx.coroutines.runBlocking
6 | import kotlinx.coroutines.sync.Mutex
7 | import kotlinx.coroutines.sync.withLock
8 |
9 | // This implementation locks the code that modifies counter
10 | // so that it's only executed by one coroutine at the time.
11 | // This implementation will always increase counter to the
12 | // correct value `2100`.
13 | fun main(args: Array) = runBlocking {
14 | val workerA = asyncIncrement(2000)
15 | val workerB = asyncIncrement(100)
16 |
17 | workerA.await()
18 | workerB.await()
19 |
20 | print("counter [$counter]")
21 | }
22 |
23 | var counter = 0
24 | var mutex = Mutex()
25 |
26 | fun asyncIncrement(by: Int) = GlobalScope.async {
27 | for (i in 0 until by) {
28 | mutex.withLock {
29 | counter++
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter7/volatile/incorrect/volatile.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter7.volatile.incorrect
2 |
3 |
4 | class Something {
5 |
6 | @Volatile
7 | private var type = 0
8 | private var title = ""
9 |
10 | fun setTitle(newTitle: String) {
11 | when(type) {
12 | 0 -> title = newTitle
13 | else -> throw Exception("Invalid State")
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter7/volatile/volatile.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter7.volatile
2 |
3 | // Example of the correct usage of the annotation.
4 | class DataProcessor {
5 | @Volatile
6 | private var shutdownRequested = false
7 |
8 | fun shutdown() {
9 | shutdownRequested = true
10 | }
11 |
12 | fun process() {
13 | while (!shutdownRequested) {
14 | // process away
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/java/main/kotlin/chapter8/test_feature.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin.chapter8
2 |
3 | import kotlinx.coroutines.Deferred
4 | import kotlinx.coroutines.async
5 | import kotlinx.coroutines.delay
6 |
7 | /**
8 | * This file defines code to be tested with
9 | * functional tests. Please see the tests packages.
10 | */
11 | data class User(
12 | val name: String,
13 | val age: Int,
14 | val profession: String
15 | )
16 |
17 | class UserManager(private val dataSource: DataSource) {
18 | suspend fun getUser(id: Int): User {
19 | val name = dataSource.getNameAsync(id)
20 | val age = dataSource.getAgeAsync(id)
21 | val profession = dataSource.getProfessionAsync(id)
22 |
23 | // Wait for each of them, don't assume they are ready
24 | return User(name.await(),
25 | age.await(),
26 | profession.await())
27 | }
28 | }
29 |
30 | interface DataSource {
31 | fun getNameAsync(id: Int): Deferred
32 | fun getAgeAsync(id: Int): Deferred
33 | fun getProfessionAsync(id: Int): Deferred
34 | }
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/KotlinSamples-master/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/KotlinSamples-master/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/KotlinSamples-master/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/KotlinSamples-master/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/KotlinSamples-master/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/KotlinSamples-master/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/KotlinSamples-master/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/KotlinSamples-master/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/KotlinSamples-master/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/KotlinSamples-master/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #6200EE
4 | #3700B3
5 | #03DAC5
6 |
7 |
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | KotlinSamples-master
3 |
4 |
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/KotlinSamples-master/app/src/test/java/main/kotlin/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package main.kotlin
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/KotlinSamples-master/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.3.72'
5 | ext.coroutines_version = '1.3.6'
6 | repositories {
7 | google()
8 | jcenter()
9 |
10 | }
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:3.6.3'
13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14 |
15 | // NOTE: Do not place your application dependencies here; they belong
16 | // in the individual module build.gradle files
17 | }
18 | }
19 |
20 | allprojects {
21 | repositories {
22 | google()
23 | jcenter()
24 |
25 | }
26 | }
27 |
28 | task clean(type: Delete) {
29 | delete rootProject.buildDir
30 | }
31 |
--------------------------------------------------------------------------------
/KotlinSamples-master/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
22 |
--------------------------------------------------------------------------------
/KotlinSamples-master/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/KotlinSamples-master/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/KotlinSamples-master/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat May 16 18:58:46 KST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
7 |
--------------------------------------------------------------------------------
/KotlinSamples-master/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name='KotlinSamples-master'
2 | include ':app'
3 |
--------------------------------------------------------------------------------
/RssReader-master/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 |
--------------------------------------------------------------------------------
/RssReader-master/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/RssReader-master/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/RssReader-master/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | 1.8
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/RssReader-master/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/RssReader-master/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | 1.8
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 |
5 | android {
6 | compileSdkVersion 29
7 | buildToolsVersion "29.0.3"
8 |
9 | defaultConfig {
10 | applicationId "co.starcarr.ressreader"
11 | minSdkVersion 24
12 | targetSdkVersion 29
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 |
26 | }
27 |
28 | dependencies {
29 | implementation fileTree(dir: 'libs', include: ['*.jar'])
30 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
31 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
32 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
33 | implementation 'androidx.appcompat:appcompat:1.1.0'
34 | implementation 'androidx.core:core-ktx:1.2.0'
35 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
36 | implementation "androidx.recyclerview:recyclerview:1.0.0"
37 | testImplementation 'junit:junit:4.12'
38 | androidTestImplementation 'androidx.test.ext:junit:1.1.1'
39 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
40 | testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
41 | testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
42 | }
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/src/androidTest/java/co/starcarr/rssreader/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package co.starcarr.rssreader
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("co.starcarr.rssreader", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
27 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter2/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #6200EE
4 | #3700B3
5 | #03DAC5
6 |
7 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RssReader
3 |
4 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/app/src/test/java/co/starcarr/rssreader/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package co.starcarr.rssreader
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.3.72'
5 | ext.coroutines_version = '1.3.6'
6 | repositories {
7 | google()
8 | jcenter()
9 |
10 | }
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:3.6.3'
13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14 |
15 | // NOTE: Do not place your application dependencies here; they belong
16 | // in the individual module build.gradle files
17 | }
18 | }
19 |
20 | allprojects {
21 | repositories {
22 | google()
23 | jcenter()
24 |
25 | }
26 | }
27 |
28 | task clean(type: Delete) {
29 | delete rootProject.buildDir
30 | }
31 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
22 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter2/RssReader/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun May 17 14:04:34 KST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
7 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter2/RssReader/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name='RssReader'
2 | include ':app'
3 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/.idea/.name:
--------------------------------------------------------------------------------
1 | RessReader
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | 1.8
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 |
5 | android {
6 | compileSdkVersion 29
7 | buildToolsVersion "29.0.3"
8 |
9 | defaultConfig {
10 | applicationId "co.starcarr.ressreader"
11 | minSdkVersion 24
12 | targetSdkVersion 29
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 |
26 | }
27 |
28 | dependencies {
29 | implementation fileTree(dir: 'libs', include: ['*.jar'])
30 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
31 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
32 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
33 | implementation 'androidx.appcompat:appcompat:1.1.0'
34 | implementation 'androidx.core:core-ktx:1.2.0'
35 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
36 | implementation "androidx.recyclerview:recyclerview:1.0.0"
37 | testImplementation 'junit:junit:4.12'
38 | androidTestImplementation 'androidx.test.ext:junit:1.1.1'
39 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
40 | testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
41 | testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
42 | }
43 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/src/androidTest/java/co/starcarr/rssreader/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package co.starcarr.rssreader
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("co.starcarr.ressreader", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
27 |
28 |
36 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter3/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #6200EE
4 | #3700B3
5 | #03DAC5
6 |
7 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RessReader
3 |
4 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/app/src/test/java/co/starcarr/rssreader/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package co.starcarr.rssreader
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.3.72'
5 | ext.coroutines_version = '1.3.6'
6 | repositories {
7 | google()
8 | jcenter()
9 |
10 | }
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:3.6.3'
13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14 |
15 | // NOTE: Do not place your application dependencies here; they belong
16 | // in the individual module build.gradle files
17 | }
18 | }
19 |
20 | allprojects {
21 | repositories {
22 | google()
23 | jcenter()
24 |
25 | }
26 | }
27 |
28 | task clean(type: Delete) {
29 | delete rootProject.buildDir
30 | }
31 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
22 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter3/RssReader/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun May 17 13:56:30 KST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
7 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter3/RssReader/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name='RessReader'
2 | include ':app'
3 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/.idea/.name:
--------------------------------------------------------------------------------
1 | RessReader
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | 1.8
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 |
5 | android {
6 | compileSdkVersion 29
7 | buildToolsVersion "29.0.3"
8 |
9 | defaultConfig {
10 | applicationId "co.starcarr.ressreader"
11 | minSdkVersion 24
12 | targetSdkVersion 29
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 |
26 | }
27 |
28 | dependencies {
29 | implementation fileTree(dir: 'libs', include: ['*.jar'])
30 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
31 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
32 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
33 | implementation 'androidx.appcompat:appcompat:1.1.0'
34 | implementation 'androidx.core:core-ktx:1.2.0'
35 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
36 | implementation "androidx.recyclerview:recyclerview:1.0.0"
37 | testImplementation 'junit:junit:4.12'
38 | androidTestImplementation 'androidx.test.ext:junit:1.1.1'
39 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
40 | testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
41 | testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
42 | }
43 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/androidTest/java/co/starcarr/rssreader/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package co.starcarr.rssreader
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("co.starcarr.ressreader", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/java/co/starcarr/rssreader/adapter/ArticleAdapter.kt:
--------------------------------------------------------------------------------
1 | package co.starcarr.rssreader.adapter
2 |
3 | import android.view.LayoutInflater
4 | import android.view.ViewGroup
5 | import android.widget.LinearLayout
6 | import android.widget.TextView
7 | import androidx.recyclerview.widget.RecyclerView
8 | import co.starcarr.rssreader.R
9 | import co.starcarr.rssreader.model.Article
10 |
11 | class ArticleAdapter : RecyclerView.Adapter() {
12 |
13 | private val articles: MutableList = mutableListOf()
14 |
15 | class ViewHolder(
16 | val layout: LinearLayout,
17 | val feed: TextView,
18 | val title: TextView,
19 | val summary: TextView
20 | ) : RecyclerView.ViewHolder(layout)
21 |
22 | override fun onCreateViewHolder(parent: ViewGroup,
23 | viewType: Int): ViewHolder {
24 | val layout = LayoutInflater.from(parent.context)
25 | .inflate(R.layout.article, parent, false) as LinearLayout
26 |
27 | val feed = layout.findViewById(R.id.feed)
28 | val title = layout.findViewById(R.id.title)
29 | val summary = layout.findViewById(R.id.summary)
30 |
31 | return ViewHolder(layout, feed, title, summary)
32 | }
33 |
34 | override fun getItemCount() = articles.size
35 |
36 | override fun onBindViewHolder(holder: ViewHolder, position: Int) {
37 | val article = articles[position]
38 |
39 | holder.feed.text = article.feed
40 | holder.title.text = article.title
41 | holder.summary.text = article.summary
42 | }
43 |
44 | fun add(articles: List) {
45 | this.articles.addAll(articles)
46 | notifyDataSetChanged()
47 | }
48 |
49 |
50 | }
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/java/co/starcarr/rssreader/model/model.kt:
--------------------------------------------------------------------------------
1 | package co.starcarr.rssreader.model
2 |
3 | data class Feed(
4 | val name: String,
5 | val url: String
6 | )
7 |
8 | data class Article(
9 | val feed: String,
10 | val title: String,
11 | val summary: String
12 | )
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
25 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/res/layout/article.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
21 |
25 |
26 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter4/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #6200EE
4 | #3700B3
5 | #03DAC5
6 |
7 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RessReader
3 |
4 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/app/src/test/java/co/starcarr/rssreader/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package co.starcarr.rssreader
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.3.72'
5 | ext.coroutines_version = '1.3.6'
6 | repositories {
7 | google()
8 | jcenter()
9 |
10 | }
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:3.6.3'
13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14 |
15 | // NOTE: Do not place your application dependencies here; they belong
16 | // in the individual module build.gradle files
17 | }
18 | }
19 |
20 | allprojects {
21 | repositories {
22 | google()
23 | jcenter()
24 |
25 | }
26 | }
27 |
28 | task clean(type: Delete) {
29 | delete rootProject.buildDir
30 | }
31 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
22 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter4/RssReader/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun May 17 13:56:30 KST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
7 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter4/RssReader/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name='RessReader'
2 | include ':app'
3 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/.idea/.name:
--------------------------------------------------------------------------------
1 | RessReader
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | 1.8
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 |
5 | android {
6 | compileSdkVersion 29
7 | buildToolsVersion "29.0.3"
8 |
9 | defaultConfig {
10 | applicationId "co.starcarr.ressreader"
11 | minSdkVersion 24
12 | targetSdkVersion 29
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 |
26 | }
27 |
28 | dependencies {
29 | implementation fileTree(dir: 'libs', include: ['*.jar'])
30 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
31 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
32 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
33 | implementation 'androidx.appcompat:appcompat:1.1.0'
34 | implementation 'androidx.core:core-ktx:1.2.0'
35 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
36 | implementation "androidx.recyclerview:recyclerview:1.0.0"
37 | testImplementation 'junit:junit:4.12'
38 | androidTestImplementation 'androidx.test.ext:junit:1.1.1'
39 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
40 | testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
41 | testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
42 | }
43 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/androidTest/java/co/starcarr/rssreader/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package co.starcarr.rssreader
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("co.starcarr.ressreader", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/main/java/co/starcarr/rssreader/model/model.kt:
--------------------------------------------------------------------------------
1 | package co.starcarr.rssreader.model
2 |
3 | data class Feed(val name: String, val url: String)
4 | data class Article(val feed: String, val title: String, val summary: String)
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
25 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/main/res/layout/article.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
21 |
25 |
26 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter5/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #6200EE
4 | #3700B3
5 | #03DAC5
6 |
7 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RessReader
3 |
4 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/app/src/test/java/co/starcarr/rssreader/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package co.starcarr.rssreader
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.3.72'
5 | ext.coroutines_version = '1.3.6'
6 | repositories {
7 | google()
8 | jcenter()
9 |
10 | }
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:3.6.3'
13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14 |
15 | // NOTE: Do not place your application dependencies here; they belong
16 | // in the individual module build.gradle files
17 | }
18 | }
19 |
20 | allprojects {
21 | repositories {
22 | google()
23 | jcenter()
24 |
25 | }
26 | }
27 |
28 | task clean(type: Delete) {
29 | delete rootProject.buildDir
30 | }
31 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
22 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter5/RssReader/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun May 17 13:56:30 KST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
7 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter5/RssReader/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name='RessReader'
2 | include ':app'
3 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/.idea/.name:
--------------------------------------------------------------------------------
1 | RessReader
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | 1.8
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 |
5 | android {
6 | compileSdkVersion 29
7 | buildToolsVersion "29.0.3"
8 |
9 | defaultConfig {
10 | applicationId "co.starcarr.ressreader"
11 | minSdkVersion 24
12 | targetSdkVersion 29
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 |
26 | }
27 |
28 | dependencies {
29 | implementation fileTree(dir: 'libs', include: ['*.jar'])
30 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
31 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
32 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
33 | implementation 'androidx.appcompat:appcompat:1.1.0'
34 | implementation 'androidx.core:core-ktx:1.2.0'
35 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
36 | implementation "androidx.recyclerview:recyclerview:1.0.0"
37 | testImplementation 'junit:junit:4.12'
38 | androidTestImplementation 'androidx.test.ext:junit:1.1.1'
39 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
40 | testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
41 | testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
42 | }
43 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/androidTest/java/co/starcarr/rssreader/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package co.starcarr.rssreader
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("co.starcarr.ressreader", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/java/co/starcarr/rssreader/model/model.kt:
--------------------------------------------------------------------------------
1 | package co.starcarr.rssreader.model
2 |
3 | data class Feed(val name: String, val url: String)
4 | data class Article(val feed: String, val title: String, val summary: String)
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
25 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/res/layout/activity_search.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
21 |
22 |
23 |
30 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/res/layout/article.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
21 |
25 |
26 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter6/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #6200EE
4 | #3700B3
5 | #03DAC5
6 |
7 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RessReader
3 |
4 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/app/src/test/java/co/starcarr/rssreader/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package co.starcarr.rssreader
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.3.72'
5 | ext.coroutines_version = '1.3.6'
6 | repositories {
7 | google()
8 | jcenter()
9 |
10 | }
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:3.6.3'
13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14 |
15 | // NOTE: Do not place your application dependencies here; they belong
16 | // in the individual module build.gradle files
17 | }
18 | }
19 |
20 | allprojects {
21 | repositories {
22 | google()
23 | jcenter()
24 |
25 | }
26 | }
27 |
28 | task clean(type: Delete) {
29 | delete rootProject.buildDir
30 | }
31 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
22 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter6/RssReader/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun May 17 13:56:30 KST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
7 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter6/RssReader/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name='RessReader'
2 | include ':app'
3 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/.idea/.name:
--------------------------------------------------------------------------------
1 | RessReader
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | 1.8
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 |
5 | android {
6 | compileSdkVersion 29
7 | buildToolsVersion "29.0.3"
8 |
9 | defaultConfig {
10 | applicationId "co.starcarr.ressreader"
11 | minSdkVersion 24
12 | targetSdkVersion 29
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 |
26 | }
27 |
28 | dependencies {
29 | implementation fileTree(dir: 'libs', include: ['*.jar'])
30 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
31 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
32 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
33 | implementation 'androidx.appcompat:appcompat:1.1.0'
34 | implementation 'androidx.core:core-ktx:1.2.0'
35 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
36 | implementation "androidx.recyclerview:recyclerview:1.0.0"
37 | testImplementation 'junit:junit:4.12'
38 | androidTestImplementation 'androidx.test.ext:junit:1.1.1'
39 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
40 | testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
41 | testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
42 | }
43 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/androidTest/java/co/starcarr/rssreader/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package co.starcarr.rssreader
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("co.starcarr.ressreader", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/java/co/starcarr/rssreader/model/model.kt:
--------------------------------------------------------------------------------
1 | package co.starcarr.rssreader.model
2 |
3 | data class Feed(val name: String, val url: String)
4 | data class Article(val feed: String, val title: String, val summary: String)
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/java/co/starcarr/rssreader/search/ResultsCounter.kt:
--------------------------------------------------------------------------------
1 | package co.starcarr.rssreader.search
2 |
3 | import kotlinx.coroutines.GlobalScope
4 | import kotlinx.coroutines.channels.Channel
5 | import kotlinx.coroutines.channels.ReceiveChannel
6 | import kotlinx.coroutines.channels.actor
7 | import kotlinx.coroutines.newSingleThreadContext
8 |
9 | enum class Action {
10 | INCREASE,
11 | RESET
12 | }
13 |
14 | object ResultsCounter {
15 | private val context = newSingleThreadContext("counter")
16 | private var counter = 0
17 | private val notifications = Channel(Channel.CONFLATED)
18 |
19 | private val actor = GlobalScope.actor(context) {
20 | for (msg in channel) {
21 | when (msg) {
22 | Action.INCREASE -> counter++
23 | Action.RESET -> counter = 0
24 | }
25 |
26 | notifications.send(counter)
27 | }
28 | }
29 |
30 | fun getNotificationChannel() : ReceiveChannel = notifications
31 |
32 |
33 | suspend fun increment() = actor.send(Action.INCREASE)
34 |
35 | suspend fun reset() = actor.send(Action.RESET)
36 |
37 | }
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
25 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/res/layout/activity_search.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
24 |
25 |
30 |
31 |
38 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/res/layout/article.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
21 |
25 |
26 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter7/RssReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #6200EE
4 | #3700B3
5 | #03DAC5
6 |
7 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RessReader
3 |
4 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/app/src/test/java/co/starcarr/rssreader/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package co.starcarr.rssreader
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.3.72'
5 | ext.coroutines_version = '1.3.6'
6 | repositories {
7 | google()
8 | jcenter()
9 |
10 | }
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:3.6.3'
13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14 |
15 | // NOTE: Do not place your application dependencies here; they belong
16 | // in the individual module build.gradle files
17 | }
18 | }
19 |
20 | allprojects {
21 | repositories {
22 | google()
23 | jcenter()
24 |
25 | }
26 | }
27 |
28 | task clean(type: Delete) {
29 | delete rootProject.buildDir
30 | }
31 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
22 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AcornPublishing/concurrency-kotlin/7dc827ee9c31c1117f9f57a2747ea4d2c3b02868/RssReader-master/Chapter7/RssReader/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun May 17 13:56:30 KST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
7 |
--------------------------------------------------------------------------------
/RssReader-master/Chapter7/RssReader/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name='RessReader'
2 | include ':app'
3 |
--------------------------------------------------------------------------------