-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
# Conflicts: # app/src/main/res/values/strings.xml
- Loading branch information
Showing
21 changed files
with
861 additions
and
55 deletions.
There are no files selected for viewing
This file contains 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 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
69 changes: 69 additions & 0 deletions
69
app/src/main/java/com/example/drp25/CommitteeEventsActivity.kt
This file contains 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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.example.drp25 | ||
|
||
import android.content.Intent | ||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.widget.* | ||
import androidx.cardview.widget.CardView | ||
import androidx.core.view.allViews | ||
import com.google.firebase.database.DataSnapshot | ||
import com.google.firebase.database.DatabaseError | ||
import com.google.firebase.database.FirebaseDatabase | ||
import com.google.firebase.database.ValueEventListener | ||
|
||
class CommitteeEventsActivity : AppCompatActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_committee_events) | ||
|
||
/* Functionality to reach profile page from events (home) page. */ | ||
val toProfile = findViewById<Button>(R.id.to_profile_button) | ||
toProfile.setOnClickListener { | ||
val intent = Intent(this, CommitteeProfileActivity::class.java) | ||
startActivity(intent) | ||
} | ||
|
||
/* LinearLayout containing the content. */ | ||
val eventsList = findViewById<LinearLayout>(R.id.committee_events) | ||
|
||
/* Display events from database */ | ||
val eventsRef = FirebaseDatabase.getInstance().reference.child("universities") | ||
.child(UNI_ID).child("events") | ||
|
||
val inflater = LayoutInflater.from(this) | ||
eventsRef.addValueEventListener(object: ValueEventListener { | ||
override fun onDataChange(snapshot: DataSnapshot) { | ||
for (event in snapshot.children) { | ||
val name: String = event.child("eventName").value as String | ||
val date = event.child("eventDate").value as String | ||
val desc = event.child("eventDesc").value as String | ||
|
||
val eventCard = inflater.inflate( | ||
R.layout.committee_event_view, eventsList, false | ||
) as CardView | ||
eventCard.findViewById<TextView>(R.id.new_event_title).text = name | ||
eventCard.findViewById<TextView>(R.id.new_event_descr).text = desc | ||
eventCard.findViewById<TextView>(R.id.new_event_date).text = date | ||
val broadcastBtn = eventCard.findViewById<Button>(R.id.broadcast_button) | ||
broadcastBtn.setOnClickListener { | ||
// TODO: broadcast message | ||
} | ||
eventsList.addView(eventCard) | ||
} | ||
} | ||
|
||
override fun onCancelled(error: DatabaseError) { | ||
TODO("Not yet implemented") | ||
} | ||
}) | ||
|
||
/* Functionality for the New Event button. */ | ||
val newEvent = findViewById<Button>(R.id.new_event_button) | ||
newEvent.setOnClickListener { | ||
val intent = Intent(this, NewEventActivity::class.java) | ||
startActivity(intent) | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/src/main/java/com/example/drp25/CommitteeProfileActivity.kt
This file contains 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.example.drp25 | ||
|
||
import android.content.Intent | ||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import android.widget.Button | ||
|
||
class CommitteeProfileActivity : AppCompatActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_committee_profile) | ||
|
||
val backButton = findViewById<Button>(R.id.committee_profile_back_button) | ||
backButton.setOnClickListener { | ||
val intent = Intent(this, CommitteeEventsActivity::class.java) | ||
startActivity(intent) | ||
} | ||
} | ||
} |
This file contains 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 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
Oops, something went wrong.