mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Cleanup and document DefaultInitialSyncProgressService
This commit is contained in:
parent
38da4b9ee5
commit
a5975a099e
3 changed files with 8 additions and 13 deletions
|
@ -20,10 +20,10 @@ import androidx.lifecycle.LiveData
|
|||
|
||||
interface InitialSyncProgressService {
|
||||
|
||||
fun getLiveStatus() : LiveData<Status?>
|
||||
fun getInitialSyncProgressStatus() : LiveData<Status?>
|
||||
|
||||
data class Status(
|
||||
@StringRes val statusText: Int?,
|
||||
@StringRes val statusText: Int,
|
||||
val percentProgress: Int = 0
|
||||
)
|
||||
}
|
|
@ -30,7 +30,7 @@ class DefaultInitialSyncProgressService @Inject constructor() : InitialSyncProgr
|
|||
|
||||
private var rootTask: TaskInfo? = null
|
||||
|
||||
override fun getLiveStatus(): LiveData<InitialSyncProgressService.Status?> {
|
||||
override fun getInitialSyncProgressStatus(): LiveData<InitialSyncProgressService.Status?> {
|
||||
return status
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ import androidx.appcompat.widget.Toolbar
|
|||
import androidx.core.view.GravityCompat
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.drawerlayout.widget.DrawerLayout
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import com.airbnb.mvrx.viewModel
|
||||
|
@ -36,12 +35,10 @@ import im.vector.riotx.core.di.ScreenComponent
|
|||
import im.vector.riotx.core.extensions.hideKeyboard
|
||||
import im.vector.riotx.core.extensions.observeEvent
|
||||
import im.vector.riotx.core.extensions.replaceFragment
|
||||
import im.vector.riotx.core.platform.OnBackPressed
|
||||
import im.vector.riotx.core.platform.ToolbarConfigurable
|
||||
import im.vector.riotx.core.platform.VectorBaseActivity
|
||||
import im.vector.riotx.core.pushers.PushersManager
|
||||
import im.vector.riotx.features.disclaimer.showDisclaimerDialog
|
||||
import im.vector.riotx.features.navigation.Navigator
|
||||
import im.vector.riotx.features.notifications.NotificationDrawerManager
|
||||
import im.vector.riotx.features.rageshake.VectorUncaughtExceptionHandler
|
||||
import im.vector.riotx.features.workers.signout.SignOutViewModel
|
||||
|
@ -119,22 +116,22 @@ class HomeActivity : VectorBaseActivity(), ToolbarConfigurable {
|
|||
intent.removeExtra(EXTRA_CLEAR_EXISTING_NOTIFICATION)
|
||||
}
|
||||
|
||||
activeSessionHolder.getSafeActiveSession()?.getLiveStatus()?.observe(this, Observer { sprogress ->
|
||||
Timber.e("${sprogress?.statusText?.let { getString(it) }} ${sprogress?.percentProgress}")
|
||||
if (sprogress == null) {
|
||||
activeSessionHolder.getSafeActiveSession()?.getInitialSyncProgressStatus()?.observe(this, Observer { status ->
|
||||
if (status == null) {
|
||||
waiting_view.isVisible = false
|
||||
} else {
|
||||
Timber.e("${getString(status.statusText)} ${status.percentProgress}")
|
||||
waiting_view.setOnClickListener {
|
||||
//block interactions
|
||||
}
|
||||
waiting_view_status_horizontal_progress.apply {
|
||||
isIndeterminate = false
|
||||
max = 100
|
||||
progress = sprogress.percentProgress
|
||||
progress = status.percentProgress
|
||||
isVisible = true
|
||||
}
|
||||
waiting_view_status_text.apply {
|
||||
text = sprogress.statusText?.let { getString(it) }
|
||||
text = getString(status.statusText)
|
||||
isVisible = true
|
||||
}
|
||||
waiting_view.isVisible = true
|
||||
|
@ -213,8 +210,6 @@ class HomeActivity : VectorBaseActivity(), ToolbarConfigurable {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
companion object {
|
||||
private const val EXTRA_CLEAR_EXISTING_NOTIFICATION = "EXTRA_CLEAR_EXISTING_NOTIFICATION"
|
||||
|
||||
|
|
Loading…
Reference in a new issue