Skip to content

Commit

Permalink
Fix part of #5344: Fix Localization Issues of Classroom List Screen (#…
Browse files Browse the repository at this point in the history
…5479)

<!-- READ ME FIRST: Please fill in the explanation section below and
check off every point from the Essential Checklist! -->
## Explanation
<!--
- Explain what your PR does. If this PR fixes an existing bug, please
include
- "Fixes #bugnum:" in the explanation so that GitHub can auto-close the
issue
  - when this PR is merged.
  -->

Fixes part of #5344

This PR fixes the localization issues of the promoted stories' header
and the classroom carousel.

## Screenshots
|Portrait|Landscape|
|--|--|

|![image](https://github.com/user-attachments/assets/9cc3dbec-f5f7-4ae6-bb42-4bb4c9d5126b)|![image](https://github.com/user-attachments/assets/51947734-a6c7-4a36-80a9-21849e4dfa90)|

|![image](https://github.com/user-attachments/assets/6774a2a8-2487-410b-8a97-60260d459b97)|![image](https://github.com/user-attachments/assets/2371f5a4-cfa7-429d-bc1b-47387825decc)|

## Essential Checklist
<!-- Please tick the relevant boxes by putting an "x" in them. -->
- [x] The PR title and explanation each start with "Fix #bugnum: " (If
this PR fixes part of an issue, prefix the title with "Fix part of
#bugnum: ...".)
- [x] Any changes to
[scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets)
files have their rationale included in the PR explanation.
- [x] The PR follows the [style
guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide).
- [x] The PR does not contain any unnecessary code changes from Android
Studio
([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)).
- [x] The PR is made from a branch that's **not** called "develop" and
is up-to-date with "develop".
- [x] The PR is **assigned** to the appropriate reviewers
([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)).

## For UI-specific PRs only
<!-- Delete these section if this PR does not include UI-related
changes. -->
If your PR includes UI-related changes, then:
- Add screenshots for portrait/landscape for both a tablet & phone of
the before & after UI changes
- For the screenshots above, include both English and pseudo-localized
(RTL) screenshots (see [RTL
guide](https://github.com/oppia/oppia-android/wiki/RTL-Guidelines))
- Add a video showing the full UX flow with a screen reader enabled (see
[accessibility
guide](https://github.com/oppia/oppia-android/wiki/Accessibility-A11y-Guide))
- For PRs introducing new UI elements or color changes, both light and
dark mode screenshots must be included
- Add a screenshot demonstrating that you ran affected Espresso tests
locally & that they're passing

---------

Co-authored-by: Adhiambo Peres <[email protected]>
  • Loading branch information
theMr17 and adhiamboperes authored Aug 8, 2024
1 parent bfa471e commit 83f5356
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 83f5356

Please sign in to comment.