From 0dbd856ac57428c18e76ac5f97956dbc32cefcef Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 30 Mar 2021 14:54:19 +0200 Subject: [PATCH] UI polishing And cleanup --- .../features/spaces/SpacePreviewActivity.kt | 3 +- .../spaces/SpacePreviewSharedAction.kt | 26 ++++++++++++++++ .../SpacePreviewSharedActionViewModel.kt | 8 ----- .../spaces/SpaceSettingsMenuBottomSheet.kt | 9 +++--- .../spaces/create/ChooseSpaceTypeFragment.kt | 3 +- .../create/CreateSpaceDefaultRoomsFragment.kt | 2 ++ .../create/CreateSpaceDetailsFragment.kt | 2 +- .../spaces/create/CreateSpaceViewModel.kt | 5 ++- .../res/layout/bottom_sheet_call_controls.xml | 1 - .../bottom_sheet_call_dialer_choice.xml | 1 - .../res/layout/bottom_sheet_space_invite.xml | 1 - .../bottom_sheet_space_invite_chooser.xml | 1 - .../layout/bottom_sheet_space_settings.xml | 31 ++++++++++--------- ...agment_space_create_generic_epoxy_form.xml | 9 +++--- vector/src/main/res/values/strings.xml | 1 + 15 files changed, 65 insertions(+), 38 deletions(-) create mode 100644 vector/src/main/java/im/vector/app/features/spaces/SpacePreviewSharedAction.kt diff --git a/vector/src/main/java/im/vector/app/features/spaces/SpacePreviewActivity.kt b/vector/src/main/java/im/vector/app/features/spaces/SpacePreviewActivity.kt index dacde8846c..0dcaf9d754 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/SpacePreviewActivity.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/SpacePreviewActivity.kt @@ -45,7 +45,8 @@ class SpacePreviewActivity : VectorBaseActivity() { SpacePreviewSharedAction.HideModalLoading -> hideWaitingView() is SpacePreviewSharedAction.ShowErrorMessage -> action.error?.let { showSnackbar(it) } } - }.disposeOnDestroy() + } + .disposeOnDestroy() if (isFirstCreation()) { val simpleName = SpacePreviewFragment::class.java.simpleName diff --git a/vector/src/main/java/im/vector/app/features/spaces/SpacePreviewSharedAction.kt b/vector/src/main/java/im/vector/app/features/spaces/SpacePreviewSharedAction.kt new file mode 100644 index 0000000000..3d5ce26cb2 --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/spaces/SpacePreviewSharedAction.kt @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2021 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.app.features.spaces + +import im.vector.app.core.platform.VectorSharedAction + +sealed class SpacePreviewSharedAction : VectorSharedAction { + object DismissAction : SpacePreviewSharedAction() + object ShowModalLoading : SpacePreviewSharedAction() + object HideModalLoading : SpacePreviewSharedAction() + data class ShowErrorMessage(val error: String? = null) : SpacePreviewSharedAction() +} diff --git a/vector/src/main/java/im/vector/app/features/spaces/SpacePreviewSharedActionViewModel.kt b/vector/src/main/java/im/vector/app/features/spaces/SpacePreviewSharedActionViewModel.kt index 058b1a275b..dec88fe38a 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/SpacePreviewSharedActionViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/SpacePreviewSharedActionViewModel.kt @@ -16,15 +16,7 @@ package im.vector.app.features.spaces -import im.vector.app.core.platform.VectorSharedAction import im.vector.app.core.platform.VectorSharedActionViewModel import javax.inject.Inject -sealed class SpacePreviewSharedAction : VectorSharedAction { - object DismissAction : SpacePreviewSharedAction() - object ShowModalLoading : SpacePreviewSharedAction() - object HideModalLoading : SpacePreviewSharedAction() - data class ShowErrorMessage(val error: String? = null) : SpacePreviewSharedAction() -} - class SpacePreviewSharedActionViewModel @Inject constructor() : VectorSharedActionViewModel() diff --git a/vector/src/main/java/im/vector/app/features/spaces/SpaceSettingsMenuBottomSheet.kt b/vector/src/main/java/im/vector/app/features/spaces/SpaceSettingsMenuBottomSheet.kt index 29472dcf28..ca4de04502 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/SpaceSettingsMenuBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/SpaceSettingsMenuBottomSheet.kt @@ -27,6 +27,7 @@ import com.airbnb.mvrx.args import im.vector.app.R import im.vector.app.core.di.ActiveSessionHolder import im.vector.app.core.di.ScreenComponent +import im.vector.app.core.extensions.setTextOrHide import im.vector.app.core.platform.VectorBaseBottomSheetDialogFragment import im.vector.app.databinding.BottomSheetSpaceSettingsBinding import im.vector.app.features.home.AvatarRenderer @@ -62,7 +63,7 @@ class SpaceSettingsMenuBottomSheet : VectorBaseBottomSheetDialogFragment() { private val sharedViewModel: CreateSpaceViewModel by activityViewModel() @@ -43,7 +42,9 @@ class ChooseSpaceTypeFragment @Inject constructor( })) views.privateButton.setOnClickListener(DebouncedClickListener({ + vectorBaseActivity.notImplemented("Creating private space") // sharedViewModel.handle(CreateSpaceAction.SetRoomType(SpaceType.Private)) })) } } + diff --git a/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceDefaultRoomsFragment.kt b/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceDefaultRoomsFragment.kt index 4fe4c6e82a..53a4ee689b 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceDefaultRoomsFragment.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceDefaultRoomsFragment.kt @@ -21,6 +21,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import com.airbnb.mvrx.activityViewModel +import im.vector.app.R import im.vector.app.core.extensions.configureWith import im.vector.app.core.extensions.hideKeyboard import im.vector.app.core.platform.OnBackPressed @@ -49,6 +50,7 @@ class CreateSpaceDefaultRoomsFragment @Inject constructor( epoxyController.setData(it) } + views.nextButton.setText(R.string.create_space) views.nextButton.debouncedClicks { view.hideKeyboard() sharedViewModel.handle(CreateSpaceAction.NextFromDefaultRooms) diff --git a/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceDetailsFragment.kt b/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceDetailsFragment.kt index 3e420ee632..b5925eec59 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceDetailsFragment.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceDetailsFragment.kt @@ -33,7 +33,7 @@ import javax.inject.Inject class CreateSpaceDetailsFragment @Inject constructor( private val epoxyController: SpaceDetailEpoxyController, - private val colorProvider: ColorProvider + colorProvider: ColorProvider ) : VectorBaseFragment(), SpaceDetailEpoxyController.Listener, GalleryOrCameraDialogHelper.Listener, OnBackPressed { diff --git a/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceViewModel.kt b/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceViewModel.kt index 18cccbe62a..ed16829c06 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceViewModel.kt @@ -23,6 +23,7 @@ import com.airbnb.mvrx.FragmentViewModelContext import com.airbnb.mvrx.Loading import com.airbnb.mvrx.MvRxViewModelFactory import com.airbnb.mvrx.Success +import com.airbnb.mvrx.Uninitialized import com.airbnb.mvrx.ViewModelContext import dagger.assisted.Assisted import dagger.assisted.AssistedFactory @@ -125,7 +126,9 @@ class CreateSpaceViewModel @AssistedInject constructor( CreateSpaceState.Step.SetDetails -> { setState { copy( - step = CreateSpaceState.Step.ChooseType + step = CreateSpaceState.Step.ChooseType, + nameInlineError = null, + creationResult = Uninitialized ) } _viewEvents.post(CreateSpaceEvents.NavigateToChooseType) diff --git a/vector/src/main/res/layout/bottom_sheet_call_controls.xml b/vector/src/main/res/layout/bottom_sheet_call_controls.xml index f30d44b731..52874f4e8c 100644 --- a/vector/src/main/res/layout/bottom_sheet_call_controls.xml +++ b/vector/src/main/res/layout/bottom_sheet_call_controls.xml @@ -2,7 +2,6 @@ - + app:layout_constraintStart_toEndOf="@id/spaceAvatarImageView" + app:layout_constraintTop_toBottomOf="@+id/spaceNameView" + tools:text="@sample/matrix.json/data/message" + tools:visibility="visible" /> @@ -88,15 +89,17 @@ app:tint="?attr/riotx_text_primary" app:titleTextColor="?attr/riotx_text_primary" /> - + + app:titleTextColor="?attr/riotx_text_primary" + tools:visibility="visible" /> + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent"> Join my space %1$s %2$s Skip for now + Create Space Join Space Join Anyway This alias is not accessible at this time.\nTry again later, or ask a room admin to check if you have access.