[merge] Further merge fixups

Change-Id: I8edf4ac5b67865843a8e3fb28146ba62195bb812
This commit is contained in:
SpiritCroc 2022-01-29 15:56:13 +01:00
parent 7b9da40e52
commit 45a5b8ca94
9 changed files with 41 additions and 30 deletions

View File

@ -16,7 +16,23 @@
package im.vector.lib.core.utils.epoxy.charsequence
import android.text.TextUtils
/**
* Extensions to wrap CharSequence to EpoxyCharSequence
*/
fun CharSequence.toEpoxyCharSequence() = EpoxyCharSequence(this)
fun CharSequence.toMessageTextEpoxyCharSequence(): EpoxyCharSequence {
var m = this
if (m.isNotEmpty()) {
// Remove last trailing newline: looks especially bad in message bubble
if (m.last() == '\n') {
m = m.subSequence(0, m.length-1)
}
// Add a narrow non-breakable space to work around wrap_content cutting italic text | https://stackoverflow.com/questions/4353836/italic-textview-with-wrap-contents-seems-to-clip-the-text-at-right-edge
// (interestingly, this seems to be only relevant for the last character even for multi-line messages)
m = TextUtils.concat(m, "\u202f")
}
return m.toEpoxyCharSequence()
}

View File

@ -49,7 +49,7 @@ import java.util.concurrent.atomic.AtomicReference
internal class DefaultTimeline(private val roomId: String,
private val initialEventId: String?,
private val initialEventIdOffset: Int = 0,
private var initialEventIdOffset: Int = 0,
private val realmConfiguration: RealmConfiguration,
private val loadRoomMembersTask: LoadRoomMembersTask,
private val readReceiptHandler: ReadReceiptHandler,
@ -356,8 +356,16 @@ internal class DefaultTimeline(private val roomId: String,
return initialEventId
}
override fun setInitialEventId(eventId: String?) {
// SC-TODO?? -- just changing initialEventId to var is not enough, we get duplicated timelines :O
//initialEventId = eventId
}
override fun getInitialEventIdOffset(): Int {
return initialEventIdOffset
}
override fun setInitialEventIdOffset(offset: Int) {
initialEventIdOffset = offset
}
}

View File

@ -28,6 +28,7 @@ import im.vector.app.features.home.room.detail.timeline.item.MessageTextItem_
import im.vector.app.features.home.room.detail.timeline.tools.createLinkMovementMethod
import im.vector.app.features.settings.VectorPreferences
import im.vector.lib.core.utils.epoxy.charsequence.toEpoxyCharSequence
import im.vector.lib.core.utils.epoxy.charsequence.toMessageTextEpoxyCharSequence
import me.gujun.android.span.image
import me.gujun.android.span.span
import org.matrix.android.sdk.api.session.crypto.MXCryptoError
@ -111,7 +112,7 @@ class EncryptedItemFactory @Inject constructor(private val messageInformationDat
.leftGuideline(avatarSizeProvider.leftGuideline)
.highlighted(params.isHighlighted)
.attributes(attributes)
.message(spannableStr.toEpoxyCharSequence())
.message(spannableStr.toMessageTextEpoxyCharSequence())
.movementMethod(createLinkMovementMethod(params.callback))
}
else -> null

View File

@ -76,6 +76,7 @@ import im.vector.app.features.media.ImageContentRenderer
import im.vector.app.features.media.VideoContentRenderer
import im.vector.app.features.settings.VectorPreferences
import im.vector.lib.core.utils.epoxy.charsequence.toEpoxyCharSequence
import im.vector.lib.core.utils.epoxy.charsequence.toMessageTextEpoxyCharSequence
import me.gujun.android.span.span
import org.commonmark.node.Document
import org.matrix.android.sdk.api.MatrixUrls.isMxcUrl
@ -573,7 +574,7 @@ class MessageItemFactory @Inject constructor(
annotateWithEdited(linkifiedBody, callback, informationData)
} else {
linkifiedBody
}.toEpoxyCharSequence()
}.toMessageTextEpoxyCharSequence()
)
.useBigFont(linkifiedBody.length <= MAX_NUMBER_OF_EMOJI_FOR_BIG_FONT * 2 && containsOnlyEmojis(linkifiedBody.toString()))
.bindingOptions(bindingOptions)
@ -689,7 +690,7 @@ class MessageItemFactory @Inject constructor(
.imageContentRenderer(imageContentRenderer)
.previewUrlCallback(callback)
.attributes(attributes)
.message(message.toEpoxyCharSequence())
.message(message.toMessageTextEpoxyCharSequence())
.bindingOptions(bindingOptions)
.highlighted(highlight)
.movementMethod(createLinkMovementMethod(callback))
@ -712,7 +713,7 @@ class MessageItemFactory @Inject constructor(
annotateWithEdited(message, callback, informationData)
} else {
message
}.toEpoxyCharSequence()
}.toMessageTextEpoxyCharSequence()
)
.bindingOptions(bindingOptions)
.leftGuideline(avatarSizeProvider.leftGuideline)

View File

@ -20,6 +20,7 @@ import android.content.Context
import android.text.Spanned
import android.text.TextUtils
import android.text.method.MovementMethod
import androidx.appcompat.widget.AppCompatTextView
import androidx.core.text.PrecomputedTextCompat
import androidx.core.view.isVisible
import androidx.core.widget.TextViewCompat
@ -100,18 +101,7 @@ abstract class MessageTextItem : AbsMessageItem<MessageTextItem.Holder>() {
}
}
var m = message
if (m != null && m.isNotEmpty()) {
// Remove last trailing newline: looks especially bad in message bubble
if (m.last() == '\n') {
m = m.subSequence(0, m.length-1)
}
// Add a narrow non-breakable space to work around wrap_content cutting italic text | https://stackoverflow.com/questions/4353836/italic-textview-with-wrap-contents-seems-to-clip-the-text-at-right-edge
// (interestingly, this seems to be only relevant for the last character even for multi-line messages)
m = TextUtils.concat(m, "\u202f")
}
m?.charSequence.let { charSequence ->
message?.charSequence.let { charSequence ->
markwonPlugins?.forEach { plugin -> plugin.beforeSetText(holder.messageView, charSequence as Spanned) }
}
super.bind(holder)
@ -129,7 +119,7 @@ abstract class MessageTextItem : AbsMessageItem<MessageTextItem.Holder>() {
setTextFuture(textFuture)
} else {
// Remove possible previously set futures that might overwrite our text
holder.messageView.setTextFuture(null)
setTextFuture(null)
text = message
}

View File

@ -334,7 +334,7 @@ class RoomListSectionBuilderSpace(
// add suggested rooms
val suggestedRoomsFlow = if (explicitSpaceId == SPACE_ID_FOLLOW_APP) { // MutableLiveData<List<SpaceChildInfo>>()
appStateHandler.selectedRoomGroupingFlow
r .distinctUntilChanged()
.distinctUntilChanged()
.flatMapLatest { groupingMethod ->
val selectedSpace = groupingMethod.orNull()?.space()
if (selectedSpace == null) {

View File

@ -18,17 +18,15 @@ package im.vector.app.features.login
import android.content.Context
import android.content.Intent
import com.google.android.material.appbar.MaterialToolbar
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.core.extensions.addFragment
import im.vector.app.core.platform.ToolbarConfigurable
import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.databinding.ActivityLoginBinding
import im.vector.app.features.pin.UnlockedActivity
import im.vector.app.features.settings.VectorPreferences
@AndroidEntryPoint
open class PromptSimplifiedModeActivity : VectorBaseActivity<ActivityLoginBinding>(), ToolbarConfigurable, UnlockedActivity {
open class PromptSimplifiedModeActivity : VectorBaseActivity<ActivityLoginBinding>(), UnlockedActivity {
override fun getBinding() = ActivityLoginBinding.inflate(layoutInflater)
@ -47,10 +45,6 @@ open class PromptSimplifiedModeActivity : VectorBaseActivity<ActivityLoginBindin
}
}
override fun configure(toolbar: MaterialToolbar) {
configureToolbar(toolbar)
}
override fun onBackPressed() {
// Don't call super - we don't want to quit on back press, user should select a mode
}

View File

@ -88,7 +88,7 @@ class VectorSettingsAdvancedSettingsFragment @Inject constructor(
.setPositiveButton(R.string._continue) { _, _ ->
vectorPreferences.applyScDefaultValues()
}
.setNegativeButton(R.string.cancel) { _, _ -> /* Just close dialog */ }
.setNegativeButton(R.string.action_cancel) { _, _ -> /* Just close dialog */ }
.show()
true
}

View File

@ -8,8 +8,8 @@
<ImageButton
android:id="@+id/attachmentCloseButton"
android:layout_width="@dimen/composer_attachment_size"
android:layout_height="@dimen/composer_attachment_size"
android:layout_width="@dimen/composer_attachment_width"
android:layout_height="@dimen/composer_attachment_height"
android:layout_margin="@dimen/composer_attachment_margin"
android:background="@null"
android:contentDescription="@string/action_close"
@ -40,7 +40,8 @@
android:layout_height="@dimen/layout_touch_size"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/attachment_type_gallery"
android:src="@drawable/ic_attachment_gallery" />
android:src="@drawable/ic_attachment_gallery"
app:tint="?colorPrimary"/>
<ImageButton
android:id="@+id/attachmentStickersButton"