Skip to content

Massively simplify styling #696

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

Merged
merged 4 commits into from
May 9, 2017
Merged

Massively simplify styling #696

merged 4 commits into from
May 9, 2017

Conversation

SUPERCILEX
Copy link
Collaborator

@samtstern I was going through the sign-in process for my app because I updated some Facebook/Twitter settings and it looked pretty ugly: 😱

Long story short, I forgot to style FirebaseUI correctly. Oops! 😄 Anyway, the point of this PR is to make styling easier, or more accurately, unnecessary. At the moment, styling requires a bunch of manual work so this PR basically styles FirebaseUI with the app's default look n' feel for free. Yay! 🚀 🎉 😄

Here's a really large and gnarly table with comparison screenshots of the default no config theme before and after this PR:

Old New
screenshot_20170508-201458 screenshot_20170508-211507
screenshot_20170508-201559 screenshot_20170508-211525
screenshot_20170508-201634 screenshot_20170508-212635
screenshot_20170508-201707 screenshot_20170508-212429
screenshot_20170508-201713 screenshot_20170508-212757
screenshot_20170508-201718 screenshot_20170508-212913
screenshot_20170508-212933 screenshot_20170508-213425
screenshot_20170508-201428 screenshot_20170508-221604
screenshot_20170508-201530 screenshot_20170508-221626

@samtstern Lol, it took me so long to make that table. 😆 This PR is a WIP because I still haven't looked through my code to clean stuff up and the existing themes look pretty dang ugly right now (their colorAccent is yucky which makes all the buttons pretty bad).

@samtstern What are your thoughts on this before I move forward and update our sample app themes? I was almost thinking of removing theme customization completely and just using the app's default theme, but I feel like that might be a little extreme... thoughts, comments, concerns, random outbursts? 😆

<color name="authui_inputTextColorDark">#000000</color>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is where all the magic happens: the app's theme overrides this so we get theme customization for free. However, we need to keep these values to be able to build the auth module.

Copy link
Contributor

Choose a reason for hiding this comment

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

I do think your new colors look better, however I think the original color schemes were set by the person who made the UX mocks so I am hesitant to change them based on our personal preference.

I'll see if someone can weigh in on that. But warning I may have to ask you to revert the colors, which will make your beautiful table obsolete :-/

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@samtstern Wait a sec, I think you're confused by the purpose of this PR and the pure awesomeness going on behind the scenes! 😄 Those colors don't mean anything are the default Android Studio setup colors:

Hex value Color
<color name="colorPrimary">#3F51B5</color> image
<color name="colorPrimaryDark">#303F9F</color> image
<color name="colorAccent">#FF4081</color> image

(I'm getting good at those tables 😆)

The colors you see from the screenshots in the original post are from the dev's app theme (in this case FirebaseUI): https://github.com/firebase/FirebaseUI-Android/blob/master/app/src/main/res/values/colors.xml#L2-L4

So the idea is that with no configuration at all, a dev can just add FirebaseUI and it will automatically style itslef with their app's theme because their colorPrimary, colorPrimaryDark, and colorAccent are overriding FirebaseUI's. Thus the colors in the FirebaseUI style are meaningless and are just there so that we can compile the auth module.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. I wasn't thinking it through all the way. Before this change the colors in our theme mattered since we were not leaning on AppCompat, so if the developer did not pass a theme those colors would show up.

Now because we are leaning on AppCompat our theme will almost never show up (unless the dev is not using AppCompat, right?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@samtstern Yup and yup! I'm happy to change the colors back to what they were since they shouldn't matter; what I really want is a way to error if the dev doesn't override our colors, but I don't think that's possible.

Copy link
Contributor

@samtstern samtstern left a comment

Choose a reason for hiding this comment

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

@SUPERCILEX some minor comments. Feel free to go crazy with the sample themes, but let's hold off on the other change (removing themes entirely and only relying on the app's theme).

@@ -2,17 +2,10 @@
<resources>

<style name="FirebaseUI" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/authui_colorPrimary</item>
Copy link
Contributor

Choose a reason for hiding this comment

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

So are all of the deleted values OK because they default to relying on colorPrimary, colorPrimaryDark, and colorAccent?

Copy link
Collaborator Author

@SUPERCILEX SUPERCILEX May 9, 2017

Choose a reason for hiding this comment

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

Yup! To build on what I said above, this PR makes heavy usage of AppCompat which takes care of almost all of the styling for us using the dev's overriden colors.

<color name="authui_inputTextColorDark">#000000</color>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
Copy link
Contributor

Choose a reason for hiding this comment

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

I do think your new colors look better, however I think the original color schemes were set by the person who made the UX mocks so I am hesitant to change them based on our personal preference.

I'll see if someone can weigh in on that. But warning I may have to ask you to revert the colors, which will make your beautiful table obsolete :-/

<item name="android:textSize">16sp</item>
<item name="android:lineSpacingExtra">8sp</item>
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these all the same as defaults too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not really, they're using @style/Widget.AppComat.TextInputLayout which takes care of the styling for us. (And of course AppCompat is following the material spec.)

@@ -207,6 +177,7 @@
<item name="android:layout_gravity">left</item>
<item name="android:gravity">left|center_vertical</item>
<item name="android:typeface">normal</item>
<item name="android:foreground">?android:attr/selectableItemBackground</item>
Copy link
Contributor

Choose a reason for hiding this comment

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

Another day, another new trick I learned!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I was really happy when I saw this in a gnarly SO post.

Copy link
Collaborator Author

@SUPERCILEX SUPERCILEX left a comment

Choose a reason for hiding this comment

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

@samtstern Make sure to read this post first for the others to make sense. Happy reading! 😄

<color name="authui_inputTextColorDark">#000000</color>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@samtstern Wait a sec, I think you're confused by the purpose of this PR and the pure awesomeness going on behind the scenes! 😄 Those colors don't mean anything are the default Android Studio setup colors:

Hex value Color
<color name="colorPrimary">#3F51B5</color> image
<color name="colorPrimaryDark">#303F9F</color> image
<color name="colorAccent">#FF4081</color> image

(I'm getting good at those tables 😆)

The colors you see from the screenshots in the original post are from the dev's app theme (in this case FirebaseUI): https://github.com/firebase/FirebaseUI-Android/blob/master/app/src/main/res/values/colors.xml#L2-L4

So the idea is that with no configuration at all, a dev can just add FirebaseUI and it will automatically style itslef with their app's theme because their colorPrimary, colorPrimaryDark, and colorAccent are overriding FirebaseUI's. Thus the colors in the FirebaseUI style are meaningless and are just there so that we can compile the auth module.

@@ -2,17 +2,10 @@
<resources>

<style name="FirebaseUI" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/authui_colorPrimary</item>
Copy link
Collaborator Author

@SUPERCILEX SUPERCILEX May 9, 2017

Choose a reason for hiding this comment

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

Yup! To build on what I said above, this PR makes heavy usage of AppCompat which takes care of almost all of the styling for us using the dev's overriden colors.

<item name="android:textSize">16sp</item>
<item name="android:lineSpacingExtra">8sp</item>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not really, they're using @style/Widget.AppComat.TextInputLayout which takes care of the styling for us. (And of course AppCompat is following the material spec.)

@@ -207,6 +177,7 @@
<item name="android:layout_gravity">left</item>
<item name="android:gravity">left|center_vertical</item>
<item name="android:typeface">normal</item>
<item name="android:foreground">?android:attr/selectableItemBackground</item>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I was really happy when I saw this in a gnarly SO post.

@SUPERCILEX SUPERCILEX changed the title [WIP] Massively simplify styling Massively simplify styling May 9, 2017
@samtstern samtstern added this to the 2.0.0 milestone May 9, 2017
@samtstern samtstern merged commit f2a78b2 into firebase:version-2.0.0-dev May 9, 2017
@SUPERCILEX SUPERCILEX deleted the simplify-styling branch May 9, 2017 22:23
SUPERCILEX added a commit to SUPERCILEX/Robot-Scouter that referenced this pull request May 10, 2017
SUPERCILEX added a commit to SUPERCILEX/Robot-Scouter that referenced this pull request May 23, 2017
@SUPERCILEX SUPERCILEX mentioned this pull request Jul 10, 2017
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