Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,9 @@ class AttendeeFragment : Fragment(), ComplexBackPressFragment {
}

private fun setupTicketDetailTable() {
rootView.qty.text = " — ${attendeeViewModel.ticketIdAndQty?.map { it.second }?.sum()} items"
attendeeViewModel.ticketIdAndQty?.map { it.second }?.sum()?.let {
rootView.qty.text = resources.getQuantityString(R.plurals.order_quantity_item, it, it)
}
rootView.ticketsRecycler.layoutManager = LinearLayoutManager(activity)
rootView.ticketsRecycler.adapter = ticketsRecyclerAdapter
rootView.ticketsRecycler.isNestedScrollingEnabled = false
Expand Down Expand Up @@ -809,13 +811,13 @@ class AttendeeFragment : Fragment(), ComplexBackPressFragment {
rootView.eventName.text = event.name
val total = if (safeArgs.amount > 0) "${attendeeViewModel.paymentCurrency} ${"%.2f".format(safeArgs.amount)}"
else getString(R.string.free)
rootView.amount.text = "Total: $total"
rootView.amount.text = getString(R.string.total_amount, total)

rootView.time.text = EventUtils.getFormattedDateTimeRangeDetailed(startsAt, endsAt)
}

private fun loadUserUI(user: User) {
rootView.helloUser.text = "Hello ${user.firstName.nullToEmpty()}"
rootView.helloUser.text = getString(R.string.hello_user, user.firstName.nullToEmpty())
rootView.firstName.text = SpannableStringBuilder(user.firstName.nullToEmpty())
rootView.lastName.text = SpannableStringBuilder(user.lastName.nullToEmpty())
rootView.email.text = SpannableStringBuilder(user.email.nullToEmpty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ class EventDetailsFragment : Fragment() {
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = true
layout.feedbackTextInputLayout.isErrorEnabled = false
} else {
layout.feedbackTextInputLayout.error = "Can't be Empty"
layout.feedbackTextInputLayout.error = getString(R.string.cant_be_empty)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class FavoriteFragment : Fragment(), BottomIconDoubleClick {
.nonNull()
.observe(viewLifecycleOwner, Observer { list ->
favoriteEventsRecyclerAdapter.submitList(list.sortedBy { getEventDateTime(it.startsAt, it.timezone) })
rootView.likesNumber.text = "${list.size} likes"
rootView.likesNumber.text = resources.getQuantityString(R.plurals.likes_number, list.size, list.size)
showEmptyMessage(list.size)
Timber.d("Fetched events of size %s", list.size)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ class SearchFragment : Fragment(), ComplexBackPressFragment, BottomIconDoubleCli
override fun removeSearch(position: Int, recentSearch: Pair<String, String>) {
adapter.removeRecentSearchAt(position)
searchViewModel.removeRecentSearch(position)
rootView.snackbar("Removed recent search ${recentSearch.first}", getString(R.string.undo)) {
rootView.snackbar(getString(R.string.removed_recent_search, recentSearch.first),
getString(R.string.undo)) {
adapter.addRecentSearch(position, recentSearch)
searchViewModel.saveRecentSearch(recentSearch.first, recentSearch.second, position)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class SearchTypeFragment : Fragment() {
private val searchTypeViewModel by viewModel<SearchTypeViewModel>()
private val safeArgs: SearchTypeFragmentArgs by navArgs()
private lateinit var rootView: View
private val eventTypesList: MutableList<String> = arrayListOf("Anything")
private val eventTypesList: MutableList<String> = arrayListOf(getString(R.string.anything))

override fun onCreateView(
inflater: LayoutInflater,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.navigation.fragment.navArgs
Expand Down Expand Up @@ -70,7 +71,7 @@ class SessionFragment : Fragment() {
.observe(viewLifecycleOwner, Observer {
rootView.snackbar(it)
if (it == getString(R.string.error_fetching_speakers_for_session)) {
rootView.sessionDetailSpeakersContainer.visibility = View.GONE
rootView.sessionDetailSpeakersContainer.isVisible = false
}
})

Expand All @@ -83,18 +84,18 @@ class SessionFragment : Fragment() {
sessionViewModel.progress
.nonNull()
.observe(viewLifecycleOwner, Observer {
rootView.progressBar.visibility = if (it) View.VISIBLE else View.GONE
rootView.sessionDetailContainer.visibility = if (it) View.GONE else View.VISIBLE
rootView.progressBar.isVisible = it
rootView.sessionDetailContainer.isVisible = !it
})

sessionViewModel.speakersUnderSession
.nonNull()
.observe(viewLifecycleOwner, Observer {
speakersAdapter.addAll(it)
if (it.isEmpty())
rootView.sessionDetailSpeakersContainer.visibility = View.GONE
rootView.sessionDetailSpeakersContainer.isVisible = false
else
rootView.speakersProgressBar.visibility = View.GONE
rootView.speakersProgressBar.isVisible = false
})

sessionViewModel.loadSession(safeArgs.sessionId)
Expand All @@ -104,9 +105,9 @@ class SessionFragment : Fragment() {
else {
speakersAdapter.addAll(currentSpeakers)
if (currentSpeakers.isEmpty())
rootView.sessionDetailSpeakersContainer.visibility = View.GONE
rootView.sessionDetailSpeakersContainer.isVisible = false
else
rootView.speakersProgressBar.visibility = View.GONE
rootView.speakersProgressBar.isVisible = false
}

val layoutManager = LinearLayoutManager(context)
Expand Down Expand Up @@ -152,7 +153,7 @@ class SessionFragment : Fragment() {

private fun makeSessionView(session: Session) {
when (session.title.isNullOrBlank()) {
true -> rootView.sessionDetailName.visibility = View.GONE
true -> rootView.sessionDetailName.isVisible = false
false -> {
rootView.sessionDetailName.text = session.title
setToolbar(activity, session.title)
Expand All @@ -161,20 +162,20 @@ class SessionFragment : Fragment() {

val type = session.sessionType
if (type == null) {
rootView.sessionDetailType.visibility = View.GONE
rootView.sessionDetailType.isVisible = false
} else {
rootView.sessionDetailType.text = "Type: ${type.name}"
rootView.sessionDetailType.text = getString(R.string.type_name, type.name)
}

val locationInfo = session.microlocation
if (locationInfo == null) {
rootView.sessionDetailLocationInfoContainer.visibility = View.GONE
rootView.sessionDetailLocationContainer.visibility = View.GONE
rootView.sessionDetailLocationInfoContainer.isVisible = false
rootView.sessionDetailLocationContainer.isVisible = false
} else {
rootView.sessionDetailInfoLocation.text = locationInfo.name
rootView.sessionDetailLocation.text = locationInfo.name
if (locationInfo.latitude.isNullOrBlank() || locationInfo.longitude.isNullOrBlank()) {
rootView.sessionDetailLocationImageMap.visibility = View.GONE
rootView.sessionDetailLocationImageMap.isVisible = false
} else {
rootView.sessionDetailLocationContainer.setOnClickListener {
startMap(locationInfo.latitude, locationInfo.longitude)
Expand All @@ -191,12 +192,12 @@ class SessionFragment : Fragment() {
}

when (session.language.isNullOrBlank()) {
true -> rootView.sessionDetailLanguageContainer.visibility = View.GONE
true -> rootView.sessionDetailLanguageContainer.isVisible = false
false -> rootView.sessionDetailLanguage.text = session.language
}

when (session.startsAt.isNullOrBlank()) {
true -> rootView.sessionDetailStartTime.visibility = View.GONE
true -> rootView.sessionDetailStartTime.isVisible = false
false -> {
val formattedStartTime = EventUtils.getEventDateTime(session.startsAt, "")
val formattedTime = EventUtils.getFormattedTime(formattedStartTime)
Expand All @@ -206,7 +207,7 @@ class SessionFragment : Fragment() {
}
}
when (session.endsAt.isNullOrBlank()) {
true -> rootView.sessionDetailEndTime.visibility = View.GONE
true -> rootView.sessionDetailEndTime.isVisible = false
false -> {
val formattedEndTime = EventUtils.getEventDateTime(session.endsAt, "")
val formattedTime = EventUtils.getFormattedTime(formattedEndTime)
Expand All @@ -216,15 +217,15 @@ class SessionFragment : Fragment() {
}
}
if (session.startsAt.isNullOrBlank() && session.endsAt.isNullOrBlank())
rootView.sessionDetailTimeContainer.visibility = View.GONE
rootView.sessionDetailTimeContainer.isVisible = false
else
rootView.sessionDetailTimeContainer.setOnClickListener {
saveSessionToCalendar(session)
}

val description = session.longAbstract ?: session.shortAbstract
when (description.isNullOrBlank()) {
true -> rootView.sessionDetailAbstractContainer.visibility = View.GONE
true -> rootView.sessionDetailAbstractContainer.isVisible = false
false -> {
rootView.sessionDetailAbstract.text = description.stripHtml()
val sessionAbstractClickListener = View.OnClickListener {
Expand All @@ -240,7 +241,7 @@ class SessionFragment : Fragment() {

rootView.sessionDetailAbstract.post {
if (rootView.sessionDetailAbstract.lineCount > LINE_COUNT_ABSTRACT) {
rootView.sessionDetailAbstractSeeMore.visibility = View.VISIBLE
rootView.sessionDetailAbstractSeeMore.isVisible = true
rootView.sessionDetailAbstractContainer.setOnClickListener(sessionAbstractClickListener)
}
}
Expand All @@ -249,7 +250,7 @@ class SessionFragment : Fragment() {

val track = session.track
when (track == null) {
true -> rootView.sessionDetailTrackContainer.visibility = View.GONE
true -> rootView.sessionDetailTrackContainer.isVisible = false
false -> {
rootView.sessionDetailTrack.text = track.name
val trackColor = Color.parseColor(track.color)
Expand All @@ -259,7 +260,7 @@ class SessionFragment : Fragment() {
}

when (session.signupUrl.isNullOrBlank()) {
true -> rootView.sessionDetailSignUpButton.visibility = View.GONE
true -> rootView.sessionDetailSignUpButton.isVisible = false
false -> rootView.sessionDetailSignUpButton.setOnClickListener {
context?.let { Utils.openUrl(it, session.signupUrl) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,19 @@ class SpeakerFragment : Fragment() {
else {
when (speaker.email.isNullOrBlank()) {
true -> rootView.email.isVisible = false
false -> rootView.email.text = "Email: ${speaker.email}"
false -> rootView.email.text = getString(R.string.email_name, speaker.email)
}

when (speaker.mobile.isNullOrBlank()) {
true -> rootView.mobile.isVisible = false
false -> rootView.mobile.text = "Phone Number: ${speaker.mobile}"
false -> rootView.mobile.text = getString(R.string.phone_number_name, speaker.mobile)
}

when {
speaker.country.isNullOrBlank() && speaker.country.isNullOrBlank() -> rootView.from.isVisible = false
speaker.country.isNullOrBlank() -> rootView.from.text = "From: ${speaker.city}"
speaker.city.isNullOrBlank() -> rootView.from.text = "From: ${speaker.country}"
else -> rootView.from.text = "From: ${speaker.city}, ${speaker.country}"
speaker.country.isNullOrBlank() -> rootView.from.text = getString(R.string.from_place, speaker.city)
speaker.city.isNullOrBlank() -> rootView.from.text = getString(R.string.from_place, speaker.country)
else -> rootView.from.text = getString(R.string.from_places, speaker.city, speaker.country)
}

when (speaker.website.isNullOrBlank()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class TicketsFragment : Fragment() {
rootView.organizerName.isVisible = false
} else {
rootView.organizerName.isVisible = true
rootView.organizerName.text = "by $organizerName"
rootView.organizerName.text = getString(R.string.by_organizer_name, organizerName)
}
val startsAt = EventUtils.getEventDateTime(event.startsAt, event.timezone)
val endsAt = EventUtils.getEventDateTime(event.endsAt, event.timezone)
Expand Down
19 changes: 19 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -495,5 +495,24 @@
<string name="language">Language</string>
<string name="no_sessions_created_message">You haven\'t created any sessions for this speaker</string>
<string name="proposal_creaed_updated_message">Proposal created/updated successfully</string>
<string name="total_amount">Total: %1$s</string>
<plurals name="order_quantity_item">
<item quantity="one"> — %1$s item</item>
<item quantity="other"> — %1$s items</item>
</plurals>
<string name="hello_user">Hello %1$s</string>
<string name="cant_be_empty">Can\'t be Empty</string>
<plurals name="likes_number">
<item quantity="zero">No likes</item>
<item quantity="one">%1$s like</item>
<item quantity="other">%1$s likes</item>
</plurals>
<string name="removed_recent_search">Removed recent search %1$s</string>
<string name="type_name">Type: %1$s</string>
<string name="email_name">Email: %1$s</string>
<string name="phone_number_name">Phone Number: %1$s</string>
<string name="from_place">From: %1$s</string>
<string name="from_places">From: %1$s, %2$s</string>
<string name="by_organizer_name">by %1$s</string>

</resources>