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

Theme override #4226

Merged
merged 10 commits into from
Feb 6, 2025
Merged

Theme override #4226

merged 10 commits into from
Feb 6, 2025

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Jan 31, 2025

Content

Give ability to override theme color at build time.
Get color from ElementTheme instead of MaterialTheme when possible.

Motivation and context

Allow Element Enterprise customization.

Screenshots / GIFs

Tests

  • Should not impact the EXA application, only minor changes on the colors.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

  • Changes have been tested on an Android device or Android emulator with API 24
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • You've made a self review of your PR

@bmarty bmarty requested a review from a team as a code owner January 31, 2025 17:49
@bmarty bmarty requested review from jmartinesp and removed request for a team January 31, 2025 17:49
Copy link
Contributor

github-actions bot commented Jan 31, 2025

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/ByJuR1

@bmarty bmarty added the PR-Misc For other changes label Jan 31, 2025
Copy link
Member

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

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

The PR looks good in general, but I'm a bit worried about the changes in tokens and how they affected the preview. Can we double check those are fine?

Copy link
Member

Choose a reason for hiding this comment

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

Haven't these been reversed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but we were using colors not from the theme... We need a design source for this anyway.
@amshakal can you help please? We need colors for this banner:

image

Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

@jmartinesp , Amsha will provide some design for this banner, but I do not think this should block this PR. Coming design will be handle in a specific PR. This PR just ensure that we are at least using semantic colors for this banner. Do you agree? If yes, I guess we can merge the PR except if you have other remarks?

Copy link
Member

Choose a reason for hiding this comment

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

I'd rather not change this color to change it back later, but I don't think it should be blocking either, so it's ok to keep the change. I'll review the PR again.

Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit worried these items now look less like they're in a disabled state, but I guess they are using the right tokens 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.

Yes, I think so

Copy link

codecov bot commented Feb 3, 2025

Codecov Report

Attention: Patch coverage is 81.11111% with 34 lines in your changes missing coverage. Please review.

Project coverage is 80.19%. Comparing base (ce1c01e) to head (108b849).
Report is 15 commits behind head on develop.

Files with missing lines Patch % Lines
...c/main/kotlin/io/element/android/x/MainActivity.kt 0.00% 6 Missing ⚠️
...roid/features/call/impl/ui/IncomingCallActivity.kt 0.00% 6 Missing ⚠️
...droid/features/call/impl/ui/ElementCallActivity.kt 0.00% 5 Missing ⚠️
...ckscreen/impl/unlock/activity/PinUnlockActivity.kt 0.00% 5 Missing ⚠️
...id/libraries/designsystem/theme/ElementThemeApp.kt 0.00% 4 Missing ⚠️
...droid/libraries/designsystem/theme/ColorAliases.kt 0.00% 3 Missing ⚠️
...atures/enterprise/impl/DefaultEnterpriseService.kt 0.00% 2 Missing ⚠️
...ent/android/features/messages/impl/MessagesView.kt 92.85% 1 Missing ⚠️
...oid/libraries/matrix/ui/components/SelectedRoom.kt 87.50% 0 Missing and 1 partial ⚠️
...ies/mediaviewer/impl/local/audio/MediaAudioView.kt 80.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4226      +/-   ##
===========================================
- Coverage    80.23%   80.19%   -0.04%     
===========================================
  Files         2045     2045              
  Lines        54184    54204      +20     
  Branches      6580     6581       +1     
===========================================
- Hits         43473    43471       -2     
- Misses        8434     8456      +22     
  Partials      2277     2277              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center
) {
Text(
text = stringResource(id = R.string.screen_room_timeline_no_permission_to_post),
color = MaterialTheme.colorScheme.onSecondary,
color = ElementTheme.colors.textSecondary,
Copy link
Member Author

Choose a reason for hiding this comment

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

Using Semantic colors for this banner, waiting for design input that can be handled later.

Copy link
Member

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

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

I added question and a possible issues with a template. Once the latter is fixed, it should be fine to merged this, thanks!

@@ -21,6 +21,7 @@ dependencies {
api(projects.features.enterprise.api)
implementation(projects.libraries.architecture)
implementation(projects.libraries.matrix.api)
api(libs.compound)
Copy link
Member

Choose a reason for hiding this comment

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

Are these api needed (here and in the api module)? Couldn't they just be implementation since the designsystem module will already provide the compound dependency?

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right: b7dc2e3

@@ -19,7 +19,7 @@ fun ${NAME}View(
Box(modifier, contentAlignment = Alignment.Center) {
Text(
"${NAME} feature view",
color = MaterialTheme.colorScheme.primary,
color = ElementTheme.colors.textprimary,
Copy link
Member

Choose a reason for hiding this comment

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

This may be a typo. textPrimary with capital P?

Copy link
Member Author

@bmarty bmarty Feb 6, 2025

Choose a reason for hiding this comment

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

Good spot, thanks! 9411cad

@bmarty bmarty force-pushed the feature/bma/themeOverride branch from 823485b to 9411cad Compare February 6, 2025 14:12
Copy link

sonarqubecloud bot commented Feb 6, 2025

@bmarty bmarty merged commit 5456f0e into develop Feb 6, 2025
28 checks passed
@bmarty bmarty deleted the feature/bma/themeOverride branch February 6, 2025 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Misc For other changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants