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

Feature/fga/message bubbles #4937

merged 43 commits into from
Feb 3, 2022

Conversation

ganfra
Copy link
Member

@ganfra ganfra commented Jan 13, 2022

This PR introduces message bubbles in Timeline.
It allows to switch Layout at runtime from the Preferences.

It also improves a bit Code Block rendering and Url previews.

@ganfra ganfra marked this pull request as draft January 13, 2022 10:36
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

Nice work, thanks! Will do some test


abstract fun getViewStubId(): Int

// Szudzik function
Copy link
Member

Choose a reason for hiding this comment

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

Wow, nice to see that here! But is there a risk of overflow since Android ids can be big integers?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I changed to Long and then normalize by substracting Int.MAX_VALUE

*
* @return true to show emoji keyboard button.
*/
fun useMessageBubblesLayout(): Boolean {
Copy link
Member

Choose a reason for hiding this comment

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

Please update the comment above :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@bmarty
Copy link
Member

bmarty commented Jan 13, 2022

(Could be nice to add some screenshots in the PR)

<im.vector.app.core.preference.VectorSwitchPreference
android:defaultValue="false"
android:key="SETTINGS_INTERFACE_BUBBLE_KEY"
android:title="@string/message_bubbles" />
Copy link
Member

Choose a reason for hiding this comment

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

Better to move this in the timeline section

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@bmarty
Copy link
Member

bmarty commented Jan 13, 2022

Quick remark, maybe increase the font size of the messages when bubbles are enabled.

@github-actions
Copy link

github-actions bot commented Jan 14, 2022

Unit Test Results

  76 files  ±0    76 suites  ±0   1m 2s ⏱️ +4s
144 tests ±0  144 ✔️ ±0  0 💤 ±0  0 ±0 
452 runs  ±0  452 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit 02de636. ± Comparison against base commit dbfd7e6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Jan 14, 2022

Matrix SDK

Integration Tests Results:

  • [org.matrix.android.sdk.session]
    passed=
  • [org.matrix.android.sdk.account]
    passed=
  • [org.matrix.android.sdk.internal]
    passed=
  • [org.matrix.android.sdk.ordering]
    passed=
  • [org.matrix.android.sdk.PermalinkParserTest]
    passed=

@bmarty
Copy link
Member

bmarty commented Feb 2, 2022

❌ Error: 'layout_(.*)="@+id' detected 1 time, in file './vector/src/main/res/layout/view_message_bubble.xml', at line 203.
Rule: Use @id and not @+id when referencing ids in layouts

Also have you handled all my remarks above?

@element-hq element-hq deleted a comment from github-actions bot Feb 2, 2022
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

Nice work.
Maybe the changes regarding code block rendering, and URL preview management (with width and heigth) could have been handled in dedicated PR.
Still some small remarks and existing one not yet handle.
After we could merge on develop if the PR is ready!

private val vectorPreferences: VectorPreferences) {

companion object {
// Can't be rendered in bubbles, so get back to default layout
Copy link
Member

Choose a reason for hiding this comment

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

I think this comment is wrong

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

private val isRTL: Boolean by lazy {
val currentLocale = localeProvider.current()
TextUtils.getLayoutDirectionFromLocale(currentLocale) == View.LAYOUT_DIRECTION_RTL
}
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.

@@ -76,6 +81,22 @@ class PreviewUrlView @JvmOverloads constructor(
}
}

override fun render(messageLayout: TimelineMessageLayout) {
Copy link
Member

Choose a reason for hiding this comment

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

weird to have to render fun in this class now

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 to renderMessageLayout

@@ -55,5 +55,5 @@
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toEndOf="@id/messageThreadSummaryAvatarImageView"
app:layout_constraintTop_toTopOf="parent"
tools:text="@sample/messages.json/data/message" />
tools:text="Pouet" />
Copy link
Member

Choose a reason for hiding this comment

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

:) (maybe revert)

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

Thanks for the update. Can you add a file for the changelog please?

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the update!

@@ -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.

private val isRTL: Boolean by lazy {
val currentLocale = localeProvider.current()
TextUtils.getLayoutDirectionFromLocale(currentLocale) == View.LAYOUT_DIRECTION_RTL
}
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.

@bmarty bmarty marked this pull request as ready for review February 3, 2022 18:00
@bmarty bmarty merged commit 4ce1ab2 into develop Feb 3, 2022
@bmarty bmarty deleted the feature/fga/message_bubbles branch February 3, 2022 18:00
@ganfra ganfra mentioned this pull request Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants