fix crash in ViewThreadFragment (#3250)

This commit is contained in:
Konrad Pozniak 2023-02-03 19:21:21 +01:00 committed by GitHub
parent fac62a638e
commit 07a4e97e9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -24,6 +24,7 @@ import android.widget.LinearLayout
import androidx.annotation.CheckResult import androidx.annotation.CheckResult
import androidx.fragment.app.commit import androidx.fragment.app.commit
import androidx.fragment.app.viewModels import androidx.fragment.app.viewModels
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.DividerItemDecoration
@ -211,7 +212,7 @@ class ViewThreadFragment : SFragment(), OnRefreshListener, StatusActionListener,
threadProgressBar.cancel() threadProgressBar.cancel()
adapter.submitList(uiState.statusViewData) { adapter.submitList(uiState.statusViewData) {
if (viewModel.isInitialLoad) { if (lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED) && viewModel.isInitialLoad) {
viewModel.isInitialLoad = false viewModel.isInitialLoad = false
// Ensure the top of the status is visible // Ensure the top of the status is visible