Refactor "trending hashtags" code (#3595)

- Fix codeformatting
- Add new refreshing state
- Disable LogConditional lint rule
- Update lint-baseline
This commit is contained in:
Konrad Pozniak 2023-06-10 19:47:07 +02:00 committed by GitHub
commit f23c0cc634
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 335 additions and 480 deletions

View file

@ -15,9 +15,6 @@
package com.keylesspalace.tusky.viewdata
import com.keylesspalace.tusky.entity.TrendingTag
import com.keylesspalace.tusky.entity.end
import com.keylesspalace.tusky.entity.start
import java.util.Date
sealed class TrendingViewData {
@ -31,18 +28,13 @@ sealed class TrendingViewData {
get() = start.toString() + end.toString()
}
fun asHeaderOrNull(): Header? {
val tag = (this as? Tag)?.tag
?: return null
return Header(tag.start(), tag.end())
}
data class Tag(
val tag: TrendingTag
val name: String,
val usage: List<Long>,
val accounts: List<Long>,
val maxTrendingValue: Long
) : TrendingViewData() {
override val id: String
get() = tag.name
get() = name
}
fun asTagOrNull() = this as? Tag
}