mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 11:46:32 +00:00
Merge branch 'fix/endless-loading-circle-inbox-fix'
This commit is contained in:
commit
e5c13d8dc2
2 changed files with 16 additions and 0 deletions
|
|
@ -72,6 +72,8 @@
|
|||
android:layout_height="42dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginStart="@dimen/spacing_medium"
|
||||
android:layout_marginEnd="@dimen/spacing_medium"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:lineSpacingMultiplier="1.0"
|
||||
android:text="Start chatting below! Remember to be friendly and follow the Community Guidelines."
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import androidx.fragment.app.viewModels
|
|||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import androidx.paging.LoadState
|
||||
import androidx.paging.PagingData
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.habitrpg.android.habitica.R
|
||||
|
|
@ -37,6 +38,7 @@ import com.habitrpg.android.habitica.ui.views.HabiticaSnackbar
|
|||
import com.habitrpg.android.habitica.ui.views.HabiticaSnackbar.Companion.showSnackbar
|
||||
import com.habitrpg.android.habitica.ui.views.dialogs.HabiticaAlertDialog
|
||||
import com.habitrpg.common.habitica.helpers.ExceptionHandler
|
||||
import com.habitrpg.common.habitica.helpers.RecyclerViewState
|
||||
import com.habitrpg.common.habitica.helpers.launchCatching
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.delay
|
||||
|
|
@ -124,6 +126,18 @@ class InboxMessageListFragment : BaseMainFragment<FragmentInboxMessageListBindin
|
|||
}
|
||||
}
|
||||
|
||||
chatAdapter?.addLoadStateListener { loadStates ->
|
||||
val isEmpty = loadStates.refresh is LoadState.NotLoading &&
|
||||
loadStates.append.endOfPaginationReached &&
|
||||
chatAdapter?.itemCount == 0
|
||||
|
||||
if (isEmpty) {
|
||||
binding?.recyclerView?.state = RecyclerViewState.EMPTY
|
||||
} else {
|
||||
binding?.recyclerView?.state = RecyclerViewState.DISPLAYING_DATA
|
||||
}
|
||||
}
|
||||
|
||||
binding?.chatBarView?.sendAction = { sendMessage(it) }
|
||||
binding?.chatBarView?.maxChatLength = configManager.maxChatLength()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue