Skip to content

Commit

Permalink
stamps change based on logged in user, added british stamps
Browse files Browse the repository at this point in the history
  • Loading branch information
hettysymes committed Jun 13, 2023
1 parent 54ec374 commit 9332d60
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions app/src/main/java/com/example/drp25/MatchActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,31 @@ class MatchActivity : AppCompatActivity() {

// Set up stamps
val stamp1 = findViewById<ImageView>(R.id.stamp_option_1)
stamp1.setImageResource(R.drawable.china_flag_stamp)
val stamp2 = findViewById<ImageView>(R.id.stamp_option_2)
stamp2.setImageResource(R.drawable.china_tourist_stamp)
val stamp3 = findViewById<ImageView>(R.id.stamp_option_3)
stamp3.setImageResource(R.drawable.china_food_stamp)

val nationalityRef = FirebaseDatabase.getInstance().reference.child("universities")
.child(UNI_ID).child("users").child(USER_ID).child("nationality")

nationalityRef.addValueEventListener(object: ValueEventListener{
override fun onDataChange(snapshot: DataSnapshot) {
val nationality = snapshot.value as String
if (nationality == "Chinese") {
stamp1.setImageResource(R.drawable.china_flag_stamp)
stamp2.setImageResource(R.drawable.china_tourist_stamp)
stamp3.setImageResource(R.drawable.china_food_stamp)
} else if (nationality == "British") {
stamp1.setImageResource(R.drawable.britain_flag_stamp)
stamp2.setImageResource(R.drawable.britain_tourist_stamp)
stamp3.setImageResource(R.drawable.britain_food_stamp)
}
}

override fun onCancelled(error: DatabaseError) {
TODO("Not yet implemented")
}

})
}

}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/britain_food_stamp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9332d60

Please sign in to comment.