Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ class MainActivity : AppCompatActivity() {
lemonCheckBox = findViewById(R.id.lemonBox)

//TODO: Assign each checkbox an EventHandler using a setOnCheckedChangeListener to calls the clickIt function with two parameters

milkCheckBox.setOnCheckedChangeListener { buttonView, isChecked ->
clickIt(buttonView, isChecked)
}
sugarCheckBox.setOnCheckedChangeListener { buttonView, isChecked ->
clickIt(buttonView, isChecked)
}
lemonCheckBox.setOnCheckedChangeListener { buttonView, isChecked ->
clickIt(buttonView, isChecked)
}
}

fun clickIt(box: CompoundButton, selected: Boolean ) {
Expand All @@ -36,6 +44,7 @@ class MainActivity : AppCompatActivity() {
for (goodies in TeaGoodies) {
goodiesString.append(goodies).append(", ")
}
goodiesString.append("Love")
//Display the string as a temporary popup - called a "Toast"
Toast.makeText(this@MainActivity, goodiesString, Toast.LENGTH_SHORT).show()
}
Expand Down
41 changes: 32 additions & 9 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- TODO : Change the Linear Layout to ConstraintLayout -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
Expand All @@ -14,34 +15,56 @@
android:id="@+id/headingText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tea Me"
android:textSize="48dp"
/>
android:layout_marginStart="48dp"
android:layout_marginTop="32dp"
android:elevation="5dp"
android:text="@string/tea_me"
android:textSize="48sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="TextContrastCheck" />

<CheckBox
android:id="@+id/milkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Milk" />
android:layout_marginTop="32dp"
android:elevation="5dp"
android:text="@string/milk"
app:layout_constraintStart_toStartOf="@id/headingText"
app:layout_constraintTop_toBottomOf="@id/headingText"
tools:ignore="TextContrastCheck" />

<CheckBox
android:id="@+id/sugarBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sugar" />
android:elevation="5dp"
android:text="@string/sugar"
app:layout_constraintStart_toStartOf="@id/headingText"
app:layout_constraintTop_toBottomOf="@id/milkBox"
tools:ignore="TextContrastCheck" />

<CheckBox
android:id="@+id/lemonBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Lemon" />
android:elevation="5dp"
android:text="@string/lemon"
app:layout_constraintStart_toStartOf="@id/headingText"
app:layout_constraintTop_toBottomOf="@id/sugarBox"
tools:ignore="TextContrastCheck" />

<ImageView
android:id="@+id/teaImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/tea"
android:contentDescription="@string/image_of_tea_being_poured"
android:scaleType="centerCrop"
android:src="@drawable/tea" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ImageContrastCheck" />


</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
10 changes: 5 additions & 5 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary">#8DF5E3</color>
<color name="secondary">#FF5252</color>
<color name="secondary_dark">#9C1A1A</color>
<color name="primary_dark">#34A192</color>
<color name="primary">#795548</color>
<color name="secondary">#795548</color>
<color name="secondary_dark">#5D4037</color>
<color name="primary_dark">#5D4037</color>
<color name="primary_light">#D7CCC8</color>
<color name="accent">#FF5252</color>
<color name="accent">#795548</color>
<color name="accent_mute">#D7CCC8</color>
<color name="primary_text">#212121</color>
<color name="secondary_text">#757575</color>
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<resources>
<string name="app_name">Tea Me</string>
<string name="tea_me">Tea Me</string>
<string name="milk">Milk</string>
<string name="lemon">Lemon</string>
<string name="sugar">Sugar</string>
<string name="image_of_tea_being_poured">image of tea being poured</string>

</resources>