Why the algorithm has never recommended your channel for me ? I love your explanations, fast (no stallings), precise, in point, and rich of information, BRAVO 👏👏👏
First - thank you so much for the kind words, and I am glad the content works good for you 🙏 The way the algorithm works is: it recommends videos that the user is more likely to click on, and watch start to end. They want you to stay on the platform. For my videos unfortunately, people click off rather soon. And so, since folks don't watch start to end - the algo sees it as a bad video and it won't recommend. If you want to be notified tho, you can subscribe to the channel and click on the notification bell. That way you'll never miss a video. Hope that helps 🙏
Hi there wave 👋 Sure thing, thanks for the question. Let me try to explain. There are 2 functions we can use to pass value(s) down the composition: `compositionLocalOf{}` and `staticCompositionLocalOf{}` When we use the first one, the composer keeps track of the values, and where (in which composable) they are read. Then, when a value changes, the composer will cause recomposition only for the composable that reads the value that changed. When we use the second function (staticCompositionLocalOf{}) the composer doesn't keep track. When a value changes- the whole composition tree is going to be recomposed. Now, if you think about themes/colors - those aren't things that change a lot. And when they change (for example we apply dark theme system-wide) - we do want the entire composition to re-compose so that the new theme values will be applied. So, to avoid possible mistakes - any time you use the `staticCompositionLocalOf{}` function - ask yourself when those values that you are wrapping inside are going to change, and if a possible change should re-compose the whole composition tree. Please let me know if that answered the question, or you are still missing something.
So, changing the values usually won't happen, right? As you mentioned, changing the color values happens when we switch the system them to dark or light. Or changing the shape may be in screen rotation, where we may want to recompose the whole screen to display different layout.... So, isn't the staticCompositionLocalOf always the best way to go with? What could be the use case of a non static version of it? Please forgive me if my question doesn't make sense.
No no, it absolutely makes sense. You want to understand better, which is great. No worries. So, when you change orientation - you don't want the entire composition to recompose. You might want to change only the layout of your current screen that is displayed. To your question: "Isn't the staticCompositionLocalOf always the best way to go with" - the short answer is NO. When you wrap a value inside `staticCompositionLocalOf` you are not telling the composer not to recompose, rather you are telling: "Hey when any value inside this block changes - recompose the whole tree". And that is a very intensive and inefficient thing. You want to avoid that. Hope that makes sense.
No, in the video, it was an example of creating one to show more options. You can still use your theme properties on the built-in composables, like so: Text( modifier = Modifier. background(AppTheme.colorScheme.onPrimary), text = "Example" ) No need to introduce wrappers
@Composable fun AppTheme( isDarkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit ) { val colorScheme = if (isDarkTheme) darkColorScheme else lightColorScheme val rippleIndication = rememberRipple() CompositionLocalProvider( LocalAppColorScheme provides colorScheme, LocalAppTypography provides typography, LocalAppShape provides shape, LocalAppSize provides size, LocalIndication provides rippleIndication, content = content ) } getting error on LocalApp related provides can you help me out
Yes, ofcorse I can help. Could you please elaborate a little bit in more details - what is the issue you encounter? Here is the reference to the repository and the corresponding file, in case it might be helpful: github.com/mitrejcevski/android-devs-app/blob/main/core/view/src/main/java/nl/jovmit/androiddevs/core/view/theme/AppTheme.kt
Why the algorithm has never recommended your channel for me ?
I love your explanations, fast (no stallings), precise, in point, and rich of information, BRAVO 👏👏👏
First - thank you so much for the kind words, and I am glad the content works good for you 🙏
The way the algorithm works is: it recommends videos that the user is more likely to click on, and watch start to end.
They want you to stay on the platform.
For my videos unfortunately, people click off rather soon. And so, since folks don't watch start to end - the algo sees it as a bad video and it won't recommend.
If you want to be notified tho, you can subscribe to the channel and click on the notification bell. That way you'll never miss a video.
Hope that helps 🙏
@@jov_mit Yeah I did activated the notifications. Your content is great don't stop making it 🤟
I definitely won't. Thank you for the encouragement my friend 🙏💯
Thank you for the video, your tutorial helped me a lot to solve the problem that I was facing.
I'm very glad it was helpful for you, and thank you so much for the feedback. I appreciate it a lot 🙏🏻
This is a very great explanation regarding the custom theme in compose. Great job. 👍
Thank you so much, I'm glad it was helpful 🙏🏻
thank you, really great explanation. now i feel confident to create my own themes :D
I'm very glad it ended up helpful for you. Thank you so much for the feedback, I really appreciate it 🙏🏻
Great video bro! It was very easy to follow, and you did a great job at explaining. Subscribed.
Thank you for the feedback mate, glad you found it helpful 🙏💯
Iam learning a lot from this guy. thank you
Thank you for the kind words my friend 🙏🏻❤️
Very well explained. Can I use the same steps for defining a custom theme for Compose Multiplatform project?
Yes, it will work fine.
Could you please elaborate more on what the danger you talked about is at 3:20?
How it can occur and how it an be avoided?
Hi there wave 👋
Sure thing, thanks for the question. Let me try to explain.
There are 2 functions we can use to pass value(s) down the composition: `compositionLocalOf{}` and `staticCompositionLocalOf{}`
When we use the first one, the composer keeps track of the values, and where (in which composable) they are read. Then, when a value changes, the composer will cause recomposition only for the composable that reads the value that changed.
When we use the second function (staticCompositionLocalOf{}) the composer doesn't keep track. When a value changes- the whole composition tree is going to be recomposed.
Now, if you think about themes/colors - those aren't things that change a lot. And when they change (for example we apply dark theme system-wide) - we do want the entire composition to re-compose so that the new theme values will be applied.
So, to avoid possible mistakes - any time you use the `staticCompositionLocalOf{}` function - ask yourself when those values that you are wrapping inside are going to change, and if a possible change should re-compose the whole composition tree.
Please let me know if that answered the question, or you are still missing something.
So, changing the values usually won't happen, right? As you mentioned, changing the color values happens when we switch the system them to dark or light. Or changing the shape may be in screen rotation, where we may want to recompose the whole screen to display different layout....
So, isn't the staticCompositionLocalOf always the best way to go with? What could be the use case of a non static version of it? Please forgive me if my question doesn't make sense.
No no, it absolutely makes sense. You want to understand better, which is great. No worries.
So, when you change orientation - you don't want the entire composition to recompose. You might want to change only the layout of your current screen that is displayed.
To your question: "Isn't the staticCompositionLocalOf always the best way to go with" - the short answer is NO. When you wrap a value inside `staticCompositionLocalOf` you are not telling the composer not to recompose, rather you are telling: "Hey when any value inside this block changes - recompose the whole tree". And that is a very intensive and inefficient thing. You want to avoid that. Hope that makes sense.
So you need to create a wrapper for everysingle ui component in order to use your theme right?
No, in the video, it was an example of creating one to show more options.
You can still use your theme properties on the built-in composables, like so:
Text(
modifier = Modifier.
background(AppTheme.colorScheme.onPrimary),
text = "Example"
)
No need to introduce wrappers
Getting error at 03:35 : Unresolved reference: Unspecified
Check if you have the correct Color import. It should be the one coming from the compose package
@Composable
fun AppTheme(
isDarkTheme: Boolean = isSystemInDarkTheme(),
content: @Composable () -> Unit
) {
val colorScheme = if (isDarkTheme) darkColorScheme else lightColorScheme
val rippleIndication = rememberRipple()
CompositionLocalProvider(
LocalAppColorScheme provides colorScheme,
LocalAppTypography provides typography,
LocalAppShape provides shape,
LocalAppSize provides size,
LocalIndication provides rippleIndication,
content = content
)
}
getting error on LocalApp related provides can you help me out
Yes, ofcorse I can help.
Could you please elaborate a little bit in more details - what is the issue you encounter?
Here is the reference to the repository and the corresponding file, in case it might be helpful: github.com/mitrejcevski/android-devs-app/blob/main/core/view/src/main/java/nl/jovmit/androiddevs/core/view/theme/AppTheme.kt