Merge pull request #2524 from vector-im/feature/bma/fix_rtl

Fix rtl
This commit is contained in:
Benoit Marty 2020-12-11 14:06:33 +01:00 committed by GitHub
commit 68a5ba9a01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 144 additions and 141 deletions

View File

@ -165,7 +165,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import kotlinx.android.parcel.Parcelize import kotlinx.android.parcel.Parcelize
import kotlinx.android.synthetic.main.fragment_room_detail.* import kotlinx.android.synthetic.main.fragment_room_detail.*
import kotlinx.android.synthetic.main.merge_composer_layout.view.* import kotlinx.android.synthetic.main.composer_layout.view.*
import kotlinx.android.synthetic.main.merge_overlay_waiting_view.* import kotlinx.android.synthetic.main.merge_overlay_waiting_view.*
import org.billcarsonfr.jsonviewer.JSonViewerDialog import org.billcarsonfr.jsonviewer.JSonViewerDialog
import org.commonmark.parser.Parser import org.commonmark.parser.Parser

View File

@ -36,7 +36,7 @@ import androidx.transition.TransitionSet
import butterknife.BindView import butterknife.BindView
import butterknife.ButterKnife import butterknife.ButterKnife
import im.vector.app.R import im.vector.app.R
import kotlinx.android.synthetic.main.merge_composer_layout.view.* import kotlinx.android.synthetic.main.composer_layout.view.*
import org.matrix.android.sdk.api.crypto.RoomEncryptionTrustLevel import org.matrix.android.sdk.api.crypto.RoomEncryptionTrustLevel
/** /**
@ -86,7 +86,7 @@ class TextComposerView @JvmOverloads constructor(context: Context, attrs: Attrib
get() = composerEditText.text get() = composerEditText.text
init { init {
inflate(context, R.layout.merge_composer_layout, this) inflate(context, R.layout.composer_layout, this)
ButterKnife.bind(this) ButterKnife.bind(this)
collapse(false) collapse(false)
composerEditText.callback = object : ComposerEditText.Callback { composerEditText.callback = object : ComposerEditText.Callback {
@ -110,20 +110,20 @@ class TextComposerView @JvmOverloads constructor(context: Context, attrs: Attrib
} }
fun collapse(animate: Boolean = true, transitionComplete: (() -> Unit)? = null) { fun collapse(animate: Boolean = true, transitionComplete: (() -> Unit)? = null) {
if (currentConstraintSetId == R.layout.constraint_set_composer_layout_compact) { if (currentConstraintSetId == R.layout.composer_layout_constraint_set_compact) {
// ignore we good // ignore we good
return return
} }
currentConstraintSetId = R.layout.constraint_set_composer_layout_compact currentConstraintSetId = R.layout.composer_layout_constraint_set_compact
applyNewConstraintSet(animate, transitionComplete) applyNewConstraintSet(animate, transitionComplete)
} }
fun expand(animate: Boolean = true, transitionComplete: (() -> Unit)? = null) { fun expand(animate: Boolean = true, transitionComplete: (() -> Unit)? = null) {
if (currentConstraintSetId == R.layout.constraint_set_composer_layout_expanded) { if (currentConstraintSetId == R.layout.composer_layout_constraint_set_expanded) {
// ignore we good // ignore we good
return return
} }
currentConstraintSetId = R.layout.constraint_set_composer_layout_expanded currentConstraintSetId = R.layout.composer_layout_constraint_set_expanded
applyNewConstraintSet(animate, transitionComplete) applyNewConstraintSet(animate, transitionComplete)
} }

View File

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item> <item
android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp">
<shape android:shape="oval"> <shape android:shape="oval">
<solid android:color="@color/riotx_accent" /> <solid android:color="@color/riotx_accent" />
</shape> </shape>

View File

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:constraintSet="@layout/constraint_set_composer_layout_compact" tools:constraintSet="@layout/composer_layout_constraint_set_compact"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout"> tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<!-- ======================== <!-- ========================
@ -12,7 +12,7 @@
/!\ These 3 files must be modified to stay coherent! /!\ These 3 files must be modified to stay coherent!
======================== --> ======================== -->
<View <View
android:id="@+id/related_message_backround" android:id="@+id/related_message_background"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:background="?riotx_bottom_nav_background_color" android:background="?riotx_bottom_nav_background_color"
@ -39,13 +39,6 @@
tools:ignore="MissingConstraints" tools:ignore="MissingConstraints"
tools:src="@tools:sample/avatars" /> tools:src="@tools:sample/avatars" />
<ImageView
android:id="@+id/composer_shield"
android:layout_width="0dp"
android:layout_height="0dp"
tools:ignore="MissingConstraints"
tools:src="@drawable/ic_shield_black" />
<TextView <TextView
android:id="@+id/composer_related_message_sender" android:id="@+id/composer_related_message_sender"
android:layout_width="0dp" android:layout_width="0dp"
@ -83,23 +76,6 @@
android:tint="@color/riotx_notice" android:tint="@color/riotx_notice"
tools:ignore="MissingConstraints" /> tools:ignore="MissingConstraints" />
<ImageButton
android:id="@+id/composer_emoji"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/ic_insert_emoji"
tools:ignore="MissingConstraints" />
<ImageButton
android:id="@+id/attachmentButton"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/option_send_files"
android:src="@drawable/ic_attachment"
tools:ignore="MissingConstraints" />
<androidx.constraintlayout.widget.Barrier <androidx.constraintlayout.widget.Barrier
android:id="@+id/composer_preview_barrier" android:id="@+id/composer_preview_barrier"
android:layout_width="0dp" android:layout_width="0dp"
@ -111,14 +87,21 @@
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent" />
<ImageButton <ImageButton
android:id="@+id/sendButton" android:id="@+id/attachmentButton"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:background="@drawable/bg_send" android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/send" android:contentDescription="@string/option_send_files"
android:src="@drawable/ic_send" android:src="@drawable/ic_attachment"
tools:ignore="MissingConstraints" /> tools:ignore="MissingConstraints" />
<ImageView
android:id="@+id/composer_shield"
android:layout_width="0dp"
android:layout_height="0dp"
tools:ignore="MissingConstraints"
tools:src="@drawable/ic_shield_black" />
<im.vector.app.features.home.room.detail.composer.ComposerEditText <im.vector.app.features.home.room.detail.composer.ComposerEditText
android:id="@+id/composerEditText" android:id="@+id/composerEditText"
style="@style/ComposerEditTextStyle" style="@style/ComposerEditTextStyle"
@ -129,4 +112,21 @@
tools:hint="@string/room_message_placeholder_not_encrypted" tools:hint="@string/room_message_placeholder_not_encrypted"
tools:ignore="MissingConstraints" /> tools:ignore="MissingConstraints" />
<ImageButton
android:id="@+id/composer_emoji"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/ic_insert_emoji"
tools:ignore="MissingConstraints" />
<ImageButton
android:id="@+id/sendButton"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@drawable/bg_send"
android:contentDescription="@string/send"
android:src="@drawable/ic_send"
tools:ignore="MissingConstraints" />
</merge> </merge>

View File

@ -10,7 +10,7 @@
app:layout_constraintStart_toStartOf="parent"> app:layout_constraintStart_toStartOf="parent">
<View <View
android:id="@+id/related_message_backround" android:id="@+id/related_message_background"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:background="?riotx_bottom_nav_background_color" android:background="?riotx_bottom_nav_background_color"
@ -95,44 +95,6 @@
tools:ignore="MissingPrefix" tools:ignore="MissingPrefix"
tools:visibility="visible" /> tools:visibility="visible" />
<ImageButton
android:id="@+id/attachmentButton"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_margin="12dp"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/ic_attachment"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/composer_shield"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="MissingPrefix" />
<ImageView
android:id="@+id/composer_shield"
android:layout_width="16dp"
android:layout_height="16dp"
app:layout_constraintBottom_toBottomOf="@id/attachmentButton"
app:layout_constraintEnd_toStartOf="@+id/attachmentButton"
app:layout_constraintStart_toEndOf="@+id/attachmentButton"
app:layout_constraintTop_toTopOf="@id/attachmentButton"
tools:src="@drawable/ic_shield_black"
tools:visibility="visible" />
<ImageButton
android:id="@+id/composer_emoji"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/ic_insert_emoji"
app:layout_constraintBottom_toBottomOf="@id/sendButton"
app:layout_constraintEnd_toStartOf="@+id/sendButton"
app:layout_constraintStart_toEndOf="@id/composerEditText"
app:layout_constraintTop_toTopOf="@id/sendButton"
app:layout_goneMarginEnd="8dp" />
<androidx.constraintlayout.widget.Barrier <androidx.constraintlayout.widget.Barrier
android:id="@+id/composer_preview_barrier" android:id="@+id/composer_preview_barrier"
android:layout_width="0dp" android:layout_width="0dp"
@ -144,18 +106,29 @@
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent" />
<ImageButton <ImageButton
android:id="@+id/sendButton" android:id="@+id/attachmentButton"
android:layout_width="36dp" android:layout_width="52dp"
android:layout_height="36dp" android:layout_height="52dp"
android:layout_marginEnd="12dp" android:layout_margin="1dp"
android:layout_marginBottom="10dp" android:background="?android:attr/selectableItemBackground"
android:background="@drawable/bg_send" android:src="@drawable/ic_attachment"
android:src="@drawable/ic_send" app:layout_constraintBottom_toBottomOf="@id/sendButton"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@+id/composer_shield"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintStart_toEndOf="@id/composer_emoji" app:layout_constraintTop_toTopOf="@id/sendButton"
tools:ignore="MissingPrefix" /> tools:ignore="MissingPrefix" />
<ImageView
android:id="@+id/composer_shield"
android:layout_width="16dp"
android:layout_height="16dp"
app:layout_constraintBottom_toBottomOf="@id/sendButton"
app:layout_constraintEnd_toStartOf="@+id/composerEditText"
app:layout_constraintStart_toEndOf="@+id/attachmentButton"
app:layout_constraintTop_toTopOf="@id/sendButton"
tools:src="@drawable/ic_shield_black"
tools:visibility="visible" />
<im.vector.app.features.home.room.detail.composer.ComposerEditText <im.vector.app.features.home.room.detail.composer.ComposerEditText
android:id="@+id/composerEditText" android:id="@+id/composerEditText"
style="@style/ComposerEditTextStyle" style="@style/ComposerEditTextStyle"
@ -170,4 +143,30 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="@tools:sample/lorem/random" /> tools:text="@tools:sample/lorem/random" />
<ImageButton
android:id="@+id/composer_emoji"
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_margin="1dp"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/ic_insert_emoji"
app:layout_constraintBottom_toBottomOf="@id/sendButton"
app:layout_constraintEnd_toStartOf="@+id/sendButton"
app:layout_constraintStart_toEndOf="@id/composerEditText"
app:layout_constraintTop_toTopOf="@id/sendButton"
app:layout_goneMarginEnd="8dp" />
<ImageButton
android:id="@+id/sendButton"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_marginEnd="2dp"
android:background="@drawable/bg_send"
android:scaleType="center"
android:src="@drawable/ic_send"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/composer_emoji"
tools:ignore="MissingPrefix" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -10,7 +10,7 @@
app:layout_constraintStart_toStartOf="parent"> app:layout_constraintStart_toStartOf="parent">
<View <View
android:id="@+id/related_message_backround" android:id="@+id/related_message_background"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:background="?riotx_bottom_nav_background_color" android:background="?riotx_bottom_nav_background_color"
@ -22,18 +22,18 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="1dp" android:layout_height="1dp"
android:background="?riotx_bottom_nav_background_border_color" android:background="?riotx_bottom_nav_background_border_color"
app:layout_constraintEnd_toEndOf="@id/related_message_backround" app:layout_constraintEnd_toEndOf="@id/related_message_background"
app:layout_constraintStart_toStartOf="@+id/related_message_backround" app:layout_constraintStart_toStartOf="@+id/related_message_background"
app:layout_constraintTop_toTopOf="@id/related_message_backround" /> app:layout_constraintTop_toTopOf="@id/related_message_background" />
<View <View
android:id="@+id/related_message_background_bottom_separator" android:id="@+id/related_message_background_bottom_separator"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="1dp" android:layout_height="1dp"
android:background="?riotx_bottom_nav_background_border_color" android:background="?riotx_bottom_nav_background_border_color"
app:layout_constraintBottom_toBottomOf="@id/related_message_backround" app:layout_constraintBottom_toBottomOf="@id/related_message_background"
app:layout_constraintEnd_toEndOf="@id/related_message_backround" app:layout_constraintEnd_toEndOf="@id/related_message_background"
app:layout_constraintStart_toStartOf="@+id/related_message_backround" /> app:layout_constraintStart_toStartOf="@+id/related_message_background" />
<ImageView <ImageView
android:id="@+id/composer_related_message_avatar_view" android:id="@+id/composer_related_message_avatar_view"
@ -100,41 +100,6 @@
app:tint="@color/riotx_notice" app:tint="@color/riotx_notice"
tools:ignore="MissingPrefix" /> tools:ignore="MissingPrefix" />
<ImageButton
android:id="@+id/attachmentButton"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/ic_attachment"
app:layout_constraintStart_toStartOf="@id/composerEditText"
app:layout_constraintTop_toBottomOf="parent"
tools:ignore="MissingPrefix" />
<ImageView
android:id="@+id/composer_shield"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_marginStart="8dp"
app:layout_constraintBottom_toBottomOf="@id/composer_emoji"
app:layout_constraintEnd_toStartOf="@+id/composerEditText"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/composer_emoji"
tools:src="@drawable/ic_shield_black" />
<ImageButton
android:id="@+id/composer_emoji"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/ic_insert_emoji"
app:layout_constraintBottom_toBottomOf="@id/sendButton"
app:layout_constraintEnd_toStartOf="@+id/sendButton"
app:layout_constraintStart_toEndOf="@id/composerEditText"
app:layout_constraintTop_toTopOf="@id/sendButton"
app:layout_goneMarginEnd="8dp" />
<androidx.constraintlayout.widget.Barrier <androidx.constraintlayout.widget.Barrier
android:id="@+id/composer_preview_barrier" android:id="@+id/composer_preview_barrier"
android:layout_width="0dp" android:layout_width="0dp"
@ -146,20 +111,28 @@
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent" />
<ImageButton <ImageButton
android:id="@+id/sendButton" android:id="@+id/attachmentButton"
android:layout_width="36dp" android:layout_width="52dp"
android:layout_height="36dp" android:layout_height="52dp"
android:background="@drawable/bg_send" android:layout_margin="1dp"
android:src="@drawable/ic_send" android:background="?android:attr/selectableItemBackground"
android:layout_marginTop="10dp" android:src="@drawable/ic_attachment"
android:layout_marginBottom="10dp" app:layout_constraintBottom_toBottomOf="@+id/sendButton"
android:layout_marginEnd="12dp" app:layout_constraintEnd_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toTopOf="@+id/sendButton"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/composer_preview_barrier"
app:layout_constraintVertical_bias="1"
tools:ignore="MissingPrefix" /> tools:ignore="MissingPrefix" />
<ImageView
android:id="@+id/composer_shield"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_marginStart="8dp"
app:layout_constraintBottom_toBottomOf="@+id/sendButton"
app:layout_constraintEnd_toStartOf="@+id/composerEditText"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/sendButton"
tools:src="@drawable/ic_shield_black" />
<im.vector.app.features.home.room.detail.composer.ComposerEditText <im.vector.app.features.home.room.detail.composer.ComposerEditText
android:id="@+id/composerEditText" android:id="@+id/composerEditText"
style="@style/ComposerEditTextStyle" style="@style/ComposerEditTextStyle"
@ -173,4 +146,31 @@
app:layout_constraintTop_toBottomOf="@id/composer_preview_barrier" app:layout_constraintTop_toBottomOf="@id/composer_preview_barrier"
tools:text="@tools:sample/lorem/random" /> tools:text="@tools:sample/lorem/random" />
<ImageButton
android:id="@+id/composer_emoji"
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_margin="1dp"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/ic_insert_emoji"
app:layout_constraintBottom_toBottomOf="@id/sendButton"
app:layout_constraintEnd_toStartOf="@+id/sendButton"
app:layout_constraintStart_toEndOf="@id/composerEditText"
app:layout_constraintTop_toTopOf="@id/sendButton"
app:layout_goneMarginEnd="8dp" />
<ImageButton
android:id="@+id/sendButton"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_marginEnd="2dp"
android:background="@drawable/bg_send"
android:scaleType="center"
android:src="@drawable/ic_send"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/composer_preview_barrier"
app:layout_constraintVertical_bias="1"
tools:ignore="MissingPrefix" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>