-
Notifications
You must be signed in to change notification settings - Fork 245
updated: AGP 9 project migration guide #530
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
Open
zamulla
wants to merge
7
commits into
master
Choose a base branch
from
zamulla/agp-9-project-migration
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6e5caee
update: initial for AGP 9 migration
zamulla 3d6528d
update: basic structure of the page
zamulla 32cebc0
update: first modules detailed
zamulla 5128e23
update: done with the bulk of instructions
zamulla e03b11f
update: done, with a couple of todos left up to discussion
zamulla dd65d31
update: change the focus of the intro a little
zamulla 8fb0d15
fix: preciser
zamulla File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,6 +101,7 @@ | |
| <toc-element toc-title="Basic project structure" topic="multiplatform-discover-project.md"/> | ||
| <toc-element toc-title="Advanced project structure" topic="multiplatform-advanced-project-structure.md"/> | ||
| <toc-element toc-title="Project configuration options" topic="multiplatform-project-configuration.md"/> | ||
| <toc-element toc-title="Project configuration options" topic="multiplatform-project-agp-9-migration.md"/> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, I'm not sure if this guide will be discoverable under "Explore project structure" |
||
| </toc-element> | ||
| <toc-element toc-title="Share code"> | ||
| <toc-element topic="multiplatform-share-on-platforms.md"/> | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,7 +68,8 @@ To get started, implement a new `App` composable: | |
|
|
||
| When you run your application and click the button, the hardcoded time is displayed. | ||
|
|
||
| 3. Run the application on the desktop. It works, but the window is clearly too large for the UI: | ||
| 3. Run the application on the desktop (with the **composeApp [jvm]** run configuration). | ||
| It works, but the window is clearly too large for the UI: | ||
|
|
||
| {width=400} | ||
|
|
||
|
|
@@ -77,7 +78,7 @@ To get started, implement a new `App` composable: | |
| ```kotlin | ||
| fun main() = application { | ||
| val state = rememberWindowState( | ||
| size = DpSize(400.dp, 250.dp), | ||
| size = DpSize(400.dp, 350.dp), | ||
| position = WindowPosition(300.dp, 300.dp) | ||
| ) | ||
| Window( | ||
|
|
@@ -94,22 +95,22 @@ To get started, implement a new `App` composable: | |
| Here, you set the title of the window and use the `WindowState` type to give the window an initial size and position on | ||
| the screen. | ||
|
|
||
| > To see your changes in real time in the desktop app, use [Compose Hot Reload](compose-hot-reload.md): | ||
| > 1. In the `main.kt` file, click the **Run** icon in the gutter. | ||
| > 2. Select **Run 'composeApp [hotRunJvm]' with Compose Hot Reload (Beta)**. | ||
| > {width=350} | ||
| > | ||
| > To see the app automatically update, save any modified files (<shortcut>⌘ S</shortcut> / <shortcut>Ctrl+S</shortcut>). | ||
| > | ||
| > Compose Hot Reload is currently in [Beta](https://kotlinlang.org/components-stability.html#stability-levels-explained) so its functionality is subject to change. | ||
| > | ||
| {style="tip"} | ||
|
|
||
| 5. Follow the IDE's instructions to import the missing dependencies. | ||
| 6. Run the desktop application again. Its appearance should improve: | ||
|
|
||
| {width=350} | ||
|
|
||
| > To see your changes in real time in the desktop app, use [Compose Hot Reload](compose-hot-reload.md): | ||
| > 1. In the `main.kt` file, click the **Run** icon in the gutter. | ||
| > 2. Select **Run 'composeApp [hotRunJvm]' with Compose Hot Reload (Beta)**. | ||
| > {width=350} | ||
| > | ||
| > To see the app automatically update, save any modified files (<shortcut>⌘ S</shortcut> / <shortcut>Ctrl+S</shortcut>). | ||
| > | ||
| > Compose Hot Reload is currently in [Beta](https://kotlinlang.org/components-stability.html#stability-levels-explained) so its functionality is subject to change. | ||
| > | ||
| {style="tip"} | ||
|
|
||
| <!-- | ||
| ### Compose Hot Reload demo {initial-collapse-state="collapsed" collapsible="true"} | ||
|
|
||
|
|
@@ -121,7 +122,7 @@ To get started, implement a new `App` composable: | |
| Now let users enter the name of a city to see the time at that location. The simplest way to achieve this is by adding | ||
| a `TextField` composable: | ||
|
|
||
| 1. Replace the current implementation of `App` with the one below: | ||
| 1. Replace the current implementation of `App()` in `commonMain/kotlin/compose.project.demo/App.kt` with the one below: | ||
|
|
||
| ```kotlin | ||
| @Composable | ||
|
|
@@ -168,7 +169,8 @@ The next step is to use the given input to calculate time. To do this, create a | |
| 1. Return to the `App.kt` file and add the following function: | ||
|
|
||
| ```kotlin | ||
| fun currentTimeAt(location: String): String? { | ||
| @OptIn(ExperimentalTime::class) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could we add opt-in on a project level? |
||
| fun currentTimeAt(location: String): String? { | ||
| fun LocalTime.formatted() = "$hour:$minute:$second" | ||
|
|
||
| return try { | ||
|
|
@@ -300,6 +302,7 @@ list. | |
| ```kotlin | ||
| data class Country(val name: String, val zone: TimeZone) | ||
|
|
||
| @OptIn(ExperimentalTime::class) | ||
| fun currentTimeAt(location: String, zone: TimeZone): String { | ||
| fun LocalTime.formatted() = "$hour:$minute:$second" | ||
|
|
||
|
|
@@ -405,7 +408,7 @@ modify the build file. | |
| To support images in your project, you'll need to download image files, store them in the correct directory, and add | ||
| code to load and display them: | ||
|
|
||
| 1. Using an external resource, such as [Flag CDN](https://flagcdn.com/), download flags to match the list of countries | ||
| 1. Download flag images from [Flag CDN](https://flagcdn.com/) to match the list of countries | ||
| you have already created. In this case, these | ||
| are [Japan](https://flagcdn.com/w320/jp.png), [France](https://flagcdn.com/w320/fr.png), [Mexico](https://flagcdn.com/w320/mx.png), [Indonesia](https://flagcdn.com/w320/id.png), | ||
| and [Egypt](https://flagcdn.com/w320/eg.png). | ||
|
|
@@ -419,14 +422,15 @@ code to load and display them: | |
| 4. Update the code in the `commonMain/kotlin/.../App.kt` file to support images: | ||
|
|
||
| ```kotlin | ||
| import compose.project.demo.generated.resources.eg | ||
| import compose.project.demo.generated.resources.fr | ||
| import compose.project.demo.generated.resources.id | ||
| import compose.project.demo.generated.resources.jp | ||
| import compose.project.demo.generated.resources.mx | ||
| import demo.composeapp.generated.resources.jp | ||
| import demo.composeapp.generated.resources.mx | ||
| import demo.composeapp.generated.resources.eg | ||
| import demo.composeapp.generated.resources.fr | ||
| import demo.composeapp.generated.resources.id | ||
|
|
||
| data class Country(val name: String, val zone: TimeZone, val image: DrawableResource) | ||
| data class Country(val name: String, val zone: TimeZone, val image: DrawableResource) | ||
|
|
||
| @OptIn(ExperimentalTime::class) | ||
| fun currentTimeAt(location: String, zone: TimeZone): String { | ||
| fun LocalTime.formatted() = "$hour:$minute:$second" | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Wrong toc-title