Small cleanup
This commit is contained in:
parent
b888d13e62
commit
ae6de8fdf1
@ -72,7 +72,7 @@
|
||||
android:id="@+id/debug_qr_code"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="200dp"
|
||||
tools:src="@tools:sample/avatars" />
|
||||
tools:src="@drawable/ic_qr_code_add" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -21,7 +21,6 @@ import com.airbnb.epoxy.EpoxyAttribute
|
||||
import com.airbnb.epoxy.EpoxyModelClass
|
||||
import com.google.android.material.checkbox.MaterialCheckBox
|
||||
import im.vector.app.R
|
||||
import kotlinx.android.synthetic.main.vector_preference_push_rule.view.*
|
||||
|
||||
@EpoxyModelClass(layout = R.layout.item_checkbox)
|
||||
abstract class CheckBoxItem : VectorEpoxyModel<CheckBoxItem.Holder>() {
|
||||
|
@ -84,11 +84,11 @@ class CreateDirectRoomActivity : SimpleFragmentActivity(), UserListViewModel.Fac
|
||||
.observe()
|
||||
.subscribe { action ->
|
||||
when (action) {
|
||||
UserListSharedAction.Close -> finish()
|
||||
UserListSharedAction.GoBack -> onBackPressed()
|
||||
UserListSharedAction.Close -> finish()
|
||||
UserListSharedAction.GoBack -> onBackPressed()
|
||||
is UserListSharedAction.OnMenuItemSelected -> onMenuItemSelected(action)
|
||||
UserListSharedAction.OpenPhoneBook -> openPhoneBook()
|
||||
UserListSharedAction.AddByQrCode -> openAddByQrCode()
|
||||
UserListSharedAction.OpenPhoneBook -> openPhoneBook()
|
||||
UserListSharedAction.AddByQrCode -> openAddByQrCode()
|
||||
}.exhaustive
|
||||
}
|
||||
.disposeOnDestroy()
|
||||
|
@ -23,7 +23,7 @@ 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.features.home.AvatarRenderer
|
||||
import kotlinx.android.synthetic.main.fragment_matrix_to_card.*
|
||||
import kotlinx.android.synthetic.main.bottom_sheet_matrix_to_card.*
|
||||
import org.matrix.android.sdk.api.util.MatrixItem
|
||||
import javax.inject.Inject
|
||||
|
||||
@ -41,7 +41,7 @@ class MatrixToBottomSheet(private val matrixItem: MatrixItem) : VectorBaseBottom
|
||||
|
||||
private var interactionListener: InteractionListener? = null
|
||||
|
||||
override fun getLayoutResId() = R.layout.fragment_matrix_to_card
|
||||
override fun getLayoutResId() = R.layout.bottom_sheet_matrix_to_card
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
@ -56,8 +56,6 @@ class MatrixToBottomSheet(private val matrixItem: MatrixItem) : VectorBaseBottom
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val ARGS = "MatrixToFragment.Args"
|
||||
|
||||
fun create(matrixItem: MatrixItem, listener: InteractionListener?): MatrixToBottomSheet {
|
||||
return MatrixToBottomSheet(matrixItem).apply {
|
||||
interactionListener = listener
|
||||
|
@ -102,6 +102,7 @@ class ScanUserCodeFragment @Inject constructor()
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
userCodeScannerView.setResultHandler(null)
|
||||
// Stop camera on pause
|
||||
userCodeScannerView.stopCamera()
|
||||
}
|
||||
|
@ -54,6 +54,5 @@ class ShowUserCodeFragment @Inject constructor(
|
||||
state.shareLink?.let { showUserCodeQRImage.setData(it) }
|
||||
showUserCodeCardNameText.setTextOrHide(state.matrixItem?.displayName)
|
||||
showUserCodeCardUserIdText.setTextOrHide(state.matrixItem?.id)
|
||||
Unit
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ import com.airbnb.mvrx.viewModel
|
||||
import com.airbnb.mvrx.withState
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.di.ScreenComponent
|
||||
import im.vector.app.core.extensions.commitTransaction
|
||||
import im.vector.app.core.extensions.exhaustive
|
||||
import im.vector.app.core.platform.VectorBaseActivity
|
||||
import im.vector.app.features.matrixto.MatrixToBottomSheet
|
||||
@ -66,8 +67,8 @@ class UserCodeActivity
|
||||
|
||||
sharedViewModel.selectSubscribe(this, UserCodeState::mode) { mode ->
|
||||
when (mode) {
|
||||
UserCodeState.Mode.SHOW -> showFragment(ShowUserCodeFragment::class, Bundle.EMPTY)
|
||||
UserCodeState.Mode.SCAN -> showFragment(ScanUserCodeFragment::class, Bundle.EMPTY)
|
||||
UserCodeState.Mode.SHOW -> showFragment(ShowUserCodeFragment::class, Bundle.EMPTY)
|
||||
UserCodeState.Mode.SCAN -> showFragment(ScanUserCodeFragment::class, Bundle.EMPTY)
|
||||
is UserCodeState.Mode.RESULT -> {
|
||||
showFragment(ShowUserCodeFragment::class, Bundle.EMPTY)
|
||||
MatrixToBottomSheet.create(mode.matrixItem, this).show(supportFragmentManager, "MatrixToBottomSheet")
|
||||
@ -77,11 +78,11 @@ class UserCodeActivity
|
||||
|
||||
sharedViewModel.observeViewEvents {
|
||||
when (it) {
|
||||
is UserCodeShareViewEvents.InviteFriend -> TODO()
|
||||
UserCodeShareViewEvents.Dismiss -> ActivityCompat.finishAfterTransition(this)
|
||||
is UserCodeShareViewEvents.InviteFriend -> TODO()
|
||||
UserCodeShareViewEvents.Dismiss -> ActivityCompat.finishAfterTransition(this)
|
||||
UserCodeShareViewEvents.ShowWaitingScreen -> simpleActivityWaitingView.isVisible = true
|
||||
UserCodeShareViewEvents.HideWaitingScreen -> simpleActivityWaitingView.isVisible = false
|
||||
is UserCodeShareViewEvents.ToastMessage -> Toast.makeText(this, it.message, Toast.LENGTH_LONG).show()
|
||||
is UserCodeShareViewEvents.ToastMessage -> Toast.makeText(this, it.message, Toast.LENGTH_LONG).show()
|
||||
is UserCodeShareViewEvents.NavigateToRoom -> navigator.openRoom(this, it.roomId)
|
||||
}.exhaustive
|
||||
}
|
||||
@ -89,14 +90,13 @@ class UserCodeActivity
|
||||
|
||||
private fun showFragment(fragmentClass: KClass<out Fragment>, bundle: Bundle) {
|
||||
if (supportFragmentManager.findFragmentByTag(fragmentClass.simpleName) == null) {
|
||||
supportFragmentManager.beginTransaction().let {
|
||||
it.setCustomAnimations(R.anim.fade_in, R.anim.fade_out, R.anim.fade_in, R.anim.fade_out)
|
||||
it.replace(R.id.simpleFragmentContainer,
|
||||
supportFragmentManager.commitTransaction {
|
||||
setCustomAnimations(R.anim.fade_in, R.anim.fade_out, R.anim.fade_in, R.anim.fade_out)
|
||||
replace(R.id.simpleFragmentContainer,
|
||||
fragmentClass.java,
|
||||
bundle,
|
||||
fragmentClass.simpleName
|
||||
)
|
||||
it.commit()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -110,7 +110,7 @@ class UserCodeActivity
|
||||
UserCodeState.Mode.SHOW -> super.onBackPressed()
|
||||
is UserCodeState.Mode.RESULT,
|
||||
UserCodeState.Mode.SCAN -> sharedViewModel.handle(UserCodeActions.SwitchMode(UserCodeState.Mode.SHOW))
|
||||
}
|
||||
}.exhaustive
|
||||
}
|
||||
|
||||
override fun create(initialState: UserCodeState, args: Args) =
|
||||
|
@ -84,9 +84,9 @@ class UserCodeSharedViewModel @AssistedInject constructor(
|
||||
|
||||
override fun handle(action: UserCodeActions) {
|
||||
when (action) {
|
||||
UserCodeActions.DismissAction -> _viewEvents.post(UserCodeShareViewEvents.Dismiss)
|
||||
is UserCodeActions.SwitchMode -> setState { copy(mode = action.mode) }
|
||||
is UserCodeActions.DecodedQRCode -> handleQrCodeDecoded(action)
|
||||
UserCodeActions.DismissAction -> _viewEvents.post(UserCodeShareViewEvents.Dismiss)
|
||||
is UserCodeActions.SwitchMode -> setState { copy(mode = action.mode) }
|
||||
is UserCodeActions.DecodedQRCode -> handleQrCodeDecoded(action)
|
||||
is UserCodeActions.StartChattingWithUser -> handleStartChatting(action)
|
||||
}
|
||||
}
|
||||
@ -138,9 +138,9 @@ class UserCodeSharedViewModel @AssistedInject constructor(
|
||||
_viewEvents.post(UserCodeShareViewEvents.ShowWaitingScreen)
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
when (linkedId) {
|
||||
is PermalinkData.RoomLink -> TODO()
|
||||
is PermalinkData.UserLink -> {
|
||||
var user = session.getUser(linkedId.userId) ?: awaitCallback<List<User>> {
|
||||
is PermalinkData.RoomLink -> TODO()
|
||||
is PermalinkData.UserLink -> {
|
||||
val user = session.getUser(linkedId.userId) ?: awaitCallback<List<User>> {
|
||||
session.searchUsersDirectory(linkedId.userId, 10, emptySet(), it)
|
||||
}.firstOrNull { it.userId == linkedId.userId }
|
||||
// Create raw Uxid in case the user is not searchable
|
||||
@ -152,7 +152,7 @@ class UserCodeSharedViewModel @AssistedInject constructor(
|
||||
)
|
||||
}
|
||||
}
|
||||
is PermalinkData.GroupLink -> TODO()
|
||||
is PermalinkData.GroupLink -> TODO()
|
||||
is PermalinkData.FallbackLink -> TODO()
|
||||
}
|
||||
_viewEvents.post(UserCodeShareViewEvents.HideWaitingScreen)
|
||||
|
@ -10,7 +10,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<RelativeLayout
|
||||
<FrameLayout
|
||||
android:id="@+id/simpleActivityWaitingView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@ -22,12 +22,9 @@
|
||||
tools:visibility="visible">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/waiting_view_status_circular_progress"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_gravity="center_vertical" />
|
||||
android:layout_height="40dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -1,12 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/matrixToCardAvatar"
|
||||
android:layout_width="60dp"
|
||||
@ -63,8 +61,6 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/matrixToCardUserIdText"
|
||||
app:layout_constraintVertical_bias="0" />
|
||||
|
||||
app:layout_constraintTop_toBottomOf="@id/matrixToCardUserIdText" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -11,6 +11,6 @@
|
||||
android:layout_height="300dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:contentDescription="@string/a11y_qr_code_for_verification"
|
||||
tools:src="@color/riotx_header_panel_background_black" />
|
||||
tools:src="@drawable/ic_qr_code_add" />
|
||||
|
||||
</FrameLayout>
|
||||
|
@ -93,7 +93,6 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/homeDrawerUsernameView" />
|
||||
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/homeDrawerInviteFriendButton"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
@ -121,7 +120,6 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/homeDrawerUserIdView" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
|
@ -48,4 +48,5 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/userCodeMyCodeButton"
|
||||
app:layout_constraintTop_toTopOf="@id/userCodeMyCodeButton" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<ScrollView 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"
|
||||
@ -59,11 +58,11 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/showUserCodeAvatar"
|
||||
android:transitionName="profile"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginStart="@dimen/layout_horizontal_margin"
|
||||
android:elevation="4dp"
|
||||
android:transitionName="profile"
|
||||
app:layout_constraintBottom_toBottomOf="@id/showUserCodeCardTopBarrier"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@ -150,7 +149,6 @@
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/showUserCodeInfoText"
|
||||
android:layout_width="0dp"
|
||||
@ -180,4 +178,5 @@
|
||||
app:layout_constraintVertical_bias="0" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</ScrollView>
|
@ -1,13 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.checkbox.MaterialCheckBox 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/checkbox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/layout_horizontal_margin"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="@dimen/layout_horizontal_margin"
|
||||
android:text="@string/matrix_only_filter"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/phoneBookFilterContainer" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/phoneBookFilterContainer"
|
||||
tools:text="@string/matrix_only_filter" />
|
@ -11,6 +11,6 @@
|
||||
android:layout_height="200dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:contentDescription="@string/a11y_qr_code_for_verification"
|
||||
tools:src="@color/riotx_header_panel_background_black" />
|
||||
tools:src="@drawable/ic_qr_code_add" />
|
||||
|
||||
</FrameLayout>
|
||||
|
Loading…
x
Reference in New Issue
Block a user