Skip to content

Conversation

@Frederic789
Copy link

code review Tea Me by Freddy

Copy link
Contributor

@Bansenauer-Cascadia Bansenauer-Cascadia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work on this Freddie. Please make the changes shown in the code and resubmt

Comment on lines +25 to +31
//: Assign each checkbox an EventHandler using a setOnCheckedChangeListener to calls the clickIt function with two parameters
milkCheckBox.setOnClickListener { view: View ->
Toast.makeText(this, "milk check box", Toast.LENGTH_SHORT).show()
}
sugarCheckBox.setOnClickListener { view: View ->
Toast.makeText(this, "sugar check box", Toast.LENGTH_SHORT).show()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please read the TODO comment carefully.
"setOnCheckedChangeListener to calls the clickIt function with two parameters" so if you look at the clickIt function code on line 28 and the setOnCheckedChangeListener requirements, you would write

milkCheckBox.setOnCheckedChangeListener { box:CompoundButton, selected:Boolean -> clickIt(box,selected) }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Toast creation will happen inside the clickIt function

//TODO: Add the word "Love" to the end of every string built
val goodiesString = StringBuilder("Tea with ")
for (goodies in TeaGoodies) {
goodiesString.append(goodies).append(",Love ").append(clickIt(box, selected))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last part of this line append(clickIt(box, selected)) doesn't add anything to the goodiesString. It is not needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants