Skip to content

Commit

Permalink
Fix #3665: [RTL] High-fi Remove textdirection attribute from all the …
Browse files Browse the repository at this point in the history
…TextViews and fix text alignment (#3666)

* Update selection_interaction_item.xml

* Update selection_interaction_item.xml

* Update return_to_topic_button_item.xml

* Update return_to_topic_button_item.xml

* removed textdirection

* fixed textview rtl

* added tablet portrait for topic summary and fixed rtl

* Fixed text alignment

* done formatting
  • Loading branch information
veena14cs authored Aug 13, 2021
1 parent cfed5fe commit a43e743
Show file tree
Hide file tree
Showing 13 changed files with 173 additions and 85 deletions.
6 changes: 3 additions & 3 deletions app/src/main/res/layout-land/promoted_story_card.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

<TextView
android:id="@+id/chapter_name_text_view"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
Expand All @@ -70,7 +70,7 @@

<TextView
android:id="@+id/story_name_text_view"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
Expand All @@ -84,7 +84,7 @@

<TextView
android:id="@+id/topic_name_text_view"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
Expand Down
24 changes: 12 additions & 12 deletions app/src/main/res/layout-land/topic_info_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,58 +26,58 @@

<TextView
android:id="@+id/topic_name_text_view"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="72dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="72dp"
android:fontFamily="sans-serif"
android:text="@{viewModel.topic.name}"
android:textColor="@color/oppiaPrimaryText"
android:textDirection="locale"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/story_count_text_view"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="72dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="72dp"
android:fontFamily="sans-serif"
android:text="@{@plurals/story_count(viewModel.topic.storyCount, viewModel.topic.storyCount)}"
android:textColor="@color/oppiaPrimaryText"
android:textDirection="locale"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/topic_name_text_view" />

<TextView
android:id="@+id/topic_description_text_view"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="72dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="72dp"
android:ellipsize="end"
android:fontFamily="sans-serif"
android:gravity="start"
android:maxLines="@{viewModel.isDescriptionExpanded() ? @integer/topic_description_expanded : @integer/topic_description_collapsed}"
android:paddingStart="72dp"
android:paddingEnd="72dp"
android:text="@{viewModel.topicDescription}"
android:textColor="@color/oppiaPrimaryText"
android:textDirection="locale"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/story_count_text_view" />

<TextView
android:id="@+id/see_more_text_view"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="72dp"
android:layout_marginEnd="72dp"
Expand All @@ -88,11 +88,11 @@
android:paddingTop="8dp"
android:text="@{viewModel.isDescriptionExpanded() ? @string/see_less : @string/see_more}"
android:textColor="@color/colorPrimary"
android:textDirection="locale"
android:textSize="16sp"
android:textStyle="bold"
android:visibility="@{viewModel.isSeeMoreVisible() ? View.VISIBLE : View.GONE}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/topic_description_text_view" />

Expand All @@ -118,9 +118,9 @@
android:gravity="center_vertical"
android:text="@string/topic_downloaded"
android:textColor="@color/oppiaPrimaryText"
android:textDirection="locale"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="@+id/download_status_image_view"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/download_status_image_view"
app:layout_constraintTop_toTopOf="@+id/download_status_image_view" />

Expand All @@ -133,10 +133,10 @@
android:fontFamily="sans-serif"
android:text="@{String.format(@string/topic_download_text, viewModel.topicSize)}"
android:textColor="@color/oppiaPrimaryText"
android:textDirection="locale"
android:textSize="18sp"
android:textStyle="italic"
app:layout_constraintBottom_toBottomOf="@+id/download_status_image_view"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/download_story_count_text_view"
app:layout_constraintTop_toTopOf="@+id/download_status_image_view" />
</androidx.constraintlayout.widget.ConstraintLayout>
Expand Down
15 changes: 8 additions & 7 deletions app/src/main/res/layout-land/topic_summary_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
android:id="@+id/topic_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutMarginTop="@{@dimen/topic_list_item_margin_top_bottom}"
app:cardCornerRadius="4dp"
app:layoutMarginBottom="@{@dimen/topic_list_item_margin_top_bottom}"
app:layoutMarginStart="@{viewModel.computeStartMargin()}"
app:layoutMarginEnd="@{viewModel.computeEndMargin()}"
app:cardCornerRadius="4dp">
app:layoutMarginStart="@{viewModel.computeStartMargin()}"
app:layoutMarginTop="@{@dimen/topic_list_item_margin_top_bottom}">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
Expand Down Expand Up @@ -51,26 +51,27 @@

<TextView
android:id="@+id/topic_name_text_view"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:ellipsize="end"
android:fontFamily="sans-serif"
android:gravity="top"
android:maxLines="2"
android:minLines="2"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:text="@{viewModel.name}"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/lesson_count_text_view"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout-sw600dp-land/promoted_story_card.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

<TextView
android:id="@+id/chapter_name_text_view"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
Expand All @@ -69,7 +69,7 @@

<TextView
android:id="@+id/story_name_text_view"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
Expand All @@ -83,7 +83,7 @@

<TextView
android:id="@+id/topic_name_text_view"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
Expand Down
23 changes: 11 additions & 12 deletions app/src/main/res/layout-sw600dp-land/topic_info_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,57 +26,55 @@

<TextView
android:id="@+id/topic_name_text_view"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:layout_marginEnd="64dp"
android:fontFamily="sans-serif"
android:text="@{viewModel.topic.name}"
android:textColor="@color/oppiaPrimaryText"
android:textDirection="locale"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/story_count_text_view"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="64dp"
android:fontFamily="sans-serif"
android:text="@{@plurals/story_count(viewModel.topic.storyCount, viewModel.topic.storyCount)}"
android:textColor="@color/oppiaPrimaryText"
android:textDirection="locale"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/topic_name_text_view" />

<TextView
android:id="@+id/topic_description_text_view"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="64dp"
android:ellipsize="end"
android:fontFamily="sans-serif"
android:gravity="start"
android:maxLines="@{viewModel.isDescriptionExpanded() ? @integer/topic_description_expanded : @integer/topic_description_collapsed}"
android:paddingStart="64dp"
android:paddingEnd="64dp"
android:text="@{viewModel.topicDescription}"
android:textColor="@color/oppiaPrimaryText"
android:textDirection="locale"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/story_count_text_view" />

<TextView
android:id="@+id/see_more_text_view"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:layout_marginEnd="64dp"
Expand All @@ -87,11 +85,11 @@
android:paddingTop="8dp"
android:text="@{viewModel.isDescriptionExpanded() ? @string/see_less : @string/see_more}"
android:textColor="@color/colorPrimary"
android:textDirection="locale"
android:textSize="16sp"
android:textStyle="bold"
android:visibility="@{viewModel.isSeeMoreVisible() ? View.VISIBLE : View.GONE}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/topic_description_text_view" />

Expand All @@ -117,6 +115,7 @@
android:textColor="@color/oppiaPrimaryText"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="@+id/download_status_image_view"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/download_status_image_view"
app:layout_constraintTop_toTopOf="@+id/download_status_image_view" />

Expand All @@ -129,10 +128,10 @@
android:fontFamily="sans-serif"
android:text="@{String.format(@string/topic_download_text, viewModel.topicSize)}"
android:textColor="@color/oppiaPrimaryText"
android:textDirection="locale"
android:textSize="18sp"
android:textStyle="italic"
app:layout_constraintBottom_toBottomOf="@+id/download_status_image_view"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/download_story_count_text_view"
app:layout_constraintTop_toTopOf="@+id/download_status_image_view" />
</androidx.constraintlayout.widget.ConstraintLayout>
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/res/layout-sw600dp-land/topic_summary_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
android:id="@+id/topic_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutMarginTop="@{@dimen/topic_list_item_margin_top_bottom}"
app:cardCornerRadius="4dp"
app:layoutMarginBottom="@{@dimen/topic_list_item_margin_top_bottom}"
app:layoutMarginStart="@{viewModel.computeStartMargin()}"
app:layoutMarginEnd="@{viewModel.computeEndMargin()}"
app:cardCornerRadius="4dp">
app:layoutMarginStart="@{viewModel.computeStartMargin()}"
app:layoutMarginTop="@{@dimen/topic_list_item_margin_top_bottom}">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
Expand Down Expand Up @@ -52,16 +52,16 @@

<TextView
android:id="@+id/topic_name_text_view"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:ellipsize="end"
android:fontFamily="sans-serif"
android:gravity="top"
android:maxLines="2"
android:minLines="2"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:text="@{viewModel.name}"
android:textColor="@color/white"
android:textSize="14sp"
Expand All @@ -71,7 +71,7 @@

<TextView
android:id="@+id/lesson_count_text_view"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout-sw600dp-port/promoted_story_card.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

<TextView
android:id="@+id/chapter_name_text_view"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
Expand All @@ -69,7 +69,7 @@

<TextView
android:id="@+id/story_name_text_view"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
Expand All @@ -83,7 +83,7 @@

<TextView
android:id="@+id/topic_name_text_view"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
Expand Down
Loading

0 comments on commit a43e743

Please sign in to comment.