-
Notifications
You must be signed in to change notification settings - Fork 388
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
Theming for new compose classes #2665
Conversation
import androidx.core.content.ContextCompat | ||
import com.salesforce.androidsdk.R | ||
|
||
object SFColors { |
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.
That way, the colors xml is still being used (and can be overriden in the client app). Or we don't want to do it this way ?? @brandonpage @JohnsonEricAtSalesforce
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 don't mind it, but I am also not sure if it servers a purpose. I don't think even the internal apps are using our existing colors for anything other than overriding our UI.
If we keep the XML colors do I have to add new values there and here?
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.
If I don't keep it, how would they override the colors?
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 was originally thinking via the view model but I don't know what is best. My first thought is that the theme could be a data class (that could be overridden) instead of an object? 🤷
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.
Or since we seem to be using a lot of Material3 components, should we be using a MaterialTheme?
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.
Maybe - should we provide an easy way for an application to use a different theme ?
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.
Should we allow the app to provide MaterialTheme's for light and dark (through SalesforceSDKManager) and we would default to the MaterialTheme.lightColorTheme() and MaterialTheme.darkColorTheme() ??
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.
@brandonpage & @wmathurin - Did you come up with an answer on the approach for this? I believe we're keeping the colors in the resource XML?
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.
We are keeping sf__colors.xml until at least 14.
So that's one way to override default colors.
We also added setDarkColorScheme() and setLightColorScheme() to SalesforceSDKManager - as another way to override colors.
Finally for login, the LoginViewModel exposes a few key colors as members.
As we work on login fit/finish, we might simplify things a bit??
Generated by 🚫 Danger |
import androidx.compose.ui.platform.LocalContext | ||
|
||
enum class SalesforceThemeType { | ||
Light, Dark, DarkLogin |
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.
Does DarkLogin
exist because we can't change the webview background color from white? What I had been doing was hiding the WebView (via opacity) when loading so we could set the background color to whatever we want -- not sure that is relevant though.
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 think that was the reason for DarkLogin.
Let me try with Dark and see how it looks.
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.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #2665 +/- ##
============================================
- Coverage 56.41% 50.80% -5.61%
+ Complexity 2468 2300 -168
============================================
Files 206 206
Lines 16282 16375 +93
Branches 2187 2195 +8
============================================
- Hits 9185 8320 -865
- Misses 6132 7164 +1032
+ Partials 965 891 -74
|
Providing a way for the application to provide its own color schemes
@brandonpage @JohnsonEricAtSalesforce what do you think of this approach (5b18ebe) for theming? |
…d into themes # Conflicts: # libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt
Should we merge this one? |
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.
🤘🏻
No description provided.