Compare commits
4 Commits
v171901010
...
v171901013
Author | SHA1 | Date | |
---|---|---|---|
a0aead6491 | |||
722b6cc06d | |||
6d7c4b40f6 | |||
f538ed39fc |
@ -112,7 +112,7 @@ dependencies {
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
|
||||
|
||||
//multidex
|
||||
implementation 'androidx.multidex:multidex:2.0.0'
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
|
||||
// About
|
||||
implementation('com.mikepenz:aboutlibraries:6.2.0@aar') {
|
||||
|
@ -247,14 +247,18 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
||||
val i = items.elementAtOrNull(position)
|
||||
|
||||
if (i != null) {
|
||||
val adapter = recyclerView.adapter
|
||||
val adapter = recyclerView.adapter as ItemsAdapter<*>
|
||||
|
||||
when (adapter) {
|
||||
is ItemCardAdapter -> adapter.handleItemAtIndex(position)
|
||||
is ItemListAdapter -> adapter.handleItemAtIndex(position)
|
||||
val wasItemUnread = adapter.unreadItemStatusAtIndex(position)
|
||||
|
||||
adapter.handleItemAtIndex(position)
|
||||
|
||||
if (wasItemUnread) {
|
||||
badgeNew--
|
||||
} else {
|
||||
badgeNew++
|
||||
}
|
||||
|
||||
badgeNew--
|
||||
reloadBadgeContent()
|
||||
|
||||
val tagHashes = i.tags.tags.split(",").map { it.longHash() }
|
||||
@ -1348,12 +1352,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
||||
).show()
|
||||
tabNewBadge.removeBadge()
|
||||
|
||||
|
||||
tagsBadge = itemsByTag.map {
|
||||
(it.key to ((tagsBadge[it.key] ?: it.value) - it.value))
|
||||
}.toMap()
|
||||
|
||||
reloadTagsBadges()
|
||||
handleDrawerItems()
|
||||
|
||||
getElementsAccordingToTab()
|
||||
} else {
|
||||
|
@ -132,15 +132,17 @@ abstract class ItemsAdapter<VH : RecyclerView.ViewHolder?> : RecyclerView.Adapte
|
||||
}
|
||||
|
||||
fun handleItemAtIndex(position: Int) {
|
||||
val i = items[position]
|
||||
|
||||
if (i.unread) {
|
||||
if (unreadItemStatusAtIndex(position)) {
|
||||
readItemAtIndex(position)
|
||||
} else {
|
||||
unreadItemAtIndex(position)
|
||||
}
|
||||
}
|
||||
|
||||
fun unreadItemStatusAtIndex(position: Int): Boolean {
|
||||
return items[position].unread
|
||||
}
|
||||
|
||||
private fun readItemAtIndex(position: Int) {
|
||||
val i = items[position]
|
||||
items.remove(i)
|
||||
|
@ -36,7 +36,7 @@
|
||||
<string name="tab_favs">"收藏夹"</string>
|
||||
<string name="action_about">"关于我们"</string>
|
||||
<string name="marked_as_read">"已读"</string>
|
||||
<string name="marked_as_unread">"Item unread"</string>
|
||||
<string name="marked_as_unread">"未讀項目"</string>
|
||||
<string name="undo_string">"撤销"</string>
|
||||
<string name="addStringNoUrl">"登录以添加数据源。"</string>
|
||||
<string name="cant_get_sources">"无法获取数据列表。"</string>
|
||||
|
Reference in New Issue
Block a user