forked from GitHub-Mirror/riotX-android
Rename class member for code clarity
This commit is contained in:
parent
49ae954183
commit
0afde3b021
@ -18,7 +18,7 @@ package im.vector.matrix.android.api.session.sync
|
|||||||
|
|
||||||
sealed class SyncState {
|
sealed class SyncState {
|
||||||
object IDLE : SyncState()
|
object IDLE : SyncState()
|
||||||
data class RUNNING(val catchingUp: Boolean) : SyncState()
|
data class RUNNING(val afterPause: Boolean) : SyncState()
|
||||||
object PAUSED : SyncState()
|
object PAUSED : SyncState()
|
||||||
object KILLING : SyncState()
|
object KILLING : SyncState()
|
||||||
object KILLED : SyncState()
|
object KILLED : SyncState()
|
||||||
|
@ -62,7 +62,7 @@ internal class SyncThread @Inject constructor(private val syncTask: SyncTask,
|
|||||||
fun restart() = synchronized(lock) {
|
fun restart() = synchronized(lock) {
|
||||||
if (state is SyncState.PAUSED) {
|
if (state is SyncState.PAUSED) {
|
||||||
Timber.v("Resume sync...")
|
Timber.v("Resume sync...")
|
||||||
updateStateTo(SyncState.RUNNING(catchingUp = true))
|
updateStateTo(SyncState.RUNNING(afterPause = true))
|
||||||
lock.notify()
|
lock.notify()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ internal class SyncThread @Inject constructor(private val syncTask: SyncTask,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (state !is SyncState.RUNNING) {
|
if (state !is SyncState.RUNNING) {
|
||||||
updateStateTo(SyncState.RUNNING(catchingUp = true))
|
updateStateTo(SyncState.RUNNING(afterPause = true))
|
||||||
}
|
}
|
||||||
Timber.v("[$this] Execute sync request with timeout $DEFAULT_LONG_POOL_TIMEOUT")
|
Timber.v("[$this] Execute sync request with timeout $DEFAULT_LONG_POOL_TIMEOUT")
|
||||||
val latch = CountDownLatch(1)
|
val latch = CountDownLatch(1)
|
||||||
@ -140,7 +140,7 @@ internal class SyncThread @Inject constructor(private val syncTask: SyncTask,
|
|||||||
|
|
||||||
latch.await()
|
latch.await()
|
||||||
if (state is SyncState.RUNNING) {
|
if (state is SyncState.RUNNING) {
|
||||||
updateStateTo(SyncState.RUNNING(catchingUp = false))
|
updateStateTo(SyncState.RUNNING(afterPause = false))
|
||||||
}
|
}
|
||||||
|
|
||||||
Timber.v("Waiting for $DEFAULT_LONG_POOL_DELAY delay before new pool...")
|
Timber.v("Waiting for $DEFAULT_LONG_POOL_DELAY delay before new pool...")
|
||||||
|
@ -209,7 +209,7 @@ class HomeDetailFragment : VectorBaseFragment(), KeysBackupBanner.Delegate {
|
|||||||
unreadCounterBadgeViews[INDEX_PEOPLE].render(UnreadCounterBadgeView.State(it.notificationCountPeople, it.notificationHighlightPeople))
|
unreadCounterBadgeViews[INDEX_PEOPLE].render(UnreadCounterBadgeView.State(it.notificationCountPeople, it.notificationHighlightPeople))
|
||||||
unreadCounterBadgeViews[INDEX_ROOMS].render(UnreadCounterBadgeView.State(it.notificationCountRooms, it.notificationHighlightRooms))
|
unreadCounterBadgeViews[INDEX_ROOMS].render(UnreadCounterBadgeView.State(it.notificationCountRooms, it.notificationHighlightRooms))
|
||||||
syncProgressBar.visibility = when (it.syncState) {
|
syncProgressBar.visibility = when (it.syncState) {
|
||||||
is SyncState.RUNNING -> if (it.syncState.catchingUp) View.VISIBLE else View.GONE
|
is SyncState.RUNNING -> if (it.syncState.afterPause) View.VISIBLE else View.GONE
|
||||||
else -> View.GONE
|
else -> View.GONE
|
||||||
}
|
}
|
||||||
syncProgressBarWrap.visibility = syncProgressBar.visibility
|
syncProgressBarWrap.visibility = syncProgressBar.visibility
|
||||||
|
Loading…
Reference in New Issue
Block a user