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