SAS: fix issue on emoji rendering

This commit is contained in:
Benoit Marty 2019-06-12 15:43:32 +02:00
parent e17ffc85e7
commit af1a48d918
6 changed files with 36 additions and 18 deletions

View File

@ -62,26 +62,29 @@ class SASVerificationIncomingFragment : VectorBaseFragment() {

viewModel.otherUser?.let {
AvatarRenderer.render(it, avatarImageView)
} ?: run {
// Fallback to what we know
AvatarRenderer.render(null, viewModel.otherUserId ?: "", viewModel.otherUserId, avatarImageView)
}

viewModel.transactionState.observe(this, Observer {
val uxState = (viewModel.transaction as? IncomingSasVerificationTransaction)?.uxState
when (uxState) {
IncomingSasVerificationTransaction.UxState.SHOW_ACCEPT -> {
IncomingSasVerificationTransaction.UxState.SHOW_ACCEPT -> {
viewModel.loadingLiveEvent.value = null
}
IncomingSasVerificationTransaction.UxState.WAIT_FOR_KEY_AGREEMENT -> {
viewModel.loadingLiveEvent.value = R.string.sas_waiting_for_partner
}
IncomingSasVerificationTransaction.UxState.SHOW_SAS -> {
IncomingSasVerificationTransaction.UxState.SHOW_SAS -> {
viewModel.shortCodeReady()
}
IncomingSasVerificationTransaction.UxState.CANCELLED_BY_ME,
IncomingSasVerificationTransaction.UxState.CANCELLED_BY_OTHER -> {
IncomingSasVerificationTransaction.UxState.CANCELLED_BY_OTHER -> {
viewModel.loadingLiveEvent.value = null
viewModel.navigateCancel()
}
else -> Unit
else -> Unit
}
})


View File

@ -2267,6 +2267,10 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref

mSession.getDevicesList(object : MatrixCallback<DevicesListResponse> {
override fun onSuccess(data: DevicesListResponse) {
if (!isAdded) {
return
}

if (data.devices?.isEmpty() == true) {
removeDevicesPreference()
} else {
@ -2275,6 +2279,10 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
}

override fun onFailure(failure: Throwable) {
if (!isAdded) {
return
}

removeDevicesPreference()
onCommonDone(failure.message)
}

View File

@ -54,15 +54,13 @@
tools:text="1234-4320-3905"
tools:visibility="visible" />

<GridLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/sas_emoji_grid"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/layout_vertical_margin"
android:columnCount="@integer/number_of_emoji_per_line"
android:padding="@dimen/layout_vertical_margin"
android:useDefaultMargins="true"
android:visibility="invisible"
app:layout_constrainedWidth="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/sas_emoji_description_2"
@ -96,7 +94,20 @@
android:id="@+id/emoji6"
layout="@layout/item_emoji_verif" />

</GridLayout>
<androidx.constraintlayout.helper.widget.Flow
android:id="@+id/sas_emoji_grid_flow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:constraint_referenced_ids="emoji0,emoji1,emoji2,emoji3,emoji4,emoji5,emoji6"
app:flow_horizontalBias="0.5"
app:flow_horizontalGap="16dp"
app:flow_horizontalStyle="packed"
app:flow_verticalBias="0"
app:flow_verticalGap="8dp"
app:flow_wrapMode="chain"
tools:ignore="MissingConstraints" />

</androidx.constraintlayout.widget.ConstraintLayout>

<com.google.android.material.button.MaterialButton
android:id="@+id/sas_request_continue_button"

View File

@ -13,6 +13,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="@color/black"
android:textSize="40dp"
tools:ignore="SpUsage"
tools:text="🌵" />
@ -23,6 +24,9 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="4dp"
android:gravity="center"
android:minWidth="60sp"
android:textColor="?riotx_text_primary"
tools:text="@string/verification_emoji_cactus" />

</LinearLayout>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<integer name="number_of_emoji_per_line">7</integer>

</resources>

View File

@ -7,6 +7,4 @@

<integer name="splash_animation_velocity">750</integer>

<integer name="number_of_emoji_per_line">4</integer>

</resources>