Reimplemented LunaEvent as a bare JSONObject to allow for expandability
This commit is contained in:
@ -2,14 +2,12 @@ package it.danieleverducci.lunatracker.adapters
|
||||
|
||||
import android.content.Context
|
||||
import android.text.format.DateFormat
|
||||
import android.text.format.DateUtils
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import it.danieleverducci.lunatracker.entities.LunaEvent
|
||||
import it.danieleverducci.lunatracker.entities.LunaEventType
|
||||
import it.danieleverducci.lunatracker.R
|
||||
import java.util.Date
|
||||
|
||||
@ -37,25 +35,25 @@ class LunaEventRecyclerAdapter: RecyclerView.Adapter<LunaEventRecyclerAdapter.Lu
|
||||
val item = items.get(position)
|
||||
holder.type.text = context.getString(
|
||||
when (item.type) {
|
||||
LunaEventType.BABY_BOTTLE -> R.string.event_bottle_type
|
||||
LunaEventType.WEIGHT -> R.string.event_scale_type
|
||||
LunaEventType.BREASTFEEDING_LEFT_NIPPLE -> R.string.event_breastfeeding_left_type
|
||||
LunaEventType.BREASTFEEDING_BOTH_NIPPLE -> R.string.event_breastfeeding_both_type
|
||||
LunaEventType.BREASTFEEDING_RIGHT_NIPPLE -> R.string.event_breastfeeding_right_type
|
||||
LunaEventType.DIAPERCHANGE_POO -> R.string.event_diaperchange_poo_type
|
||||
LunaEventType.DIAPERCHANGE_PEE -> R.string.event_diaperchange_pee_type
|
||||
LunaEvent.TYPE_BABY_BOTTLE -> R.string.event_bottle_type
|
||||
LunaEvent.TYPE_WEIGHT -> R.string.event_scale_type
|
||||
LunaEvent.TYPE_BREASTFEEDING_LEFT_NIPPLE -> R.string.event_breastfeeding_left_type
|
||||
LunaEvent.TYPE_BREASTFEEDING_BOTH_NIPPLE -> R.string.event_breastfeeding_both_type
|
||||
LunaEvent.TYPE_BREASTFEEDING_RIGHT_NIPPLE -> R.string.event_breastfeeding_right_type
|
||||
LunaEvent.TYPE_DIAPERCHANGE_POO -> R.string.event_diaperchange_poo_type
|
||||
LunaEvent.TYPE_DIAPERCHANGE_PEE -> R.string.event_diaperchange_pee_type
|
||||
else -> R.string.event_unknown_type
|
||||
}
|
||||
)
|
||||
holder.description.text = context.getString(
|
||||
when (item.type) {
|
||||
LunaEventType.BABY_BOTTLE -> R.string.event_bottle_desc
|
||||
LunaEventType.WEIGHT -> R.string.event_scale_desc
|
||||
LunaEventType.BREASTFEEDING_LEFT_NIPPLE -> R.string.event_breastfeeding_left_desc
|
||||
LunaEventType.BREASTFEEDING_BOTH_NIPPLE -> R.string.event_breastfeeding_both_desc
|
||||
LunaEventType.BREASTFEEDING_RIGHT_NIPPLE -> R.string.event_breastfeeding_right_desc
|
||||
LunaEventType.DIAPERCHANGE_POO -> R.string.event_diaperchange_poo_desc
|
||||
LunaEventType.DIAPERCHANGE_PEE -> R.string.event_diaperchange_pee_desc
|
||||
LunaEvent.TYPE_BABY_BOTTLE -> R.string.event_bottle_desc
|
||||
LunaEvent.TYPE_WEIGHT -> R.string.event_scale_desc
|
||||
LunaEvent.TYPE_BREASTFEEDING_LEFT_NIPPLE -> R.string.event_breastfeeding_left_desc
|
||||
LunaEvent.TYPE_BREASTFEEDING_BOTH_NIPPLE -> R.string.event_breastfeeding_both_desc
|
||||
LunaEvent.TYPE_BREASTFEEDING_RIGHT_NIPPLE -> R.string.event_breastfeeding_right_desc
|
||||
LunaEvent.TYPE_DIAPERCHANGE_POO -> R.string.event_diaperchange_poo_desc
|
||||
LunaEvent.TYPE_DIAPERCHANGE_PEE -> R.string.event_diaperchange_pee_desc
|
||||
else -> R.string.event_unknown_desc
|
||||
}
|
||||
)
|
||||
|
Reference in New Issue
Block a user