|
|
@ -39,12 +39,18 @@ class MainActivity : AppCompatActivity() { |
|
|
|
it.join() |
|
|
|
} |
|
|
|
|
|
|
|
// If the code below crashes, please change the filter |
|
|
|
// to !it.isCompletedExceptionally until this issue is |
|
|
|
// closed: https://github.com/Kotlin/kotlinx.coroutines/issues/220 |
|
|
|
val headlines = requests |
|
|
|
.filter { !it.isCompletedExceptionally } |
|
|
|
.filter { !it.isCancelled } |
|
|
|
.flatMap { it.getCompleted() } |
|
|
|
|
|
|
|
// If the counter doesn't work, please change the filter |
|
|
|
// to it.isCompletedExceptionally until this issues is |
|
|
|
// closed: https://github.com/Kotlin/kotlinx.coroutines/issues/220 |
|
|
|
val failed = requests |
|
|
|
.filter { it.isCompletedExceptionally } |
|
|
|
.filter { it.isCancelled } |
|
|
|
.size |
|
|
|
|
|
|
|
val newsCount = findViewById<TextView>(R.id.newsCount) |
|
|
|