Minor fixes

- don't show dialog on resume in mobile networks
- load more items when deleting without scrolling
This commit is contained in:
Christian Basler 2017-09-19 17:34:11 +02:00
parent 34e2e0673b
commit c1d74e4781
2 changed files with 6 additions and 4 deletions

View File

@ -241,7 +241,7 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> {
.withIdentifier(ID_NODE_SWITCH)
.withName(R.string.full_node)
.withIcon(CommunityMaterial.Icon.cmd_cloud_outline)
.withChecked(isRunning)
.withChecked(Preferences.isFullNodeActive(this))
.withOnCheckedChangeListener { _, _, isChecked ->
if (isChecked) {
NetworkUtils.enableNode(this@MainActivity)
@ -373,7 +373,6 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> {
if (Preferences.isFullNodeActive(this) && Preferences.isConnectionAllowed(this@MainActivity)) {
NetworkUtils.enableNode(this, false)
}
updateNodeSwitch()
Singleton.getMessageListener(this).resetNotification()
active = true
super.onResume()

View File

@ -81,8 +81,7 @@ class MessageListFragment : Fragment(), ListHolder<Label> {
if (!isLoading && !isLastPage) {
if (visibleItemCount + firstVisibleItemPosition >= totalItemCount - 5
&& firstVisibleItemPosition >= 0
&& totalItemCount >= PAGE_SIZE) {
&& firstVisibleItemPosition >= 0) {
loadMoreItems()
}
}
@ -193,11 +192,13 @@ class MessageListFragment : Fragment(), ListHolder<Label> {
item.addLabels(messageRepo.getLabels(Label.Type.TRASH))
messageRepo.save(item)
}
recyclerViewOnScrollListener.onScrolled(null, 0, 0)
}
override fun onItemArchived(item: Plaintext) {
item.labels.clear()
messageRepo.save(item)
recyclerViewOnScrollListener.onScrolled(null, 0, 0)
}
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()) {
// work-around for messages that are deleted from trash
swipeableMessageAdapter?.remove(message)
recyclerViewOnScrollListener.onScrolled(null, 0, 0)
} else if (added.contains(currentLabel)) {
// in most cases, top should be the correct position, but time will show if
// the message should be properly sorted in
swipeableMessageAdapter?.addFirst(message)
} else if (removed.contains(currentLabel)) {
swipeableMessageAdapter?.remove(message)
recyclerViewOnScrollListener.onScrolled(null, 0, 0)
} else if (removed.any { it.type == Label.Type.UNREAD } || added.any { it.type == Label.Type.UNREAD }) {
swipeableMessageAdapter?.update(message)
}