Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add progress bar to contact list on dashboard #649

Merged
merged 2 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class NetworkQueryMessageImpl(
private const val ENDPOINT_MESSAGES_READ = "/messages/%d/read"
private const val ENDPOINT_MESSAGES = "/messages"
private const val ENDPOINT_PAYMENT = "/payment"
private const val ENDPOINT_PAYMENTS = "payments"
private const val ENDPOINT_PAYMENTS = "/payments"
private const val ENDPOINT_PAY_ATTACHMENT = "/purchase"
private const val ENDPOINT_INVOICES = "/invoices"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import chat.sphinx.dashboard.ui.adapter.DashboardFooterAdapter
import chat.sphinx.dashboard.ui.viewstates.ChatFilter
import chat.sphinx.dashboard.ui.viewstates.ChatListFooterButtonsViewState
import chat.sphinx.dashboard.ui.viewstates.ChatListViewState
import chat.sphinx.dashboard.ui.viewstates.ChatViewState
import chat.sphinx.resources.SphinxToastUtils
import chat.sphinx.resources.inputMethodManager
import chat.sphinx.wrapper_chat.ChatType
Expand All @@ -32,6 +33,7 @@ import io.matthewnelson.android_feature_screens.navigation.CloseAppOnBackPress
import io.matthewnelson.android_feature_screens.ui.sideeffect.SideEffectFragment
import io.matthewnelson.android_feature_screens.util.gone
import io.matthewnelson.android_feature_screens.util.goneIfFalse
import io.matthewnelson.android_feature_screens.util.visible
import io.matthewnelson.concept_views.viewstate.collect
import kotlinx.coroutines.launch
import javax.inject.Inject
Expand Down Expand Up @@ -217,4 +219,21 @@ internal class ChatListFragment : SideEffectFragment<
}
}
}

override fun subscribeToViewStateFlow() {
onStopSupervisor.scope.launch(viewModel.mainImmediate) {
viewModel.chatViewStateContainer.collect { viewState ->
when {
viewState.list.isEmpty() -> {
binding.progressBarChatList.visible
}
viewState.list.isNotEmpty() -> {
binding.progressBarChatList.gone
}
}
}
}

super.subscribeToViewStateFlow()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,17 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/layout_search_bar" />

<ProgressBar
android:id="@+id/progress_bar_chat_list"
style="?android:attr/progressBarStyle"
android:layout_width="@dimen/default_large_layout_margin"
android:layout_height="@dimen/default_large_layout_margin"
android:indeterminate="true"
android:indeterminateTint="@android:color/white"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
Loading