Skip to content

Commit

Permalink
Merge pull request #33 from ItamiOMW/diary-feature
Browse files Browse the repository at this point in the history
1) Changed russian name of diary feature; 2) Localized time formats;
  • Loading branch information
ItamiOMW authored Jun 28, 2024
2 parents 7c76e37 + 747c01b commit b9c0d78
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import java.time.ZonedDateTime

object DateTimeUtil {

const val DEFAULT_TIME_PATTERN = "hh:mm a"

fun stringToDateTime(
datetimeStr: String,
zoneId: ZoneId = ZoneId.systemDefault(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.itami.calorie_tracker.R
import com.itami.calorie_tracker.core.presentation.theme.CalorieTrackerTheme
import com.itami.calorie_tracker.core.utils.DateTimeUtil
import com.itami.calorie_tracker.diary_feature.presentation.model.MealUi
import java.time.format.DateTimeFormatter
import java.time.format.FormatStyle

@Composable
fun MealItem(
Expand Down Expand Up @@ -69,7 +69,7 @@ fun MealItem(
modifier = Modifier.size(16.dp)
)
Text(
text = meal.createdAt.format(DateTimeFormatter.ofPattern(DateTimeUtil.DEFAULT_TIME_PATTERN)),
text = meal.createdAt.format(DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT)),
style = CalorieTrackerTheme.typography.bodySmall,
color = secondaryContentColor,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import com.itami.calorie_tracker.diary_feature.presentation.model.ConsumedWaterU
import com.itami.calorie_tracker.diary_feature.presentation.model.MealUi
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
import java.time.format.FormatStyle

@Composable
fun DiaryScreen(
Expand Down Expand Up @@ -325,7 +326,7 @@ private fun WaterIntakeSection(
consumedWaterMl = consumedWater?.waterMl ?: 0,
waterMlGoal = dailyNutrientsGoal.waterMlGoal,
lastTimeDrank = consumedWater?.timestamp?.format(
DateTimeFormatter.ofPattern(DateTimeUtil.DEFAULT_TIME_PATTERN)
DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT)
) ?: stringResource(R.string.text_have_not_drank),
onAddWaterClick = onAddWaterClick,
onRemoveWaterClick = onRemoveWaterClick,
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<string name="app_name">Calorie Tracker</string>
<string name="current_app_version">Версия: 0.1.0</string>

<string name="diary">Ежедневник</string>
<string name="diary">Дневник</string>
<string name="recipes">Рецепты</string>
<string name="reports">Отчёты</string>
<string name="welcome_em">Добро пожаловать!</string>
Expand Down Expand Up @@ -197,7 +197,7 @@
<string name="enter_password_reset_code">Пожалуйста, введите код для сброса пароля, который мы отправили вам на электронную почту, %1$s</string>
<string name="calorie_tracker_about_app">приложение для Android, разработанное одним разработчиком, чтобы помочь вам на пути к достижению фигуры мечты.</string>
<string name="provide_features_such_as">Мы предоставляем все необходимые функции, такие как:</string>
<string name="desc_diary_feature">Ежедневник для записи ваших приемов пищи и выпитой воды</string>
<string name="desc_diary_feature">Дневник для записи ваших приемов пищи и выпитой воды</string>
<string name="desc_reports_feature">Отчеты для отслеживания вашего веса</string>
<string name="desc_recipes_feature">Рецепты, позволяющие быстро придумать, что приготовить</string>
<string name="you_sure_you_want_to_log_out">Вы уверены, что хотите выйти?</string>
Expand Down

0 comments on commit b9c0d78

Please sign in to comment.