Skip to content

Commit 6ebf070

Browse files
authored
Merge pull request #16529 from wordpress-mobile/issue/blogging-prompts-visual-fixes
Issue/blogging prompts visual fixes
2 parents 1b5487b + 997c527 commit 6ebf070

File tree

7 files changed

+33
-24
lines changed

7 files changed

+33
-24
lines changed

WordPress/src/main/java/org/wordpress/android/ui/bloggingprompts/onboarding/BloggingPromptsOnboardingUiStateMapper.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ class BloggingPromptsOnboardingUiStateMapper @Inject constructor() {
2121
): Ready {
2222
val dummyRespondent = BloggingPromptRespondent(
2323
54279365,
24-
"https://0.gravatar.com/avatar/cec64efa352617" +
25-
"c35743d8ed233ab410?s=96&d=identicon&r=G"
24+
""
2625
)
2726

2827
val dummyRespondents = listOf(

WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/dashboard/bloggingprompts/BloggingPromptCardViewHolder.kt

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,28 @@ class BloggingPromptCardViewHolder(
5959
FlexDirection.ROW,
6060
FlexWrap.NOWRAP
6161
).apply { justifyContent = JustifyContent.CENTER }
62-
answeredUsersRecycler.addItemDecoration(
63-
AvatarItemDecorator(
64-
RtlUtils.isRtl(answeredUsersRecycler.context),
65-
answeredUsersRecycler.context,
66-
AVATAR_LEFT_OFFSET_DIMEN
67-
)
68-
)
69-
answeredUsersRecycler.layoutManager = layoutManager
7062

71-
val adapter = TrainOfAvatarsAdapter(
72-
imageManager,
73-
uiHelpers
74-
)
75-
answeredUsersRecycler.adapter = adapter
63+
if (card.numberOfAnswers > 0) {
64+
uiHelpers.updateVisibility(answeredUsersRecycler, true)
65+
answeredUsersRecycler.addItemDecoration(
66+
AvatarItemDecorator(
67+
RtlUtils.isRtl(answeredUsersRecycler.context),
68+
answeredUsersRecycler.context,
69+
AVATAR_LEFT_OFFSET_DIMEN
70+
)
71+
)
72+
answeredUsersRecycler.layoutManager = layoutManager
73+
74+
val adapter = TrainOfAvatarsAdapter(
75+
imageManager,
76+
uiHelpers
77+
)
78+
answeredUsersRecycler.adapter = adapter
7679

77-
adapter.loadData(card.respondents)
80+
adapter.loadData(card.respondents)
81+
} else {
82+
uiHelpers.updateVisibility(answeredUsersRecycler, false)
83+
}
7884
}
7985
}
8086

WordPress/src/main/res/layout/avatar_item.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
android:layout_height="match_parent">
66

77
<ImageView
8+
android:backgroundTint="?attr/colorSurface"
89
android:id="@+id/avatar"
910
style="@style/ReaderImageView.Avatar.Small"
1011
android:layout_gravity="center_vertical"

WordPress/src/main/res/layout/blogging_promp_card_compact.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
<com.google.android.material.textview.MaterialTextView
4848
android:id="@+id/prompt_content"
49-
style="@style/MySiteCardItemTitle"
49+
style="@style/MySiteCardBloggingPromptTitle"
5050
android:layout_width="match_parent"
5151
android:layout_height="wrap_content"
5252
android:layout_marginTop="@dimen/margin_large"

WordPress/src/main/res/layout/my_site_blogging_promp_card.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
<com.google.android.material.textview.MaterialTextView
5555
android:id="@+id/prompt_content"
56-
style="@style/MySiteCardItemTitle"
56+
style="@style/MySiteCardBloggingPromptTitle"
5757
android:layout_width="match_parent"
5858
android:layout_height="wrap_content"
5959
android:layout_marginTop="@dimen/margin_extra_large"

WordPress/src/main/res/values/styles.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,12 @@
856856
<item name="android:paddingEnd">@dimen/margin_medium</item>
857857
</style>
858858

859+
<style name="MySiteCardBloggingPromptTitle" parent="@style/MySiteCardItemTitle">
860+
<item name="android:maxLines">3</item>
861+
<item name="autoSizeTextType">uniform</item>
862+
<item name="autoSizeMinTextSize">12sp</item>
863+
</style>
864+
859865
<!--People Management Styles-->
860866
<style name="PersonAvatar">
861867
<item name="android:layout_width">@dimen/people_avatar_sz</item>

WordPress/src/test/java/org/wordpress/android/ui/bloggingprompts/onboarding/BloggingPromptsOnboardingUiStateMapperTest.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,15 @@ class BloggingPromptsOnboardingUiStateMapperTest {
1717
private val expectedRespondents = listOf(
1818
AvatarItem(
1919
54279365,
20-
"https://0.gravatar.com/avatar/cec64efa352617" +
21-
"c35743d8ed233ab410?s=96&d=identicon&r=G"
20+
""
2221
),
2322
AvatarItem(
2423
54279365,
25-
"https://0.gravatar.com/avatar/cec64efa352617" +
26-
"c35743d8ed233ab410?s=96&d=identicon&r=G"
24+
""
2725
),
2826
AvatarItem(
2927
54279365,
30-
"https://0.gravatar.com/avatar/cec64efa352617" +
31-
"c35743d8ed233ab410?s=96&d=identicon&r=G"
28+
""
3229
),
3330
TrailingLabelTextItem(
3431
UiStringPluralRes(R.plurals.my_site_blogging_prompt_card_number_of_answers, 5),

0 commit comments

Comments
 (0)