diff --git a/app/src/main/java/org/oppia/android/app/classroom/classroomlist/ClassroomList.kt b/app/src/main/java/org/oppia/android/app/classroom/classroomlist/ClassroomList.kt index 23554bad74d..5a5db784fec 100644 --- a/app/src/main/java/org/oppia/android/app/classroom/classroomlist/ClassroomList.kt +++ b/app/src/main/java/org/oppia/android/app/classroom/classroomlist/ClassroomList.kt @@ -8,7 +8,6 @@ import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width @@ -52,8 +51,7 @@ fun ClassroomList( .testTag(CLASSROOM_LIST_TEST_TAG) .background( color = colorResource(id = R.color.component_color_shared_screen_primary_background_color) - ) - .fillMaxWidth(), + ), contentPadding = PaddingValues( start = dimensionResource(id = R.dimen.classrooms_text_margin_start), top = dimensionResource(id = R.dimen.classrooms_text_margin_bottom), diff --git a/app/src/main/java/org/oppia/android/app/classroom/promotedlist/PromotedStoryList.kt b/app/src/main/java/org/oppia/android/app/classroom/promotedlist/PromotedStoryList.kt index 55e59672d18..ba9fcc32e13 100644 --- a/app/src/main/java/org/oppia/android/app/classroom/promotedlist/PromotedStoryList.kt +++ b/app/src/main/java/org/oppia/android/app/classroom/promotedlist/PromotedStoryList.kt @@ -7,6 +7,7 @@ import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row @@ -52,40 +53,46 @@ fun PromotedStoryList( promotedStoryListViewModel: PromotedStoryListViewModel, machineLocale: OppiaLocale.MachineLocale, ) { - Row( - modifier = Modifier - .testTag(PROMOTED_STORY_LIST_HEADER_TEST_TAG) - .fillMaxWidth() - .padding( - start = dimensionResource(id = R.dimen.promoted_story_list_layout_margin_start), - top = dimensionResource(id = R.dimen.promoted_story_list_layout_margin_top), - end = dimensionResource(id = R.dimen.promoted_story_list_layout_margin_end), - ), - horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically, + Box( + contentAlignment = Alignment.Center, ) { - Text( - text = promotedStoryListViewModel.getHeader(), - color = colorResource(id = R.color.component_color_classroom_shared_header_text_color), - fontFamily = FontFamily.SansSerif, - fontWeight = FontWeight.Normal, - fontSize = dimensionResource(id = R.dimen.promoted_story_list_header_text_size).value.sp, + Row( modifier = Modifier - .weight(weight = 1f, fill = false), - ) - if (promotedStoryListViewModel.getViewAllButtonVisibility() == View.VISIBLE) { + .testTag(PROMOTED_STORY_LIST_HEADER_TEST_TAG) + .fillMaxWidth() + .padding( + start = dimensionResource(id = R.dimen.promoted_story_list_layout_margin_start), + top = dimensionResource(id = R.dimen.promoted_story_list_layout_margin_top), + end = dimensionResource(id = R.dimen.promoted_story_list_layout_margin_end), + ), + horizontalArrangement = Arrangement.SpaceBetween, + verticalAlignment = Alignment.CenterVertically, + ) { Text( - text = machineLocale.run { stringResource(id = R.string.view_all).toMachineUpperCase() }, - color = colorResource(id = R.color.component_color_home_activity_view_all_text_color), + text = promotedStoryListViewModel.getHeader(), + color = colorResource(id = R.color.component_color_classroom_shared_header_text_color), fontFamily = FontFamily.SansSerif, - fontWeight = FontWeight.Medium, - fontSize = dimensionResource(id = R.dimen.promoted_story_list_view_all_text_size).value.sp, + fontWeight = FontWeight.Normal, + fontSize = dimensionResource(id = R.dimen.promoted_story_list_header_text_size).value.sp, modifier = Modifier - .padding( - start = dimensionResource(id = R.dimen.promoted_story_list_view_all_padding_start) - ) - .clickable { promotedStoryListViewModel.clickOnViewAll() }, + .weight(weight = 1f, fill = false), ) + if (promotedStoryListViewModel.getViewAllButtonVisibility() == View.VISIBLE) { + Text( + text = machineLocale.run { stringResource(id = R.string.view_all).toMachineUpperCase() }, + color = colorResource(id = R.color.component_color_home_activity_view_all_text_color), + fontFamily = FontFamily.SansSerif, + fontWeight = FontWeight.Medium, + fontSize = dimensionResource( + id = R.dimen.promoted_story_list_view_all_text_size + ).value.sp, + modifier = Modifier + .padding( + start = dimensionResource(id = R.dimen.promoted_story_list_view_all_padding_start) + ) + .clickable { promotedStoryListViewModel.clickOnViewAll() }, + ) + } } } LazyRow(