Skip to content

Commit

Permalink
Fix part of #2003: Replacing all dimensions except space_0dp (#2160)
Browse files Browse the repository at this point in the history
* Fix part of #2003: Replacing space_32dp

Fixes part of #2003
This PR replaces the use of space_32dp with the dimensions having
contextful names.

* Resloving conflicts

* Overiding dimensions

* Fixes part of #2003: Replacing space_24dp

Fixes part of #2003
This PR replaces the use of space_24dp with the dimensions having
contextful names.

* Resolving conflicts

* Failing tests

* Fix part of #2003: Replacing space_16dp,space_12dp

Fixes part of #2003:
This PR replaces the use of space_16dp and space_12dp with the
dimensions having contextful names.

* Failing Tests

* Commiting for updating the replacing-space-16dp-12dp branch

* Fix part of #2003: Replacing all dimensions except space_0dp

Fixes part of # 2003:
This PR replaces all the dimensions with the one having contextful names
(except space_0dp)

* Failing tests
  • Loading branch information
Arjupta authored Nov 23, 2020
1 parent 9c24167 commit ac29306
Show file tree
Hide file tree
Showing 68 changed files with 446 additions and 226 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,22 @@ class OngoingListAdapter(
val params =
holder.binding.ongoingStoryCardView.layoutParams as (ViewGroup.MarginLayoutParams)
val marginTop = if (activity.resources.getBoolean(R.bool.isTablet)) {
(activity as Context).resources.getDimensionPixelSize(R.dimen.space_28dp)
(activity as Context).resources
.getDimensionPixelSize(R.dimen.ongoing_story_card_view_is_tablet_margin_top)
} else {
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
if (storyGridPosition > 2) {
(activity as Context).resources
.getDimensionPixelSize(R.dimen.ongoing_story_card_view_margin_top_portrait)
} else {
(activity as Context).resources.getDimensionPixelSize(R.dimen.space_28dp)
(activity as Context).resources
.getDimensionPixelSize(
R.dimen.ongoing_story_card_view_margin_top_portrait_story_grid_greater_then_2
)
}
} else {
(activity as Context).resources.getDimensionPixelSize(R.dimen.space_28dp)
(activity as Context).resources
.getDimensionPixelSize(R.dimen.ongoing_story_card_view_margin_top_landscape)
}
}
val marginBottom = 0
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout-land/content_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
android:background="@{viewModel.hasConversationView ? @drawable/content_blue_background : @drawable/transparent_background}"
app:explorationSplitViewMarginApplicable="@{viewModel.hasConversationView && viewModel.isSplitView}"
app:explorationSplitViewMarginBottom="@{@dimen/space_0dp}"
app:explorationSplitViewMarginEnd="@{@dimen/space_40dp}"
app:explorationSplitViewMarginEnd="@{@dimen/content_item_exploration_split_view_margin_end}"
app:explorationSplitViewMarginStart="@{@dimen/content_item_exploration_split_view_margin_start}"
app:explorationSplitViewMarginTop="@{@dimen/space_40dp}"
app:explorationSplitViewMarginTop="@{@dimen/content_item_exploration_split_view_margin_top}"
app:explorationSplitViewPaddingApplicable="@{viewModel.hasConversationView && viewModel.isSplitView}"
app:explorationSplitViewPaddingBottom="@{@dimen/content_item_exploration_split_view_padding_bottom}"
app:explorationSplitViewPaddingEnd="@{@dimen/content_item_exploration_split_view_padding_end}"
Expand All @@ -42,7 +42,7 @@
app:questionSplitViewMarginBottom="@{@dimen/content_item_question_split_view_margin_bottom}"
app:questionSplitViewMarginEnd="@{@dimen/content_item_question_split_view_margin_end}"
app:questionSplitViewMarginStart="@{@dimen/content_item_question_split_view_margin_start}"
app:questionSplitViewMarginTop="@{@dimen/space_40dp}"
app:questionSplitViewMarginTop="@{@dimen/content_item_question_split_view_margin_top}"
app:questionSplitViewPaddingApplicable="@{!viewModel.hasConversationView && viewModel.isSplitView}"
app:questionSplitViewPaddingBottom="@{@dimen/space_0dp}"
app:questionSplitViewPaddingEnd="@{@dimen/space_0dp}"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout-land/drag_drop_interaction_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
app:explorationSplitViewMarginBottom="@{@dimen/space_0dp}"
app:explorationSplitViewMarginEnd="@{@dimen/drag_drop_item_exploration_split_view_margin_end}"
app:explorationSplitViewMarginStart="@{@dimen/drag_drop_item_exploration_split_view_margin_start}"
app:explorationSplitViewMarginTop="@{@dimen/space_40dp}"
app:explorationSplitViewMarginTop="@{@dimen/drag_drop_item_exploration_split_view_margin_top}"
app:explorationViewMarginApplicable="@{viewModel.hasConversationView && !viewModel.splitView}"
app:explorationViewMarginBottom="@{@dimen/space_0dp}"
app:explorationViewMarginEnd="@{@dimen/drag_drop_item_exploration_view_margin_end}"
Expand All @@ -38,7 +38,7 @@
app:questionSplitViewMarginBottom="@{@dimen/space_0dp}"
app:questionSplitViewMarginEnd="@{@dimen/drag_drop_item_question_split_view_margin_end}"
app:questionSplitViewMarginStart="@{@dimen/drag_drop_item_question_split_view_margin_start}"
app:questionSplitViewMarginTop="@{@dimen/space_40dp}"
app:questionSplitViewMarginTop="@{@dimen/drag_drop_item_question_split_view_margin_top}"
app:questionViewMarginApplicable="@{!viewModel.hasConversationView && !viewModel.splitView}"
app:questionViewMarginBottom="@{@dimen/space_0dp}"
app:questionViewMarginEnd="@{@dimen/drag_drop_item_question_view_margin_end}"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout-land/feedback_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
android:background="@{viewModel.hasConversationView ? @drawable/content_blue_background : @drawable/transparent_background}"
app:explorationSplitViewMarginApplicable="@{viewModel.hasConversationView && viewModel.isSplitView}"
app:explorationSplitViewMarginBottom="@{@dimen/space_0dp}"
app:explorationSplitViewMarginEnd="@{@dimen/space_40dp}"
app:explorationSplitViewMarginEnd="@{@dimen/feedback_item_exploration_split_view_margin_end}"
app:explorationSplitViewMarginStart="@{@dimen/feedback_item_exploration_split_view_margin_start}"
app:explorationSplitViewMarginTop="@{@dimen/feedback_item_exploration_split_view_margin_top}"
app:explorationSplitViewPaddingApplicable="@{viewModel.hasConversationView && viewModel.isSplitView}"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout-land/profile_chooser_add_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
android:layout_marginBottom="24dp"
android:gravity="center_horizontal"
android:orientation="vertical"
app:layoutMarginBottom="@{hasProfileEverBeenAddedValue ? @dimen/profile_view_already_added_margin : @dimen/space_28dp}"
app:layoutMarginBottom="@{hasProfileEverBeenAddedValue ? @dimen/profile_view_already_added_margin : @dimen/profile_chooser_add_view_margin_bottom_profile_not_added}"
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/profile_chooser_add_view_margin_top_profile_already_added : @dimen/profile_chooser_add_view_margin_top_profile_not_added}">

<de.hdodenhof.circleimageview.CircleImageView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
android:layout_marginEnd="@dimen/profile_chooser_profile_view_margin_end"
android:gravity="center_horizontal"
android:orientation="vertical"
app:layoutMarginBottom="@{hasProfileEverBeenAddedValue ? @dimen/profile_chooser_profile_view_margin_bottom_profile_already_added : @dimen/space_28dp}"
app:layoutMarginBottom="@{hasProfileEverBeenAddedValue ? @dimen/profile_chooser_profile_view_margin_bottom_profile_already_added : @dimen/profile_chooser_profile_view_margin_bottom_profile_not_added}"
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/profile_chooser_profile_view_margin_top_profile_already_added : @dimen/profile_chooser_profile_view_margin_top_profile_not_added}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout-land/state_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
android:clipToPadding="false"
android:divider="@android:color/transparent"
android:overScrollMode="never"
android:paddingTop="@{viewModel.isSplitView() ? (viewModel.isAudioBarVisible ? @dimen/space_96dp : @dimen/space_0dp) : (viewModel.isAudioBarVisible ? @dimen/state_fragment_split_view_with_audio_bar_visible_padding_top : @dimen/space_0dp)}"
android:paddingTop="@{viewModel.isSplitView() ? (viewModel.isAudioBarVisible ? @dimen/state_fragment_split_view_with_audio_bar_visible_padding_top : @dimen/space_0dp) : (viewModel.isAudioBarVisible ? @dimen/state_fragment_non_split_view_with_audio_bar_visible_padding_top : @dimen/space_0dp)}"
android:scrollbars="none"
app:data="@{viewModel.itemList}"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
Expand Down Expand Up @@ -70,8 +70,8 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="top"
app:layoutMarginEnd="@{viewModel.isSplitView() ? @dimen/state_fragment_split_view_margin_end : @dimen/space_120dp}"
app:layoutMarginStart="@{viewModel.isSplitView() ? @dimen/state_fragment_split_view_margin_start : @dimen/space_120dp}"
app:layoutMarginEnd="@{viewModel.isSplitView() ? @dimen/state_fragment_split_view_margin_end : @dimen/state_fragment_non_split_view_margin_end}"
app:layoutMarginStart="@{viewModel.isSplitView() ? @dimen/state_fragment_split_view_margin_start : @dimen/state_fragment_non_split_view_margin_start}"
app:layout_constraintEnd_toStartOf="@id/center_guideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout-land/submitted_answer_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
app:explorationSplitViewMarginApplicable="@{viewModel.hasConversationView &amp;&amp; viewModel.isSplitView}"
app:explorationSplitViewMarginBottom="@{@dimen/space_0dp}"
app:explorationSplitViewMarginEnd="@{@dimen/submitted_answer_exploration_split_view_margin_end}"
app:explorationSplitViewMarginStart="@{@dimen/space_40dp}"
app:explorationSplitViewMarginStart="@{@dimen/submitted_answer_exploration_split_view_margin_start}"
app:explorationSplitViewMarginTop="@{@dimen/submitted_answer_exploration_split_view_margin_top}"
app:explorationViewMarginApplicable="@{viewModel.hasConversationView &amp;&amp; !viewModel.isSplitView}"
app:explorationViewMarginBottom="@{@dimen/space_0dp}"
Expand Down
18 changes: 9 additions & 9 deletions app/src/main/res/layout-sw600dp-land/content_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
android:background="@{viewModel.hasConversationView ? @drawable/content_blue_background : @drawable/transparent_background}"
app:explorationSplitViewMarginApplicable="@{viewModel.hasConversationView &amp;&amp; viewModel.isSplitView}"
app:explorationSplitViewMarginBottom="@{@dimen/space_0dp}"
app:explorationSplitViewMarginEnd="@{@dimen/space_40dp}"
app:explorationSplitViewMarginEnd="@{@dimen/content_item_exploration_split_view_margin_end}"
app:explorationSplitViewMarginStart="@{@dimen/content_item_exploration_split_view_margin_start}"
app:explorationSplitViewMarginTop="@{@dimen/space_40dp}"
app:explorationSplitViewMarginTop="@{@dimen/content_item_exploration_split_view_margin_top}"
app:explorationSplitViewPaddingApplicable="@{viewModel.hasConversationView &amp;&amp; viewModel.isSplitView}"
app:explorationSplitViewPaddingBottom="@{@dimen/content_item_exploration_split_view_padding_bottom}"
app:explorationSplitViewPaddingEnd="@{@dimen/content_item_exploration_split_view_padding_end}"
app:explorationSplitViewPaddingStart="@{@dimen/content_item_exploration_split_view_padding_start}"
app:explorationSplitViewPaddingTop="@{@dimen/content_item_exploration_split_view_padding_top}"
app:explorationViewMarginApplicable="@{viewModel.hasConversationView &amp;&amp; !viewModel.isSplitView}"
app:explorationViewMarginBottom="@{@dimen/space_0dp}"
app:explorationViewMarginEnd="@{@dimen/space_208dp}"
app:explorationViewMarginStart="@{@dimen/space_176dp}"
app:explorationViewMarginTop="@{@dimen/space_40dp}"
app:explorationViewMarginEnd="@{@dimen/content_item_exploration_margin_end}"
app:explorationViewMarginStart="@{@dimen/content_item_exploration_view_margin_start}"
app:explorationViewMarginTop="@{@dimen/content_item_exploration_view_margin_top}"
app:explorationViewPaddingApplicable="@{viewModel.hasConversationView &amp;&amp; !viewModel.isSplitView}"
app:explorationViewPaddingBottom="@{@dimen/content_item_exploration_view_padding_bottom}"
app:explorationViewPaddingEnd="@{@dimen/content_item_exploration_view_padding_end}"
Expand All @@ -42,17 +42,17 @@
app:questionSplitViewMarginBottom="@{@dimen/space_0dp}"
app:questionSplitViewMarginEnd="@{@dimen/content_item_question_split_view_margin_end}"
app:questionSplitViewMarginStart="@{@dimen/content_item_question_split_view_margin_start}"
app:questionSplitViewMarginTop="@{@dimen/space_40dp}"
app:questionSplitViewMarginTop="@{@dimen/content_item_question_split_view_margin_top}"
app:questionSplitViewPaddingApplicable="@{!viewModel.hasConversationView &amp;&amp; viewModel.isSplitView}"
app:questionSplitViewPaddingBottom="@{@dimen/space_0dp}"
app:questionSplitViewPaddingEnd="@{@dimen/space_0dp}"
app:questionSplitViewPaddingStart="@{@dimen/space_0dp}"
app:questionSplitViewPaddingTop="@{@dimen/space_0dp}"
app:questionViewMarginApplicable="@{!viewModel.hasConversationView &amp;&amp; !viewModel.isSplitView}"
app:questionViewMarginBottom="@{@dimen/space_0dp}"
app:questionViewMarginEnd="@{@dimen/space_192dp}"
app:questionViewMarginStart="@{@dimen/space_192dp}"
app:questionViewMarginTop="@{@dimen/space_40dp}"
app:questionViewMarginEnd="@{@dimen/content_item_question_view_margin_end}"
app:questionViewMarginStart="@{@dimen/content_item_question_view_margin_start}"
app:questionViewMarginTop="@{@dimen/content_item_question_view_margin_top}"
app:questionViewPaddingApplicable="@{!viewModel.hasConversationView &amp;&amp; !viewModel.isSplitView}"
app:questionViewPaddingBottom="@{@dimen/space_0dp}"
app:questionViewPaddingEnd="@{@dimen/space_0dp}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
app:explorationSplitViewPaddingTop="@{@dimen/space_0dp}"
app:explorationViewMarginApplicable="@{viewModel.hasConversationView &amp;&amp; !viewModel.isSplitView}"
app:explorationViewMarginBottom="@{@dimen/space_0dp}"
app:explorationViewMarginEnd="@{@dimen/space_176dp}"
app:explorationViewMarginStart="@{@dimen/space_176dp}"
app:explorationViewMarginEnd="@{@dimen/continue_interaction_item_exploration_view_margin_end}"
app:explorationViewMarginStart="@{@dimen/continue_interaction_item_exploration_view_margin_start}"
app:explorationViewMarginTop="@{@dimen/continue_item_exploration_view_margin_top}"
app:explorationViewPaddingApplicable="@{viewModel.hasConversationView &amp;&amp; !viewModel.isSplitView}"
app:explorationViewPaddingBottom="@{@dimen/space_0dp}"
Expand All @@ -46,8 +46,8 @@
app:questionSplitViewPaddingTop="@{@dimen/space_0dp}"
app:questionViewMarginApplicable="@{!viewModel.hasConversationView &amp;&amp; !viewModel.isSplitView}"
app:questionViewMarginBottom="@{@dimen/space_0dp}"
app:questionViewMarginEnd="@{@dimen/space_192dp}"
app:questionViewMarginStart="@{@dimen/space_192dp}"
app:questionViewMarginEnd="@{@dimen/continue_interaction_item_question_view_margin_end}"
app:questionViewMarginStart="@{@dimen/continue_interaction_item_question_view_margin_start}"
app:questionViewMarginTop="@{@dimen/continue_item_question_view_margin_top}"
app:questionViewPaddingApplicable="@{!viewModel.hasConversationView &amp;&amp; !viewModel.isSplitView}"
app:questionViewPaddingBottom="@{@dimen/space_0dp}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
app:explorationSplitViewPaddingTop="@{@dimen/space_0dp}"
app:explorationViewMarginApplicable="@{buttonViewModel.hasConversationView &amp;&amp; !buttonViewModel.isSplitView}"
app:explorationViewMarginBottom="@{@dimen/space_0dp}"
app:explorationViewMarginEnd="@{@dimen/space_176dp}"
app:explorationViewMarginStart="@{@dimen/space_176dp}"
app:explorationViewMarginEnd="@{@dimen/continue_navigation_item_exploration_view_margin_end}"
app:explorationViewMarginStart="@{@dimen/continue_navigation_item_exploration_view_margin_start}"
app:explorationViewMarginTop="@{@dimen/continue_navigation_item_exploration_view_margin_top}"
app:explorationViewPaddingApplicable="@{buttonViewModel.hasConversationView &amp;&amp; !buttonViewModel.isSplitView}"
app:explorationViewPaddingBottom="@{@dimen/space_0dp}"
Expand All @@ -46,8 +46,8 @@
app:questionSplitViewPaddingTop="@{@dimen/space_0dp}"
app:questionViewMarginApplicable="@{!buttonViewModel.hasConversationView &amp;&amp; !buttonViewModel.isSplitView}"
app:questionViewMarginBottom="@{@dimen/space_0dp}"
app:questionViewMarginEnd="@{@dimen/space_192dp}"
app:questionViewMarginStart="@{@dimen/space_192dp}"
app:questionViewMarginEnd="@{@dimen/continue_navigation_item_question_view_margin_end}"
app:questionViewMarginStart="@{@dimen/continue_navigation_item_question_view_margin_start}"
app:questionViewMarginTop="@{@dimen/continue_navigation_item_question_view_margin_top}"
app:questionViewPaddingApplicable="@{!buttonViewModel.hasConversationView &amp;&amp; !buttonViewModel.isSplitView}"
app:questionViewPaddingBottom="@{@dimen/space_0dp}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@
app:explorationSplitViewMarginBottom="@{@dimen/space_0dp}"
app:explorationSplitViewMarginEnd="@{@dimen/drag_drop_item_exploration_split_view_margin_end}"
app:explorationSplitViewMarginStart="@{@dimen/drag_drop_item_exploration_split_view_margin_start}"
app:explorationSplitViewMarginTop="@{@dimen/space_40dp}"
app:explorationSplitViewMarginTop="@{@dimen/drag_drop_item_exploration_split_view_margin_top}"
app:explorationViewMarginApplicable="@{viewModel.hasConversationView &amp;&amp; !viewModel.splitView}"
app:explorationViewMarginBottom="@{@dimen/space_0dp}"
app:explorationViewMarginEnd="@{@dimen/space_176dp}"
app:explorationViewMarginStart="@{@dimen/space_208dp}"
app:explorationViewMarginEnd="@{@dimen/drag_drop_item_exploration_view_margin_end}"
app:explorationViewMarginStart="@{@dimen/drag_drop_item_exploration_view_margin_start}"
app:explorationViewMarginTop="@{@dimen/drag_drop_item_exploration_view_margin_top}"
app:questionSplitViewMarginApplicable="@{!viewModel.hasConversationView &amp;&amp; viewModel.splitView}"
app:questionSplitViewMarginBottom="@{@dimen/space_0dp}"
app:questionSplitViewMarginEnd="@{@dimen/drag_drop_item_question_split_view_margin_end}"
app:questionSplitViewMarginStart="@{@dimen/drag_drop_item_question_split_view_margin_start}"
app:questionSplitViewMarginTop="@{@dimen/space_40dp}"
app:questionSplitViewMarginTop="@{@dimen/drag_drop_item_question_split_view_margin_top}"
app:questionViewMarginApplicable="@{!viewModel.hasConversationView &amp;&amp; !viewModel.splitView}"
app:questionViewMarginBottom="@{@dimen/space_0dp}"
app:questionViewMarginEnd="@{@dimen/space_192dp}"
app:questionViewMarginStart="@{@dimen/space_192dp}"
app:questionViewMarginEnd="@{@dimen/drag_drop_item_question_view_margin_end}"
app:questionViewMarginStart="@{@dimen/drag_drop_item_question_view_margin_start}"
app:questionViewMarginTop="@{@dimen/drag_drop_item_question_view_margin_top}">

<TextView
Expand Down
Loading

0 comments on commit ac29306

Please sign in to comment.