-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Massively simplify styling #696
Conversation
<color name="authui_inputTextColorDark">#000000</color> | ||
<color name="colorPrimary">#3F51B5</color> | ||
<color name="colorPrimaryDark">#303F9F</color> | ||
<color name="colorAccent">#FF4081</color> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 :-/
There was a problem hiding this comment.
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> |
![]() |
<color name="colorPrimaryDark">#303F9F</color> |
![]() |
<color name="colorAccent">#FF4081</color> |
![]() |
(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.
There was a problem hiding this comment.
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?)
There was a problem hiding this comment.
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.
There was a problem hiding this 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> |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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 :-/
auth/src/main/res/values/styles.xml
Outdated
<item name="android:textSize">16sp</item> | ||
<item name="android:lineSpacingExtra">8sp</item> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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.
There was a problem hiding this 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> |
There was a problem hiding this comment.
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> |
![]() |
<color name="colorPrimaryDark">#303F9F</color> |
![]() |
<color name="colorAccent">#FF4081</color> |
![]() |
(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> |
There was a problem hiding this comment.
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.
auth/src/main/res/values/styles.xml
Outdated
<item name="android:textSize">16sp</item> | ||
<item name="android:lineSpacingExtra">8sp</item> |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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.
firebase/FirebaseUI-Android#696 firebase/FirebaseUI-Android#694 Signed-off-by: Alex Saveau <[email protected]>
firebase/FirebaseUI-Android#696 firebase/FirebaseUI-Android#694 Signed-off-by: Alex Saveau <[email protected]>
@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:
@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? 😆