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

[Rich text editor] Implement full screen editor mode (simple approach) #7436

Merged
merged 6 commits into from
Oct 26, 2022

Conversation

jmartinesp
Copy link
Member

@jmartinesp jmartinesp commented Oct 24, 2022

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

A new 'maximise' button has been added to the rich text editor. This button will toggle the full screen mode of the editor, overlaying the timeline to get more room to write and focus. To achieve this we had to use a new set of constraints in layout/fragment_timeline_fullscreen.xml, a new MessageComposerViewAction and an extra callback.

Motivation and context

The full screen mode is a request from one of our clients.

Screenshots / GIFs

Before After
Screenshot_1666715277 Screenshot_1666715217

Tests

  • Go to settings, enable 'rich text editor' in Labs.
  • Open any room, tap on the 'full screen' button.
  • Test both modes with reply, edit, quote, etc.

Tested devices

  • Physical
  • Emulator
  • OS version(s): 13, 10.

Checklist

@jmartinesp jmartinesp self-assigned this Oct 25, 2022
@jmartinesp jmartinesp requested review from a team and bmarty and removed request for a team October 25, 2022 16:33
@jmartinesp jmartinesp marked this pull request as ready for review October 25, 2022 16:34
@jmartinesp jmartinesp force-pushed the feature/wysiwyg-full-screen-editor branch from 676c06e to 1d1f7b8 Compare October 25, 2022 16:35
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, first remarks. I will test the feature.


</androidx.constraintlayout.widget.ConstraintLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
Copy link
Member

Choose a reason for hiding this comment

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

It's annoying to duplicate this whole file, there is no other option? Maybe add a comment on top of the two files to warn developers about the fact that they must update the 2 files.

Copy link
Member Author

Choose a reason for hiding this comment

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

We'd have to change those constraints programmatically, I used the same approach that we use for composer_text_layout.xml. I agree it's not great, but I think the alternative would be worse. I'll add the comment.

@@ -34,6 +34,8 @@ sealed class MessageComposerAction : VectorViewModelAction {
data class SlashCommandConfirmed(val parsedCommand: ParsedCommand) : MessageComposerAction()
data class InsertUserDisplayName(val userId: String) : MessageComposerAction()

object ToggleFullScreen : MessageComposerAction()
Copy link
Member

Choose a reason for hiding this comment

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

ToggleFullScreen maybe be replaced to a data class SetFullScreen(val fullscreen: Boolean), because I think in the usage there is a View to enter fullscreen and a view to exit fullscreen. Also when the message is sent, it's maybe better to use SetFullScreen(false) rather than if(fullscreen) ToggleFullScreen.

But I have not tested to implement the change, this is maybe not better, I let you choose.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll try to. It's true that we have 2 sources of truth, but passing state to the MessageComposerView might not be so easy to do with no side effects.

private val animationDuration = 100L

private var isFullScreen = false
Copy link
Member

Choose a reason for hiding this comment

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

In case of configuration change, this value (if true) may be lost.
We have 2 source of truth, this is not ideal. Can we rely only on the ViewState?

@bmarty
Copy link
Member

bmarty commented Oct 26, 2022

  • When in fullscreen, there is an issue with the scroll to bottom button:

image

It should maybe be hidden.

  • There is an issue with the background color at the top. Maybe using a padding instead of a margin would fix. But this is maybe expected?

image

  • The menu item matrix app blinks as well when toggle fullscreen

@jmartinesp
Copy link
Member Author

There is an issue with the background color at the top. Maybe using a padding instead of a margin would fix. But this is maybe expected?

If it's about covering the appbar, that's in the designs, but it's a bit weird to be honest. I could probably remove the scrim view elevation.

The menu item matrix app blinks as well when toggle fullscreen

I think it's because we change its alpha value (the menu is handled again) while we animate the constraintset transition and gets animated too instead of instantly applying the values. I'll try to find a way to fix it.

@jmartinesp jmartinesp force-pushed the feature/wysiwyg-full-screen-editor branch from 1d1f7b8 to 826902d Compare October 26, 2022 10:52
@jmartinesp jmartinesp changed the base branch from develop to resilience-rc October 26, 2022 10:52
@jmartinesp
Copy link
Member Author

Sorry, there's no way to fix the blinking app icon issue without re-building this from scratch as far as I could see. We're already working on an alternative using a custom CoordinatorLayout.Behavior to replace this, but it's a lot more complex so it might take time.

As for the shadow covering the app bar but not the statusbar, I'd have to change the way the activity works so it draws the status bar background and play with the insets... I can try to do it, but it could take some time and this is a bit urgent.

I could also remove the shadow view altogether and cover the screen up to the appbar, but that wouldn't really match the designs.

@jmartinesp jmartinesp requested a review from bmarty October 26, 2022 10:56
@ElementBot
Copy link

Warnings
⚠️

vector/src/main/AndroidManifest.xml#L201 - Consider splitting data tag into multiple tags with individual attributes to avoid confusion

⚠️

vector/src/main/AndroidManifest.xml#L201 - Consider splitting data tag into multiple tags with individual attributes to avoid confusion

⚠️

vector/src/main/AndroidManifest.xml#L204 - Consider splitting data tag into multiple tags with individual attributes to avoid confusion

⚠️

vector/src/main/AndroidManifest.xml#L204 - Consider splitting data tag into multiple tags with individual attributes to avoid confusion

⚠️

vector/src/main/AndroidManifest.xml#L258 - Expecting android:screenOrientation="unspecified" or "fullSensor" for this activity so the user can use the application in any orientation and provide a great experience on Chrome OS devices

⚠️

vector/src/main/AndroidManifest.xml#L258 - Expecting android:screenOrientation="unspecified" or "fullSensor" for this activity so the user can use the application in any orientation and provide a great experience on Chrome OS devices

⚠️

vector/src/main/AndroidManifest.xml#L267 - Attribute supportsPictureInPicture is only used in API level 24 and higher (current min is 21)

⚠️

vector/src/main/AndroidManifest.xml#L267 - Attribute supportsPictureInPicture is only used in API level 24 and higher (current min is 21)

⚠️

vector/src/main/AndroidManifest.xml#L274 - Attribute supportsPictureInPicture is only used in API level 24 and higher (current min is 21)

⚠️

vector/src/main/AndroidManifest.xml#L274 - Attribute supportsPictureInPicture is only used in API level 24 and higher (current min is 21)

⚠️

vector/src/main/AndroidManifest.xml#L280 - Attribute supportsPictureInPicture is only used in API level 24 and higher (current min is 21)

⚠️

vector/src/main/AndroidManifest.xml#L280 - Attribute supportsPictureInPicture is only used in API level 24 and higher (current min is 21)

⚠️

vector/src/main/AndroidManifest.xml#L400 - Exported receiver does not require permission

⚠️

vector/src/main/AndroidManifest.xml#L400 - Exported receiver does not require permission

⚠️

vector/src/main/res/drawable/ic_composer_full_screen.xml#L7 - Very long vector path (893 characters), which is bad for performance. Considering reducing precision, removing minor details or rasterizing vector.

⚠️

vector/src/main/res/drawable/ic_composer_full_screen.xml#L7 - Very long vector path (893 characters), which is bad for performance. Considering reducing precision, removing minor details or rasterizing vector.

Generated by 🚫 dangerJS against b492158

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@bmarty
Copy link
Member

bmarty commented Oct 26, 2022

As for the shadow covering the app bar but not the statusbar, I'd have to change the way the activity works so it draws the status bar background and play with the insets... I can try to do it, but it could take some time and this is a bit urgent.

I am talking about this banner (between my ugly red brackets):

Screenshot 2022-10-26 at 14 59 27

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!

@jmartinesp jmartinesp merged commit d242ab0 into resilience-rc Oct 26, 2022
@jmartinesp jmartinesp deleted the feature/wysiwyg-full-screen-editor branch October 26, 2022 13:15
jmartinesp added a commit that referenced this pull request Nov 2, 2022
#7436)

* Rich text editor: implement full screen editor mode using ConstraintSets

* Add back press handler

* Change ToggleFullScreen to SetFullScreen, fix rebase issues

* Add warning to fragment_timeline* files
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.

3 participants