Minor fixes
- don't show dialog on resume in mobile networks - load more items when deleting without scrolling
This commit is contained in:
parent
34e2e0673b
commit
c1d74e4781
@ -241,7 +241,7 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> {
|
|||||||
.withIdentifier(ID_NODE_SWITCH)
|
.withIdentifier(ID_NODE_SWITCH)
|
||||||
.withName(R.string.full_node)
|
.withName(R.string.full_node)
|
||||||
.withIcon(CommunityMaterial.Icon.cmd_cloud_outline)
|
.withIcon(CommunityMaterial.Icon.cmd_cloud_outline)
|
||||||
.withChecked(isRunning)
|
.withChecked(Preferences.isFullNodeActive(this))
|
||||||
.withOnCheckedChangeListener { _, _, isChecked ->
|
.withOnCheckedChangeListener { _, _, isChecked ->
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
NetworkUtils.enableNode(this@MainActivity)
|
NetworkUtils.enableNode(this@MainActivity)
|
||||||
@ -373,7 +373,6 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> {
|
|||||||
if (Preferences.isFullNodeActive(this) && Preferences.isConnectionAllowed(this@MainActivity)) {
|
if (Preferences.isFullNodeActive(this) && Preferences.isConnectionAllowed(this@MainActivity)) {
|
||||||
NetworkUtils.enableNode(this, false)
|
NetworkUtils.enableNode(this, false)
|
||||||
}
|
}
|
||||||
updateNodeSwitch()
|
|
||||||
Singleton.getMessageListener(this).resetNotification()
|
Singleton.getMessageListener(this).resetNotification()
|
||||||
active = true
|
active = true
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
@ -81,8 +81,7 @@ class MessageListFragment : Fragment(), ListHolder<Label> {
|
|||||||
|
|
||||||
if (!isLoading && !isLastPage) {
|
if (!isLoading && !isLastPage) {
|
||||||
if (visibleItemCount + firstVisibleItemPosition >= totalItemCount - 5
|
if (visibleItemCount + firstVisibleItemPosition >= totalItemCount - 5
|
||||||
&& firstVisibleItemPosition >= 0
|
&& firstVisibleItemPosition >= 0) {
|
||||||
&& totalItemCount >= PAGE_SIZE) {
|
|
||||||
loadMoreItems()
|
loadMoreItems()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,11 +192,13 @@ class MessageListFragment : Fragment(), ListHolder<Label> {
|
|||||||
item.addLabels(messageRepo.getLabels(Label.Type.TRASH))
|
item.addLabels(messageRepo.getLabels(Label.Type.TRASH))
|
||||||
messageRepo.save(item)
|
messageRepo.save(item)
|
||||||
}
|
}
|
||||||
|
recyclerViewOnScrollListener.onScrolled(null, 0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onItemArchived(item: Plaintext) {
|
override fun onItemArchived(item: Plaintext) {
|
||||||
item.labels.clear()
|
item.labels.clear()
|
||||||
messageRepo.save(item)
|
messageRepo.save(item)
|
||||||
|
recyclerViewOnScrollListener.onScrolled(null, 0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onItemViewClicked(v: View?) {
|
override fun onItemViewClicked(v: View?) {
|
||||||
@ -244,12 +245,14 @@ class MessageListFragment : Fragment(), ListHolder<Label> {
|
|||||||
if (currentLabel?.type == Label.Type.TRASH && added.all { it.type == Label.Type.TRASH } && removed.isEmpty()) {
|
if (currentLabel?.type == Label.Type.TRASH && added.all { it.type == Label.Type.TRASH } && removed.isEmpty()) {
|
||||||
// work-around for messages that are deleted from trash
|
// work-around for messages that are deleted from trash
|
||||||
swipeableMessageAdapter?.remove(message)
|
swipeableMessageAdapter?.remove(message)
|
||||||
|
recyclerViewOnScrollListener.onScrolled(null, 0, 0)
|
||||||
} else if (added.contains(currentLabel)) {
|
} else if (added.contains(currentLabel)) {
|
||||||
// in most cases, top should be the correct position, but time will show if
|
// in most cases, top should be the correct position, but time will show if
|
||||||
// the message should be properly sorted in
|
// the message should be properly sorted in
|
||||||
swipeableMessageAdapter?.addFirst(message)
|
swipeableMessageAdapter?.addFirst(message)
|
||||||
} else if (removed.contains(currentLabel)) {
|
} else if (removed.contains(currentLabel)) {
|
||||||
swipeableMessageAdapter?.remove(message)
|
swipeableMessageAdapter?.remove(message)
|
||||||
|
recyclerViewOnScrollListener.onScrolled(null, 0, 0)
|
||||||
} else if (removed.any { it.type == Label.Type.UNREAD } || added.any { it.type == Label.Type.UNREAD }) {
|
} else if (removed.any { it.type == Label.Type.UNREAD } || added.any { it.type == Label.Type.UNREAD }) {
|
||||||
swipeableMessageAdapter?.update(message)
|
swipeableMessageAdapter?.update(message)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user