-
Notifications
You must be signed in to change notification settings - Fork 9
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
Setup Jetpack Compose #406
Conversation
This fixes a bug where the help articles list couldn't be refreshed correctly
The colour schemes were auto-generated by the [Material Theme Builder using the custom preset](https://m3.material.io/theme-builder#/custom), with the following colours: * Primary: `#8d5fff` * Secondary: `#c0b1c8` * Tertiary: `#c87994` * Neutral: `#938f94` This commit also updates the `StudyBuddyTheme` composable's parameters to allow for: * whether dynamic colours should be used (defaults to `true` on devices that support it) * whether to use the new M3 colour schemes (defaults to `true`)
The `StudyBuddyTheme` composable should be used instead
* Adds a single unit test to verify that the Baloo 2 font is used for all typography styles * Remove example unit test
* Accompanist: `0.30.0` -> `0.30.1` * Compose BoM: `2023.03.00` -> `2023.04.00-beta01.1`
In preparation of an upcoming Compose 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.
Apart from the missing PendingIntent flags which I expect will actually crash on newer OS versions, good stuff dude!
package com.edricchan.studybuddy.library | ||
|
||
plugins { | ||
id("com.edricchan.studybuddy.library.android") |
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 can be version cataloged 👀
|
||
android { | ||
buildFeatures.compose = true | ||
composeOptions.kotlinCompilerExtensionVersion = "1.4.7" |
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.
version catalog? 👀
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.
Version catalogs aren't natively supported in convention plugins AFAICT - see gradle/gradle#15383
@@ -14,7 +14,7 @@ class GitHubHelpApiImpl @Inject constructor( | |||
private val http: HttpClient | |||
) : HelpApi { | |||
override suspend fun fetchHelpArticles(): List<HelpArticle> { | |||
return http.use { it.get(urlHelpFeatured).body<HelpArticles>().articles } | |||
return http.get(urlHelpFeatured).body<HelpArticles>().articles |
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.
Any plans for error handling?
*/ | ||
@Composable | ||
fun StudyBuddyTheme( | ||
context: Context = LocalContext.current, |
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 see why a context is needed as a parameter here, there's nothing that you can pass in that'll actually affect dynamicDarkColorScheme/dynamicLightColorScheme
, right?
|
||
private val defaultTypography = Typography() | ||
|
||
val StudyBuddyTypography = Typography( |
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.
oh this is unfortunate 🙃 hopefully they fix it soon!
|
||
import androidx.compose.ui.graphics.Color | ||
|
||
val md_theme_light_primary = Color(0xFF6C39DC) |
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.
Respect for straight up copying all the variable names too 😂
@@ -0,0 +1,38 @@ | |||
plugins { | |||
id("com.edricchan.studybuddy.library.android-compose") |
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.
version catalog 😛
...idgets/compose/src/main/kotlin/com/edricchan/studybuddy/ui/widgets/compose/BackIconButton.kt
Show resolved
Hide resolved
...idgets/compose/src/main/kotlin/com/edricchan/studybuddy/ui/widgets/compose/BackIconButton.kt
Show resolved
Hide resolved
class ExampleUnitTest { | ||
@Test | ||
fun addition_isCorrect() { | ||
assertEquals(4, 2 + 2) |
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.
good test 👍
* Nuke `Defaults` object as we aren't passing in any custom tooltip/icon data * Require `onClick` to be specified * Improve preview
* Address comments from #406 * Mark `moreExpanded` as a save-able
This PR is a preliminary requirement to migrating the whole project to Jetpack Compose (at some point...)
See #368 for more info on the progress
Additions
This PR adds the following changes:
StudyBuddyTheme
+StudyBuddyCompatTheme
- the latter should be used for existing compatibility with the current app's theme)SetSystemBarsColor
composable for insets support (this just sets the colour for the status bar/navigation bar):ui:widgets:views
)GitHubHelpApiImpl
where the help articles weren't refreshed correctly (this is becauseHttpClient.use
actually closes the client once it's called, as per the implementation ofAutoClosable.use
from Kotlin stdlib, so it won't be usable again without creating a newHttpClient
instance, and as we're sharing the instance throughout the app, hence the issue)