Skip to content

Gutenberg/dark mode integration#11004

Merged
khaykov merged 54 commits intofeature/material-themefrom
gutenberg/dark_mode_integration
Mar 13, 2020
Merged

Gutenberg/dark mode integration#11004
khaykov merged 54 commits intofeature/material-themefrom
gutenberg/dark_mode_integration

Conversation

@marecar3
Copy link
Copy Markdown
Contributor

@marecar3 marecar3 commented Dec 21, 2019

Fixes implements Dark Mode on Android platform: wordpress-mobile/gutenberg-mobile#1675

To test: Instructions can be found on the following Gutenberg PR: wordpress-mobile/gutenberg-mobile#1717

PR submission checklist:

  • I have considered adding unit tests where possible.

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented Dec 21, 2019

You can test the changes on this Pull Request by downloading the APK here.

@marecar3 marecar3 marked this pull request as ready for review December 25, 2019 16:25
@marecar3 marecar3 added the Gutenberg Editing and display of Gutenberg blocks. label Dec 25, 2019
@marecar3 marecar3 requested a review from khaykov December 25, 2019 16:26
@khaykov khaykov self-assigned this Jan 7, 2020
Copy link
Copy Markdown
Contributor

@khaykov khaykov 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 PR, @marecar3 ! I have a couple of comments inline :)

@@ -1,3 +1,7 @@
14.1
-----
* Block Editor: Add support for Dark Mode
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since this branch targets feature branch, it's probably not going to get released just yet :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed.

return view;
}

private String getAppTheme() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not really sure about the details of GB implementation, but this approach of getting string resource from the app_theme_entry_value_* looks a bit hacky to me. Can GB be aware of the current theme from withing its own code? Or we could just use boolean to indicate light or dark mode.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Changed to boolean.

<resources>

<!-- Gutenberg -->
<color name="background_color">#121212</color>
Copy link
Copy Markdown
Contributor

@khaykov khaykov Jan 8, 2020

Choose a reason for hiding this comment

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

While overriding color values is a legit approach, ideally we would use attributes for this, that we could override in styles.xml on client-side. If GB would use other standard material color attributes (colorPrimary, colorSecondary,colorBackground, etc.), styling it from the client would also be a breeze.

PS: Discregard this.

localeString,
translations);
translations,
getContext().getResources().getColor(R.color.background_color));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We have defined background color in our styles.xml for both light and dark mode, so I think we can use an existing color attribute here, like this:
ContextExtensionsKt.getColorFromAttribute(getContext(), R.attr.backgroundColor)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ContextExtensionsKt isn't available in this class. Not sure if we want to include it?

@mchowning
Copy link
Copy Markdown
Contributor

mchowning commented Mar 9, 2020

This is looking good.

Connect a Site Screen

I did notice a weird issue when switching battery mode on/off from the editor. It would load up the connect a site screen.

UPDATE: This happened to me a number of times, but it also stopped occurring with me shortly after I originally posted this comment, so it may have just been a temporary local issue.

I only tested this using an emulator because I don't have an API<29 device handy.

App Settings appear to be disabled

Also, and this isn't an issue with the gutenberg changes, but to my eyes, I found that the coloring of the options on the app settings screen made it seem like all the options other than privacy settings were disabled.

Screen Shot 2020-03-09 at 3 06 04 PM

I realize this code has been sitting for awhile (so sorry about the slow review 😞) so maybe these are just the result of not having the latest code on this branch? cc: @khaykov

@khaykov
Copy link
Copy Markdown
Contributor

khaykov commented Mar 9, 2020

@mchowning Yeah, this looks like an old version of the feature branch :) I'll check out the Connect a Site Screen things, but it's not related to this PR.

@oguzkocer
Copy link
Copy Markdown
Contributor

We're freezing 14.4 today, so this PR is being bumped to 14.5. If you'd like it to ship with 14.4, please merge it into release/14.4 and ping me – I'll be happy to cut a new beta release.

@oguzkocer oguzkocer modified the milestones: 14.4, 14.5 Mar 9, 2020
setTitle(SiteUtils.getSiteNameOrHomeURL(mSite));
mSectionsPagerAdapter = new SectionsPagerAdapter(fragmentManager);

setupViewPager();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hey @khaykov,
I moved the code into a separate method as our changes have exceeded the allowed number of lines per method which resulted in failed lint tests.

tools:listitem="@layout/insights_management_list_item" />

</ScrollView> No newline at end of file
</ScrollView>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed lint error.

tools:listitem="@layout/insights_management_list_item" />

</ScrollView> No newline at end of file
</ScrollView>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed lint error.

Copy link
Copy Markdown
Contributor

@khaykov khaykov left a comment

Choose a reason for hiding this comment

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

Works like a charm 👍 Thank you so much for great work, @marecar3 !

@khaykov khaykov merged commit 6357643 into feature/material-theme Mar 13, 2020
@khaykov khaykov deleted the gutenberg/dark_mode_integration branch March 13, 2020 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Gutenberg Editing and display of Gutenberg blocks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants