Skip to content

Commit d9cb45c

Browse files
authored
Activity Tab: empty state for no modules enabled (#5890)
1 parent dc9142f commit d9cb45c

File tree

5 files changed

+176
-0
lines changed

5 files changed

+176
-0
lines changed

app/src/main/java/org/wikipedia/activitytab/ActivityTabFragment.kt

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,42 @@ class ActivityTabFragment : Fragment() {
250250
return@Scaffold
251251
}
252252

253+
if (modules.noModulesEnabled()) {
254+
Box(
255+
modifier = Modifier
256+
.fillMaxSize()
257+
.padding(paddingValues)
258+
) {
259+
val scrollState = rememberScrollState()
260+
Column(
261+
modifier = Modifier.align(Alignment.Center).padding(horizontal = 16.dp)
262+
.verticalScroll(scrollState),
263+
horizontalAlignment = Alignment.CenterHorizontally
264+
) {
265+
Image(
266+
modifier = Modifier.size(164.dp),
267+
painter = painterResource(R.drawable.illustration_activity_tab_empty),
268+
contentDescription = null
269+
)
270+
Text(
271+
modifier = Modifier.padding(top = 16.dp),
272+
text = stringResource(R.string.activity_tab_customize_screen_no_modules_title),
273+
style = MaterialTheme.typography.titleSmall,
274+
textAlign = TextAlign.Center,
275+
color = WikipediaTheme.colors.primaryColor
276+
)
277+
Text(
278+
modifier = Modifier.padding(top = 4.dp),
279+
text = stringResource(R.string.activity_tab_customize_screen_no_modules_message),
280+
style = MaterialTheme.typography.bodyMedium,
281+
textAlign = TextAlign.Center,
282+
color = WikipediaTheme.colors.primaryColor
283+
)
284+
}
285+
return@Scaffold
286+
}
287+
}
288+
253289
PullToRefreshBox(
254290
onRefresh = {
255291
isRefreshing = true
@@ -547,6 +583,39 @@ class ActivityTabFragment : Fragment() {
547583
}
548584
}
549585

586+
@Preview
587+
@Composable
588+
fun ActivityTabNoModulesPreview() {
589+
BaseTheme(currentTheme = Theme.LIGHT) {
590+
ActivityTabScreen(
591+
isLoggedIn = true,
592+
userName = "User",
593+
modules = ActivityTabModules(
594+
isTimeSpentEnabled = false,
595+
isReadingInsightsEnabled = false,
596+
isEditingInsightsEnabled = false,
597+
isImpactEnabled = false,
598+
isGamesEnabled = false,
599+
isDonationsEnabled = false,
600+
isTimelineEnabled = false
601+
),
602+
readingHistoryState = UiState.Success(ActivityTabViewModel.ReadingHistory(
603+
timeSpentThisWeek = 0,
604+
articlesReadThisMonth = 0,
605+
lastArticleReadTime = null,
606+
articlesReadByWeek = listOf(0, 0, 0, 0),
607+
articlesSavedThisMonth = 0,
608+
lastArticleSavedTime = null,
609+
articlesSaved = emptyList(),
610+
topCategories = emptyList()
611+
)),
612+
donationUiState = UiState.Success("Unknown"),
613+
wikiGamesUiState = UiState.Success(null),
614+
impactUiState = UiState.Success(GrowthUserImpact())
615+
)
616+
}
617+
}
618+
550619
companion object {
551620
fun newInstance(): ActivityTabFragment {
552621
return ActivityTabFragment().apply {

app/src/main/java/org/wikipedia/activitytab/ActivityTabModules.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ data class ActivityTabModules(
3232
ModuleType.DONATIONS -> copy(isDonationsEnabled = enabled)
3333
ModuleType.TIMELINE -> copy(isTimelineEnabled = enabled)
3434
}
35+
36+
fun noModulesEnabled() = !(isTimeSpentEnabled || isReadingInsightsEnabled || isEditingInsightsEnabled || isImpactEnabled || isGamesEnabled || isDonationsEnabled || isTimelineEnabled)
3537
}
3638

3739
enum class ModuleType(val displayName: Int) {
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="164dp"
3+
android:height="179dp"
4+
android:viewportWidth="164"
5+
android:viewportHeight="179">
6+
<path
7+
android:pathData="M27.88,82.23L28.15,10.22C28.16,9.12 29.05,8.23 30.15,8.23H120.96V21.48C120.96,22.58 121.86,23.48 122.96,23.48H136.04V150.56C136.04,152.39 133.14,153.2 131.31,153.2C128.89,153.2 129.11,155.11 126.97,155.71C124.82,156.3 124.82,153.2 122.53,153.2C120.23,153.2 120.11,155.71 117.92,155.71C115.74,155.71 115.88,153.2 113.49,153.2C111.1,153.2 110.87,155.71 108.78,155.71C106.68,155.71 106.74,153.2 104.29,153.2C101.83,153.2 101.85,155.71 99.67,155.71C97.5,155.71 97.65,153.2 95.36,153.2C93.06,153.2 93.15,155.11 90.93,155.71C88.71,156.3 88.32,153.2 86.1,153.2C83.88,153.2 83.72,155.71 81.58,155.71C79.44,155.71 79.79,153.2 77.42,153.2C75.05,153.2 74.78,155.71 72.57,155.71C70.35,155.71 70.16,153.2 67.85,153.2C65.54,153.2 65.79,155.71 63.52,155.71C61.24,155.71 61.16,153.2 58.9,153.2C56.63,153.2 56.67,155.71 54.44,155.71C52.22,155.71 52.32,153.2 49.93,153.2C47.54,153.2 47.45,155.71 45.21,155.71C42.97,155.71 43.17,153.2 41.21,153.2C39.25,153.2 38.44,156.38 36.3,155.71C34.16,155.04 34.41,153.2 32.03,153.2C30.59,153.2 27.88,152.42 27.88,150.99V102.59V82.23Z"
8+
android:strokeWidth="0.5"
9+
android:fillColor="#F1F4FD"
10+
android:fillType="evenOdd"
11+
android:strokeColor="#EAF3FF"
12+
android:strokeLineCap="round"/>
13+
<path
14+
android:pathData="M121.67,24.71C120.8,24.71 120.1,23.98 120.1,23.08V9.86C120.1,9.2 120.17,8.57 120.75,8.31C121.35,8.06 122.34,8.24 122.79,8.71L135.43,21.75C135.83,22.05 136.01,22.81 136.01,23.36C136.01,24.26 135.39,24.71 134.51,24.71C134.51,24.71 121.67,24.71 121.67,24.71Z"
15+
android:fillColor="#88A3E8"
16+
android:fillType="evenOdd"/>
17+
<path
18+
android:pathData="M35.48,27.18a7.6,7.42 0,1 0,15.21 0a7.6,7.42 0,1 0,-15.21 0z"
19+
android:fillColor="#B6D4FB"/>
20+
<path
21+
android:pathData="M100,37.07C100,37.07 118.33,49.22 122.46,44.75C126.58,40.28 122.46,51.24 122.46,51.24H86.27"
22+
android:fillColor="#3366CC"
23+
android:fillType="evenOdd"/>
24+
<path
25+
android:pathData="M27.88,43.66C27.88,43.66 42.49,53.71 62.85,53.71C83.2,53.71 67.83,60.14 67.83,60.14H27.92"
26+
android:fillColor="#3366CC"
27+
android:fillType="evenOdd"/>
28+
<path
29+
android:pathData="M30.2,60.24C30.2,60.24 110.15,22.69 100.13,41.59C90.11,60.49 136.01,37.15 136.01,37.15V60.24"
30+
android:fillColor="#B6D4FB"
31+
android:fillType="evenOdd"/>
32+
<path
33+
android:pathData="M27.95,59.43h108.09v1.65h-108.09z"
34+
android:fillColor="#ffffff"/>
35+
<path
36+
android:pathData="M38.59,74.98L97.08,74.98A0.82,0.82 0,0 1,97.91 75.8L97.91,75.8A0.82,0.82 0,0 1,97.08 76.62L38.59,76.62A0.82,0.82 0,0 1,37.77 75.8L37.77,75.8A0.82,0.82 0,0 1,38.59 74.98z"
37+
android:fillColor="#A6BBF5"/>
38+
<path
39+
android:pathData="M38.59,94.75L103.67,94.75A0.82,0.82 0,0 1,104.5 95.58L104.5,95.58A0.82,0.82 0,0 1,103.67 96.4L38.59,96.4A0.82,0.82 0,0 1,37.77 95.58L37.77,95.58A0.82,0.82 0,0 1,38.59 94.75z"
40+
android:fillColor="#6485D1"/>
41+
<path
42+
android:pathData="M38.59,139.25L63.3,139.25A0.82,0.82 0,0 1,64.13 140.07L64.13,140.07A0.82,0.82 0,0 1,63.3 140.9L38.59,140.9A0.82,0.82 0,0 1,37.77 140.07L37.77,140.07A0.82,0.82 0,0 1,38.59 139.25z"
43+
android:fillColor="#6485D1"/>
44+
<path
45+
android:pathData="M67.42,139.25L125.92,139.25A0.82,0.82 0,0 1,126.74 140.08L126.74,140.08A0.82,0.82 0,0 1,125.92 140.9L67.42,140.9A0.82,0.82 0,0 1,66.6 140.08L66.6,140.08A0.82,0.82 0,0 1,67.42 139.25z"
46+
android:fillColor="#6485D1"/>
47+
<path
48+
android:pathData="M38.59,106.29L50.95,106.29A0.82,0.82 0,0 1,51.77 107.11L51.77,107.11A0.82,0.82 0,0 1,50.95 107.94L38.59,107.94A0.82,0.82 0,0 1,37.77 107.11L37.77,107.11A0.82,0.82 0,0 1,38.59 106.29z"
49+
android:fillColor="#6485D1"/>
50+
<path
51+
android:pathData="M113.56,106.29L125.92,106.29A0.82,0.82 0,0 1,126.74 107.11L126.74,107.11A0.82,0.82 0,0 1,125.92 107.94L113.56,107.94A0.82,0.82 0,0 1,112.74 107.11L112.74,107.11A0.82,0.82 0,0 1,113.56 106.29z"
52+
android:fillColor="#6485D1"/>
53+
<path
54+
android:pathData="M55.07,106.29L109.44,106.29A0.82,0.82 0,0 1,110.26 107.11L110.26,107.11A0.82,0.82 0,0 1,109.44 107.94L55.07,107.94A0.82,0.82 0,0 1,54.24 107.11L54.24,107.11A0.82,0.82 0,0 1,55.07 106.29z"
55+
android:fillColor="#6485D1"/>
56+
<path
57+
android:pathData="M38.59,133.48L50.95,133.48A0.82,0.82 0,0 1,51.77 134.31L51.77,134.31A0.82,0.82 0,0 1,50.95 135.13L38.59,135.13A0.82,0.82 0,0 1,37.77 134.31L37.77,134.31A0.82,0.82 0,0 1,38.59 133.48z"
58+
android:fillColor="#6485D1"/>
59+
<path
60+
android:pathData="M97.91,133.48L126.74,133.48A0.82,0.82 0,0 1,127.56 134.31L127.56,134.31A0.82,0.82 0,0 1,126.74 135.13L97.91,135.13A0.82,0.82 0,0 1,97.08 134.31L97.08,134.31A0.82,0.82 0,0 1,97.91 133.48z"
61+
android:fillColor="#6485D1"/>
62+
<path
63+
android:pathData="M55.07,133.48L93.79,133.48A0.82,0.82 0,0 1,94.61 134.31L94.61,134.31A0.82,0.82 0,0 1,93.79 135.13L55.07,135.13A0.82,0.82 0,0 1,54.24 134.31L54.24,134.31A0.82,0.82 0,0 1,55.07 133.48z"
64+
android:fillColor="#6485D1"/>
65+
<path
66+
android:pathData="M125.92,94.75L107.79,94.75A0.82,0.82 90.03,0 0,106.97 95.58L106.97,95.58A0.82,0.82 90.03,0 0,107.79 96.4L125.92,96.4A0.82,0.82 90.03,0 0,126.74 95.58L126.74,95.58A0.82,0.82 90.03,0 0,125.92 94.75z"
67+
android:fillColor="#6485D1"/>
68+
<path
69+
android:pathData="M38.59,123.59L103.67,123.59A0.82,0.82 0,0 1,104.5 124.42L104.5,124.42A0.82,0.82 0,0 1,103.67 125.24L38.59,125.24A0.82,0.82 0,0 1,37.77 124.42L37.77,124.42A0.82,0.82 0,0 1,38.59 123.59z"
70+
android:fillColor="#6485D1"/>
71+
<path
72+
android:pathData="M83.08,88.98L92.96,88.98A0.82,0.82 0,0 1,93.79 89.81L93.79,89.81A0.82,0.82 0,0 1,92.96 90.63L83.08,90.63A0.82,0.82 0,0 1,82.25 89.81L82.25,89.81A0.82,0.82 0,0 1,83.08 88.98z"
73+
android:fillColor="#6485D1"/>
74+
<path
75+
android:pathData="M97.08,88.98L125.92,88.98A0.82,0.82 0,0 1,126.74 89.81L126.74,89.81A0.82,0.82 0,0 1,125.92 90.63L97.08,90.63A0.82,0.82 0,0 1,96.26 89.81L96.26,89.81A0.82,0.82 0,0 1,97.08 88.98z"
76+
android:fillColor="#6485D1"/>
77+
<path
78+
android:pathData="M38.59,88.98L78.96,88.98A0.82,0.82 0,0 1,79.78 89.81L79.78,89.81A0.82,0.82 0,0 1,78.96 90.63L38.59,90.63A0.82,0.82 0,0 1,37.77 89.81L37.77,89.81A0.82,0.82 0,0 1,38.59 88.98z"
79+
android:fillColor="#6485D1"/>
80+
<path
81+
android:pathData="M38.59,117.83L125.92,117.83A0.82,0.82 0,0 1,126.74 118.65L126.74,118.65A0.82,0.82 0,0 1,125.92 119.47L38.59,119.47A0.82,0.82 0,0 1,37.77 118.65L37.77,118.65A0.82,0.82 0,0 1,38.59 117.83z"
82+
android:fillColor="#6485D1"/>
83+
<path
84+
android:pathData="M38.59,112.06L125.92,112.06A0.82,0.82 0,0 1,126.74 112.88L126.74,112.88A0.82,0.82 0,0 1,125.92 113.71L38.59,113.71A0.82,0.82 0,0 1,37.77 112.88L37.77,112.88A0.82,0.82 0,0 1,38.59 112.06z"
85+
android:fillColor="#6485D1"/>
86+
<path
87+
android:pathData="M38.59,145.02L125.92,145.02A0.82,0.82 0,0 1,126.74 145.84L126.74,145.84A0.82,0.82 0,0 1,125.92 146.67L38.59,146.67A0.82,0.82 0,0 1,37.77 145.84L37.77,145.84A0.82,0.82 0,0 1,38.59 145.02z"
88+
android:fillColor="#6485D1"/>
89+
<path
90+
android:pathData="M38.59,100.52L125.92,100.52A0.82,0.82 0,0 1,126.74 101.35L126.74,101.35A0.82,0.82 0,0 1,125.92 102.17L38.59,102.17A0.82,0.82 0,0 1,37.77 101.35L37.77,101.35A0.82,0.82 0,0 1,38.59 100.52z"
91+
android:fillColor="#6485D1"/>
92+
<path
93+
android:pathData="M38.59,69.21L78.96,69.21A0.82,0.82 0,0 1,79.78 70.03L79.78,70.03A0.82,0.82 0,0 1,78.96 70.86L38.59,70.86A0.82,0.82 0,0 1,37.77 70.03L37.77,70.03A0.82,0.82 0,0 1,38.59 69.21z"
94+
android:fillColor="#6485D1"/>
95+
<path
96+
android:pathData="M129.5,153.5m-25.5,0a25.5,25.5 0,1 1,51 0a25.5,25.5 0,1 1,-51 0"
97+
android:fillColor="#6699FF"/>
98+
<path
99+
android:pathData="M122.73,155.96C122.4,155.96 122.12,155.85 121.9,155.63C121.68,155.4 121.56,155.12 121.56,154.79C121.56,154.46 121.68,154.19 121.9,153.97C122.12,153.75 122.4,153.63 122.73,153.63H128.96V145.2C128.96,144.87 129.07,144.6 129.3,144.38C129.52,144.15 129.79,144.04 130.12,144.04C130.45,144.04 130.73,144.15 130.95,144.38C131.18,144.6 131.29,144.87 131.29,145.2V154.79C131.29,155.12 131.18,155.4 130.95,155.63C130.73,155.85 130.45,155.96 130.12,155.96H122.73ZM130.13,169.26C128.04,169.26 126.08,168.87 124.26,168.08C122.43,167.3 120.82,166.21 119.44,164.82C118.05,163.45 116.96,161.85 116.17,160.02C115.39,158.18 115,156.22 115,154.13C115,152.04 115.39,150.08 116.17,148.26C116.96,146.42 118.05,144.81 119.44,143.42C120.82,142.04 122.43,140.95 124.26,140.17C126.08,139.39 128.04,139 130.13,139C132.22,139 134.18,139.39 136.01,140.17C137.84,140.95 139.45,142.04 140.84,143.42C142.23,144.81 143.31,146.42 144.09,148.26C144.88,150.08 145.28,152.04 145.28,154.13C145.28,156.22 144.88,158.18 144.09,160.02C143.31,161.85 142.23,163.45 140.84,164.82C139.45,166.21 137.84,167.3 136.01,168.08C134.18,168.87 132.22,169.26 130.13,169.26ZM130.13,166.27C131.81,166.27 133.38,165.96 134.85,165.32C136.31,164.7 137.6,163.83 138.72,162.72C139.84,161.6 140.71,160.31 141.34,158.85C141.96,157.38 142.27,155.81 142.27,154.13C142.27,152.45 141.96,150.88 141.34,149.41C140.71,147.94 139.84,146.65 138.72,145.55C137.6,144.43 136.31,143.57 134.85,142.94C133.38,142.31 131.81,141.99 130.13,141.99C128.46,141.99 126.89,142.31 125.42,142.94C123.95,143.57 122.66,144.43 121.55,145.55C120.43,146.65 119.56,147.94 118.93,149.41C118.3,150.88 117.99,152.45 117.99,154.13C117.99,155.81 118.3,157.38 118.93,158.85C119.56,160.31 120.43,161.6 121.55,162.72C122.66,163.83 123.95,164.7 125.42,165.32C126.89,165.96 128.46,166.27 130.13,166.27Z"
100+
android:fillColor="#ffffff"/>
101+
</vector>

app/src/main/res/values-qq/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,6 +1236,8 @@
12361236
<string name="activity_tab_customize_screen_games_switch_title">Title of the switch for the Games module in the Activity Tab customization screen.</string>
12371237
<string name="activity_tab_customize_screen_donations_switch_title">Title of the switch for the Donations module in the Activity Tab customization screen.</string>
12381238
<string name="activity_tab_customize_screen_timeline_switch_title">Title of the switch for the Timeline module in the Activity Tab customization screen.</string>
1239+
<string name="activity_tab_customize_screen_no_modules_title">Title of the empty state when all modules are turned off.</string>
1240+
<string name="activity_tab_customize_screen_no_modules_message">Message of the empty state when all modules are turned off.</string>
12391241
<string name="file_page_activity_title">Title shown at the top of the activity for the file page.</string>
12401242
<string name="file_page_add_image_caption_button">Button label to add image caption for the file.</string>
12411243
<string name="file_page_add_image_tags_button">Button label to add image tags for the file.</string>

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,8 @@
12581258
<string name="activity_tab_customize_screen_games_switch_title">Game stats</string>
12591259
<string name="activity_tab_customize_screen_donations_switch_title">Last in app donation</string>
12601260
<string name="activity_tab_customize_screen_timeline_switch_title">Timeline of behavior</string>
1261+
<string name="activity_tab_customize_screen_no_modules_title">Your Activity Tab modules are off</string>
1262+
<string name="activity_tab_customize_screen_no_modules_message">Turn on Activity Tab modules to see your reading history, editing history, and more.</string>
12611263
<!-- /Suggested edits -->
12621264

12631265
<!-- File page -->

0 commit comments

Comments
 (0)