Cleanup and fix bugs
This commit is contained in:
parent
7aa4066a25
commit
7c348959cf
|
@ -44,10 +44,9 @@ class AutocompleteCommandPresenter @Inject constructor(context: Context,
|
|||
override fun onQuery(query: CharSequence?) {
|
||||
val data = Command.values()
|
||||
.filter {
|
||||
if (it.isDevCommand && !vectorPreferences.developerMode()) {
|
||||
return@filter false
|
||||
!it.isDevCommand || vectorPreferences.developerMode()
|
||||
}
|
||||
|
||||
.filter {
|
||||
if (query.isNullOrEmpty()) {
|
||||
true
|
||||
} else {
|
||||
|
|
|
@ -74,10 +74,7 @@ abstract class FormEditTextItem : VectorEpoxyModel<FormEditTextItem.Holder>() {
|
|||
holder.textInputLayout.isEnabled = enabled
|
||||
holder.textInputLayout.hint = hint
|
||||
holder.textInputLayout.error = errorMessage
|
||||
|
||||
endIconMode?.let { mode ->
|
||||
holder.textInputLayout.endIconMode = mode
|
||||
}
|
||||
holder.textInputLayout.endIconMode = endIconMode ?: TextInputLayout.END_ICON_NONE
|
||||
|
||||
// Update only if text is different and value is not null
|
||||
holder.textInputEditText.setTextSafe(value)
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
package im.vector.app.features.grouplist
|
||||
|
||||
import android.content.res.ColorStateList
|
||||
import android.content.res.Resources
|
||||
import android.util.TypedValue
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
|
@ -62,12 +60,4 @@ abstract class HomeSpaceSummaryItem : VectorEpoxyModel<HomeSpaceSummaryItem.Hold
|
|||
val rootView by bind<CheckableConstraintLayout>(R.id.itemGroupLayout)
|
||||
val leaveView by bind<ImageView>(R.id.groupTmpLeave)
|
||||
}
|
||||
|
||||
fun dpToPx(resources: Resources, dp: Int): Int {
|
||||
return TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP,
|
||||
dp.toFloat(),
|
||||
resources.displayMetrics
|
||||
).toInt()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,9 @@ class AvatarRenderer @Inject constructor(private val activeSessionHolder: Active
|
|||
fun renderSpace(matrixItem: MatrixItem, imageView: ImageView) {
|
||||
renderSpace(
|
||||
matrixItem,
|
||||
imageView, GlideApp.with(imageView))
|
||||
imageView,
|
||||
GlideApp.with(imageView)
|
||||
)
|
||||
}
|
||||
|
||||
fun clear(imageView: ImageView) {
|
||||
|
|
|
@ -109,13 +109,13 @@ class HomeActivity :
|
|||
|
||||
private val createSpaceResultLauncher = registerStartForActivityResult { activityResult ->
|
||||
if (activityResult.resultCode == Activity.RESULT_OK) {
|
||||
val spaceId = activityResult.data?.extras?.getString(SpaceCreationActivity.RESULT_DATA_CREATED_SPACE_ID)
|
||||
val defaultRoomsId = activityResult.data?.extras?.getString(SpaceCreationActivity.RESULT_DATA_DEFAULT_ROOM_ID)
|
||||
val spaceId = SpaceCreationActivity.getCreatedSpaceId(activityResult.data)
|
||||
val defaultRoomId = SpaceCreationActivity.getDefaultRoomId(activityResult.data)
|
||||
views.drawerLayout.closeDrawer(GravityCompat.START)
|
||||
|
||||
// Here we want to change current space to the newly created one, and then immediately open the default room
|
||||
if (spaceId != null) {
|
||||
navigator.switchToSpace(this, spaceId, defaultRoomsId, true)
|
||||
navigator.switchToSpace(this, spaceId, defaultRoomId, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -252,7 +252,8 @@ class HomeDetailFragment @Inject constructor(
|
|||
}
|
||||
|
||||
private fun onSpaceChange(spaceSummary: RoomSummary?) {
|
||||
spaceSummary?.let {
|
||||
spaceSummary ?: return
|
||||
|
||||
// Use GlideApp with activity context to avoid the glideRequests to be paused
|
||||
if (spaceSummary.roomId == ALL_COMMUNITIES_GROUP_ID) {
|
||||
// Special case
|
||||
|
@ -268,12 +269,11 @@ class HomeDetailFragment @Inject constructor(
|
|||
views.groupToolbarSpaceTitleView.isVisible = false
|
||||
} else {
|
||||
views.groupToolbarAvatarImageView.background = null
|
||||
avatarRenderer.renderSpace(it.toMatrixItem(), views.groupToolbarAvatarImageView, GlideApp.with(requireActivity()))
|
||||
avatarRenderer.renderSpace(spaceSummary.toMatrixItem(), views.groupToolbarAvatarImageView, GlideApp.with(requireActivity()))
|
||||
views.groupToolbarSpaceTitleView.isVisible = true
|
||||
views.groupToolbarSpaceTitleView.text = spaceSummary.displayName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupKeysBackupBanner() {
|
||||
serverBackupStatusViewModel
|
||||
|
|
|
@ -644,9 +644,6 @@ class RoomDetailFragment @Inject constructor(
|
|||
private fun handleSpaceShare() {
|
||||
roomDetailArgs.openShareSpaceForId?.let { spaceId ->
|
||||
ShareSpaceBottomSheet.show(childFragmentManager, spaceId)
|
||||
view?.post {
|
||||
handleChatEffect(ChatEffect.CONFETTI)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,8 @@ class MessageActionsViewModel @AssistedInject constructor(@Assisted
|
|||
setState {
|
||||
copy(actionPermissions = permissions)
|
||||
}
|
||||
}.disposeOnClear()
|
||||
}
|
||||
.disposeOnClear()
|
||||
}
|
||||
|
||||
private fun observeEvent() {
|
||||
|
|
|
@ -27,5 +27,4 @@ sealed class MatrixToAction : VectorViewModelAction {
|
|||
data class JoinRoom(val roomId: String, val viaServers: List<String>?) : MatrixToAction()
|
||||
data class OpenSpace(val spaceID: String) : MatrixToAction()
|
||||
data class OpenRoom(val roomId: String) : MatrixToAction()
|
||||
// data class OpenSpace(val spaceID: String) : MatrixToAction()
|
||||
}
|
||||
|
|
|
@ -287,7 +287,8 @@ class RoomMemberProfileViewModel @AssistedInject constructor(@Assisted private v
|
|||
val roomSummaryLive = room.rx().liveRoomSummary().unwrap()
|
||||
val powerLevelsContentLive = PowerLevelsObservableFactory(room).createObservable()
|
||||
|
||||
powerLevelsContentLive.subscribe {
|
||||
powerLevelsContentLive
|
||||
.subscribe {
|
||||
val powerLevelsHelper = PowerLevelsHelper(it)
|
||||
val permissions = ActionPermissions(
|
||||
canKick = powerLevelsHelper.isUserAbleToKick(session.myUserId),
|
||||
|
@ -296,7 +297,8 @@ class RoomMemberProfileViewModel @AssistedInject constructor(@Assisted private v
|
|||
canEditPowerLevel = powerLevelsHelper.isUserAllowedToSend(session.myUserId, true, EventType.STATE_ROOM_POWER_LEVELS)
|
||||
)
|
||||
setState { copy(powerLevelsContent = it, actionPermissions = permissions) }
|
||||
}.disposeOnClear()
|
||||
}
|
||||
.disposeOnClear()
|
||||
|
||||
roomSummaryLive.execute {
|
||||
copy(isRoomEncrypted = it.invoke()?.isEncrypted == true)
|
||||
|
|
|
@ -72,10 +72,12 @@ class RoomBannedMemberListViewModel @AssistedInject constructor(@Assisted initia
|
|||
|
||||
val powerLevelsContentLive = PowerLevelsObservableFactory(room).createObservable()
|
||||
|
||||
powerLevelsContentLive.subscribe {
|
||||
powerLevelsContentLive
|
||||
.subscribe {
|
||||
val powerLevelsHelper = PowerLevelsHelper(it)
|
||||
setState { copy(canUserBan = powerLevelsHelper.isUserAbleToBan(session.myUserId)) }
|
||||
}.disposeOnClear()
|
||||
}
|
||||
.disposeOnClear()
|
||||
}
|
||||
|
||||
companion object : MvRxViewModelFactory<RoomBannedMemberListViewModel, RoomBannedMemberListViewState> {
|
||||
|
|
|
@ -138,7 +138,8 @@ class RoomMemberListViewModel @AssistedInject constructor(@Assisted initialState
|
|||
setState {
|
||||
copy(actionsPermissions = permissions)
|
||||
}
|
||||
}.disposeOnClear()
|
||||
}
|
||||
.disposeOnClear()
|
||||
}
|
||||
|
||||
private fun observeRoomSummary() {
|
||||
|
|
|
@ -139,15 +139,22 @@ class SpaceCreationActivity : SimpleFragmentActivity(), CreateSpaceViewModel.Fac
|
|||
}
|
||||
|
||||
companion object {
|
||||
|
||||
const val RESULT_DATA_CREATED_SPACE_ID = "RESULT_DATA_CREATED_SPACE_ID"
|
||||
const val RESULT_DATA_DEFAULT_ROOM_ID = "RESULT_DATA_DEFAULT_ROOM_ID"
|
||||
private const val RESULT_DATA_CREATED_SPACE_ID = "RESULT_DATA_CREATED_SPACE_ID"
|
||||
private const val RESULT_DATA_DEFAULT_ROOM_ID = "RESULT_DATA_DEFAULT_ROOM_ID"
|
||||
|
||||
fun newIntent(context: Context): Intent {
|
||||
return Intent(context, SpaceCreationActivity::class.java).apply {
|
||||
// putExtra(MvRx.KEY_ARG, SpaceDirectoryArgs(spaceId))
|
||||
}
|
||||
}
|
||||
|
||||
fun getCreatedSpaceId(data: Intent?): String? {
|
||||
return data?.extras?.getString(RESULT_DATA_CREATED_SPACE_ID)
|
||||
}
|
||||
|
||||
fun getDefaultRoomId(data: Intent?): String? {
|
||||
return data?.extras?.getString(RESULT_DATA_DEFAULT_ROOM_ID)
|
||||
}
|
||||
}
|
||||
|
||||
override fun create(initialState: CreateSpaceState): CreateSpaceViewModel = viewModelFactory.create(initialState)
|
||||
|
|
|
@ -123,9 +123,11 @@ class WidgetViewModel @AssistedInject constructor(@Assisted val initialState: Wi
|
|||
.unwrap()
|
||||
.map {
|
||||
PowerLevelsHelper(it).isUserAllowedToSend(session.myUserId, true, null)
|
||||
}.subscribe {
|
||||
}
|
||||
.subscribe {
|
||||
setState { copy(canManageWidgets = it) }
|
||||
}.disposeOnClear()
|
||||
}
|
||||
.disposeOnClear()
|
||||
}
|
||||
|
||||
private fun observeWidgetIfNeeded() {
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
app:layout_constraintCircleAngle="45"
|
||||
app:layout_constraintCircleRadius="48dp"
|
||||
app:tint="@color/riotx_destructive_accent"
|
||||
tools:ignore="MissingConstraints"
|
||||
tools:ignore="MissingConstraints,MissingPrefix"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
||||
|
@ -55,14 +55,14 @@
|
|||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="?riotx_background"
|
||||
android:contentDescription="@string/a11y_change_avatar"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_camera_plain"
|
||||
android:contentDescription="@string/a11y_change_avatar"
|
||||
app:tint="?riotx_text_secondary"
|
||||
app:layout_constraintCircle="@+id/itemEditableAvatarImageContainer"
|
||||
app:layout_constraintCircleAngle="135"
|
||||
app:layout_constraintCircleRadius="48dp"
|
||||
tools:ignore="MissingConstraints" />
|
||||
app:tint="?riotx_text_secondary"
|
||||
tools:ignore="MissingConstraints,MissingPrefix" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
android:id="@+id/itemRoomLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:foreground="?attr/selectableItemBackground"
|
||||
android:background="?riotx_background">
|
||||
android:background="?riotx_background"
|
||||
android:foreground="?attr/selectableItemBackground">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/roomAvatarContainer"
|
||||
|
@ -95,14 +95,14 @@
|
|||
|
||||
<ProgressBar
|
||||
android:id="@+id/joinSuggestedLoading"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/joinSuggestedRoomButton"
|
||||
app:layout_constraintEnd_toEndOf="@id/joinSuggestedRoomButton"
|
||||
app:layout_constraintStart_toStartOf="@id/joinSuggestedRoomButton"
|
||||
app:layout_constraintTop_toTopOf="@id/joinSuggestedRoomButton" />
|
||||
app:layout_constraintTop_toTopOf="@id/joinSuggestedRoomButton"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/roomBottomBarrier"
|
||||
|
|
Loading…
Reference in New Issue