Add CLEAR and FILTER buttons to notifications (#1168)

* Issue tuskyapp#762 add clear notifications button to the top of the Notifications adapter

* Issue tuskyapp#764 add the notifications filter

* Update notifications top bar buttons

* Replace PopupMenu with PopupWindow. Save notifications filter to the account table

* Disable hide top bar on empty content at the notification screen

* Add app bar behavior to the sw640 notification layout

* Fix issue with click on top notification tab
This commit is contained in:
pandasoft0 2019-04-09 20:13:54 +03:00 committed by Konrad Pozniak
commit 63e4c1d4e0
15 changed files with 1247 additions and 28 deletions

View file

@ -15,10 +15,7 @@
package com.keylesspalace.tusky.entity
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
import com.google.gson.JsonParseException
import com.google.gson.*
import com.google.gson.annotations.JsonAdapter
data class Notification(
@ -28,26 +25,28 @@ data class Notification(
val status: Status?) {
@JsonAdapter(NotificationTypeAdapter::class)
enum class Type {
UNKNOWN,
MENTION,
REBLOG,
FAVOURITE,
FOLLOW;
enum class Type(val presentation: String) {
UNKNOWN("unknown"),
MENTION("mention"),
REBLOG("reblog"),
FAVOURITE("favourite"),
FOLLOW("follow");
companion object {
@JvmStatic
fun byString(s: String): Type {
return when (s) {
"mention" -> MENTION
"reblog" -> REBLOG
"favourite" -> FAVOURITE
"follow" -> FOLLOW
else -> UNKNOWN
values().forEach {
if (s == it.presentation)
return it
}
return UNKNOWN
}
val asList = listOf(MENTION,REBLOG,FAVOURITE,FOLLOW)
}
override fun toString(): String {
return presentation
}
}