From 64da27cbda556201c9bccffbdaa387c8bc17c5b3 Mon Sep 17 00:00:00 2001 From: Nguyen Quang Minh Date: Thu, 12 Dec 2024 00:28:18 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20=C4=91a=20ng=C3=B4n=20ng=E1=BB=AF=20cho?= =?UTF-8?q?=20subject?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/dto/subject/SubjectResponseDto.kt | 2 +- .../data/mapper/subject/SubjectMapper.kt | 3 +- .../domain/model/subject/SubjectModel.kt | 541 +++++++++--------- .../component/AddStudySetToClassItem.kt | 2 +- .../component/AddStudySetToFolderItem.kt | 2 +- .../presentation/app/home/HomeScreen.kt | 4 +- .../app/home/components/StudySetHomeItem.kt | 2 +- .../app/home/components/SubjectItem.kt | 19 +- .../SearchStudySetBySubjectScreen.kt | 14 +- .../SearchStudySetBySubjectTopAppBar.kt | 4 +- .../study_set/component/StudySetItem.kt | 3 +- .../component/FilterStudySetBottomSheet.kt | 2 +- .../component/StudySetSubjectBottomSheet.kt | 7 +- .../component/StudySetSubjectInput.kt | 13 +- .../study_set/create/CreateStudySetScreen.kt | 2 +- .../app/study_set/edit/EditStudySetScreen.kt | 2 +- app/src/main/res/values-vi/strings.xml | 77 +++ app/src/main/res/values/strings.xml | 77 +++ 18 files changed, 472 insertions(+), 304 deletions(-) diff --git a/app/src/main/java/com/pwhs/quickmem/data/dto/subject/SubjectResponseDto.kt b/app/src/main/java/com/pwhs/quickmem/data/dto/subject/SubjectResponseDto.kt index dba533b0..d8088abf 100644 --- a/app/src/main/java/com/pwhs/quickmem/data/dto/subject/SubjectResponseDto.kt +++ b/app/src/main/java/com/pwhs/quickmem/data/dto/subject/SubjectResponseDto.kt @@ -7,5 +7,5 @@ data class SubjectResponseDto( val id: Int, @SerializedName("name") - val name: String + val name: String? = null, ) \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/data/mapper/subject/SubjectMapper.kt b/app/src/main/java/com/pwhs/quickmem/data/mapper/subject/SubjectMapper.kt index 1b2e1233..debf29ad 100644 --- a/app/src/main/java/com/pwhs/quickmem/data/mapper/subject/SubjectMapper.kt +++ b/app/src/main/java/com/pwhs/quickmem/data/mapper/subject/SubjectMapper.kt @@ -5,10 +5,9 @@ import com.pwhs.quickmem.domain.model.subject.SubjectModel fun SubjectResponseDto.toSubjectModel() = SubjectModel( id = id, - name = name, + subjectName = SubjectModel.defaultSubjects.first { it.id == id }.subjectName ) fun SubjectModel.toSubjectResponseDto() = SubjectResponseDto( id = id, - name = name, ) \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/domain/model/subject/SubjectModel.kt b/app/src/main/java/com/pwhs/quickmem/domain/model/subject/SubjectModel.kt index bc0d671f..efc159c7 100644 --- a/app/src/main/java/com/pwhs/quickmem/domain/model/subject/SubjectModel.kt +++ b/app/src/main/java/com/pwhs/quickmem/domain/model/subject/SubjectModel.kt @@ -1,287 +1,290 @@ package com.pwhs.quickmem.domain.model.subject import androidx.annotation.DrawableRes +import androidx.annotation.StringRes import androidx.compose.ui.graphics.Color import com.pwhs.quickmem.R data class SubjectModel( val id: Int = 0, - val name: String = "", + @StringRes val subjectName: Int = -1, @DrawableRes val iconRes: Int? = null, var studySetCount: Int = 0, val color: Color? = null, - val description: String? = null, + @StringRes val subjectDescription: Int? = null, val createdAt: String? = null, val updatedAt: String? = null ) { companion object { - val defaultSubjects = listOf( - SubjectModel( - 1, - "General", - iconRes = R.drawable.ic_all, - color = Color(0xFF7f60f9), - description = "General subjects that do not fit into specific categories." - ), - SubjectModel( - 2, - "Anthropology", - iconRes = R.drawable.ic_anthropology, - color = Color(0xFFedb527), - description = "Anthropology is the study of human societies and cultures." - ), - SubjectModel( - 3, - "Architecture and design", - iconRes = R.drawable.ic_architecture_and_design, - color = Color(0xFF7f60f9), - description = "Architecture and design is the study of buildings, structures, and spaces." - ), - SubjectModel( - 4, - "Arts", - iconRes = R.drawable.ic_arts, - color = Color(0xFF7f60f9), - description = "Arts is the study of creative expressions in various forms like painting, music, and sculpture." - ), - SubjectModel( - 5, - "Biology", - iconRes = R.drawable.ic_biology, - color = Color(0xFF15b39b), - description = "Biology is the study of living organisms and life processes." - ), - SubjectModel( - 6, - "Business", - iconRes = R.drawable.ic_business, - color = Color(0xFF7f60f9), - description = "Business is the study of commerce, trade, and organizational management." - ), - SubjectModel( - 7, - "Chemistry", - iconRes = R.drawable.ic_chemistry, - color = Color(0xFF15b39b), - description = "Chemistry is the study of substances, their properties, and reactions." - ), - SubjectModel( - 8, - "Computer sciences", - iconRes = R.drawable.ic_computer_sciences, - color = Color(0xFF3678fd), - description = "Computer Science is the study of computational systems, algorithms, and programming." - ), - SubjectModel( - 9, - "Earth sciences", - iconRes = R.drawable.ic_earth_sciences, - color = Color(0xFF15b39b), - description = "Earth Science is the study of the Earth, its composition, and natural phenomena." - ), - SubjectModel( - 10, - "Economics", - iconRes = R.drawable.ic_economics, - color = Color(0xFFeaaa08), - description = "Economics is the study of the production, distribution, and consumption of goods and services." - ), - SubjectModel( - 11, - "Engineering and technology", - iconRes = R.drawable.ic_engineering_and_technology, - color = Color(0xFF2970ff), - description = "Engineering and technology involves applying scientific knowledge to develop solutions for practical problems." - ), - SubjectModel( - 12, - "Environmental studies and forestry", - iconRes = R.drawable.ic_environmental_studies_and_forestry, - color = Color(0xFF7a5af8), - description = "Environmental studies and forestry focus on the protection and management of natural resources and ecosystems." - ), - SubjectModel( - 13, - "Family and consumer science", - iconRes = R.drawable.ic_family_and_consumer_science, - color = Color(0xFFeaaa09), - description = "Family and consumer science is the study of family dynamics, nutrition, and consumer behavior." - ), - SubjectModel( - 14, - "Geography", - iconRes = R.drawable.ic_geography, - color = Color(0xFFeaaa09), - description = "Geography is the study of places, landscapes, and the human-environment relationship." - ), - SubjectModel( - 15, - "History", - iconRes = R.drawable.ic_history, - color = Color(0xFFf63d68), - description = "History is the study of past events, civilizations, and their impact on the present." - ), - SubjectModel( - 16, - "Human physical performance and recreation", - iconRes = R.drawable.ic_human_physical_performance_and_recreation, - color = Color(0xFF7a5af8), - description = "Human physical performance and recreation focuses on physical activities, sports, and overall well-being." - ), - SubjectModel( - 17, - "Interdisciplinary studies", - iconRes = R.drawable.ic_interdisciplinary_studies, - color = Color(0xFF9076f8), - description = "Interdisciplinary studies involve integrating knowledge from multiple academic disciplines." - ), - SubjectModel( - 18, - "Journalism, media studies and communication", - iconRes = R.drawable.ic_journalism__media_studies_and_communication, - color = Color(0xFF7a5af8), - description = "Journalism and media studies explore communication, reporting, and media's role in society." - ), - SubjectModel( - 19, - "Languages and cultures", - iconRes = R.drawable.ic_languages_and_cultures, - color = Color(0xFFd444f1), - description = "Languages and cultures focus on linguistics, cultural practices, and communication across societies." - ), - SubjectModel( - 20, - "Law", - iconRes = R.drawable.ic_law, - color = Color(0xFF7a5af8), - description = "Law is the study of legal systems, regulations, and justice." - ), - SubjectModel( - 21, - "Library and museum studies", - iconRes = R.drawable.ic_library_and_museum_studies, - color = Color(0xFFf63d68), - description = "Library and museum studies focus on the preservation and organization of information and artifacts." - ), - SubjectModel( - 22, - "Literature", - iconRes = R.drawable.ic_literature, - color = Color(0xFFf63d68), - description = "Literature is the study of written works, such as novels, poetry, and plays." - ), - SubjectModel( - 23, - "Logic", - iconRes = R.drawable.ic_logic, - color = Color(0xFF4180fe), - description = "Logic is the study of reasoning, critical thinking, and problem-solving methods." - ), - SubjectModel( - 24, - "Mathematics", - iconRes = R.drawable.ic_mathematics, - color = Color(0xFF2970ff), - description = "Mathematics is the study of numbers, quantities, shapes, and patterns." - ), - SubjectModel( - 25, - "Medicine", - iconRes = R.drawable.ic_medicine, - color = Color(0xFF7a5af8), - description = "Medicine is the study of health, diseases, and medical practices." - ), - SubjectModel( - 26, - "Military sciences", - iconRes = R.drawable.ic_military_sciences, - color = Color(0xFF7a5af8), - description = "Military sciences study military tactics, defense strategies, and security systems." - ), - SubjectModel( - 27, - "Other", - iconRes = R.drawable.ic_other, - color = Color(0xFF66c61c), - description = "Other fields of study that do not fit into traditional academic categories." - ), - SubjectModel( - 28, - "Philosophy", - iconRes = R.drawable.ic_philosophy, - color = Color(0xFFf63d68), - description = "Philosophy is the study of existence, knowledge, and ethics." - ), - SubjectModel( - 29, - "Physics", - iconRes = R.drawable.ic_physics, - color = Color(0xFF17b89f), - description = "Physics is the study of matter, energy, and the laws governing the universe." - ), - SubjectModel( - 30, - "Political science", - iconRes = R.drawable.ic_political_science, - color = Color(0xFFeaaa08), - description = "Political science is the study of government systems, policies, and political behavior." - ), - SubjectModel( - 31, - "Psychology", - iconRes = R.drawable.ic_psychology, - color = Color(0xFFeaaa08), - description = "Psychology is the study of the human mind, behavior, and mental processes." - ), - SubjectModel( - 32, - "Public administration", - iconRes = R.drawable.ic_public_administration, - color = Color(0xFFeaaa08), - description = "Public administration involves the management of government policies and programs." - ), - SubjectModel( - 33, - "Religion and divinity", - iconRes = R.drawable.ic_religion_and_divinity, - color = Color(0xFFf63d68), - description = "Religion and divinity focus on the study of faith, spirituality, and religious beliefs." - ), - SubjectModel( - 34, - "Social work", - iconRes = R.drawable.ic_social_work, - color = Color(0xFFeaaa09), - description = "Social work is the study of helping individuals, families, and communities improve their well-being." - ), - SubjectModel( - 35, - "Sociology", - iconRes = R.drawable.ic_sociology, - color = Color(0xFFeaaa09), - description = "Sociology is the study of human societies, social behavior, and social structures." - ), - SubjectModel( - 36, - "Space sciences", - iconRes = R.drawable.ic_space_sciences, - color = Color(0xFF1ab8a0), - description = "Space sciences explore the study of the universe, celestial bodies, and cosmic phenomena." - ), - SubjectModel( - 37, - "Systems science", - iconRes = R.drawable.ic_systems_science, - color = Color(0xFFf64b73), - description = "Systems science is the study of complex systems, such as ecosystems, organizations, and technologies." - ), - SubjectModel( - 38, - "Transportation", - iconRes = R.drawable.ic_transportation, - color = Color(0xFF8d72f8), - description = "Transportation is the study of the movement of people and goods and the infrastructure that supports it." + val defaultSubjects: List + get() = listOf( + SubjectModel( + id = 1, + subjectName = R.string.txt_general, + iconRes = R.drawable.ic_all, + color = Color(0xFF7f60f9), + subjectDescription = R.string.txt_general_subjects_that_do_not_fit_into_specific_categories + ), + SubjectModel( + id = 2, + subjectName = R.string.txt_anthropology, + iconRes = R.drawable.ic_anthropology, + color = Color(0xFFedb527), + subjectDescription = R.string.txt_anthropology_is_the_study_of_human_societies_and_cultures + ), + SubjectModel( + id = 3, + subjectName = R.string.txt_architecture_and_design, + iconRes = R.drawable.ic_architecture_and_design, + color = Color(0xFF7f60f9), + subjectDescription = R.string.txt_architecture_and_design_is_the_study_of_buildings_structures_and_spaces + ), + SubjectModel( + id = 4, + subjectName = R.string.txt_arts, + iconRes = R.drawable.ic_arts, + color = Color(0xFF7f60f9), + subjectDescription = R.string.txt_arts_is_the_study_of_creative_expressions_in_various_forms_like_painting_music_and_sculpture + ), + SubjectModel( + id = 5, + subjectName = R.string.txt_biology, + iconRes = R.drawable.ic_biology, + color = Color(0xFF15b39b), + subjectDescription = R.string.txt_biology_is_the_study_of_living_organisms_and_life_processes + ), + SubjectModel( + id = 6, + subjectName = R.string.txt_business, + iconRes = R.drawable.ic_business, + color = Color(0xFF7f60f9), + subjectDescription = R.string.txt_business_is_the_study_of_commerce_trade_and_organizational_management + ), + SubjectModel( + id = 7, + subjectName = R.string.txt_chemistry, + iconRes = R.drawable.ic_chemistry, + color = Color(0xFF15b39b), + subjectDescription = R.string.txt_chemistry_is_the_study_of_substances_their_properties_and_reactions + ), + SubjectModel( + id = 8, + subjectName = R.string.txt_computer_sciences, + iconRes = R.drawable.ic_computer_sciences, + color = Color(0xFF3678fd), + subjectDescription = R.string.txt_computer_science_is_the_study_of_computational_systems_algorithms_and_programming + ), + SubjectModel( + id = 9, + subjectName = R.string.txt_earth_sciences, + iconRes = R.drawable.ic_earth_sciences, + color = Color(0xFF15b39b), + subjectDescription = R.string.txt_earth_science_is_the_study_of_the_earth_its_composition_and_natural_phenomena + ), + SubjectModel( + id = 10, + subjectName = R.string.txt_economics, + iconRes = R.drawable.ic_economics, + color = Color(0xFFeaaa08), + subjectDescription = R.string.txt_economics_is_the_study_of_the_production_distribution_and_consumption_of_goods_and_services + ), + SubjectModel( + id = 11, + subjectName = R.string.txt_engineering_and_technology, + iconRes = R.drawable.ic_engineering_and_technology, + color = Color(0xFF2970ff), + subjectDescription = R.string.txt_engineering_and_technology_involves_applying_scientific_knowledge_to_develop_solutions_for_practical_problems + ), + SubjectModel( + id = 12, + subjectName = R.string.txt_environmental_studies_and_forestry, + iconRes = R.drawable.ic_environmental_studies_and_forestry, + color = Color(0xFF7a5af8), + subjectDescription = R.string.txt_environmental_studies_and_forestry_focus_on_the_protection_and_management_of_natural_resources_and_ecosystems + ), + SubjectModel( + id = 13, + subjectName = R.string.txt_family_and_consumer_science, + iconRes = R.drawable.ic_family_and_consumer_science, + color = Color(0xFFeaaa09), + subjectDescription = R.string.txt_family_and_consumer_science_is_the_study_of_family_dynamics_nutrition_and_consumer_behavior + ), + SubjectModel( + id = 14, + subjectName = R.string.txt_geography, + iconRes = R.drawable.ic_geography, + color = Color(0xFFeaaa09), + subjectDescription = R.string.txt_geography_is_the_study_of_places_landscapes_and_the_human_environment_relationship + ), + SubjectModel( + id = 15, + subjectName = R.string.txt_history, + iconRes = R.drawable.ic_history, + color = Color(0xFFf63d68), + subjectDescription = R.string.txt_history_is_the_study_of_past_events_civilizations_and_their_impact_on_the_present + ), + SubjectModel( + id = 16, + subjectName = R.string.txt_human_physical_performance_and_recreation, + iconRes = R.drawable.ic_human_physical_performance_and_recreation, + color = Color(0xFF7a5af8), + subjectDescription = R.string.txt_human_physical_performance_and_recreation_focuses_on_physical_activities_sports_and_overall_well_being + ), + SubjectModel( + id = 17, + subjectName = R.string.txt_interdisciplinary_studies, + iconRes = R.drawable.ic_interdisciplinary_studies, + color = Color(0xFF9076f8), + subjectDescription = R.string.txt_interdisciplinary_studies_involve_integrating_knowledge_from_multiple_academic_disciplines + ), + SubjectModel( + id = 18, + subjectName = R.string.txt_journalism_media_studies_and_communication, + iconRes = R.drawable.ic_journalism__media_studies_and_communication, + color = Color(0xFF7a5af8), + subjectDescription = R.string.txt_journalism_and_media_studies_explore_communication_reporting_and_media_s_role_in_society + ), + SubjectModel( + id = 19, + subjectName = R.string.txt_languages_and_cultures, + iconRes = R.drawable.ic_languages_and_cultures, + color = Color(0xFFd444f1), + subjectDescription = R.string.txt_languages_and_cultures_focus_on_linguistics_cultural_practices_and_communication_across_societies + ), + SubjectModel( + id = 20, + subjectName = R.string.txt_law, + iconRes = R.drawable.ic_law, + color = Color(0xFF7a5af8), + subjectDescription = R.string.txt_law_is_the_study_of_legal_systems_regulations_and_justice + ), + SubjectModel( + id = 21, + subjectName = R.string.txt_library_and_museum_studies, + iconRes = R.drawable.ic_library_and_museum_studies, + color = Color(0xFFf63d68), + subjectDescription = R.string.txt_library_and_museum_studies_focus_on_the_preservation_and_organization_of_information_and_artifacts + ), + SubjectModel( + id = 22, + subjectName = R.string.txt_literature, + iconRes = R.drawable.ic_literature, + color = Color(0xFFf63d68), + subjectDescription = R.string.txt_literature_is_the_study_of_written_works_such_as_novels_poetry_and_plays + ), + SubjectModel( + id = 23, + subjectName = R.string.txt_logic, + iconRes = R.drawable.ic_logic, + color = Color(0xFF4180fe), + subjectDescription = R.string.txt_logic_is_the_study_of_reasoning_critical_thinking_and_problem_solving_methods + ), + SubjectModel( + id = 24, + subjectName = R.string.txt_mathematics, + iconRes = R.drawable.ic_mathematics, + color = Color(0xFF2970ff), + subjectDescription = R.string.txt_mathematics_is_the_study_of_numbers_quantities_shapes_and_patterns + ), + SubjectModel( + id = 25, + subjectName = R.string.txt_medicine, + iconRes = R.drawable.ic_medicine, + color = Color(0xFF7a5af8), + subjectDescription = R.string.txt_medicine_is_the_study_of_health_diseases_and_medical_practices + ), + SubjectModel( + id = 26, + subjectName = R.string.txt_military_sciences, + iconRes = R.drawable.ic_military_sciences, + color = Color(0xFF7a5af8), + subjectDescription = R.string.txt_military_sciences_study_military_tactics_defense_strategies_and_security_systems + ), + SubjectModel( + id = 27, + subjectName = R.string.txt_other, + iconRes = R.drawable.ic_other, + color = Color(0xFF66c61c), + subjectDescription = R.string.txt_other_fields_of_study_that_do_not_fit_into_traditional_academic_categories + ), + SubjectModel( + id = 28, + subjectName = R.string.txt_philosophy, + iconRes = R.drawable.ic_philosophy, + color = Color(0xFFf63d68), + subjectDescription = R.string.txt_philosophy_is_the_study_of_existence_knowledge_and_ethics + ), + SubjectModel( + id = 29, + subjectName = R.string.txt_physics, + iconRes = R.drawable.ic_physics, + color = Color(0xFF17b89f), + subjectDescription = R.string.txt_physics_is_the_study_of_matter_energy_and_the_laws_governing_the_universe + ), + SubjectModel( + id = 30, + subjectName = R.string.txt_political_science, + iconRes = R.drawable.ic_political_science, + color = Color(0xFFeaaa08), + subjectDescription = R.string.txt_political_science_is_the_study_of_government_systems_policies_and_political_behavior + ), + SubjectModel( + id = 31, + subjectName = R.string.txt_psychology, + iconRes = R.drawable.ic_psychology, + color = Color(0xFFeaaa08), + subjectDescription = R.string.txt_psychology_is_the_study_of_the_human_mind_behavior_and_mental_processes + ), + SubjectModel( + id = 32, + subjectName = R.string.txt_public_administration, + iconRes = R.drawable.ic_public_administration, + color = Color(0xFFeaaa08), + subjectDescription = R.string.txt_public_administration_involves_the_management_of_government_policies_and_programs + ), + SubjectModel( + id = 33, + subjectName = R.string.txt_religion_and_divinity, + iconRes = R.drawable.ic_religion_and_divinity, + color = Color(0xFFf63d68), + subjectDescription = R.string.txt_religion_and_divinity_focus_on_the_study_of_faith_spirituality_and_religious_beliefs + ), + SubjectModel( + id = 34, + subjectName = R.string.txt_social_work, + iconRes = R.drawable.ic_social_work, + color = Color(0xFFeaaa09), + subjectDescription = R.string.txt_social_work_is_the_study_of_helping_individuals_families_and_communities_improve_their_well_being + ), + SubjectModel( + id = 35, + subjectName = R.string.txt_sociology, + iconRes = R.drawable.ic_sociology, + color = Color(0xFFeaaa09), + subjectDescription = R.string.txt_sociology_is_the_study_of_human_societies_social_behavior_and_social_structures + ), + SubjectModel( + id = 36, + subjectName = R.string.txt_space_sciences, + iconRes = R.drawable.ic_space_sciences, + color = Color(0xFF1ab8a0), + subjectDescription = R.string.txt_space_sciences_explore_the_study_of_the_universe_celestial_bodies_and_cosmic_phenomena + ), + SubjectModel( + id = 37, + subjectName = R.string.txt_systems_science, + iconRes = R.drawable.ic_systems_science, + color = Color(0xFFf64b73), + subjectDescription = R.string.txt_systems_science_is_the_study_of_complex_systems_such_as_ecosystems_organizations_and_technologies + ), + SubjectModel( + id = 38, + subjectName = R.string.txt_transportation, + iconRes = R.drawable.ic_transportation, + color = Color(0xFF8d72f8), + subjectDescription = R.string.txt_transportation_is_the_study_of_the_movement_of_people_and_goods_and_the_infrastructure_that_supports_it + ) ) - ) + } } diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/add_study_set/component/AddStudySetToClassItem.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/add_study_set/component/AddStudySetToClassItem.kt index 8e027519..d1be7509 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/add_study_set/component/AddStudySetToClassItem.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/add_study_set/component/AddStudySetToClassItem.kt @@ -115,7 +115,7 @@ fun AddStudySetToClassItem( horizontalArrangement = Arrangement.spacedBy(8.dp), ) { Text( - text = studySet.subject?.name ?: SubjectModel.defaultSubjects[0].name, + text = stringResource(studySet.subject?.subjectName ?: SubjectModel.defaultSubjects[0].subjectName), style = typography.bodySmall.copy( color = colorScheme.onSurface.copy(alpha = 0.6f) ) diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/folder/add_study_set/component/AddStudySetToFolderItem.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/folder/add_study_set/component/AddStudySetToFolderItem.kt index 9b5fa812..06a40be4 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/folder/add_study_set/component/AddStudySetToFolderItem.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/folder/add_study_set/component/AddStudySetToFolderItem.kt @@ -115,7 +115,7 @@ fun AddStudySetToFolderItem( horizontalArrangement = Arrangement.spacedBy(8.dp), ) { Text( - text = studySet.subject?.name ?: SubjectModel.defaultSubjects[0].name, + text = stringResource(studySet.subject?.subjectName ?: SubjectModel.defaultSubjects[0].subjectName), style = typography.bodySmall.copy( color = colorScheme.onSurface.copy(alpha = 0.6f) ) diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/home/HomeScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/home/HomeScreen.kt index ac7b15a6..e4044110 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/home/HomeScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/home/HomeScreen.kt @@ -662,8 +662,8 @@ private fun HomeScreenPreview() { Home( subjects = listOf( SubjectModel( - 1, - "General", + id = 1, + subjectName = R.string.txt_general, iconRes = R.drawable.ic_all, color = Color(0xFF7f60f9), studySetCount = 1 diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/home/components/StudySetHomeItem.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/home/components/StudySetHomeItem.kt index 151dd5b6..937007a6 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/home/components/StudySetHomeItem.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/home/components/StudySetHomeItem.kt @@ -101,7 +101,7 @@ fun StudySetHomeItem( horizontalArrangement = Arrangement.spacedBy(8.dp), ) { Text( - text = studySet?.subject?.name ?: SubjectModel.defaultSubjects[0].name, + text = stringResource(studySet?.subject?.subjectName ?: SubjectModel.defaultSubjects[0].subjectName), style = typography.bodySmall.copy( color = colorScheme.onSurface.copy(alpha = 0.6f) ) diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/home/components/SubjectItem.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/home/components/SubjectItem.kt index 01544657..bb239d9d 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/home/components/SubjectItem.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/home/components/SubjectItem.kt @@ -15,6 +15,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview @@ -47,15 +48,15 @@ fun SubjectItem( verticalAlignment = Alignment.CenterVertically, ) { Icon( - painter = painterResource(id = subject.iconRes!!), - contentDescription = subject.name, + painter = painterResource(id = subject.iconRes ?: R.drawable.ic_all), + contentDescription = stringResource(subject.subjectName), tint = subject.color!!, modifier = Modifier .size(35.dp) ) Text( - text = subject.name, + text = stringResource(subject.subjectName), style = typography.titleMedium.copy( color = colorScheme.onSurface, fontWeight = FontWeight.Bold @@ -69,8 +70,12 @@ fun SubjectItem( Text( text = when (subject.studySetCount) { - 1 -> "${subject.studySetCount} Study Set" - else -> "${subject.studySetCount} Study Sets" + 0 -> stringResource(R.string.txt_no_study_sets) + 1 -> stringResource(R.string.txt_one_study_set) + else -> stringResource( + R.string.txt_study_sets_library, + subject.studySetCount + ) }, style = typography.bodyMedium.copy( color = colorScheme.onSurface, @@ -89,10 +94,10 @@ fun SubjectItemPreview() { onSearchStudySetBySubject = {}, subject = SubjectModel( id = 1, - name = "All", + subjectName = R.string.txt_general, iconRes = R.drawable.ic_all, color = Color(0xFF7f60f9), - description = "Agriculture is the study of farming and cultivation of land." + subjectDescription = R.string.txt_general_subjects_that_do_not_fit_into_specific_categories, ), ) } diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/home/search_by_subject/SearchStudySetBySubjectScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/home/search_by_subject/SearchStudySetBySubjectScreen.kt index fdf6dba8..ea5e2987 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/home/search_by_subject/SearchStudySetBySubjectScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/home/search_by_subject/SearchStudySetBySubjectScreen.kt @@ -2,6 +2,7 @@ package com.pwhs.quickmem.presentation.app.home.search_by_subject import android.widget.Toast import androidx.annotation.DrawableRes +import androidx.annotation.StringRes import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -87,9 +88,10 @@ fun SearchStudySetBySubjectScreen( icon = uiState.icon, studySetCount = uiState.studySetCount, isLoading = uiState.isLoading, - nameSubject = uiState.subject?.name ?: "", + nameSubject = uiState.subject?.subjectName ?: R.string.txt_general, colorSubject = uiState.subject?.color ?: Color.Blue, - descriptionSubject = uiState.subject?.description ?: "", + descriptionSubject = uiState.subject?.subjectDescription + ?: R.string.txt_general_subjects_that_do_not_fit_into_specific_categories, studySets = studySetItems, onNavigateBack = { resultBackNavigator.navigateBack(true) @@ -108,11 +110,11 @@ fun SearchStudySetBySubject( modifier: Modifier = Modifier, studySets: LazyPagingItems? = null, onStudySetClick: (GetStudySetResponseModel?) -> Unit = {}, - nameSubject: String = "", + @StringRes nameSubject: Int = R.string.txt_general, colorSubject: Color, @DrawableRes icon: Int = R.drawable.ic_all, studySetCount: Int = 0, - descriptionSubject: String = "", + @StringRes descriptionSubject: Int = R.string.txt_general_subjects_that_do_not_fit_into_specific_categories, isLoading: Boolean = false, onNavigateBack: () -> Unit, onStudySetRefresh: () -> Unit = {}, @@ -126,11 +128,11 @@ fun SearchStudySetBySubject( topBar = { SearchStudySetBySubjectTopAppBar( onNavigateBack = onNavigateBack, - name = nameSubject, + name = stringResource(nameSubject), color = colorSubject, icon = icon, studySetCount = studySetCount, - description = descriptionSubject, + description = stringResource(descriptionSubject), onAddStudySet = onAddStudySet ) } diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/home/search_by_subject/component/SearchStudySetBySubjectTopAppBar.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/home/search_by_subject/component/SearchStudySetBySubjectTopAppBar.kt index 8526bc44..ec8cd787 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/home/search_by_subject/component/SearchStudySetBySubjectTopAppBar.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/home/search_by_subject/component/SearchStudySetBySubjectTopAppBar.kt @@ -56,7 +56,9 @@ fun SearchStudySetBySubjectTopAppBar( title = { Column { Row( - modifier = Modifier.padding(vertical = 8.dp), + modifier = Modifier + .padding(vertical = 8.dp) + .padding(end = 16.dp), horizontalArrangement = Arrangement.Center, verticalAlignment = Alignment.CenterVertically ) { diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/library/study_set/component/StudySetItem.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/library/study_set/component/StudySetItem.kt index d0c30276..e9993055 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/library/study_set/component/StudySetItem.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/library/study_set/component/StudySetItem.kt @@ -17,7 +17,6 @@ import androidx.compose.material3.CardDefaults.cardColors import androidx.compose.material3.CardDefaults.elevatedCardElevation import androidx.compose.material3.Icon import androidx.compose.material3.IconButton -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme.colorScheme import androidx.compose.material3.MaterialTheme.typography import androidx.compose.material3.Scaffold @@ -105,7 +104,7 @@ fun StudySetItem( horizontalArrangement = Arrangement.spacedBy(8.dp), ) { Text( - text = studySet?.subject?.name ?: SubjectModel.defaultSubjects[0].name, + text = stringResource(studySet?.subject?.subjectName ?: SubjectModel.defaultSubjects[0].subjectName), style = typography.bodySmall.copy( color = colorScheme.onSurface.copy(alpha = 0.6f) ) diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/search_result/study_set/component/FilterStudySetBottomSheet.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/search_result/study_set/component/FilterStudySetBottomSheet.kt index 81fd4f21..58541cc7 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/search_result/study_set/component/FilterStudySetBottomSheet.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/search_result/study_set/component/FilterStudySetBottomSheet.kt @@ -45,7 +45,7 @@ fun FilterStudySetBottomSheet( var searchSubjectQuery by remember { mutableStateOf("") } val filteredSubjects = SubjectModel.defaultSubjects.filter { - it.name.contains(searchSubjectQuery, ignoreCase = true) + stringResource(it.subjectName).contains(searchSubjectQuery, ignoreCase = true) } LazyColumn( diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/component/StudySetSubjectBottomSheet.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/component/StudySetSubjectBottomSheet.kt index 9dc51e69..e2eb0861 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/component/StudySetSubjectBottomSheet.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/component/StudySetSubjectBottomSheet.kt @@ -24,6 +24,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import com.pwhs.quickmem.R @@ -98,15 +99,15 @@ fun StudySetSubjectBottomSheet( verticalAlignment = Alignment.CenterVertically, ) { Icon( - painter = painterResource(id = subject.iconRes!!), - contentDescription = subject.name, + painter = painterResource(id = subject.iconRes ?: R.drawable.ic_all), + contentDescription = stringResource(subject.subjectName), tint = subject.color!!, modifier = Modifier .size(24.dp) ) Text( - text = subject.name, + text = stringResource(subject.subjectName), style = typography.bodyMedium.copy( color = colorScheme.onSurface, fontWeight = FontWeight.Bold diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/component/StudySetSubjectInput.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/component/StudySetSubjectInput.kt index 4e2fcbc8..52fc9b36 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/component/StudySetSubjectInput.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/component/StudySetSubjectInput.kt @@ -16,6 +16,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import com.pwhs.quickmem.R @@ -31,16 +32,16 @@ fun StudySetSubjectInput( modifier = modifier.padding(top = 10.dp) ) { Text( - text = "Subject", + text = stringResource(R.string.txt_subject), style = typography.bodyMedium.copy( fontWeight = FontWeight.Bold ) ) OutlinedTextField( shape = RoundedCornerShape(10.dp), - value = subjectModel!!.name, + value = stringResource(subjectModel?.subjectName ?: R.string.txt_general), onValueChange = { }, - placeholder = { Text("Subject") }, + placeholder = { Text(stringResource(R.string.txt_general)) }, modifier = Modifier .fillMaxWidth() .padding(top = 5.dp) @@ -50,8 +51,10 @@ fun StudySetSubjectInput( readOnly = true, leadingIcon = { Icon( - painter = painterResource(id = subjectModel.iconRes!!), - contentDescription = subjectModel.name, + painter = painterResource(id = subjectModel?.iconRes ?: R.drawable.ic_all), + contentDescription = stringResource( + subjectModel?.subjectName ?: R.string.txt_general + ), modifier = Modifier.size(24.dp), tint = Color.Black ) diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/create/CreateStudySetScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/create/CreateStudySetScreen.kt index 21faa8e8..2bad9b32 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/create/CreateStudySetScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/create/CreateStudySetScreen.kt @@ -122,7 +122,7 @@ fun CreateStudySet( mutableStateOf("") } val filteredSubjects = SubjectModel.defaultSubjects.filter { - it.name.contains(searchSubjectQuery, ignoreCase = true) + stringResource(it.subjectName).contains(searchSubjectQuery, ignoreCase = true) } val imeState = rememberImeState() val scrollState = rememberScrollState() diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/edit/EditStudySetScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/edit/EditStudySetScreen.kt index bb5df657..3c90dafd 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/edit/EditStudySetScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/edit/EditStudySetScreen.kt @@ -123,7 +123,7 @@ fun EditStudySet( mutableStateOf("") } val filteredSubjects = SubjectModel.defaultSubjects.filter { - it.name.contains(searchSubjectQuery, ignoreCase = true) + stringResource(it.subjectName).contains(searchSubjectQuery, ignoreCase = true) } val imeState = rememberImeState() val scrollState = rememberScrollState() diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 72740d3b..18223dd6 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -482,4 +482,81 @@ Bộ học đã được tạo Bộ học đã được chỉnh sửa Quá trình học lật thẻ hiện tại + Chung + Các môn học tổng quát không thuộc vào các danh mục cụ thể. + Nhân học + Nhân học là nghiên cứu về xã hội và văn hóa của con người. + Kiến trúc và thiết kế + Kiến trúc và thiết kế là nghiên cứu về các tòa nhà, công trình và không gian. + Nghệ thuật + Nghệ thuật là nghiên cứu về các biểu hiện sáng tạo trong các hình thức khác nhau như hội họa, âm nhạc và điêu khắc. + Sinh học là nghiên cứu về các sinh vật sống và các quá trình sống. + Sinh học + Kinh doanh + Kinh doanh là nghiên cứu về thương mại, giao dịch và quản lý tổ chức. + Hóa học + Hóa học là nghiên cứu về các chất, tính chất và phản ứng của chúng. + Khoa học máy tính + Khoa học Máy tính là nghiên cứu về các hệ thống tính toán, thuật toán và lập trình. + Khoa học Trái Đất + Khoa học Trái Đất là nghiên cứu về Trái Đất, thành phần và các hiện tượng tự nhiên của nó. + Kinh tế học + Kinh tế học là nghiên cứu về sản xuất, phân phối và tiêu dùng hàng hóa và dịch vụ. + Giao thông vận tải + Giao thông vận tải là nghiên cứu về sự di chuyển của người và hàng hóa, cũng như cơ sở hạ tầng hỗ trợ. + Khoa học hệ thống là nghiên cứu về các hệ thống phức tạp, chẳng hạn như hệ sinh thái, tổ chức và công nghệ. + Khoa học hệ thống + Khoa học vũ trụ + Khoa học vũ trụ khám phá nghiên cứu về vũ trụ, các thiên thể và hiện tượng vũ trụ. + Xã hội học là nghiên cứu về xã hội loài người, hành vi xã hội và cấu trúc xã hội. + Xã hội học + Công tác xã hội là nghiên cứu về việc giúp đỡ cá nhân, gia đình và cộng đồng cải thiện hạnh phúc. + Công tác xã hội + Tôn giáo và thần học + Tôn giáo và thần học tập trung vào nghiên cứu về đức tin, tâm linh và niềm tin tôn giáo. + Quản trị công liên quan đến việc quản lý các chính sách và chương trình của chính phủ. + Quản trị công + Tâm lý học là nghiên cứu về tâm trí, hành vi và quá trình tâm lý của con người. + Tâm lý học + Khoa học chính trị là nghiên cứu về hệ thống chính phủ, chính sách và hành vi chính trị. + Khoa học chính trị + Vật lý học là nghiên cứu về vật chất, năng lượng và các định luật chi phối vũ trụ. + Vật lý + Triết học là nghiên cứu về sự tồn tại, kiến thức và đạo đức. + Triết học + Các lĩnh vực nghiên cứu khác không phù hợp với các danh mục học thuật truyền thống. + Khác + Khoa học quân sự + Khoa học quân sự nghiên cứu về chiến thuật quân sự, chiến lược phòng thủ và hệ thống an ninh. + Y học + Y học là nghiên cứu về sức khỏe, bệnh tật và thực hành y tế. + Toán học + Toán học là nghiên cứu về số, lượng, hình dạng và mẫu. + Logic học là nghiên cứu về lý luận, tư duy phê phán và phương pháp giải quyết vấn đề. + Logic + Văn học là nghiên cứu về các tác phẩm viết, như tiểu thuyết, thơ và kịch. + Văn học + Nghiên cứu thư viện và bảo tàng tập trung vào việc bảo quản và tổ chức thông tin cũng như hiện vật. + Nghiên cứu thư viện và bảo tàng + Luật học là nghiên cứu về hệ thống pháp luật, quy định và công lý. + Luật học + Ngôn ngữ và văn hóa + Ngôn ngữ và văn hóa tập trung vào ngôn ngữ học, thực hành văn hóa và giao tiếp giữa các xã hội. + Nghiên cứu báo chí và truyền thông khám phá giao tiếp, báo cáo và vai trò của truyền thông trong xã hội. + Báo chí, nghiên cứu truyền thông và giao tiếp + Nghiên cứu liên ngành liên quan đến việc tích hợp kiến thức từ nhiều ngành học khác nhau. + Nghiên cứu liên ngành + Hiệu suất thể chất và giải trí của con người tập trung vào các hoạt động thể chất, thể thao và hạnh phúc tổng thể. + Hiệu suất thể chất và giải trí của con người + Lịch sử là nghiên cứu về các sự kiện, nền văn minh trong quá khứ và ảnh hưởng của chúng đến hiện tại. + Địa lý là nghiên cứu về các địa điểm, cảnh quan và mối quan hệ giữa con người và môi trường. + Lịch sử + Địa lý + Khoa học gia đình và tiêu dùng là nghiên cứu về động lực gia đình, dinh dưỡng và hành vi tiêu dùng. + Khoa học gia đình và tiêu dùng + Nghiên cứu môi trường và lâm nghiệp + Nghiên cứu môi trường và lâm nghiệp tập trung vào bảo vệ và quản lý tài nguyên thiên nhiên và hệ sinh thái. + Kỹ thuật và công nghệ liên quan đến việc áp dụng kiến thức khoa học để phát triển giải pháp cho các vấn đề thực tế. + Kỹ thuật và công nghệ + Môn học \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 87409b4a..be06f12b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -484,4 +484,81 @@ Study Set Created Study Set Edited Current flip status + General + General subjects that do not fit into specific categories. + Anthropology + Anthropology is the study of human societies and cultures. + Architecture and design + Architecture and design is the study of buildings, structures, and spaces. + Arts + Arts is the study of creative expressions in various forms like painting, music, and sculpture. + Biology is the study of living organisms and life processes. + Biology + Business + Business is the study of commerce, trade, and organizational management. + Chemistry + Chemistry is the study of substances, their properties, and reactions. + Computer sciences + Computer Science is the study of computational systems, algorithms, and programming. + Earth sciences + Earth Science is the study of the Earth, its composition, and natural phenomena. + Economics + Economics is the study of the production, distribution, and consumption of goods and services. + Transportation + Transportation is the study of the movement of people and goods and the infrastructure that supports it. + Systems science is the study of complex systems, such as ecosystems, organizations, and technologies. + Systems science + Space sciences + Space sciences explore the study of the universe, celestial bodies, and cosmic phenomena. + Sociology is the study of human societies, social behavior, and social structures. + Sociology + Social work is the study of helping individuals, families, and communities improve their well-being. + Social work + Religion and divinity + Religion and divinity focus on the study of faith, spirituality, and religious beliefs. + Public administration involves the management of government policies and programs. + Public administration + Psychology is the study of the human mind, behavior, and mental processes. + Psychology + Political science is the study of government systems, policies, and political behavior. + Political science + Physics is the study of matter, energy, and the laws governing the universe. + Physics + Philosophy is the study of existence, knowledge, and ethics. + Philosophy + Other fields of study that do not fit into traditional academic categories. + Other + Military sciences + Military sciences study military tactics, defense strategies, and security systems. + Medicine + Medicine is the study of health, diseases, and medical practices. + Mathematics + Mathematics is the study of numbers, quantities, shapes, and patterns. + Logic is the study of reasoning, critical thinking, and problem-solving methods. + Logic + Literature is the study of written works, such as novels, poetry, and plays. + Literature + Library and museum studies focus on the preservation and organization of information and artifacts. + Library and museum studies + Law is the study of legal systems, regulations, and justice. + Law + Languages and cultures + Languages and cultures focus on linguistics, cultural practices, and communication across societies. + Journalism and media studies explore communication, reporting, and media\'s role in society. + Journalism, media studies and communication + Interdisciplinary studies involve integrating knowledge from multiple academic disciplines. + Interdisciplinary studies + Human physical performance and recreation focuses on physical activities, sports, and overall well-being. + Human physical performance and recreation + History is the study of past events, civilizations, and their impact on the present. + Geography is the study of places, landscapes, and the human-environment relationship. + History + Geography + Family and consumer science is the study of family dynamics, nutrition, and consumer behavior. + Family and consumer science + Environmental studies and forestry + Environmental studies and forestry focus on the protection and management of natural resources and ecosystems. + Engineering and technology involves applying scientific knowledge to develop solutions for practical problems. + Engineering and technology + Subject \ No newline at end of file