mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +01:00
Tables work
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
This commit is contained in:
parent
39b7931534
commit
62d9a47c37
@ -291,6 +291,7 @@ dependencies {
|
|||||||
implementation "io.noties.markwon:core:$markwonVersion"
|
implementation "io.noties.markwon:core:$markwonVersion"
|
||||||
implementation "io.noties.markwon:ext-strikethrough:$markwonVersion"
|
implementation "io.noties.markwon:ext-strikethrough:$markwonVersion"
|
||||||
implementation "io.noties.markwon:ext-tasklist:$markwonVersion"
|
implementation "io.noties.markwon:ext-tasklist:$markwonVersion"
|
||||||
|
implementation "io.noties.markwon:ext-tables:$markwonVersion"
|
||||||
|
|
||||||
implementation 'com.github.nextcloud-deps:ImagePicker:2.1.0.2'
|
implementation 'com.github.nextcloud-deps:ImagePicker:2.1.0.2'
|
||||||
implementation 'io.github.elye:loaderviewlibrary:3.0.0'
|
implementation 'io.github.elye:loaderviewlibrary:3.0.0'
|
||||||
|
@ -18,6 +18,7 @@ import androidx.core.content.ContextCompat
|
|||||||
import androidx.core.text.toSpanned
|
import androidx.core.text.toSpanned
|
||||||
import autodagger.AutoInjector
|
import autodagger.AutoInjector
|
||||||
import coil.load
|
import coil.load
|
||||||
|
import com.google.android.flexbox.FlexboxLayout
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import com.nextcloud.talk.R
|
import com.nextcloud.talk.R
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||||
@ -103,10 +104,33 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) :
|
|||||||
true,
|
true,
|
||||||
viewThemeUtils
|
viewThemeUtils
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val spansFromString: Array<Any> = processedMessageText!!.getSpans(
|
||||||
|
0,
|
||||||
|
processedMessageText.length,
|
||||||
|
Any::class.java
|
||||||
|
)
|
||||||
|
|
||||||
|
if (spansFromString.isNotEmpty()) {
|
||||||
|
binding.bubble.layoutParams.apply {
|
||||||
|
width = FlexboxLayout.LayoutParams.MATCH_PARENT
|
||||||
|
}
|
||||||
|
binding.messageText.layoutParams.apply {
|
||||||
|
width = FlexboxLayout.LayoutParams.MATCH_PARENT
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
binding.bubble.layoutParams.apply {
|
||||||
|
width = FlexboxLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
}
|
||||||
|
binding.messageText.layoutParams.apply {
|
||||||
|
width = FlexboxLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
processedMessageText = messageUtils.processMessageParameters(
|
processedMessageText = messageUtils.processMessageParameters(
|
||||||
binding.messageText.context,
|
binding.messageText.context,
|
||||||
viewThemeUtils,
|
viewThemeUtils,
|
||||||
processedMessageText!!,
|
processedMessageText,
|
||||||
message,
|
message,
|
||||||
itemView
|
itemView
|
||||||
)
|
)
|
||||||
|
@ -116,10 +116,33 @@ class OutcomingTextMessageViewHolder(itemView: View) :
|
|||||||
false,
|
false,
|
||||||
viewThemeUtils
|
viewThemeUtils
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val spansFromString: Array<Any> = processedMessageText!!.getSpans(
|
||||||
|
0,
|
||||||
|
processedMessageText.length,
|
||||||
|
Any::class.java
|
||||||
|
)
|
||||||
|
|
||||||
|
if (spansFromString.isNotEmpty()) {
|
||||||
|
binding.bubble.layoutParams.apply {
|
||||||
|
width = FlexboxLayout.LayoutParams.MATCH_PARENT
|
||||||
|
}
|
||||||
|
binding.messageText.layoutParams.apply {
|
||||||
|
width = FlexboxLayout.LayoutParams.MATCH_PARENT
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
binding.bubble.layoutParams.apply {
|
||||||
|
width = FlexboxLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
}
|
||||||
|
binding.messageText.layoutParams.apply {
|
||||||
|
width = FlexboxLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
processedMessageText = messageUtils.processMessageParameters(
|
processedMessageText = messageUtils.processMessageParameters(
|
||||||
binding.messageText.context,
|
binding.messageText.context,
|
||||||
viewThemeUtils,
|
viewThemeUtils,
|
||||||
processedMessageText!!,
|
processedMessageText,
|
||||||
message,
|
message,
|
||||||
itemView
|
itemView
|
||||||
)
|
)
|
||||||
|
@ -230,6 +230,7 @@ import java.util.concurrent.ExecutionException
|
|||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
|
@Suppress("TooManyFunctions")
|
||||||
@AutoInjector(NextcloudTalkApplication::class)
|
@AutoInjector(NextcloudTalkApplication::class)
|
||||||
class ChatActivity :
|
class ChatActivity :
|
||||||
BaseActivity(),
|
BaseActivity(),
|
||||||
@ -989,8 +990,10 @@ class ChatActivity :
|
|||||||
val newString = state.messageEdited.ocs?.data?.parentMessage?.message ?: "(null)"
|
val newString = state.messageEdited.ocs?.data?.parentMessage?.message ?: "(null)"
|
||||||
val id = state.messageEdited.ocs?.data?.parentMessage?.id.toString()
|
val id = state.messageEdited.ocs?.data?.parentMessage?.id.toString()
|
||||||
val index = adapter?.getMessagePositionById(id) ?: 0
|
val index = adapter?.getMessagePositionById(id) ?: 0
|
||||||
val message = adapter?.items?.get(index)?.item as ChatMessage
|
val item = adapter?.items?.get(index)?.item
|
||||||
setMessageAsEdited(message, newString)
|
item?.let {
|
||||||
|
setMessageAsEdited(item as ChatMessage, newString)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
is MessageInputViewModel.EditMessageErrorState -> {
|
is MessageInputViewModel.EditMessageErrorState -> {
|
||||||
|
@ -25,6 +25,7 @@ import io.noties.markwon.Markwon
|
|||||||
import io.noties.markwon.MarkwonConfiguration
|
import io.noties.markwon.MarkwonConfiguration
|
||||||
import io.noties.markwon.core.MarkwonTheme
|
import io.noties.markwon.core.MarkwonTheme
|
||||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin
|
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin
|
||||||
|
import io.noties.markwon.ext.tables.TablePlugin
|
||||||
import io.noties.markwon.ext.tasklist.TaskListDrawable
|
import io.noties.markwon.ext.tasklist.TaskListDrawable
|
||||||
import io.noties.markwon.ext.tasklist.TaskListPlugin
|
import io.noties.markwon.ext.tasklist.TaskListPlugin
|
||||||
|
|
||||||
@ -195,6 +196,7 @@ class MessageUtils(val context: Context) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.usePlugin(TaskListPlugin.create(drawable))
|
.usePlugin(TaskListPlugin.create(drawable))
|
||||||
|
.usePlugin(TablePlugin.create { _ -> })
|
||||||
.usePlugin(StrikethroughPlugin.create()).build()
|
.usePlugin(StrikethroughPlugin.create()).build()
|
||||||
return markwon.toMarkdown(markdown)
|
return markwon.toMarkdown(markdown)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user