Skip to content

Commit 233dfa9

Browse files
authored
Merge pull request material-components#7 from etonotieno/sample-data
Add sampledata to render layout previews
2 parents 600d1b8 + f0d4324 commit 233dfa9

18 files changed

+283
-26
lines changed

Owl/app/sampledata/courses.json

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{
2+
"data": [
3+
{
4+
"name": "Basic Blocks and Woodturning",
5+
"step": "1 / 7",
6+
"steps": "7",
7+
"subject": "Arts & Crafts"
8+
},
9+
{
10+
"name": "An Introduction To Oil Painting On Canvas",
11+
"step": "1 / 12",
12+
"steps": "12",
13+
"subject": "Painting"
14+
},
15+
{
16+
"name": "Understanding the Composition of Modern Cities",
17+
"step": "1 / 18",
18+
"steps": "18",
19+
"subject": "Architecture"
20+
},
21+
{
22+
"name": "Learning The Basics of Brand Identity",
23+
"step": "1 / 22",
24+
"steps": "22",
25+
"subject": "Design"
26+
},
27+
{
28+
"name": "Wooden Materials and Sculpting Machinery",
29+
"step": "1 / 19",
30+
"steps": "19",
31+
"subject": "Arts & Crafts"
32+
},
33+
{
34+
"name": "Advanced Potter's Wheel",
35+
"step": "1 / 14",
36+
"steps": "14",
37+
"subject": "Arts & Crafts"
38+
},
39+
{
40+
"name": "Advanced Abstract Shapes & 3D Printing",
41+
"step": "1 / 17",
42+
"steps": "17",
43+
"subject": "Arts & Crafts"
44+
},
45+
{
46+
"name": "Beginning Portraiture",
47+
"step": "1 / 22",
48+
"steps": "22",
49+
"subject": "Photography"
50+
},
51+
{
52+
"name": "Intermediate Knife Skills",
53+
"step": "1 / 14",
54+
"steps": "14",
55+
"subject": "Culinary"
56+
},
57+
{
58+
"name": "Pattern Making for Beginners",
59+
"step": "1 / 7",
60+
"steps": "7",
61+
"subject": "Fashion"
62+
},
63+
{
64+
"name": "Location Lighting for Beginners",
65+
"step": "1 / 6",
66+
"steps": "6",
67+
"subject": "Photography"
68+
},
69+
{
70+
"name": "Cinematography & Lighting",
71+
"step": "1 / 4",
72+
"steps": "4",
73+
"subject": "Film"
74+
},
75+
{
76+
"name": "Monuments, Buildings & Other Structures",
77+
"step": "1 / 4",
78+
"steps": "4",
79+
"subject": "Photography"
80+
}
81+
]
82+
}

Owl/app/sampledata/lessons.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"data": [
3+
{
4+
"title": "An introduction to the Landscape",
5+
"formattedStepNumber": "01",
6+
"length": "4:14"
7+
},
8+
{
9+
"title": "Movement and Expression",
10+
"formattedStepNumber": "02",
11+
"length": "7:28"
12+
},
13+
{
14+
"title": "Composition and the Urban Canvas",
15+
"formattedStepNumber": "03",
16+
"length": "3:43"
17+
},
18+
{
19+
"title": "Lighting Techniques and Aesthetics",
20+
"formattedStepNumber": "04",
21+
"length": "4:45"
22+
},
23+
{
24+
"title": "Special Effects",
25+
"formattedStepNumber": "05",
26+
"length": "6:19"
27+
},
28+
{
29+
"title": "Techniques with Structures",
30+
"formattedStepNumber": "06",
31+
"length": "9:41"
32+
},
33+
{
34+
"title": "Deep Focus Using a Camera Dolly",
35+
"formattedStepNumber": "07",
36+
"length": "4:43"
37+
},
38+
{
39+
"title": "Point of View Shots with Structures",
40+
"formattedStepNumber": "08",
41+
"length": "9:41"
42+
},
43+
{
44+
"title": "Photojournalism: Street Art",
45+
"formattedStepNumber": "09",
46+
"length": "9:41"
47+
}
48+
]
49+
}

Owl/app/sampledata/steps.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"data": [
3+
{
4+
"title": "Step 1",
5+
"body": "@string/step_0"
6+
},
7+
{
8+
"title": "Step 2",
9+
"body": "@string/step_1"
10+
},
11+
{
12+
"title": "Step 3",
13+
"body": "@string/step_2"
14+
},
15+
{
16+
"title": "Step 4",
17+
"body": "@string/step_0"
18+
},
19+
{
20+
"title": "Step 5",
21+
"body": "@string/step_1"
22+
},
23+
{
24+
"title": "Step 6",
25+
"body": "@string/step_2"
26+
},
27+
{
28+
"title": "Step 7",
29+
"body": "@string/step_0"
30+
},
31+
{
32+
"title": "Step 8",
33+
"body": "@string/step_1"
34+
},
35+
{
36+
"title": "Step 9",
37+
"body": "@string/step_2"
38+
}
39+
]
40+
}

Owl/app/sampledata/topics.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"data": [
3+
{
4+
"name": "Architecture",
5+
"courses": "58"
6+
},
7+
{
8+
"name": "Arts & Crafts",
9+
"courses": "121"
10+
},
11+
{
12+
"name": "Business",
13+
"courses": "78"
14+
},
15+
{
16+
"name": "Culinary",
17+
"courses": "118"
18+
},
19+
{
20+
"name": "Design",
21+
"courses": "423"
22+
},
23+
{
24+
"name": "Fashion",
25+
"courses": "92"
26+
},
27+
{
28+
"name": "Film",
29+
"courses": "165"
30+
},
31+
{
32+
"name": "Gaming",
33+
"courses": "164"
34+
},
35+
{
36+
"name": "Illustration",
37+
"courses": "326"
38+
},
39+
{
40+
"name": "Lifestyle",
41+
"courses": "305"
42+
},
43+
{
44+
"name": "Music",
45+
"courses": "212"
46+
},
47+
{
48+
"name": "Painting",
49+
"courses": "172"
50+
},
51+
{
52+
"name": "Photography",
53+
"courses": "321"
54+
},
55+
{
56+
"name": "Technology",
57+
"courses": "118"
58+
}
59+
]
60+
}

Owl/app/src/main/res/layout/course_item.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@
8181
android:lines="2"
8282
android:ellipsize="end"
8383
android:text="@{course.name}"
84-
android:textAppearance="?attr/textAppearanceSubtitle1"/>
84+
android:textAppearance="?attr/textAppearanceSubtitle1"
85+
tools:text="@sample/courses.json/data/name"/>
8586

8687
<ImageView
8788
android:id="@+id/course_icon"
@@ -107,7 +108,8 @@
107108
android:paddingVertical="@dimen/grid_2"
108109
android:textColor="?attr/colorPrimary"
109110
android:textAppearance="?attr/textAppearanceCaption"
110-
android:text="@{@string/course_steps(course.step, course.steps)}"/>
111+
android:text="@{@string/course_steps(course.step, course.steps)}"
112+
tools:text="@sample/courses.json/data/step"/>
111113

112114
<ImageView
113115
android:id="@+id/course_instructor"

Owl/app/src/main/res/layout/featured_item.xml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@
8686
android:text="@{course.subject}"
8787
android:textColor="?attr/colorPrimary"
8888
android:textAppearance="?attr/textAppearanceOverline"
89-
android:textAllCaps="true"/>
89+
android:textAllCaps="true"
90+
tools:text="@sample/courses.json/data/subject"/>
9091

9192
<TextView
9293
android:id="@+id/course_name"
@@ -98,7 +99,8 @@
9899
android:paddingHorizontal="@dimen/grid_2"
99100
android:gravity="center"
100101
android:text="@{course.name}"
101-
android:textAppearance="?attr/textAppearanceSubtitle1"/>
102+
android:textAppearance="?attr/textAppearanceSubtitle1"
103+
tools:text="@sample/courses.json/data/name"/>
102104

103105
<androidx.constraintlayout.widget.Guideline
104106
android:id="@+id/guideline"
@@ -128,7 +130,8 @@
128130
android:paddingStart="@dimen/grid_0_5"
129131
android:textColor="?attr/colorPrimary"
130132
android:textAppearance="?attr/textAppearanceSubtitle2"
131-
android:text="@{String.valueOf(course.steps)}"/>
133+
android:text="@{String.valueOf(course.steps)}"
134+
tools:text="@sample/courses.json/data/steps"/>
132135

133136
</androidx.constraintlayout.widget.ConstraintLayout>
134137

Owl/app/src/main/res/layout/fragment_featured.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@
6363
app:spanCount="@integer/featured_grid_columns"
6464
app:hasFixedSize="@{true}"
6565
android:scrollbarStyle="outsideOverlay"
66-
android:scrollbars="vertical"/>
66+
android:scrollbars="vertical"
67+
tools:listitem="@layout/featured_item"/>
6768

6869
</androidx.coordinatorlayout.widget.CoordinatorLayout>
6970

Owl/app/src/main/res/layout/fragment_learn.xml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@
118118
android:paddingHorizontal="@dimen/grid_2"
119119
android:gravity="center"
120120
android:text="@{course.name}"
121-
android:textAppearance="?attr/textAppearanceHeadline4"/>
121+
android:textAppearance="?attr/textAppearanceHeadline4"
122+
tools:text="@sample/courses.json/data/name"/>
122123

123124
<TextView
124125
android:id="@+id/description"
@@ -207,7 +208,8 @@
207208
android:orientation="horizontal"
208209
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
209210
app:hasFixedSize="@{true}"
210-
android:theme="@style/ThemeOverlay.Owl.Blue"/>
211+
android:theme="@style/ThemeOverlay.Owl.Blue"
212+
tools:listitem="@layout/course_item"/>
211213

212214
</androidx.constraintlayout.widget.ConstraintLayout>
213215

@@ -217,7 +219,8 @@
217219
android:id="@+id/lessons_sheet"
218220
android:layout_width="match_parent"
219221
android:layout_height="match_parent"
220-
android:name="com.materialstudies.owl.ui.lessons.LessonsSheetFragment"/>
222+
android:name="com.materialstudies.owl.ui.lessons.LessonsSheetFragment"
223+
tools:layout="@layout/fragment_lessons_sheet" />
221224

222225
</FrameLayout>
223226

Owl/app/src/main/res/layout/fragment_lesson.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@
9393
android:paddingBottom="?attr/actionBarSize"
9494
android:clipToPadding="false"
9595
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
96-
app:hasFixedSize="@{true}"/>
96+
app:hasFixedSize="@{true}"
97+
tools:listitem="@layout/step_item"/>
9798

9899
<SeekBar
99100
android:id="@+id/seek"
@@ -113,7 +114,8 @@
113114
android:id="@+id/lessons_sheet"
114115
android:name="com.materialstudies.owl.ui.lessons.LessonsSheetFragment"
115116
android:layout_width="match_parent"
116-
android:layout_height="match_parent"/>
117+
android:layout_height="match_parent"
118+
tools:layout="@layout/fragment_lessons_sheet" />
117119

118120
</FrameLayout>
119121

Owl/app/src/main/res/layout/fragment_lessons_sheet.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@
6363
android:lines="1"
6464
android:alpha="0"
6565
android:textAppearance="?attr/textAppearanceSubtitle1"
66-
android:text="@{course.name}"/>
66+
android:text="@{course.name}"
67+
tools:text="@sample/courses.json/data/name"/>
6768

6869
<ImageView
6970
android:id="@+id/collapse_playlist"
@@ -111,7 +112,8 @@
111112
android:clipToPadding="false"
112113
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
113114
app:hasFixedSize="@{true}"
114-
android:alpha="0"/>
115+
android:alpha="0"
116+
tools:listitem="@layout/lesson_item"/>
115117

116118
</androidx.constraintlayout.widget.ConstraintLayout>
117119

Owl/app/src/main/res/layout/fragment_my_courses.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
5252
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
5353
app:hasFixedSize="@{true}"
54-
android:scrollbars="vertical"/>
54+
android:scrollbars="vertical"
55+
tools:listitem="@layout/course_item"/>
5556

5657
</androidx.coordinatorlayout.widget.CoordinatorLayout>
5758

Owl/app/src/main/res/layout/fragment_onboarding.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@
8787
app:layoutManager="androidx.recyclerview.widget.StaggeredGridLayoutManager"
8888
app:spanCount="@integer/onboarding_topics_rows"
8989
app:reverseLayout="true"
90-
app:hasFixedSize="@{true}"/>
90+
app:hasFixedSize="@{true}"
91+
tools:listitem="@layout/onboarding_topic_item"/>
9192

9293
<com.google.android.material.floatingactionbutton.FloatingActionButton
9394
android:id="@+id/fab"

Owl/app/src/main/res/layout/fragment_search.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@
6565
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
6666
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
6767
app:hasFixedSize="@{true}"
68-
android:scrollbars="vertical"/>
68+
android:scrollbars="vertical"
69+
tools:listitem="@layout/search_item"/>
6970

7071
</androidx.coordinatorlayout.widget.CoordinatorLayout>
7172

0 commit comments

Comments
 (0)