google-developer-training / basic-android-kotlin-compose-training-dice-roller

Apache License 2.0
57 stars 49 forks source link

Art Space app: Android Basics in Compose #9

Closed jh115424 closed 2 years ago

jh115424 commented 2 years ago

URL of codelab

In which task and step of the codelab can this issue be found?

Why does my makeText give a red line in the toast? Sorry for all the questions. This is the last one for a while!

Screen Shot 2022-07-09 at 2 22 57 PM

Describe the problem

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions Android Studio version: API version of the emulator:

Additional information Include screenshots if they would be useful in clarifying the problem.

YaerQ commented 2 years ago

What does the error message say?

jh115424 commented 2 years ago

None of the following functions can be called with the arguments supplied.

makeText(Context!, CharSequence!, Int) defined in android.widget.Toast makeText(Context!, Int, Int) defined in android.widget.Toast

Jennifer Hodge

Internet Sales

414-586-5425

Russ Darrow Honda

[cid:599b4539-9c22-4237-9083-38ad800a5c28]https://your.tradeinvalet.com/tdhe0j


From: YaerQ @.> Sent: Saturday, July 9, 2022 4:28 PM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

What does the error message say?

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1179609367, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3FW76QCSTZ4SECZ6MTVTHVI7ANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

YaerQ commented 2 years ago

try

val context = LocalContext.current
            Button(onClick = { Toast.makeText(context,"Button Clicked", Toast.LENGTH_LONG).show()}) {

            }
jh115424 commented 2 years ago

Ok, thanks! I'll try it when I get to Starbucks early tomorrow morning at 6 and let u know! (I go every Wednesday and Sunday morning on my days off to practice😁

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: YaerQ @.> Sent: Saturday, July 9, 2022 6:11:11 PM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

try

val context = LocalContext.current Button(onClick = { Toast.makeText(context,"Button Clicked", Toast.LENGTH_LONG).show()}) {

        }

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1179619469, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3AYSSFIOQSQLYNZFIDVTIBI7ANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

jh115424 commented 2 years ago

well.....the code DID get rid of the red underline under makeText but it still wont make the button display the toast when I click on it. Maybe it is something else I have to do.

hmmmmmm.........well.....the search is on!

Jennifer Hodge

Internet Sales

414-586-5425

Russ Darrow Honda

[cid:43dfa5d0-215d-4404-84bc-022984691bd8]https://your.tradeinvalet.com/tdhe0j


From: YaerQ @.> Sent: Saturday, July 9, 2022 6:11 PM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

try

val context = LocalContext.current Button(onClick = { Toast.makeText(context,"Button Clicked", Toast.LENGTH_LONG).show()}) {

        }

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1179619469, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3AYSSFIOQSQLYNZFIDVTIBI7ANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

YaerQ commented 2 years ago

I tried on my end and it worked. Make sure to replace Toast.makeText(this, with Toast.makeText(context,

jh115424 commented 2 years ago

Hmmmm...OK I'll double check.

I sent u an update in GitHub unless u already saw it.

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: YaerQ @.> Sent: Sunday, July 10, 2022 10:28:37 AM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

I tried on my end and it worked. Make sure to replace Toast.makeText(this, with Toast.makeText(context,

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1179749047, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3DZJFU5DB3SLWO6ZK3VTLT2LANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

jh115424 commented 2 years ago

What kind of button code would i put in the Todo section, other than toast?

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: YaerQ @.> Sent: Sunday, July 10, 2022 10:28:37 AM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

I tried on my end and it worked. Make sure to replace Toast.makeText(this, with Toast.makeText(context,

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1179749047, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3DZJFU5DB3SLWO6ZK3VTLT2LANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

jh115424 commented 2 years ago

Yes! The toast worked. I uploaded on my phone.😁

Now do I use navigation code to get it to click from next to previous?

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: YaerQ @.> Sent: Sunday, July 10, 2022 10:28:37 AM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

I tried on my end and it worked. Make sure to replace Toast.makeText(this, with Toast.makeText(context,

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1179749047, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3DZJFU5DB3SLWO6ZK3VTLT2LANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

YaerQ commented 2 years ago

Now you have to program a way to recompose the UI with a different composition every time you click the button. But that's gonna depend on how you built your composables.

jh115424 commented 2 years ago

Hi Yaer!

Well, I am finally finished with putting my 4 art pieces.....

I found a good combination of codes that work and load properly.

I uploaded both screen shots here, showing my 4 art pics, and I figured out the card view also.

If you cant see them here, look in Github in our chat.

Let me know if you want to see my code.

Now the grand finale......to add the buttons and get them to click to each image!

Since the screenshots are too big, I sent them in the next email!

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: YaerQ @.> Sent: Saturday, July 9, 2022 6:11:11 PM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

try

val context = LocalContext.current Button(onClick = { Toast.makeText(context,"Button Clicked", Toast.LENGTH_LONG).show()}) {

        }

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1179619469, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3AYSSFIOQSQLYNZFIDVTIBI7ANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

jh115424 commented 2 years ago

Hope you like the art I found! It was during business trips to Chicago! Some at my hotel and some outside!

Yours is cool also! 😁

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: YaerQ @.> Sent: Sunday, July 10, 2022 2:13:09 PM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

Now you have to program a way to recompose the UI with a different composition every time you click the button. But that's gonna depend on how you built your composables.

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1179782779, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3AVL6237AAUJMNY2SDVTMOELANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

YaerQ commented 2 years ago

Hi Yaer! Well, I am finally finished with putting my 4 art pieces..... I found a good combination of codes that work and load properly. I uploaded both screen shots here, showing my 4 art pics, and I figured out the card view also. If you cant see them here, look in Github in our chat. Let me know if you want to see my code. Now the grand finale......to add the buttons and get them to click to each image! Since the screenshots are too big, I sent them in the next email! Get Outlook for Androidhttps://aka.ms/AAb9ysg …

Hi That's awesome! Yeah that's the trick. There are so many ways to do things that you will always find a way that works for you, and as long as it loads without any error then its fine 😁. Yes I wouldn't mind checking your code. The art you found looks great, mine are just random images from google since the app wouldn't be published lol.

The buttons is the tricky part, like I mentioned earlier the easiest way is with a when expression and a variable with a "mutableStateOf by remember"

jh115424 commented 2 years ago

yes, I actually got that the when statements!

My issue is do I need to have the navigation code implemented and how I would write the click code in the brackets so it clicks from one to another.

Jennifer Hodge

Internet Sales

414-586-5425

Russ Darrow Honda

[cid:5e5ef0bc-355a-44dd-9055-2ee347053227]https://your.tradeinvalet.com/tdhe0j


From: YaerQ @.> Sent: Friday, July 15, 2022 5:41 AM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

Hi Yaer! Well, I am finally finished with putting my 4 art pieces..... I found a good combination of codes that work and load properly. I uploaded both screen shots here, showing my 4 art pics, and I figured out the card view also. If you cant see them here, look in Github in our chat. Let me know if you want to see my code. Now the grand finale......to add the buttons and get them to click to each image! Since the screenshots are too big, I sent them in the next email! Get Outlook for Androidhttps://aka.ms/AAb9ysg …

Hi That's awesome! Yeah that's the trick. There are so many ways to do things that you will always find a way that works for you, and as long as it loads without any error then its fine 😁. Yes I wouldn't mind checking your code. The art you found looks great, mine are just random images from google since the app wouldn't be published lol.

The buttons is the tricky part, like I mentioned earlier the easiest way is with a when expression and a variable with a "mutableStateOf by remember"

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1185419301, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3AIVDPY2FSTPCY4KRLVUE553ANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

YaerQ commented 2 years ago

Button(onClick = {onNextClick()}, modifier = Modifier.width(100.dp)) { Text(text = "Next") }

I hoisted the onClick to a Parameter I made onNextClick() in the composable. I assigned () -> Unit as the type to that parameter so I can input a lambda function (I think that's what's called). That way when I call the composable in the when expression I can assign different behavior to the button depending on which state the var currentImage by remember {mutableStateOf(1)} is. Remeber that each state represent an image composable. For example for the first image the currentImage state is at 1 for the second the state is 2 and so on. So I want the next button to change it to state 2 and the previous button to change it to state 5 because I have 5 images.

 when (currentImage) {

            1 -> {
                ArtWithArtistCard(
                    artworkTitle = "Too Many Leaves on My Face",
                    artworkArtist = "Leavy Forrest",
                    artworkYear = "(2008)",
                    imageResourceId = R.drawable.image1,
                    imageDescriptionTextId = R.string.app_name,
                    onNextClick = {currentImage = 2},
                    onPreviousClick = {currentImage = 5}
                )
            }

As you can see I passed a lambda expression on the onNextClick and on the onPreviousClick that will set currentImage to 2 when I click the next button and to 5 when I click the previous button. If you notice on state 2 I change the onNextClick and onPreviousClick to 3 and 1 respectively. That way when I press next it will go to state 3 or if I press previous it will go to state 1.
Then I do the same to the other composables changing the button behavior accordingly. And if it's done correctly you should have a loop if you keep pressing the next or previous buttons.

when (currentImage) {

            1 -> {
                ArtWithArtistCard(
                    artworkTitle = "Too Many Leaves on My Face",
                    artworkArtist = "Leavy Forrest",
                    artworkYear = "(2008)",
                    imageResourceId = R.drawable.image1,
                    imageDescriptionTextId = R.string.app_name,
                    onNextClick = {currentImage = 2},
                    onPreviousClick = {currentImage = 5}
                )
            }

            2 -> {
                ArtWithArtistCard(
                    artworkTitle = "Kitty Cat",
                    artworkArtist = "Kat Jennings",
                    artworkYear = "(2018)",
                    imageResourceId = R.drawable.image2,
                    imageDescriptionTextId = R.string.app_name,
                    onNextClick = {currentImage = 3},
                    onPreviousClick = {currentImage = 1}
                )
            }

            3 -> {
                ArtWithArtistCard(
                    artworkTitle = "Are Fish Real?",
                    artworkArtist = "Sean Tunalo",
                    artworkYear = "(2020)",
                    imageResourceId = R.drawable.image3,
                    imageDescriptionTextId = R.string.app_name,
                    onNextClick = {currentImage = 4},
                    onPreviousClick = {currentImage = 2}
                )
            }

            4 -> {
                ArtWithArtistCard(
                    artworkTitle = "Ruining Mom's Garden",
                    artworkArtist = "Potter Green",
                    artworkYear = "(2019)",
                    imageResourceId = R.drawable.image4,
                    imageDescriptionTextId = R.string.app_name,
                    onNextClick = {currentImage = 5},
                    onPreviousClick = {currentImage = 3}
                )
            }

            5 -> {
                ArtWithArtistCard(
                    artworkTitle = "It's not Even Raining",
                    artworkArtist = "Rihanna",
                    artworkYear = "(2010)",
                    imageResourceId = R.drawable.image5,
                    imageDescriptionTextId = R.string.app_name,
                    onNextClick = {currentImage = 1},
                    onPreviousClick = {currentImage = 4}
                )
            }
        }
jh115424 commented 2 years ago

oooh, ok! That is what I kind of thought....but wanted to be sure!

And I would put that at the bottom of the code for each art piece, right?

Jennifer Hodge

Internet Sales

414-586-5425

Russ Darrow Honda

[cid:5b415168-5b2f-45a7-8293-d86cd4ae0f05]https://your.tradeinvalet.com/tdhe0j


From: YaerQ @.> Sent: Friday, July 15, 2022 12:36 PM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

Button(onClick = {onNextClick()}, modifier = Modifier.width(100.dp)) { Text(text = "Next") }

I hoisted the onClick to a Parameter I made onNextClick() in the composable. I assigned () -> Unit as the type to that parameter so I can input a lambda function (I think that's what's called). That way when I call the composable in the when expression I can assign different behavior to the button depending on which state the var currentImage by remember {mutableStateOf(1)} is. Remeber that each state represent an image composable. For example for the first image the currentImage state is at 1. So I want the next button to change it to state 2 and the previous button to change it to state 5 because I have 5 images.

when (currentImage) {

        1 -> {
            ArtWithArtistCard(
                artworkTitle = "Too Many Leaves on My Face",
                artworkArtist = "Leavy Forrest",
                artworkYear = "(2008)",
                imageResourceId = R.drawable.image1,
                imageDescriptionTextId = R.string.app_name,
                onNextClick = {currentImage = 2},
                onPreviousClick = {currentImage = 5}
            )
        }

As you can see I passed a lambda expression on the onNextClick and on the onPreviousClick that will set currentImage to 2 when I click the next button and to 5 when I click the previous button. Then I do the same to the other composables chaning the button behavior accordingly.

when (currentImage) {

        1 -> {
            ArtWithArtistCard(
                artworkTitle = "Too Many Leaves on My Face",
                artworkArtist = "Leavy Forrest",
                artworkYear = "(2008)",
                imageResourceId = R.drawable.image1,
                imageDescriptionTextId = R.string.app_name,
                onNextClick = {currentImage = 2},
                onPreviousClick = {currentImage = 5}
            )
        }

        2 -> {
            ArtWithArtistCard(
                artworkTitle = "Kitty Cat",
                artworkArtist = "Kat Jennings",
                artworkYear = "(2018)",
                imageResourceId = R.drawable.image2,
                imageDescriptionTextId = R.string.app_name,
                onNextClick = {currentImage = 3},
                onPreviousClick = {currentImage = 1}
            )
        }

        3 -> {
            ArtWithArtistCard(
                artworkTitle = "Are Fish Real?",
                artworkArtist = "Sean Tunalo",
                artworkYear = "(2020)",
                imageResourceId = R.drawable.image3,
                imageDescriptionTextId = R.string.app_name,
                onNextClick = {currentImage = 4},
                onPreviousClick = {currentImage = 2}
            )
        }

        4 -> {
            ArtWithArtistCard(
                artworkTitle = "Ruining Mom's Garden",
                artworkArtist = "Potter Green",
                artworkYear = "(2019)",
                imageResourceId = R.drawable.image4,
                imageDescriptionTextId = R.string.app_name,
                onNextClick = {currentImage = 5},
                onPreviousClick = {currentImage = 3}
            )
        }

        5 -> {
            ArtWithArtistCard(
                artworkTitle = "It's not Even Raining",
                artworkArtist = "Rihanna",
                artworkYear = "(2010)",
                imageResourceId = R.drawable.image5,
                imageDescriptionTextId = R.string.app_name,
                onNextClick = {currentImage = 1},
                onPreviousClick = {currentImage = 4}
            )
        }
    }

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1185758253, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3FXLDZFPU4HRE3KKNTVUGOQVANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

YaerQ commented 2 years ago

It depends on the order you wrote the properties in your composable

jh115424 commented 2 years ago

hmmmmm......for some reason I get a unresolved reference for the onNextClick, even though I have it up in my string at the top...

I'll keep trying things.

I sent a screenshot in this email.

Jennifer Hodge

Internet Sales

414-586-5425

Russ Darrow Honda

[cid:5205c7c9-9847-4187-b4e3-cb902eab3625]https://your.tradeinvalet.com/tdhe0j


From: YaerQ @.> Sent: Friday, July 15, 2022 5:00 PM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

It depends on the order you wrote the properties in your composable

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1185980715, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3HQBYWTHDFKRJ54IDLVUHNRXANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

YaerQ commented 2 years ago

I can't see the screenshot. Make sure in the button onClick to write it as onNextClick() with the parentesis

jh115424 commented 2 years ago

Ok, I'll send in github...

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: YaerQ @.> Sent: Saturday, July 16, 2022 5:05:30 PM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

I can't see the screenshot. Make sure in the button onClick to write it as onNextClick() with the parentesis

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1186304886, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3BVZOSP5NANXSCISVDVUMW2VANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

jh115424 commented 2 years ago

I just sent it. it is reply to another email in github

Jennifer Hodge

Internet Sales

414-586-5425

Russ Darrow Honda

[cid:47d6cfca-8375-4060-88bd-62adfe562f12]https://your.tradeinvalet.com/tdhe0j


From: YaerQ @.> Sent: Saturday, July 16, 2022 5:05 PM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

I can't see the screenshot. Make sure in the button onClick to write it as onNextClick() with the parentesis

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1186304886, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3BVZOSP5NANXSCISVDVUMW2VANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

YaerQ commented 2 years ago

No, sorry still can't find the screenshot, you can copy paste the code here using the add code button <> (or crtl+e) which will be easier to check too.

jh115424 commented 2 years ago

I sent it.

I also sent an issue about the alignment in a new question in Github.

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: YaerQ @.> Sent: Saturday, July 16, 2022 5:23:43 PM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

No, sorry still can't find the screenshot, you can copy paste the code here using the add code button <> (or crtl+e) which will be easier to check too.

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1186309922, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3BO2Z6P4XRJA34UHN3VUMY67ANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

YaerQ commented 2 years ago

I'm sorry but where are you sending it? If you are replying to the github notification email with the code that wont work you have to post it here directly.

jh115424 commented 2 years ago

Button(onClick = {onNextClick()}, modifier = Modifier.width(100.dp)

){

Text(text = "Next")

}

onNextClick comes up red and says, "unresolved reference", even though I have it in my when statements.

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: YaerQ @.> Sent: Sunday, July 17, 2022 3:33:06 PM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

I'm sorry but where are you sending it? If you are replying to the github notification email with the code that wont work you have to post it here directly.

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1186602680, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3EGCMJ2O5VYFFUPT73VURUYFANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

YaerQ commented 2 years ago

Did you add onNextClick: () - > Unit as a property of the composable function you are using?

Ex.

@Composable
fun ArtistCard (onNextClick: () -> Unit ) {

....

}

This video should explain it more clearly https://www.youtube.com/watch?v=mymWGMy9pYI It explains how to save and change state and state hoisting.

jh115424 commented 2 years ago

The is the Composable it is under......

would I do a composable JUST for the Button, because when I put the onClick in the parenthesis for fun ArtSpaceAppPreview, it turned the @Preview(showBackground = true red.

@Preview(showBackground = true) @Composable fun ArtSpaceAppPreview() { ArtSpaceAppTheme { Column { Row(modifier = Modifier .shadow(elevation = 5.dp) .border(width = 4.dp, color = Color.Blue) .padding(15.dp)) { Image( painter = painterResource(R.drawable._0220621_204734), contentDescription = null) } Card( modifier = Modifier .fillMaxWidth() .padding(15.dp) .clickable { }, elevation = 10.dp

        ) {
            Column(
                modifier = Modifier.padding(15.dp)

Jennifer Hodge

Internet Sales

414-586-5425

Russ Darrow Honda

[cid:56fd4bc4-76f3-4217-8488-94f11daa210d]https://your.tradeinvalet.com/tdhe0j


From: YaerQ @.> Sent: Sunday, July 17, 2022 7:38 PM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

Did you add onNextClick: () - > Unit as a property of the composable function you are using?

Ex.

@Composable fun ArtistCard (onNextClick: () -> Unit ) {

....

}

This video should explain it more clearly

https://www.youtube.com/watch?v=mymWGMy9pYI It explains how to save and change state and state hoisting.

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1186645667, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3EWFBNV2DFA65PYJP3VUSRQHANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

YaerQ commented 2 years ago

Remember that @Preview(showBackground = true) @Composable fun ArtSpaceAppPreview() { .... }

is just to let you see the preview on Android Studio and test the layout, you don't want any final code in there because it wont show if you run it in the emulator or an actual device. Anything you want to display should be between the Set Content brackets at the top of the file

You can do a composable just for the buttons if you want but it shouldn't be necessary. Can you post all the code so it's easier to to figure out whats going on?

jh115424 commented 2 years ago

this is what I have so far for The Button...and also still red line under Alignment.BottomStart, even though I have it under Row.

@Composable

fun Button(onNextClick: () -> Unit){ Row( horizontalArrangement = Arrangement.Start, verticalAlignment = Alignment.CenterVertically, modifier = Modifier .width(100.dp) .weight(1f) .align(alignment = Alignment.BottomStart) ){ Button(onClick = {onNextClick }, modifier = Modifier.width(100.dp)) { Text(text = "Next") } Button(onClick = { }) {

}

}

}

Jennifer Hodge

Internet Sales

414-586-5425

Russ Darrow Honda

[cid:dec0a578-32af-4a6c-9a97-0e80e195d0ca]https://your.tradeinvalet.com/tdhe0j


From: YaerQ @.> Sent: Monday, July 18, 2022 2:46 PM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

Remember that @Previewhttps://github.com/Preview(showBackground = true) @composablehttps://github.com/composable fun ArtSpaceAppPreview() { .... }

is just to let you see the preview on Android Studio and test the layout, you don't want any final code in there because it wont show if you run it in the emulator or an actual device. Anything you want to display should be between the Set Content brackets at the top of the file

You can do a composable just for the buttons if you want but it shouldn't be necessary. Can you post all the code so it's easier to to figure out whats going on?

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1188229317, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3ECTHE7Y54VMC2YSILVUWX7TANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

YaerQ commented 2 years ago

Ok you should give the onNextClick: () -> Unit property to the parent composable not directly to the button. In the button then you pass that property to the onClick like this onClick = {onNextClick()} the () are important if you pass onNextClick without them it wont work.

jh115424 commented 2 years ago

uh oh.....

I think the parent composable is mixed with the code of the first Art image.

What can I do to unmix it?

@Preview(showBackground = true) @Composable fun ArtSpaceAppPreview() { ArtSpaceAppTheme { Column { Row(modifier = Modifier .shadow(elevation = 5.dp) .border(width = 4.dp, color = Color.Blue) .padding(15.dp)) { Image( painter = painterResource(R.drawable._0220621_204734), contentDescription = null) } Card( modifier = Modifier .fillMaxWidth() .padding(15.dp) .clickable { }, elevation = 10.dp

        ) {
            Column(
                modifier = Modifier.padding(15.dp)

            ) {
                Text(text = "Lady Of Glamour")
                Spacer(modifier = Modifier
                    .height(20.dp)
                    .padding(15.dp)

Jennifer Hodge

Internet Sales

414-586-5425

Russ Darrow Honda

[cid:b054344e-8d74-4540-b96a-9d7290890b3f]https://your.tradeinvalet.com/tdhe0j


From: YaerQ @.> Sent: Monday, July 18, 2022 3:05 PM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

Ok you should give the onNextClick: () -> Unit property to the parent composable not directly to the button. In the button then you pass that property to the onClick like this onClick = {onNextClick()}

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1188248000, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3GFSNHKPEM4F35C2QDVUW2H3ANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

YaerQ commented 2 years ago

You may want to reorganize the code then: MainApp Composable -> The Main parent where the component composables will go Component Composable -> where the different element composble will go... Image, Text, Button. You want to give the properties to this one.

then call the main composable inside the Set Content, and the Preview. If you check out the code I posted on the other thread the structure I used is there.

jh115424 commented 2 years ago

Thx so much!

I can't believe I did that!

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: YaerQ @.> Sent: Monday, July 18, 2022 4:08:26 PM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

You may want to reorganize the code then: MainApp Composable -> The Main parent where the component composables will go Component Composable -> where the different element composble will go... Image, Text, Button. You want to give the properties to this one.

then call the main composable inside the Set Content, and the Preview. If you check out the code I posted the structure I used is there.

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1188312075, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3C3OVLFG6NK6HAUU23VUXBUVANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

jh115424 commented 2 years ago

Now I would do a new composable for each picture, right? NOT with preview, just regular composable?

I got the main one at the top with the preview with no code!

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: YaerQ @.> Sent: Monday, July 18, 2022 4:08:26 PM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

You may want to reorganize the code then: MainApp Composable -> The Main parent where the component composables will go Component Composable -> where the different element composble will go... Image, Text, Button. You want to give the properties to this one.

then call the main composable inside the Set Content, and the Preview. If you check out the code I posted the structure I used is there.

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1188312075, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3C3OVLFG6NK6HAUU23VUXBUVANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

YaerQ commented 2 years ago

No, make one composable with the state hoisting and re use it for the different pictures.

In the preview just call the main composable so you can preview it like this

@Preview(showBackground = true)
@Composable
fun ArtSpaceAppPreview() {
    ArtSpaceAppTheme {
        NameOfYourMainComposable()
    }
}
jh115424 commented 2 years ago

ok, so I just repeat that one main composable for each picture shown below, or something similar to it right?

Jennifer Hodge

Internet Sales

414-586-5425

Russ Darrow Honda

[cid:b7b1fcbf-c95e-4dd3-b978-c2cd0dfd50f1]https://your.tradeinvalet.com/tdhe0j


From: YaerQ @.> Sent: Monday, July 18, 2022 11:07 PM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

No, make one composable with the state hoisting and re use it for the different pictures.

In the preview just call the main composable so you can preview it like this

@Preview(showBackground = true) @Composable fun ArtSpaceAppPreview() { ArtSpaceAppTheme { NameOfYourMainComposable() } }

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1188571872, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3F7FR5NTO6Y6NLCNFLVUYSYRANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

YaerQ commented 2 years ago

Yes, if you hoist the state meaning if you add the information you need as properties to the composable function you can re use the composable.

What are those properties? Well, you need an image, the image description (for screen readers accessibility) the art name, the artist name, the year it was created/finished, and the function of the button. So your coposable function should look like this: (Remember you can call the properties however you want, the names I use here are just an example same with the layout of the composable. Whats Important is the type you assign them and the order because when you use the composable it will ask the values for the properties in the same order you typed them.)

@Composable
fun ComponentComposable ( artImageId: Int, artDescriptionId: String , artName: String, artistName: String, artYear: String, onNextClick: () - > Unit, onPreviousClick: () - >) {

Column {
Image(
       painter = painterResource(artImageId),   //Here you pass the property you created instead of the image resource directly
       contentDescription = stringResource(artDescriptionId), //Here you pass the artDescription property
       contentScale = ContentScale.FillWidth,
      modifier = Modifier
      .padding(36.dp)
      .fillMaxWidth()
     )

//You do the same for the text and the buttons

Text(
         text = artistName,    // Pass the artistName property
         fontSize = artistFontSize,
         fontWeight = FontWeight.Bold,
         modifier = Modifier.padding(end = 4.dp)
         )

        Text(
                text = artYear, // Pass the artYear property 
                fontSize = 16.dp
       )
                                    //Pass the onNextClick lambda here
Button(onClick = { onNextClick() }, modifier = Modifier.width(100.dp)) {
                Text(text = "Next")
            }

}       

Now you can call this ComponentComposable as many times you want and just pass the values the properties need. For example:

@Composable
fun MainApp () {

ComponentComposable (
            artImageId = R.drawable.image1 // or the name you gave the image file
            artDescriptionId = "Description of the image"
            artName = "Name of the piece"
            artistName = "Name of the Artist"
            artYear = "Art Year"
            onNextClick = { variable = 2 }  // here you pass the function you want the button to have.  in this case it will set the variable          
                                                          to 2 when you click the button.
            onPreviousClick = {5}  //same as onClick in this case it will set the variable to 5 so it goes to the last image (if you only have              
                                              5 images) 
)

// for the second image and the third etc etc you just call the ComponentComposable  again and pass the information for the respective image. 

ComponentComposable (
            artImageId = R.drawable.image2
            artDescriptionId = "Description of the second image"
            artName = "Name of the second piece"
            artistName = "Name of the second Artist"
            artYear = "Art Year of the second image"
            onNextClick = { variable = 3 }            
            onPreviousClick = {variable = 1}                                                   
) 

}

if you used when then it should look like:

@Composable
fun MainComposable() {

when (variable) { 

1 - >  ComponentComposable (
            artImageId = R.drawable.image1 // or the name you gave the image file
            artDescriptionId = "Description of the image"
            artName = "Name of the piece"
            artistName = "Name of the Artist"
            artYear = "Art Year"
            onNextClick = { variable = 2 }  // here you pass the function you want the button to have.  in this case it will set the variable to 2 when you click the button.
            onPreviousClick = {5}  //same as onClick in this case it will set the variable to 5 so it goes to the last image (if you only have 5 images) 
)

2 - > ComponentComposable etc etc...
jh115424 commented 2 years ago

this is so helpful! You have no idea! It is making more sense now!

thx a bunch! πŸ™‚

Jennifer Hodge

Internet Sales

414-586-5425

Russ Darrow Honda

[cid:1b226ad8-feec-4d82-9807-9c5df0960c30]https://your.tradeinvalet.com/tdhe0j


From: YaerQ @.> Sent: Tuesday, July 19, 2022 11:13 AM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

Yes, if you hoist the state meaning if you add the information you need as properties to the composable function you can re use the composable.

What are those properties? Well, you need an image, the image description (for screen readers accessibility) the art name, the artist name, the year it was created/finished, and the function of the button. So your coposable function should look like this: (Remember you can call the properties however you want, the names I use here are just an example same with the layout of the composable. Whats Important is the type you assign them and the order because when you use the composable it will ask the values for the properties in the same order you typed them.)

@Composable fun ComponentComposable ( artImageId: Int, artDescriptionId: String , artName: String, artistName: String, artYear: String, onNextClick: () - > Unit, onPreviousClick: () - >) {

Column { Image( painter = painterResource(artImageId), //Here you pass the property you created instead of the image resource directly contentDescription = stringResource(artDescriptionId), //Here you pass the artDescription property contentScale = ContentScale.FillWidth, modifier = Modifier .padding(36.dp) .fillMaxWidth() )

//You do the same for the text and the buttons

Text( text = artistName, // Pass the artistName property fontSize = artistFontSize, fontWeight = FontWeight.Bold, modifier = Modifier.padding(end = 4.dp) )

    Text(
            text = artYear, // Pass the artYear property
            fontSize = 16.dp
   )
                                //Pass the onNextClick lambda here

Button(onClick = { onNextClick() }, modifier = Modifier.width(100.dp)) { Text(text = "Next") }

}

Now you can call this ComponentComposable as many times you want and just pass the values the properties need. For example:

@Composable fun MainApp () {

ComponentComposable ( artImageId = R.drawable.image1 // or the name you gave the image file artDescriptionId = "Description of the image" artName = "Name of the piece" artistName = "Name of the Artist" artYear = "Art Year" onNextClick = { variable = 2 } // here you pass the function you want the button to have. in this case it will set the variable to 2 when you click the button. onPreviousClick = {5} //same as onClick in this case it will set the variable to 5 so it goes to the last image (if you only have 5 images) )

// for the second image and the third etc etc you just call the ComponentComposable again and pass the information for the respective image.

ComponentComposable ( artImageId = R.drawable.image2 artDescriptionId = "Description of the second image" artName = "Name of the second piece" artistName = "Name of the second Artist" artYear = "Art Year of the second image" onNextClick = { variable = 3 } onPreviousClick = {variable = 1} )

}

if you used when then it should look like:

@Composable fun MainComposable() {

when (variable) {

1 - > ComponentComposable ( artImageId = R.drawable.image1 // or the name you gave the image file artDescriptionId = "Description of the image" artName = "Name of the piece" artistName = "Name of the Artist" artYear = "Art Year" onNextClick = { variable = 2 } // here you pass the function you want the button to have. in this case it will set the variable to 2 when you click the button. onPreviousClick = {5} //same as onClick in this case it will set the variable to 5 so it goes to the last image (if you only have 5 images) )

2 - > ComponentComposable etc etc...

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1189275257, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3HWPOGHPBRKTSIDCSDVU3H37ANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

YaerQ commented 2 years ago

No problem! πŸ™‚

jh115424 commented 2 years ago

ok, now don't laugh! ( well, you can laugh, because I laughed also. lol)

I started rearranging everything, and I got the 1st image, so I know I am on the right track, buuuuuuuut....it is really tiny.

It is the same code I used originally for the 1st image I showed you......dont know what I am missing.

@Composable

fun ArtistWithCard(artTitle: String, artArtists: String, artYear: String, imageResource: Int, imageDescriptionTextId: Int, onNextClick: () -> Unit, onPreviousClick: () -> Unit ) { val artistsFontSize = 14.sp

Column(
    modifier = Modifier.fillMaxSize(),
    horizontalAlignment = Alignment.CenterHorizontally,
    verticalArrangement = Arrangement.SpaceBetween
){
    Image(painter = painterResource(R.drawable._0220621_204734),
        contentDescription =null,
        modifier = Modifier
            .shadow(elevation = 20.dp)
            .border(width = 4.dp, color = Color.Blue)
            .size(15.dp)
    )

   }
}

Jennifer Hodge

Internet Sales

414-586-5425

Russ Darrow Honda

[cid:d761e740-54e4-4141-9a1b-543bc73a545b]https://your.tradeinvalet.com/tdhe0j


From: YaerQ @.> Sent: Tuesday, July 19, 2022 12:08 PM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

No problem! πŸ™‚

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1189344035, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3AK47ZYG7G7732DOMTVU3OJRANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

jh115424 commented 2 years ago

ok, this one I changed a little, but my image is still really small. I dont get it.

you can compare this one and the last I sent before this one

fun ArtistWithCard(artTitle: String, artArtists: String, artYear: String, imageResource: Int, imageDescriptionTextId: Int, onNextClick: () -> Unit, onPreviousClick: () -> Unit ) { val artistsFontSize = 14.sp

Column(
    modifier = Modifier.fillMaxSize(),
    horizontalAlignment = Alignment.CenterHorizontally,
    verticalArrangement = Arrangement.SpaceBetween
){
   Surface(
       modifier = Modifier
           .border(width = 4.dp, color = Color.Blue),
       shape = RectangleShape,
       elevation = 5.dp
   ) {
       Image(painter = painterResource(R.drawable._0220621_204734),
            contentDescription =null,
            modifier = Modifier
             .shadow(elevation = 20.dp)
             .border(width = 4.dp, color = Color.Blue)
            .size(15.dp)
          )

   }

Jennifer Hodge

Internet Sales

414-586-5425

Russ Darrow Honda

[cid:90340005-5a17-42f2-9a7a-f95eeb0a0b38]https://your.tradeinvalet.com/tdhe0j


From: YaerQ @.> Sent: Tuesday, July 19, 2022 12:08 PM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

No problem! πŸ™‚

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1189344035, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3AK47ZYG7G7732DOMTVU3OJRANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

YaerQ commented 2 years ago

Can you send all the code? From the Import to the last line on the bottom. It would make it easier to check whats wrong.

jh115424 commented 2 years ago

Yes, I figured it out! Its back to normal!

I kept working with it!

Thx!

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: YaerQ @.> Sent: Wednesday, July 20, 2022 12:09:28 AM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

Can you send all the code? From the Import to the last line on the bottom. It would make it easier to check whats wrong.

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1189835288, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3B7ADKCTJFPER26FTLVU6CYRANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

jh115424 commented 2 years ago

Hi Yaer! Hope your having a great weekend!

Well I am about finished with the 1st art piece after the revisions....finally!

I forgot one thing....how do I add space UNDER the card so I can put the buttons?

[cid:fcd483d3-baaa-473f-b995-d28d6eb1bdaa]

Jennifer Hodge

Internet Sales

414-586-5425

Russ Darrow Honda

[cid:213eed01-1c6e-464c-9737-596f42af664a]https://your.tradeinvalet.com/tdhe0j


From: YaerQ @.> Sent: Wednesday, July 20, 2022 12:09 AM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

Can you send all the code? From the Import to the last line on the bottom. It would make it easier to check whats wrong.

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1189835288, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3B7ADKCTJFPER26FTLVU6CYRANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

jh115424 commented 2 years ago

nevermind.....I got it! πŸ™‚

Jennifer Hodge

Internet Sales

414-586-5425

Russ Darrow Honda

[cid:75f614c8-8aca-4c0f-9ddb-1d365c504fd0]https://your.tradeinvalet.com/tdhe0j


From: YaerQ @.> Sent: Wednesday, July 20, 2022 12:09 AM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

Can you send all the code? From the Import to the last line on the bottom. It would make it easier to check whats wrong.

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1189835288, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3B7ADKCTJFPER26FTLVU6CYRANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

YaerQ commented 2 years ago

Either with a spacer or padding

YaerQ commented 2 years ago

Oh I missed the post saying you got it. Glad you got it! πŸ™‚

jh115424 commented 2 years ago

thanks! Great news......I am FINISHED, and the art pieces change back and forth successfully in the Interactive modeπŸ˜€, BUUUUUTTTT, it gives a error when I try to upload it to my phone.😩

There are no errors in the code or anything. I don't know what they mean by "Duplicate class.

Here is the screen shot.

Jennifer Hodge

[cid:6f3015b7-d240-4317-809f-6a5038dc8666]Internet Sales

414-586-5425

Russ Darrow Honda

[cid:56875bbf-4221-40bb-a459-572efeae477d]https://your.tradeinvalet.com/tdhe0j


From: YaerQ @.> Sent: Sunday, July 24, 2022 8:02 AM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

Oh I missed the post saying you got it. Glad you got it! πŸ™‚

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1193314078, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3FJK2LWRFX3VMSQLLLVVU5GBANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

jh115424 commented 2 years ago

nevermind, figured out the last issue! I had a duplicate line in the module gradles

Jennifer Hodge

Internet Sales

414-586-5425

Russ Darrow Honda

[cid:413045d7-7518-4f6f-9f23-30a264348f6f]https://your.tradeinvalet.com/tdhe0j


From: YaerQ @.> Sent: Sunday, July 24, 2022 8:02 AM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

Oh I missed the post saying you got it. Glad you got it! πŸ™‚

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1193314078, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3FJK2LWRFX3VMSQLLLVVU5GBANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.

jh115424 commented 2 years ago

So, what regular Kotlin (non compose) projects are you working on?

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: YaerQ @.> Sent: Sunday, July 24, 2022 8:01:34 AM To: google-developer-training/basic-android-kotlin-compose-training-dice-roller @.> Cc: Jennifer Hodge @.>; Author @.> Subject: Re: [google-developer-training/basic-android-kotlin-compose-training-dice-roller] Art Space app: Android Basics in Compose (Issue #9)

CAUTION: External Sender

Either with a spacer or padding

β€” Reply to this email directly, view it on GitHubhttps://github.com/google-developer-training/basic-android-kotlin-compose-training-dice-roller/issues/9#issuecomment-1193313950, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXNC3DK5BF6Z62REYDORTDVVU5C5ANCNFSM53DZ4HSA. You are receiving this because you authored the thread.Message ID: @.***>

CONFIDENTIALITY NOTICE: This electronic mail transmission and any attachments are confidential and may be privileged. They should be read or retained only by the intended recipient. If you have received this transmission in error, please notify the sender immediately and delete the transmission from your system.