mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-27 07:29:48 +01:00
layout changes
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
6995964e5c
commit
ea61e49821
@ -92,6 +92,8 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) :
|
||||
private fun processMessage(message: ChatMessage, hasCheckboxes: Boolean) {
|
||||
var textSize = context.resources!!.getDimension(R.dimen.chat_text_size)
|
||||
if (!hasCheckboxes) {
|
||||
binding.messageText.visibility = View.VISIBLE
|
||||
binding.checkboxContainer.visibility = View.GONE
|
||||
var processedMessageText = messageUtils.enrichChatMessageText(
|
||||
binding.messageText.context,
|
||||
message,
|
||||
@ -121,7 +123,8 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) :
|
||||
binding.messageText.text = processedMessageText
|
||||
|
||||
}else{
|
||||
binding.messageText.text = ""
|
||||
binding.messageText.visibility = View.GONE
|
||||
binding.checkboxContainer.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
if (message.lastEditTimestamp != 0L && !message.isDeleted) {
|
||||
@ -233,7 +236,7 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) :
|
||||
var updatedMessage = originalMessage
|
||||
val regex = """(- \[(X|x| )])\s*(.+)""".toRegex(RegexOption.MULTILINE)
|
||||
|
||||
checkboxes.forEach { checkBox ->
|
||||
checkboxes.forEach { _ ->
|
||||
updatedMessage = regex.replace(updatedMessage) { matchResult ->
|
||||
val taskText = matchResult.groupValues[TASK_TEXT_GROUP_INDEX].trim()
|
||||
val checkboxState = if (checkboxes.find { it.text == taskText }?.isChecked == true) "X" else " "
|
||||
@ -347,6 +350,11 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) :
|
||||
this.commonMessageInterface = commonMessageInterface
|
||||
}
|
||||
|
||||
override fun viewDetached() {
|
||||
super.viewDetached()
|
||||
job?.cancel()
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TEXT_SIZE_MULTIPLIER = 2.5
|
||||
private val TAG = IncomingTextMessageViewHolder::class.java.simpleName
|
||||
@ -355,3 +363,5 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) :
|
||||
private const val AGE_THRESHOLD_FOR_EDIT_MESSAGE: Long = 86400000
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -95,13 +95,16 @@ class OutcomingTextMessageViewHolder(itemView: View) :
|
||||
|
||||
private fun processMessage(message: ChatMessage, hasCheckboxes: Boolean) {
|
||||
var isBubbled = true
|
||||
val layoutParams = binding.messageTime.layoutParams as FlexboxLayout.LayoutParams
|
||||
var textSize = context.resources.getDimension(R.dimen.chat_text_size)
|
||||
if (!hasCheckboxes) {
|
||||
realView.isSelected = false
|
||||
val layoutParams = binding.messageTime.layoutParams as FlexboxLayout.LayoutParams
|
||||
layoutParams.isWrapBefore = false
|
||||
var textSize = context.resources.getDimension(R.dimen.chat_text_size)
|
||||
viewThemeUtils.platform.colorTextView(binding.messageTime, ColorRole.ON_SURFACE_VARIANT)
|
||||
|
||||
binding.messageText.visibility = View.VISIBLE
|
||||
binding.checkboxContainer.visibility = View.GONE
|
||||
|
||||
var processedMessageText = messageUtils.enrichChatMessageText(
|
||||
binding.messageText.context,
|
||||
message,
|
||||
@ -126,15 +129,15 @@ class OutcomingTextMessageViewHolder(itemView: View) :
|
||||
isBubbled = false
|
||||
}
|
||||
|
||||
binding.messageText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize)
|
||||
binding.messageTime.layoutParams = layoutParams
|
||||
viewThemeUtils.platform.colorTextView(binding.messageText, ColorRole.ON_SURFACE_VARIANT)
|
||||
binding.messageText.text = processedMessageText
|
||||
|
||||
}else{
|
||||
binding.messageText.text = ""
|
||||
binding.messageText.visibility = View.GONE
|
||||
binding.checkboxContainer.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
binding.messageText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize)
|
||||
if (message.lastEditTimestamp != 0L && !message.isDeleted) {
|
||||
binding.messageEditIndicator.visibility = View.VISIBLE
|
||||
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.lastEditTimestamp!!)
|
||||
@ -267,7 +270,7 @@ class OutcomingTextMessageViewHolder(itemView: View) :
|
||||
var updatedMessage = originalMessage
|
||||
val regex = """(- \[(X|x| )])\s*(.+)""".toRegex(RegexOption.MULTILINE)
|
||||
|
||||
checkboxes.forEach { checkBox ->
|
||||
checkboxes.forEach { _ ->
|
||||
updatedMessage = regex.replace(updatedMessage) { matchResult ->
|
||||
val taskText = matchResult.groupValues[TASK_TEXT_GROUP_INDEX].trim()
|
||||
val checkboxState = if (checkboxes.find { it.text == taskText }?.isChecked == true) "X" else " "
|
||||
@ -361,6 +364,11 @@ class OutcomingTextMessageViewHolder(itemView: View) :
|
||||
this.commonMessageInterface = commonMessageInterface
|
||||
}
|
||||
|
||||
override fun viewDetached() {
|
||||
super.viewDetached()
|
||||
job?.cancel()
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TEXT_SIZE_MULTIPLIER = 2.5
|
||||
private val TAG = OutcomingTextMessageViewHolder::class.java.simpleName
|
||||
|
@ -67,11 +67,12 @@
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/checkboxContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_below="@id/messageText">
|
||||
|
||||
android:layout_below="@id/messageText"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:visibility="gone">
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
@ -84,9 +85,8 @@
|
||||
android:textColor="@color/no_emphasis_text"
|
||||
android:textIsSelectable="false"
|
||||
android:gravity="end"
|
||||
app:layout_alignSelf="center"
|
||||
app:layout_flexGrow="1"
|
||||
app:layout_alignSelf="flex_end"
|
||||
app:layout_flexGrow="1"
|
||||
app:layout_wrapBefore="false"
|
||||
tools:text="12:38" />
|
||||
|
||||
|
@ -41,15 +41,17 @@
|
||||
android:textAlignment="viewStart"
|
||||
android:textColorHighlight="@color/nc_grey"
|
||||
android:textIsSelectable="false"
|
||||
app:layout_alignSelf="flex_start"
|
||||
app:layout_flexGrow="1"
|
||||
tools:text="Talk to you later!" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/checkboxContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_below="@id/messageText"
|
||||
android:layout_marginTop="8dp"
|
||||
android:visibility="gone">
|
||||
|
||||
</LinearLayout>
|
||||
@ -65,7 +67,6 @@
|
||||
android:textColor="@color/no_emphasis_text"
|
||||
android:textIsSelectable="false"
|
||||
app:layout_alignSelf="flex_end"
|
||||
android:layout_gravity="end"
|
||||
app:layout_flexGrow="1"
|
||||
app:layout_wrapBefore="false"
|
||||
tools:text="10:35" />
|
||||
@ -79,7 +80,6 @@
|
||||
android:alpha="0.6"
|
||||
android:textColor="@color/no_emphasis_text"
|
||||
android:textIsSelectable="false"
|
||||
android:gravity="end"
|
||||
app:layout_alignSelf="flex_end"
|
||||
android:text = "@string/hint_edited_message"
|
||||
android:textSize="12sp">
|
||||
@ -94,7 +94,6 @@
|
||||
android:layout_marginStart="8dp"
|
||||
android:contentDescription="@null"
|
||||
app:layout_alignSelf="flex_end"
|
||||
android:gravity="end"
|
||||
app:tint="@color/high_emphasis_text"
|
||||
tools:src="@drawable/ic_check_all" />
|
||||
|
||||
@ -105,7 +104,7 @@
|
||||
android:layout_below="@id/messageTime"
|
||||
android:layout_marginStart="8dp"
|
||||
android:contentDescription="@null"
|
||||
app:layout_alignSelf="center"
|
||||
app:layout_alignSelf="flex_end"
|
||||
app:tint="@color/high_emphasis_text"
|
||||
tools:src="@drawable/ic_warning_white"/>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user