-
Notifications
You must be signed in to change notification settings - Fork 868
space switcher empty spaces #6988
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| [App Layout] - space switcher now has empty state |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,13 +21,15 @@ import android.view.HapticFeedbackConstants | |
| import android.view.LayoutInflater | ||
| import android.view.View | ||
| import android.view.ViewGroup | ||
| import androidx.core.view.isVisible | ||
| import com.airbnb.epoxy.EpoxyTouchHelper | ||
| import com.airbnb.mvrx.Loading | ||
| import com.airbnb.mvrx.Success | ||
| import com.airbnb.mvrx.Uninitialized | ||
| import com.airbnb.mvrx.fragmentViewModel | ||
| import com.airbnb.mvrx.withState | ||
| import dagger.hilt.android.AndroidEntryPoint | ||
| import im.vector.app.core.epoxy.onClick | ||
| import im.vector.app.core.extensions.cleanup | ||
| import im.vector.app.core.extensions.configureWith | ||
| import im.vector.app.core.platform.StateView | ||
|
|
@@ -71,6 +73,7 @@ class SpaceListFragment : | |
| homeActivitySharedActionViewModel = activityViewModelProvider[HomeSharedActionViewModel::class.java] | ||
| roomListSharedActionViewModel = activityViewModelProvider[RoomListSharedActionViewModel::class.java] | ||
| views.stateView.contentView = views.groupListView | ||
| views.spacesEmptyButton.onClick { onAddSpaceSelected() } | ||
| setupSpaceController() | ||
| observeViewEvents() | ||
| } | ||
|
|
@@ -147,13 +150,22 @@ class SpaceListFragment : | |
| } | ||
|
|
||
| override fun invalidate() = withState(viewModel) { state -> | ||
| when (state.asyncSpaces) { | ||
| when (val spaces = state.asyncSpaces) { | ||
| Uninitialized, | ||
| is Loading -> { | ||
| views.stateView.state = StateView.State.Loading | ||
| return@withState | ||
| } | ||
| is Success -> views.stateView.state = StateView.State.Content | ||
| is Success -> { | ||
| views.stateView.state = StateView.State.Content | ||
| if (spaces.invoke().isEmpty()) { | ||
| views.spacesEmptyGroup.isVisible = true | ||
| views.groupListView.isVisible = false | ||
| } else { | ||
| views.spacesEmptyGroup.isVisible = false | ||
| views.groupListView.isVisible = true | ||
| } | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. About StateView, the correct code would be: is Success -> {
if (spaces.invoke().isEmpty()) {
views.stateView.state = StateView.State.Empty(...)
} else {
views.stateView.state = StateView.State.Content
}
}But maybe there are specific needs here? If this is the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK; thanks for explaining. |
||
| else -> Unit | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is maybe not new, but when the user clicks on this button, do we want to close the bottomsheet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ericdecanini could you please verify?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we don't want to close it immediately in case the user navigates back but we want to close it following a successful space creation.
There's already an issue for this #6950Edit: This behaviour already works like this in this PR. It also may be that we can close the above mentioned issue if we investigate that this works too in other cases