Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 71084de

Browse files
committedJun 15, 2020
[Jetsnack] Implement homescreen
Change-Id: I24360d64f4b60e57046c814f22e4ca12b540d679
1 parent 54eb1c0 commit 71084de

25 files changed

+1310
-58
lines changed
 

‎Jetsnack/ASSETS_LICENSE

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
All font files are licensed under the SIL OPEN FONT LICENSE license. All other files are licensed under the Apache 2 license.
2+
3+
4+
SIL OPEN FONT LICENSE
5+
Version 1.1 - 26 February 2007
6+
7+
PREAMBLE
8+
The goals of the Open Font License (OFL) are to stimulate worldwide
9+
development of collaborative font projects, to support the font creation
10+
efforts of academic and linguistic communities, and to provide a free and
11+
open framework in which fonts may be shared and improved in partnership
12+
with others.
13+
14+
The OFL allows the licensed fonts to be used, studied, modified and
15+
redistributed freely as long as they are not sold by themselves. The
16+
fonts, including any derivative works, can be bundled, embedded,
17+
redistributed and/or sold with any software provided that any reserved
18+
names are not used by derivative works. The fonts and derivatives,
19+
however, cannot be released under any other type of license. The
20+
requirement for fonts to remain under this license does not apply
21+
to any document created using the fonts or their derivatives.
22+
23+
DEFINITIONS
24+
"Font Software" refers to the set of files released by the Copyright
25+
Holder(s) under this license and clearly marked as such. This may
26+
include source files, build scripts and documentation.
27+
28+
"Reserved Font Name" refers to any names specified as such after the
29+
copyright statement(s).
30+
31+
"Original Version" refers to the collection of Font Software components as
32+
distributed by the Copyright Holder(s).
33+
34+
"Modified Version" refers to any derivative made by adding to, deleting,
35+
or substituting — in part or in whole — any of the components of the
36+
Original Version, by changing formats or by porting the Font Software to a
37+
new environment.
38+
39+
"Author" refers to any designer, engineer, programmer, technical
40+
writer or other person who contributed to the Font Software.
41+
42+
PERMISSION & CONDITIONS
43+
Permission is hereby granted, free of charge, to any person obtaining
44+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
45+
redistribute, and sell modified and unmodified copies of the Font
46+
Software, subject to the following conditions:
47+
48+
1) Neither the Font Software nor any of its individual components,
49+
in Original or Modified Versions, may be sold by itself.
50+
51+
2) Original or Modified Versions of the Font Software may be bundled,
52+
redistributed and/or sold with any software, provided that each copy
53+
contains the above copyright notice and this license. These can be
54+
included either as stand-alone text files, human-readable headers or
55+
in the appropriate machine-readable metadata fields within text or
56+
binary files as long as those fields can be easily viewed by the user.
57+
58+
3) No Modified Version of the Font Software may use the Reserved Font
59+
Name(s) unless explicit written permission is granted by the corresponding
60+
Copyright Holder. This restriction only applies to the primary font name as
61+
presented to the users.
62+
63+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
64+
Software shall not be used to promote, endorse or advertise any
65+
Modified Version, except to acknowledge the contribution(s) of the
66+
Copyright Holder(s) and the Author(s) or with their explicit written
67+
permission.
68+
69+
5) The Font Software, modified or unmodified, in part or in whole,
70+
must be distributed entirely under this license, and must not be
71+
distributed under any other license. The requirement for fonts to
72+
remain under this license does not apply to any document created
73+
using the Font Software.
74+
75+
TERMINATION
76+
This license becomes null and void if any of the above conditions are
77+
not met.
78+
79+
DISCLAIMER
80+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
81+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
82+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
83+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
84+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
85+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
86+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
87+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
88+
OTHER DEALINGS IN THE FONT SOFTWARE.

‎Jetsnack/app/build.gradle

+22-22
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@ android {
2323
compileSdkVersion 29
2424

2525
defaultConfig {
26-
applicationId "com.example.jetsnack"
26+
applicationId 'com.example.jetsnack'
2727
minSdkVersion 21
2828
targetSdkVersion 29
2929
versionCode 1
30-
versionName "1.0"
31-
32-
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
30+
versionName '1.0'
31+
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
3332
}
3433

3534
buildTypes {
@@ -45,8 +44,8 @@ android {
4544
}
4645

4746
kotlinOptions {
48-
jvmTarget = "1.8"
49-
apiVersion = "1.3"
47+
jvmTarget = '1.8'
48+
apiVersion = '1.3'
5049
allWarningsAsErrors = true
5150
}
5251

@@ -55,7 +54,7 @@ android {
5554
}
5655

5756
composeOptions {
58-
kotlinCompilerVersion "1.3.70-dev-withExperimentalGoogleExtensions-20200424"
57+
kotlinCompilerVersion '1.3.70-dev-withExperimentalGoogleExtensions-20200424'
5958
kotlinCompilerExtensionVersion compose_version
6059
}
6160
}
@@ -66,29 +65,30 @@ configurations {
6665

6766
dependencies {
6867
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
69-
implementation('androidx.core:core-ktx:1.1.0') // don't update yet b/152023266
70-
implementation 'androidx.appcompat:appcompat:1.1.0'
71-
72-
implementation("androidx.ui:ui-core:$compose_version")
73-
implementation("androidx.ui:ui-layout:$compose_version")
74-
implementation("androidx.ui:ui-material:$compose_version")
75-
implementation("androidx.ui:ui-tooling:$compose_version")
76-
68+
implementation 'androidx.core:core-ktx:1.5.0-alpha01'
69+
implementation 'androidx.appcompat:appcompat:1.3.0-alpha01'
70+
def coilVersion = "0.1.6.ui-$snapshot-SNAPSHOT"
71+
implementation "dev.chrisbanes.accompanist:accompanist-coil:$coilVersion"
72+
implementation "androidx.ui:ui-core:$compose_version"
73+
implementation "androidx.ui:ui-layout:$compose_version"
74+
implementation "androidx.ui:ui-material:$compose_version"
75+
implementation "androidx.ui:ui-material-icons-extended:$compose_version"
76+
implementation "androidx.ui:ui-tooling:$compose_version"
7777
ktlint "com.pinterest:ktlint:0.37.0"
7878
}
7979

8080
task ktlint(type: JavaExec, group: "verification") {
81-
description = "Check Kotlin code style."
82-
main = "com.pinterest.ktlint.Main"
81+
description = 'Check Kotlin code style.'
82+
main = 'com.pinterest.ktlint.Main'
8383
classpath = configurations.ktlint
84-
args "src/**/*.kt"
84+
args 'src/**/*.kt'
8585
}
8686

8787
check.dependsOn ktlint
8888

89-
task ktlintFormat(type: JavaExec, group: "formatting") {
90-
description = "Fix Kotlin code style deviations."
91-
main = "com.pinterest.ktlint.Main"
89+
task ktlintFormat(type: JavaExec, group: 'formatting') {
90+
description = 'Fix Kotlin code style deviations.'
91+
main = 'com.pinterest.ktlint.Main'
9292
classpath = configurations.ktlint
93-
args "-F", "src/**/*.kt"
93+
args '-F', 'src/**/*.kt'
9494
}

‎Jetsnack/app/src/main/AndroidManifest.xml

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
1616
package="com.example.jetsnack">
1717

18+
<!--Load images from Unsplash-->
19+
<uses-permission android:name="android.permission.INTERNET" />
20+
1821
<application
1922
android:allowBackup="true"
2023
android:icon="@mipmap/ic_launcher"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright 2020 The Android Open Source Project
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+
* http://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.example.jetsnack.model
18+
19+
import androidx.compose.Stable
20+
import androidx.compose.mutableStateOf
21+
22+
@Stable
23+
class Filter(
24+
val name: String,
25+
enabled: Boolean = false
26+
) {
27+
val enabled = mutableStateOf(enabled)
28+
}
29+
30+
val filters = listOf(
31+
Filter(name = "Organic"),
32+
Filter(name = "Gluten-free"),
33+
Filter(name = "Dairy-free"),
34+
Filter(name = "Sweet"),
35+
Filter(name = "Savory")
36+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright 2020 The Android Open Source Project
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+
* http://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.example.jetsnack.model
18+
19+
import androidx.compose.Immutable
20+
21+
@Immutable
22+
data class Snack(
23+
val id: Long,
24+
val name: String,
25+
val imageUrl: String,
26+
val tagline: String = "",
27+
val tags: Set<String> = emptySet()
28+
)
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.