Skip to content

Commit

Permalink
fix ep status merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ekibun committed Dec 19, 2019
1 parent ba5d6fe commit d458ae7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import soko.ekibun.bangumi.R
import soko.ekibun.bangumi.api.ApiHelper
import soko.ekibun.bangumi.api.bangumi.Bangumi
import java.text.DecimalFormat
import java.text.SimpleDateFormat
import java.util.*

/**
* 剧集类
Expand Down Expand Up @@ -49,12 +47,7 @@ data class Episode(
category = category ?: ep.category
}

val isAir
get() = status == STATUS_AIR || progress == PROGRESS_WATCH || (category?.startsWith("Disc") ?: false) || try {
SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).parse(airdate ?: "")!!.time < Date().time
} catch (e: Exception) {
false
}
val isAir get() = status == STATUS_AIR || progress == PROGRESS_WATCH || (category?.startsWith("Disc") ?: false)

/**
* 第*话
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ class MainPresenter(private val context: MainActivity) {
context.runOnUiThread { context.notifyMenu?.badge = notify?.let { it.first + it.second } ?: 0 }
})
collectionCall?.enqueue(ApiHelper.buildCallback({
it.forEach { subject ->
calendar.find { cal -> cal.id == subject.id }?.eps?.forEach { calEp ->
subject.eps?.find { ep -> ep.id == calEp.id }?.merge(calEp)
}
}
collectionList = it
callback(it)
}, {
Expand Down

0 comments on commit d458ae7

Please sign in to comment.