Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.

Commit c6d9016

Browse files
committed
Add Owl sample.
2 parents dc4f5a3 + baa76bf commit c6d9016

File tree

143 files changed

+9047
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+9047
-0
lines changed

Owl/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Owl
2+
3+
<img src="screenshots/collage_header.png" alt="Owl collage"/>
4+
5+
## Introduction
6+
Owl is an educational app that uses Material Design components and [Material Theming](https://material.io/design/material-theming) to create an energetic, motivational brand experience.
7+
This project is an Android implementation of [Owl](https://material.io/design/material-studies/owl.html), a Material study meant to showcase componentry and theming using the [Material Components for Android library](https://github.com/material-components/material-components-android).
8+
9+
## Screenshots
10+
<img src="screenshots/owl_demo.gif" alt="Owl sample demo"/>
11+
12+
## Material Theming
13+
Owl employs material theming to reflect the energy and excitement of learning a new skill, using a bold aesthetic and unfilled shapes that invite the user to populate them with new content and courses. The app customizes [color](https://material.io/develop/android/theming/color/), [shape](https://material.io/develop/android/theming/shape/) and [typography](https://material.io/develop/android/theming/typography/) to achieve this.
14+
15+
### Color
16+
<img src="screenshots/color_header.png" alt="Owl color theming"/>
17+
18+
Owl has three primary colors. Each color is used to create a distinct visual theme for each section. See [colors.xml](https://github.com/material-components/material-components-android-examples/blob/develop/owl/app/src/main/res/values/color.xml) and how they are used in [light](https://github.com/material-components/material-components-android-examples/blob/develop/owl/app/src/main/res/values/themes.xml#L58-L86) and [dark](https://github.com/material-components/material-components-android-examples/blob/develop/owl/app/src/main/res/values-night/themes.xml) themes.
19+
20+
### Shape
21+
<img src="screenshots/shape_header.png" alt="Owl shape theming"/>
22+
23+
Owl defines small, medium and large shape categories for different sized components. See [shape.xml](https://github.com/material-components/material-components-android-examples/blob/develop/owl/app/src/main/res/values/shape.xml) which defines the `ShapeAppearance`s, which are then [set in the theme](https://github.com/material-components/material-components-android-examples/blob/develop/owl/app/src/main/res/values/themes.xml#L20-L23) and picked up by all components or refferred to directly.
24+
25+
### Typography
26+
<img src="screenshots/type_header.png" alt="Owl typography theming"/>
27+
28+
Owl’s type scale provides the typographic variety necessary for the app content. All items in the type scale use [Rubik](https://fonts.google.com/specimen/Rubik) as the typeface, and make use of the variety of weights available by using Rubik Regular, Medium, and Bold. See [type.xml](https://github.com/material-components/material-components-android-examples/blob/develop/owl/app/src/main/res/values/type.xml) which defines `TextAppearance`s which are then [set in the theme](https://github.com/material-components/material-components-android-examples/blob/develop/owl/app/src/main/res/values/themes.xml#L25-L38) and referred to using `?attr/textAppearance[...]` throughout.
29+
30+
## License
31+
32+
```
33+
Copyright 2019 Google, Inc.
34+
35+
Licensed to the Apache Software Foundation (ASF) under one or more contributor
36+
license agreements. See the NOTICE file distributed with this work for
37+
additional information regarding copyright ownership. The ASF licenses this
38+
file to you under the Apache License, Version 2.0 (the "License"); you may not
39+
use this file except in compliance with the License. You may obtain a copy of
40+
the License at
41+
42+
http://www.apache.org/licenses/LICENSE-2.0
43+
44+
Unless required by applicable law or agreed to in writing, software
45+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
46+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
47+
License for the specific language governing permissions and limitations under
48+
the License.
49+
```

Owl/app/build.gradle

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Copyright (c) 2019 Google Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5+
* in compliance with the License. You may obtain a copy of the License at
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software distributed under the License
9+
*
10+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11+
* or implied. See the License for the specific language governing permissions and limitations under
12+
* the License.
13+
*/
14+
15+
apply plugin: 'com.android.application'
16+
apply plugin: 'kotlin-android'
17+
apply plugin: 'kotlin-kapt'
18+
apply plugin: 'androidx.navigation.safeargs.kotlin'
19+
20+
android {
21+
compileSdkVersion 29
22+
defaultConfig {
23+
applicationId 'com.materialstudies.owl'
24+
minSdkVersion 23
25+
targetSdkVersion 29
26+
versionCode 1
27+
versionName '1.0'
28+
vectorDrawables.useSupportLibrary = true
29+
}
30+
dataBinding {
31+
enabled true
32+
}
33+
buildTypes {
34+
release {
35+
minifyEnabled false
36+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
37+
}
38+
}
39+
compileOptions {
40+
sourceCompatibility JavaVersion.VERSION_1_8
41+
targetCompatibility JavaVersion.VERSION_1_8
42+
}
43+
kotlinOptions {
44+
jvmTarget = "1.8"
45+
}
46+
}
47+
48+
dependencies {
49+
implementation 'androidx.appcompat:appcompat:1.1.0'
50+
implementation 'androidx.fragment:fragment:1.2.0-beta02'
51+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
52+
implementation 'androidx.core:core-ktx:1.1.0'
53+
implementation 'com.google.android.material:material:1.1.0-beta01'
54+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
55+
56+
implementation "androidx.navigation:navigation-runtime-ktx:$nav_version"
57+
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
58+
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
59+
implementation 'androidx.dynamicanimation:dynamicanimation:1.0.0'
60+
61+
implementation 'com.github.bumptech.glide:glide:4.9.0'
62+
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
63+
}

Owl/app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile

Owl/app/src/main/AndroidManifest.xml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright (c) 2019 Google Inc.
4+
5+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6+
in compliance with the License. You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software distributed under the License
11+
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12+
or implied. See the License for the specific language governing permissions and limitations under
13+
the License.
14+
-->
15+
<manifest
16+
xmlns:android="http://schemas.android.com/apk/res/android"
17+
xmlns:tools="http://schemas.android.com/tools"
18+
package="com.materialstudies.owl">
19+
20+
<!--Load images from Unsplash-->
21+
<uses-permission android:name="android.permission.INTERNET"/>
22+
23+
<application
24+
android:allowBackup="true"
25+
android:icon="@mipmap/ic_launcher"
26+
android:label="@string/app_name"
27+
android:name="OwlApplication"
28+
android:supportsRtl="true"
29+
android:theme="@style/Owl.Blue"
30+
tools:ignore="GoogleAppIndexingWarning">
31+
32+
<activity
33+
android:name=".ui.MainActivity"
34+
android:theme="@style/Owl.Blue">
35+
<intent-filter>
36+
<action android:name="android.intent.action.MAIN"/>
37+
<category android:name="android.intent.category.LAUNCHER"/>
38+
</intent-filter>
39+
</activity>
40+
41+
<!--Preload custom fonts-->
42+
<meta-data
43+
android:name="preloaded_fonts"
44+
android:resource="@array/preloaded_fonts"/>
45+
<meta-data
46+
android:name="fontProviderRequests"
47+
android:value="Rubik"/>
48+
49+
</application>
50+
51+
</manifest>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright 2019 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.materialstudies.owl
18+
19+
import android.app.Application
20+
import android.os.Build.VERSION.SDK_INT
21+
import android.os.Build.VERSION_CODES.Q
22+
import androidx.appcompat.app.AppCompatDelegate
23+
24+
class OwlApplication : Application() {
25+
26+
override fun onCreate() {
27+
super.onCreate()
28+
val nightMode = if (SDK_INT >= Q) {
29+
AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
30+
} else {
31+
AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY
32+
}
33+
AppCompatDelegate.setDefaultNightMode(nightMode)
34+
}
35+
36+
}
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
/*
2+
* Copyright 2019 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.materialstudies.owl.model
18+
19+
import androidx.recyclerview.widget.DiffUtil
20+
21+
typealias CourseId = Long
22+
23+
data class Course(
24+
val id: CourseId,
25+
val name: String,
26+
val subject: String,
27+
val thumbUrl: String,
28+
val thumbContentDesc: String,
29+
val description: String = "",
30+
val steps: Int,
31+
val step: Int,
32+
val instructor: String = "https://i.pravatar.cc/112?$id"
33+
)
34+
35+
object CourseDiff : DiffUtil.ItemCallback<Course>() {
36+
override fun areItemsTheSame(oldItem: Course, newItem: Course) = oldItem.id == newItem.id
37+
override fun areContentsTheSame(oldItem: Course, newItem: Course) = oldItem == newItem
38+
}
39+
40+
object CourseRepo {
41+
fun getCourse(id: CourseId) = courses.find { it.id == id } ?: courses.last()
42+
}
43+
44+
val courses = listOf(
45+
Course(
46+
id = 0,
47+
name = "Basic Blocks and Woodturning",
48+
subject = "Arts & Crafts",
49+
thumbUrl = "https://source.unsplash.com/oJ7SV6vQfBA",
50+
thumbContentDesc = "",
51+
steps = 7,
52+
step = 1
53+
),
54+
Course(
55+
id = 1,
56+
name = "An Introduction To Oil Painting On Canvas",
57+
subject = "Painting",
58+
thumbUrl = "https://source.unsplash.com/W9_sznrBmoA",
59+
thumbContentDesc = "",
60+
steps = 12,
61+
step = 1
62+
),
63+
Course(
64+
id = 2,
65+
name = "Understanding the Composition of Modern Cities",
66+
subject = "Architecture",
67+
thumbUrl = "https://source.unsplash.com/s4I1xpX_ny8",
68+
thumbContentDesc = "",
69+
steps = 18,
70+
step = 1
71+
),
72+
Course(
73+
id = 3,
74+
name = "Learning The Basics of Brand Identity",
75+
subject = "Design",
76+
thumbUrl = "https://source.unsplash.com/G9_Euqxpu4k",
77+
thumbContentDesc = "",
78+
steps = 22,
79+
step = 1
80+
),
81+
Course(
82+
id = 4,
83+
name = "Wooden Materials and Sculpting Machinery",
84+
subject = "Arts & Crafts",
85+
thumbUrl = "https://source.unsplash.com/o54RjF-C7xo",
86+
thumbContentDesc = "",
87+
steps = 19,
88+
step = 1
89+
),
90+
Course(
91+
id = 5,
92+
name = "Advanced Potter's Wheel",
93+
subject = "Arts & Crafts",
94+
thumbUrl = "https://source.unsplash.com/-LHvba-FgAo",
95+
thumbContentDesc = "",
96+
steps = 14,
97+
step = 1
98+
),
99+
Course(
100+
id = 6,
101+
name = "Advanced Abstract Shapes & 3D Printing",
102+
subject = "Arts & Crafts",
103+
thumbUrl = "https://source.unsplash.com/HQkz_lWT_lY",
104+
thumbContentDesc = "",
105+
steps = 17,
106+
step = 1
107+
),
108+
Course(
109+
id = 7,
110+
name = "Beginning Portraiture",
111+
subject = "Photography",
112+
thumbUrl = "https://source.unsplash.com/LE0Hp8l9gvs",
113+
thumbContentDesc = "",
114+
steps = 22,
115+
step = 1
116+
),
117+
Course(
118+
id = 8,
119+
name = "Intermediate Knife Skills",
120+
subject = "Culinary",
121+
thumbUrl = "https://source.unsplash.com/f1xj_KeZ5RM",
122+
thumbContentDesc = "",
123+
steps = 14,
124+
step = 1
125+
),
126+
Course(
127+
id = 9,
128+
name = "Pattern Making for Beginners",
129+
subject = "Fashion",
130+
thumbUrl = "https://source.unsplash.com/hew8-OoUriU",
131+
thumbContentDesc = "",
132+
steps = 7,
133+
step = 1
134+
),
135+
Course(
136+
id = 10,
137+
name = "Location Lighting for Beginners",
138+
subject = "Photography",
139+
thumbUrl = "https://source.unsplash.com/pPxJTtxfV1A",
140+
thumbContentDesc = "",
141+
steps = 6,
142+
step = 1
143+
),
144+
Course(
145+
id = 11,
146+
name = "Cinematography & Lighting",
147+
subject = "Film",
148+
thumbUrl = "https://source.unsplash.com/oIf4VCDztZY",
149+
thumbContentDesc = "",
150+
steps = 4,
151+
step = 1
152+
),
153+
Course(
154+
id = 12,
155+
name = "Monuments, Buildings & Other Structures",
156+
subject = "Photography",
157+
thumbUrl = "https://source.unsplash.com/KxCJXXGsv9I",
158+
thumbContentDesc = "",
159+
steps = 4,
160+
step = 1
161+
)
162+
)

0 commit comments

Comments
 (0)