UI polishing

And cleanup
This commit is contained in:
Benoit Marty 2021-03-30 14:54:19 +02:00 committed by Valere
parent 386e06d675
commit 0dbd856ac5
15 changed files with 65 additions and 38 deletions

View File

@ -45,7 +45,8 @@ class SpacePreviewActivity : VectorBaseActivity<ActivitySimpleBinding>() {
SpacePreviewSharedAction.HideModalLoading -> hideWaitingView()
is SpacePreviewSharedAction.ShowErrorMessage -> action.error?.let { showSnackbar(it) }
}
}.disposeOnDestroy()
}
.disposeOnDestroy()
if (isFirstCreation()) {
val simpleName = SpacePreviewFragment::class.java.simpleName

View File

@ -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()
}

View File

@ -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<SpacePreviewSharedAction>()

View File

@ -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
@ -78,10 +79,10 @@ class SpaceSettingsMenuBottomSheet : VectorBaseBottomSheetDialogFragment<BottomS
val session = activeSessionHolder.getSafeActiveSession() ?: return
val roomSummary = session.getRoomSummary(spaceArgs.spaceId)
roomSummary?.toMatrixItem()?.let {
avatarRenderer.renderSpace(it, views.roomAvatarImageView)
avatarRenderer.renderSpace(it, views.spaceAvatarImageView)
}
views.roomNameView.text = roomSummary?.displayName
views.roomDescription.text = roomSummary?.topic
views.spaceNameView.text = roomSummary?.displayName
views.spaceDescription.setTextOrHide(roomSummary?.topic?.takeIf { it.isNotEmpty() })
val room = session.getRoom(spaceArgs.spaceId) ?: return

View File

@ -27,7 +27,6 @@ import im.vector.app.databinding.FragmentSpaceCreateChooseTypeBinding
import javax.inject.Inject
class ChooseSpaceTypeFragment @Inject constructor(
// private val viewModelFactory: CreateSpaceViewModel.Factory,
) : VectorBaseFragment<FragmentSpaceCreateChooseTypeBinding>() {
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))
}))
}
}

View File

@ -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)

View File

@ -33,7 +33,7 @@ import javax.inject.Inject
class CreateSpaceDetailsFragment @Inject constructor(
private val epoxyController: SpaceDetailEpoxyController,
private val colorProvider: ColorProvider
colorProvider: ColorProvider
) : VectorBaseFragment<FragmentSpaceCreateGenericEpoxyFormBinding>(), SpaceDetailEpoxyController.Listener,
GalleryOrCameraDialogHelper.Listener, OnBackPressed {

View File

@ -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)

View File

@ -2,7 +2,6 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/callControlsWrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?riotx_bottom_sheet_background"

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/callControlsWrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?riotx_bottom_sheet_background"

View File

@ -2,7 +2,6 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/callControlsWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?riotx_bottom_sheet_background"

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/callControlsWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?riotx_bottom_sheet_background"

View File

@ -2,13 +2,11 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/callControlsWrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?riotx_bottom_sheet_background"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -18,7 +16,7 @@
android:paddingEnd="8dp">
<ImageView
android:id="@+id/roomAvatarImageView"
android:id="@+id/spaceAvatarImageView"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@string/avatar"
@ -28,8 +26,8 @@
tools:src="@tools:sample/avatars" />
<TextView
android:id="@+id/roomNameView"
android:layout_width="wrap_content"
android:id="@+id/spaceNameView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/layout_horizontal_margin"
android:layout_marginEnd="8dp"
@ -40,15 +38,15 @@
android:textSize="15sp"
android:textStyle="bold"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toTopOf="@+id/spaceDescription"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toEndOf="@id/roomAvatarImageView"
app:layout_constraintStart_toEndOf="@id/spaceAvatarImageView"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="@sample/matrix.json/data/displayName" />
<TextView
android:id="@+id/roomDescription"
android:id="@+id/spaceDescription"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/layout_horizontal_margin"
@ -58,10 +56,13 @@
android:maxLines="1"
android:textColor="?riotx_text_secondary"
android:textSize="15sp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/roomAvatarImageView"
app:layout_constraintTop_toBottomOf="@+id/roomNameView"
tools:text="@sample/matrix.json/data/message" />
app:layout_constraintStart_toEndOf="@id/spaceAvatarImageView"
app:layout_constraintTop_toBottomOf="@+id/spaceNameView"
tools:text="@sample/matrix.json/data/message"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
@ -88,15 +89,17 @@
app:tint="?attr/riotx_text_primary"
app:titleTextColor="?attr/riotx_text_primary" />
<!-- Only visible when in developer mode -->
<im.vector.app.core.ui.views.BottomSheetActionButton
android:id="@+id/spaceSettings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:actionTitle="@string/settings"
app:leftIcon="@drawable/ic_settings_root_general"
app:tint="?attr/riotx_text_primary"
app:titleTextColor="?attr/riotx_text_primary" />
app:titleTextColor="?attr/riotx_text_primary"
tools:visibility="visible" />
<im.vector.app.core.ui.views.BottomSheetActionButton
android:id="@+id/exploreRooms"

View File

@ -17,17 +17,18 @@
<FrameLayout
android:id="@+id/buttonBar"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="?riotx_background"
android:elevation="2dp"
app:layout_constraintBottom_toBottomOf="parent">
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<com.google.android.material.button.MaterialButton
android:id="@+id/nextButton"
style="@style/VectorButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginStart="14dp"
android:layout_marginEnd="14dp"
android:layout_marginBottom="16dp"

View File

@ -3295,6 +3295,7 @@
<!-- First one is the space name, and the second one is the matrix.to link -->
<string name="share_space_link_message">Join my space %1$s %2$s</string>
<string name="skip_for_now">Skip for now</string>
<string name="create_space">Create Space</string>
<string name="join_space">Join Space</string>
<string name="join_anyway">Join Anyway</string>
<string name="room_alias_preview_not_found">This alias is not accessible at this time.\nTry again later, or ask a room admin to check if you have access.</string>