Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/fga/message bubbles #4937

Merged
merged 43 commits into from
Feb 3, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9a5934d
Bubbles: R&D try to find the best way to provide dynamic layout
Dec 16, 2021
e540b26
Merge develop into feature/fga/message_bubbles
Jan 4, 2022
bde1df0
Bubbles: continue R&D on UI
Jan 5, 2022
ad63d3d
Bubbles: still R&D. Not sure how to handle every event types.
Jan 6, 2022
f7c9b36
Bubbles: continue exploration
Jan 11, 2022
af542a8
Bubbles: start adding "theming" mechanism
Jan 11, 2022
f7df0b8
Bubbles: fix recycling issue
Jan 12, 2022
32e72f5
Bubbles: add quick settings (temporary)
Jan 12, 2022
37af93f
Bubbles: fix avatar/name visibility in modern layout
Jan 12, 2022
b9cc795
Bubbles : fix background colors
Jan 13, 2022
baee076
Bubbles: fix types using wrong layout
Jan 13, 2022
5ac1552
Bubbles: some clean up
Jan 13, 2022
d06df45
Merge branch 'develop' into feature/fga/message_bubbles
Jan 13, 2022
1108ef9
Bubbles: make it works for file, voice and polls. Also add parity for…
Jan 14, 2022
7ff8483
Merge branch 'develop' into feature/fga/message_bubbles
Jan 17, 2022
a9e7c45
Fix url preview sizing
Jan 18, 2022
5ee4984
Bubbles: handle images and make small refactoring
Jan 18, 2022
ac0c262
Bubbles: update sticker handling
Jan 19, 2022
2d9454c
Bubbles: first iteration on url preview
Jan 19, 2022
8c4dff4
Bubbles: change again url preview
Jan 20, 2022
713f6f7
Timeline: Add spacing to quote
Jan 21, 2022
1580269
Bubbles: move settings to timeline section
Jan 21, 2022
608d8a5
Bubbles: change colors
Jan 24, 2022
8f0e103
Bubbles: make round style algorithm more accurate
Jan 24, 2022
a9fe21e
Timeline html rendering: handle code tags
Jan 27, 2022
4de421d
Timeline html rendering: better reply and pill
Jan 27, 2022
881b063
Bubbles: remove emote from bubble (keep right/left alignment)
Jan 27, 2022
ed9adf8
Bubbles: fix paddings
Jan 27, 2022
c14eb05
Merge branch 'develop' into feature/fga/message_bubbles
Jan 27, 2022
b79a5fd
Bubble: move overlay view to MessageBubbleView (and fix corner radius)
Jan 28, 2022
35674ad
Bubbles: handle location sharing (need updates)
Jan 28, 2022
c425701
Bubbles: handle ripple effect
Jan 28, 2022
fd99d6d
Bubbles: start fixing RTL
Jan 28, 2022
820bc64
Bubble: introduce CornersRadius
Jan 31, 2022
38f1bbd
RTL: better support for some TextViews
Jan 31, 2022
825c2ca
Merge branch 'develop' into feature/fga/message_bubbles
Feb 1, 2022
5081006
Bubbles: update media sizing (including LocationItem)
Feb 1, 2022
cfda76b
Timeline: avoid overflow on getViewType
Feb 1, 2022
1bf2523
Merge branch 'develop' into feature/fga/message_bubbles
Feb 2, 2022
9e00867
Bubbles: clean up after review
Feb 2, 2022
2e2da16
Bubbles: merge develop
Feb 3, 2022
0423431
Bubble: get LayoutDirection (RTL) from current Locale
Feb 3, 2022
02de636
Bubbles: add CHANGELOG file
Feb 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/4937.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support message bubbles in timeline.
6 changes: 0 additions & 6 deletions library/ui-styles/src/main/res/values-ldrtl/bools.xml

This file was deleted.

2 changes: 0 additions & 2 deletions library/ui-styles/src/main/res/values/bools.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@
<!-- Created to detect what has to be implemented (especially in the settings) -->
<bool name="false_not_implemented">false</bool>

<bool name="is_rtl">false</bool>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ internal class RealmSessionStoreMigration @Inject constructor(
) : RealmMigration {

companion object {
const val SESSION_STORE_SCHEMA_VERSION = 23L
const val SESSION_STORE_SCHEMA_VERSION = 24L
}

/**
Expand Down Expand Up @@ -93,6 +93,7 @@ internal class RealmSessionStoreMigration @Inject constructor(
if (oldVersion <= 20) migrateTo21(realm)
if (oldVersion <= 21) migrateTo22(realm)
if (oldVersion <= 22) migrateTo23(realm)
if (oldVersion <= 23) migrateTo24(realm)
}

private fun migrateTo1(realm: DynamicRealm) {
Expand Down Expand Up @@ -480,8 +481,8 @@ internal class RealmSessionStoreMigration @Inject constructor(
?.addRealmObjectField(EventEntityFields.THREAD_SUMMARY_LATEST_MESSAGE.`$`, eventEntity)
}

private fun migrateTo23(realm: DynamicRealm) {
Timber.d("Step 22 -> 23")
private fun migrateTo24(realm: DynamicRealm) {
Timber.d("Step 23 -> 24")
realm.schema.get("PreviewUrlCacheEntity")
?.addField(PreviewUrlCacheEntityFields.IMAGE_WIDTH, Int::class.java)
?.setNullable(PreviewUrlCacheEntityFields.IMAGE_WIDTH, true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package im.vector.app.core.resources

import android.content.res.Resources
import android.text.TextUtils
import android.view.View
import androidx.core.os.ConfigurationCompat
import java.util.Locale
import javax.inject.Inject
Expand All @@ -29,3 +31,7 @@ class LocaleProvider @Inject constructor(private val resources: Resources) {
}

fun LocaleProvider.isEnglishSpeaking() = current().language.startsWith("en")

fun LocaleProvider.getLayoutDirectionFromCurrentLocale() = TextUtils.getLayoutDirectionFromLocale(current())

fun LocaleProvider.isRTL() = getLayoutDirectionFromCurrentLocale() == View.LAYOUT_DIRECTION_RTL
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package im.vector.app.features.home.room.detail.timeline.factory

import android.content.res.Resources
import android.text.Spannable
import android.text.SpannableStringBuilder
import android.text.Spanned
Expand Down Expand Up @@ -130,7 +129,6 @@ class MessageItemFactory @Inject constructor(
private val locationPinProvider: LocationPinProvider,
private val vectorPreferences: VectorPreferences,
private val urlMapProvider: UrlMapProvider,
private val resources: Resources
) {

// TODO inject this properly?
Expand Down Expand Up @@ -225,7 +223,7 @@ class MessageItemFactory @Inject constructor(
.locationUrl(locationUrl)
.mapWidth(width)
.mapHeight(height)
.userId(informationData.senderId)
.userId(userId)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.locationPinProvider(locationPinProvider)
.highlighted(highlight)
.leftGuideline(avatarSizeProvider.leftGuideline)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ abstract class MessageLocationItem : AbsMessageItem<MessageLocationItem.Holder>(
super.bind(holder)
renderSendState(holder.view, null)
val location = locationUrl ?: return
val locationOwnerId = userId ?: return
val messageLayout = attributes.informationData.messageLayout
val dimensionConverter = DimensionConverter(holder.view.resources)
val imageCornerTransformation = if (messageLayout is TimelineMessageLayout.Bubble) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
package im.vector.app.features.home.room.detail.timeline.style

import android.content.res.Resources
import android.text.TextUtils
import android.view.View
import im.vector.app.R
import im.vector.app.core.extensions.localDateTime
import im.vector.app.core.resources.LocaleProvider
import im.vector.app.core.resources.isRTL
import im.vector.app.features.home.room.detail.timeline.factory.TimelineItemFactoryParams
import im.vector.app.features.settings.VectorPreferences
import org.matrix.android.sdk.api.session.Session
Expand Down Expand Up @@ -71,8 +70,7 @@ class TimelineMessageLayoutFactory @Inject constructor(private val session: Sess
}

private val isRTL: Boolean by lazy {
val currentLocale = localeProvider.current()
TextUtils.getLayoutDirectionFromLocale(currentLocale) == View.LAYOUT_DIRECTION_RTL
localeProvider.isRTL()
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do this on develop now: resources.getBoolean(R.bool.is_rtl), simplier to me

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R.bool.is_rtl is not working properly if the user change the language inside the app.
This have to be rework. I create an issue from here :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I'll close the related issue then.


fun create(params: TimelineItemFactoryParams): TimelineMessageLayout {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.graphics.drawable.RippleDrawable
import android.text.TextUtils
import android.util.AttributeSet
import android.view.View
import android.view.ViewOutlineProvider
Expand All @@ -35,6 +34,7 @@ import androidx.core.view.updateLayoutParams
import com.google.android.material.shape.MaterialShapeDrawable
import im.vector.app.R
import im.vector.app.core.resources.LocaleProvider
import im.vector.app.core.resources.getLayoutDirectionFromCurrentLocale
import im.vector.app.core.utils.DimensionConverter
import im.vector.app.databinding.ViewMessageBubbleBinding
import im.vector.app.features.home.room.detail.timeline.style.TimelineMessageLayout
Expand Down Expand Up @@ -65,8 +65,7 @@ class MessageBubbleView @JvmOverloads constructor(context: Context, attrs: Attri
override fun onFinishInflate() {
super.onFinishInflate()
views = ViewMessageBubbleBinding.bind(this)
val currentLocale = LocaleProvider(resources).current()
val currentLayoutDirection = TextUtils.getLayoutDirectionFromLocale(currentLocale)
val currentLayoutDirection = LocaleProvider(resources).getLayoutDirectionFromCurrentLocale()
val layoutDirectionToSet = if (isIncoming) {
currentLayoutDirection
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

package im.vector.app.features.location

import android.content.res.Resources
import im.vector.app.BuildConfig
import im.vector.app.R
import im.vector.app.core.resources.LocaleProvider
import im.vector.app.core.resources.isRTL
import javax.inject.Inject

class UrlMapProvider @Inject constructor(
private val resources: Resources
private val localeProvider: LocaleProvider
) {
private val keyParam = "?key=${BuildConfig.mapTilerKey}"

Expand All @@ -49,7 +49,7 @@ class UrlMapProvider @Inject constructor(
append(height)
append(".png")
append(keyParam)
if (!resources.getBoolean(R.bool.is_rtl)) {
if (!localeProvider.isRTL()) {
// On LTR languages we want the legal mentions to be displayed on the bottom left of the image
append("&attribution=bottomleft")
}
Expand Down