Skip to content

Commit

Permalink
fix sluggishness in session detail screen and get rid of one useless …
Browse files Browse the repository at this point in the history
…class
  • Loading branch information
Ken Yee committed Mar 22, 2018
1 parent 6b9ff0a commit 416176e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ open class FirebaseDatabase {
var title: String = "",
var org: String = "",
var name: String = "") {

fun toScheduleDetail(listRow: ScheduleRow): ScheduleDetail {
val detail = ScheduleDetail(listRow)
detail.facebook = socialProfiles?.get("facebook") ?: ""
detail.linkedIn = socialProfiles?.get("linkedIn") ?: ""
detail.twitter = socialProfiles?.get("twitter") ?: ""
detail.speakerBio = bio
return detail
}

companion object {
var SPEAKER_ITEM_ROW = "speaker_item_row"
}
Expand All @@ -98,23 +108,6 @@ open class FirebaseDatabase {
var firstName: String = "",
var lastName: String = "")

data class ScheduleEventDetail(
val socialProfiles: HashMap<String, String>? = HashMap(0),
var bio: String = "",
var title: String = "",
var org: String = "",
var name: String = "") {

fun toScheduleDetail(listRow: ScheduleRow): ScheduleDetail {
val detail = ScheduleDetail(listRow)
detail.facebook = socialProfiles?.get("facebook") ?: ""
detail.linkedIn = socialProfiles?.get("linkedIn") ?: ""
detail.twitter = socialProfiles?.get("twitter") ?: ""
detail.speakerBio = bio
return detail
}
}

class FaqEvent {

data class Answer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import com.google.firebase.database.DatabaseError
import com.google.firebase.database.ValueEventListener
import com.mentalmachines.droidcon_boston.R
import com.mentalmachines.droidcon_boston.R.string
import com.mentalmachines.droidcon_boston.data.FirebaseDatabase.ScheduleEventDetail
import com.mentalmachines.droidcon_boston.data.FirebaseDatabase.EventSpeaker
import com.mentalmachines.droidcon_boston.data.Schedule
import com.mentalmachines.droidcon_boston.data.Schedule.ScheduleDetail
Expand Down Expand Up @@ -103,14 +102,14 @@ class AgendaDetailFragment : Fragment() {
val dataListener: ValueEventListener = object : ValueEventListener {
override fun onDataChange(dataSnapshot: DataSnapshot) {
for (speakerSnapshot in dataSnapshot.children) {
val detail = speakerSnapshot.getValue(ScheduleEventDetail::class.java)
val speaker = speakerSnapshot.getValue(EventSpeaker::class.java)
if (detail != null) {
scheduleDetail = detail.toScheduleDetail(scheduleRowItem)
showAgendaDetail(scheduleDetail)
}
if (speaker != null) {
eventSpeakers.put(speaker.name, speaker)

if (scheduleRowItem.primarySpeakerName == speaker.name) {
scheduleDetail = speaker.toScheduleDetail(scheduleRowItem)
showAgendaDetail(scheduleDetail)
}
}

}
Expand Down

0 comments on commit 416176e

Please sign in to comment.