1 package com.android.healthconnect.controller.dataentries.formatters
2 
3 import android.content.Context
4 import android.health.connect.datatypes.MealType
5 import com.android.healthconnect.controller.R
6 
7 object MealFormatter {
formatMealTypenull8     fun formatMealType(context: Context, mealType: Int): String {
9         return when (mealType) {
10             MealType.MEAL_TYPE_UNKNOWN -> context.getString(R.string.mealtype_unknown)
11             MealType.MEAL_TYPE_BREAKFAST -> context.getString(R.string.mealtype_breakfast)
12             MealType.MEAL_TYPE_LUNCH -> context.getString(R.string.mealtype_lunch)
13             MealType.MEAL_TYPE_DINNER -> context.getString(R.string.mealtype_dinner)
14             MealType.MEAL_TYPE_SNACK -> context.getString(R.string.mealtype_snack)
15             else -> {
16                 throw IllegalArgumentException("Unrecognised meal type $mealType")
17             }
18         }
19     }
20 }
21