Skip to content

Commit cb99ede

Browse files
committed
Update views widget preview
Updated Views this week widget on WP to show three rows with different colors for neutral, positive and negative change
1 parent 0f5e084 commit cb99ede

File tree

6 files changed

+112
-13
lines changed

6 files changed

+112
-13
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
style="@style/StatsWidgetListItem"
6+
android:layout_width="match_parent"
7+
android:layout_height="@dimen/stats_widget_list_item_height">
8+
9+
<TextView
10+
style="@style/StatsWidgetKey.Light"
11+
android:layout_width="0dp"
12+
android:layout_weight="1"
13+
android:layout_height="wrap_content"
14+
android:text="?widgetContent1"
15+
tools:text="Today"/>
16+
17+
<TextView
18+
style="@style/StatsChange.NegativeLight"
19+
android:layout_width="wrap_content"
20+
android:layout_height="wrap_content"
21+
android:text="?widgetContentNegative"
22+
tools:text="-25(1%)"/>
23+
24+
<TextView
25+
style="@style/StatsWidgetValue.Light"
26+
android:layout_width="wrap_content"
27+
android:layout_height="wrap_content"
28+
android:layout_marginEnd="2dp"
29+
android:text="?widgetContent2"
30+
tools:text="+15,908"/>
31+
</LinearLayout>
32+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
style="@style/StatsWidgetListItem"
6+
android:layout_width="match_parent"
7+
android:layout_height="@dimen/stats_widget_list_item_height">
8+
9+
<TextView
10+
style="@style/StatsWidgetKey.Light"
11+
android:layout_width="0dp"
12+
android:layout_weight="1"
13+
android:layout_height="wrap_content"
14+
android:text="?widgetContent1"
15+
tools:text="Today"/>
16+
17+
<TextView
18+
style="@style/StatsChange.NeutralLight"
19+
android:layout_width="wrap_content"
20+
android:layout_height="wrap_content"
21+
android:text="?widgetContentNeutral"
22+
tools:text="+25(1%)"/>
23+
24+
<TextView
25+
style="@style/StatsWidgetValue.Light"
26+
android:layout_width="wrap_content"
27+
android:layout_height="wrap_content"
28+
android:layout_marginEnd="2dp"
29+
android:text="?widgetContent2"
30+
tools:text="+15,908"/>
31+
</LinearLayout>
32+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
style="@style/StatsWidgetListItem"
6+
android:layout_width="match_parent"
7+
android:layout_height="@dimen/stats_widget_list_item_height">
8+
9+
<TextView
10+
style="@style/StatsWidgetKey.Light"
11+
android:layout_width="0dp"
12+
android:layout_weight="1"
13+
android:layout_height="wrap_content"
14+
android:text="?widgetContent1"
15+
tools:text="Today"/>
16+
17+
<TextView
18+
style="@style/StatsChange.PositiveDark"
19+
android:layout_width="wrap_content"
20+
android:layout_height="wrap_content"
21+
android:text="?widgetContentPositive"
22+
tools:text="+25(1%)"/>
23+
24+
<TextView
25+
style="@style/StatsWidgetValue.Light"
26+
android:layout_width="wrap_content"
27+
android:layout_height="wrap_content"
28+
android:layout_marginEnd="2dp"
29+
android:text="?widgetContent2"
30+
tools:text="+15,908"/>
31+
</LinearLayout>
32+

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,13 @@
3434
android:layout_width="match_parent"
3535
android:layout_height="wrap_content" />
3636

37-
<include layout="@layout/stats_widget_block_item_light"
37+
<include layout="@layout/stats_views_widget_item_neutral_preview"
3838
android:theme="@style/ListItem.Preview5" />
3939

40-
<include layout="@layout/stats_widget_block_item_light"
40+
<include layout="@layout/stats_views_widget_item_positive_preview"
4141
android:theme="@style/ListItem.Preview6" />
4242

43-
<include layout="@layout/stats_widget_block_item_light"
43+
<include layout="@layout/stats_views_widget_item_negative_preview"
4444
android:theme="@style/ListItem.Preview7" />
45+
4546
</LinearLayout>

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@
273273
<attr name="widgetContent1" format="string" />
274274
<attr name="widgetTitle2" format="string" />
275275
<attr name="widgetContent2" format="string" />
276-
<attr name="widgetTitle3" format="string" />
277-
<attr name="widgetContent3" format="string" />
276+
<attr name="widgetContentNeutral" format="string" />
277+
<attr name="widgetContentPositive" format="string" />
278+
<attr name="widgetContentNegative" format="string" />
278279

279280
</resources>

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,9 @@
386386
<item name="widgetContent1"></item>
387387
<item name="widgetTitle2"></item>
388388
<item name="widgetContent2"></item>
389-
<item name="widgetTitle3"></item>
390-
<item name="widgetContent3"></item>
389+
<item name="widgetContentNeutral"></item>
390+
<item name="widgetContentPositive"></item>
391+
<item name="widgetContentNegative"></item>
391392
</style>
392393
<style name="ListItem.Preview">
393394
<item name="widgetTitle1">@string/stats_views</item>
@@ -419,17 +420,17 @@
419420
</style>
420421
<style name="ListItem.Preview5">
421422
<item name="widgetContent1">Today</item>
422-
<item name="widgetContent2">+10(18%)</item>
423-
<item name="widgetContent3">46</item>
423+
<item name="widgetContentNeutral">+10(18%)</item>
424+
<item name="widgetContent2">46</item>
424425
</style>
425426
<style name="ListItem.Preview6">
426427
<item name="widgetContent1">Jun 26, 2019</item>
427-
<item name="widgetContent2">+6(12%)</item>
428-
<item name="widgetContent3">56</item>
428+
<item name="widgetContentPositive">+6(12%)</item>
429+
<item name="widgetContent2">56</item>
429430
</style>
430431
<style name="ListItem.Preview7">
431432
<item name="widgetContent1">Jun 25, 2019</item>
432-
<item name="widgetContent2">-3(6%)</item>
433-
<item name="widgetContent3">50</item>
433+
<item name="widgetContentNegative">-3(6%)</item>
434+
<item name="widgetContent2">50</item>
434435
</style>
435436
</resources>

0 commit comments

Comments
 (0)