mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-15 18:20:14 +00:00
Moved into libsession for ease of access to control message view creation
This commit is contained in:
@@ -227,7 +227,6 @@ dependencies {
|
||||
ksp("com.google.dagger:hilt-compiler:$daggerHiltVersion")
|
||||
ksp("com.github.bumptech.glide:ksp:$glideVersion")
|
||||
|
||||
implementation 'androidx.compose.material3:material3-android:1.2.1'
|
||||
implementation("com.google.dagger:hilt-android:$daggerHiltVersion")
|
||||
implementation "androidx.appcompat:appcompat:$appcompatVersion"
|
||||
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
||||
|
@@ -1072,24 +1072,6 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
updateUnreadCountIndicator()
|
||||
}
|
||||
|
||||
// Method that takes a char sequence that contains one or more elements surrounded in bold tags
|
||||
// like "Hello <b>world</b>" and returns a SpannableString that will display the appropriate
|
||||
// elements in bold. If there are no such <b> or </b> elements then the original string is returned
|
||||
// as a SpannableString without any bold highlighting.
|
||||
private fun makeBoldBetweenTags(input: CharSequence): SpannableString {
|
||||
val spannable = SpannableString(input)
|
||||
var startIndex = 0
|
||||
while (true) {
|
||||
startIndex = input.indexOf("<b>", startIndex)
|
||||
if (startIndex == -1) break
|
||||
val endIndex = input.indexOf("</b>", startIndex + 3)
|
||||
if (endIndex == -1) break
|
||||
spannable.setSpan(StyleSpan(Typeface.BOLD),startIndex + 3, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
startIndex = endIndex + 4
|
||||
}
|
||||
return spannable
|
||||
}
|
||||
|
||||
// Update placeholder / control messages in a conversation
|
||||
private fun updatePlaceholder() {
|
||||
val recipient = viewModel.recipient ?: return Log.w("Loki", "recipient was null in placeholder update")
|
||||
@@ -1134,7 +1116,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
binding.placeholderText.isVisible = showPlaceholder
|
||||
if (showPlaceholder) {
|
||||
if (!isNoteToSelf) {
|
||||
binding.placeholderText.text = makeBoldBetweenTags(txtCS)
|
||||
binding.placeholderText.text = org.session.libsession.utilities.Util.makeBoldBetweenTags(txtCS)
|
||||
} else {
|
||||
binding.placeholderText.text = txtCS
|
||||
}
|
||||
|
@@ -1,9 +1,13 @@
|
||||
package org.thoughtcrime.securesms.conversation.v2.utilities
|
||||
|
||||
import android.graphics.Rect
|
||||
import android.graphics.Typeface
|
||||
import android.text.Layout
|
||||
import android.text.SpannableString
|
||||
import android.text.Spanned
|
||||
import android.text.StaticLayout
|
||||
import android.text.TextPaint
|
||||
import android.text.style.StyleSpan
|
||||
import android.view.MotionEvent
|
||||
import android.widget.TextView
|
||||
import androidx.core.text.getSpans
|
||||
|
@@ -78,7 +78,7 @@ class SaveAttachmentTask @JvmOverloads constructor(context: Context, count: Int
|
||||
// for unknown reasons it provides us with an empty filename when saving files.
|
||||
// TODO: Further investigation into root cause and fix!
|
||||
if (fileName.isNullOrEmpty()) fileName = generateOutputFileName(contentType, attachment.date)
|
||||
|
||||
|
||||
fileName = sanitizeOutputFileName(fileName)
|
||||
val outputUri: Uri = getMediaStoreContentUriForType(contentType)
|
||||
val mediaUri = createOutputUri(context, outputUri, contentType, fileName)
|
||||
|
Reference in New Issue
Block a user