diff --git a/vector/src/main/java/com/ruesga/rview/widget/ExpandableViewLayout.java b/vector/src/main/java/com/ruesga/rview/widget/ExpandableViewLayout.java
index 5c89f16d2b..6383e569f4 100644
--- a/vector/src/main/java/com/ruesga/rview/widget/ExpandableViewLayout.java
+++ b/vector/src/main/java/com/ruesga/rview/widget/ExpandableViewLayout.java
@@ -33,6 +33,7 @@ public class ExpandableViewLayout extends FrameLayout {
private int mMaxHeight;
private boolean mExpanded;
+ private boolean mAllowExpand;
private View mExpandableControl;
private int mChildViewHeight;
@@ -57,6 +58,8 @@ public class ExpandableViewLayout extends FrameLayout {
mMaxHeight = a.getDimensionPixelSize(attr, mMaxHeight);
} else if (attr == R.styleable.ExpandableViewLayout_expanded) {
mExpanded = a.getBoolean(attr, false);
+ } else if (attr == R.styleable.ExpandableViewLayout_allowExpand) {
+ mAllowExpand = a.getBoolean(attr, false);
}
}
a.recycle();
@@ -73,11 +76,19 @@ public class ExpandableViewLayout extends FrameLayout {
// Obtain the expandable control
mExpandableControl = getChildAt(1);
- mExpandableControl.setOnClickListener(view -> {
- mExpanded = !mExpanded;
- setExpandableControlVisibility();
- requestLayout();
- });
+ if (mAllowExpand) {
+ mExpandableControl.setOnClickListener(view -> {
+ mExpanded = !mExpanded;
+ setExpandableControlVisibility();
+ requestLayout();
+ });
+ }
+ }
+
+ public void setExpanded(Boolean expanded) {
+ mExpanded = expanded;
+ setExpandableControlVisibility();
+ requestLayout();
}
@Override
diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reply/InReplyToView.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reply/InReplyToView.kt
index 68cc753def..bb031949e7 100755
--- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reply/InReplyToView.kt
+++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reply/InReplyToView.kt
@@ -18,6 +18,8 @@
package im.vector.app.features.home.room.detail.timeline.reply
import android.content.Context
+import android.content.res.ColorStateList
+import android.graphics.Color
import android.text.Spanned
import android.text.method.MovementMethod
import android.util.AttributeSet
@@ -28,11 +30,14 @@ import androidx.core.text.PrecomputedTextCompat
import androidx.core.view.isVisible
import androidx.core.widget.TextViewCompat
import im.vector.app.R
+import im.vector.app.core.extensions.tintBackground
import im.vector.app.databinding.ViewInReplyToBinding
import im.vector.app.features.home.room.detail.timeline.TimelineEventController
import im.vector.app.features.home.room.detail.timeline.item.BindingOptions
import im.vector.app.features.home.room.detail.timeline.item.MessageInformationData
+import im.vector.app.features.home.room.detail.timeline.style.TimelineMessageLayout
import im.vector.app.features.home.room.detail.timeline.tools.findPillsAndProcess
+import im.vector.app.features.themes.ThemeUtils
import kotlinx.coroutines.CoroutineScope
import org.matrix.android.sdk.api.extensions.orFalse
import org.matrix.android.sdk.api.session.room.model.message.MessageTextContent
@@ -103,6 +108,7 @@ class InReplyToView @JvmOverloads constructor(
private fun hideViews() {
views.replyMemberNameView.isVisible = false
views.replyTextView.isVisible = false
+ renderFadeOut(null)
}
private fun renderHidden() {
@@ -139,6 +145,7 @@ class InReplyToView @JvmOverloads constructor(
if (state.event.root.isRedacted()) {
renderRedacted()
} else {
+ renderFadeOut(roomInformationData)
when (val content = state.event.getLastMessageContent()) {
is MessageTextContent -> renderTextContent(content, retriever, movementMethod, coroutineScope)
else -> renderFallback(state.event, retriever)
@@ -207,4 +214,36 @@ class InReplyToView @JvmOverloads constructor(
text = message
}
}
+
+ /**
+ * @param informationData The information data of the parent message, for background fade rendering info. Null to force expand to full height.
+ */
+ private fun renderFadeOut(informationData: MessageInformationData?) {
+ if (informationData != null) {
+ views.expandableReplyView.setExpanded(false)
+ val bgColor = when (val layout = informationData.messageLayout) {
+ is TimelineMessageLayout.ScBubble -> {
+ if (informationData.sentByMe && !layout.singleSidedLayout) {
+ ThemeUtils.getColor(context, R.attr.sc_message_bg_outgoing)
+ } else {
+ ThemeUtils.getColor(context, R.attr.sc_message_bg_incoming)
+ }
+ }
+ is TimelineMessageLayout.Bubble -> {
+ if (layout.isPseudoBubble) {
+ 0
+ } else {
+ val backgroundColorAttr = if (informationData.sentByMe) R.attr.vctr_message_bubble_outbound else R.attr.vctr_message_bubble_inbound
+ ThemeUtils.getColor(context, backgroundColorAttr)
+ }
+ }
+ is TimelineMessageLayout.Default -> {
+ ThemeUtils.getColor(context, R.attr.vctr_system)
+ }
+ }
+ views.expandableReplyView.getChildAt(1).tintBackground(bgColor)
+ } else {
+ views.expandableReplyView.setExpanded(true)
+ }
+ }
}
diff --git a/vector/src/main/res/drawable/bg_expandable_edge_shadow.xml b/vector/src/main/res/drawable/bg_expandable_edge_shadow.xml
index f5153b9884..ceb1f862a1 100644
--- a/vector/src/main/res/drawable/bg_expandable_edge_shadow.xml
+++ b/vector/src/main/res/drawable/bg_expandable_edge_shadow.xml
@@ -15,5 +15,5 @@
limitations under the License.
-->
-
-
\ No newline at end of file
+
+
diff --git a/vector/src/main/res/layout/view_in_reply_to.xml b/vector/src/main/res/layout/view_in_reply_to.xml
index 6978818649..95d3e58fa0 100644
--- a/vector/src/main/res/layout/view_in_reply_to.xml
+++ b/vector/src/main/res/layout/view_in_reply_to.xml
@@ -31,22 +31,36 @@
android:textSize="12sp"
tools:text="@sample/users.json/data/displayName" />
-
-
+ android:scrollbars="none"
+ app:expanded="false"
+ app:allowExpand="false"
+ app:maxHeight="64dp">
+
+
+
+
diff --git a/vector/src/main/res/values/expandable_view_layout_attrs.xml b/vector/src/main/res/values/expandable_view_layout_attrs.xml
index b07e8a6615..c5f9fd16aa 100644
--- a/vector/src/main/res/values/expandable_view_layout_attrs.xml
+++ b/vector/src/main/res/values/expandable_view_layout_attrs.xml
@@ -18,5 +18,6 @@
+