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 @@ -216,7 +216,8 @@ fun TaskBottomSheet(
getPredefinedIconRes(category.title)
)
else rememberAsyncImagePainter(category.iconUrl),
label = category.title,
label = category.titleRes?.let { stringResource(category.titleRes) }
?: category.title,
selected = selectedCategory?.id == category.id,
modifier = Modifier
.fillMaxWidth()
Expand Down
29 changes: 29 additions & 0 deletions app/src/main/java/com/moscow/tudee/presentation/mapper/UiMapper.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.moscow.tudee.presentation.mapper

import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
Expand Down Expand Up @@ -28,6 +29,7 @@ fun Task.toTaskUi() = TaskUi(
fun Category.toCategoryUi() = CategoryUi(
id = id,
title = title,
titleRes = mapPredefinedCategoryToStringResource(title),
iconUrl = iconUri,
numberOfTasksInCategory = countOfTasks,
isPredefined = isPredefined,
Expand Down Expand Up @@ -117,4 +119,31 @@ fun Task.Status.getColor(): Color {
}
fun LocalDateTime.asLong(): Long {
return this.toInstant(TimeZone.currentSystemDefault()).toEpochMilliseconds()
}

@StringRes
fun mapPredefinedCategoryToStringResource(
categoryTitle: String
): Int? {
return when (categoryTitle) {
"quran" -> R.string.quran
"shopping" -> R.string.shopping
"education" -> R.string.education
"medical" -> R.string.medical
"gym" -> R.string.gym
"entertainment" -> R.string.entertainment
"cooking" -> R.string.cooking
"family & friend" -> R.string.family_and_friend
"traveling" -> R.string.traveling
"agriculture" -> R.string.agriculture
"coding" -> R.string.coding
"adoration" -> R.string.adoration
"fixing bugs" -> R.string.fixing_bugs
"cleaning" -> R.string.cleaning
"work" -> R.string.work
"budgeting" -> R.string.budgeting
"self-care" -> R.string.self_care
"event" -> R.string.event
else -> null
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package com.moscow.tudee.presentation.model

import androidx.annotation.StringRes

data class CategoryUi(
val id: Long = 0L,
val title: String = "",
@StringRes val titleRes: Int? = null,
val isPredefined: Boolean = false,
val numberOfTasksInCategory: Int = 0,
val iconUrl: String = "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private fun CategoryGridItem(

CategoryCard(
icon = iconPainter,
label = category.title,
label = category.titleRes?.let { stringResource(category.titleRes) } ?: category.title,
count = category.numberOfTasksInCategory,
isPredefined = category.isPredefined,
iconTint = Color.Unspecified,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,8 @@ class CategoryViewModel(
private fun onFinally() {
updateState { it.copy(isLoading = false) }
}

private fun mapPredefinedCategoriesToStringResources() {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
Expand All @@ -30,8 +31,8 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.moscow.tudee.R
import com.moscow.tudee.presentation.screen.category.CategoriesScreenState
import com.moscow.tudee.presentation.designSystem.theme.Theme
import com.moscow.tudee.presentation.screen.category.CategoriesScreenState
import kotlinx.coroutines.delay

@Composable
Expand Down Expand Up @@ -94,6 +95,7 @@ private fun SnackBarContent(
Row(
modifier = modifier
.padding(16.dp)
.statusBarsPadding()
.fillMaxWidth()
.shadow(
elevation = 6.dp,
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,22 @@
<string name="friday">الجمعة</string>
<string name="saturday">السبت</string>
<string name="sunday">الأحد</string>
<string name="quran">قرآن</string>
<string name="shopping">تسوق</string>
<string name="education">تعليم</string>
<string name="medical">طبي</string>
<string name="gym">رياضة</string>
<string name="entertainment">ترفيه</string>
<string name="cooking">طبخ</string>
<string name="family_and_friend">عائلة وأصدقاء</string>
<string name="traveling">سفر</string>
<string name="agriculture">زراعة</string>
<string name="coding">برمجة</string>
<string name="adoration">عبادة</string>
<string name="fixing_bugs">حل أخطاء برمجية</string>
<string name="cleaning">تنظيف</string>
<string name="work">عمل</string>
<string name="budgeting">ميزانية</string>
<string name="self_care">عناية شخصية</string>
<string name="event">حدث</string>
</resources>
18 changes: 18 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,22 @@
<string name="friday">Friday</string>
<string name="saturday">Saturday</string>
<string name="sunday">Sunday</string>
<string name="quran">quran</string>
<string name="shopping">shopping</string>
<string name="education">education</string>
<string name="medical">medical</string>
<string name="gym">gym</string>
<string name="entertainment">entertainment</string>
<string name="cooking">cooking</string>
<string name="family_and_friend">family &amp; friend</string>
<string name="traveling">traveling</string>
<string name="agriculture">agriculture</string>
<string name="coding">coding</string>
<string name="adoration">adoration</string>
<string name="fixing_bugs">fixing bugs</string>
<string name="cleaning">cleaning</string>
<string name="work">work</string>
<string name="budgeting">budgeting</string>
<string name="self_care">self-care</string>
<string name="event">event</string>
</resources>
Loading