Skip to content

Commit bd1be16

Browse files
authored
Merge pull request #45 from android/maintanence-update
Maintanence update
2 parents 264b051 + 7f3d435 commit bd1be16

96 files changed

Lines changed: 174 additions & 316 deletions

File tree

Some content is hidden

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

baseline-profiles/app/build.gradle.kts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ plugins {
1919
alias(libs.plugins.kotlin.android)
2020
alias(libs.plugins.kotlin.parcelize)
2121
alias(libs.plugins.compose.compiler)
22-
alias(libs.plugins.androidx.baselineprofile)
22+
alias(libs.plugins.baselineprofile)
2323
}
2424

2525
android {
@@ -45,6 +45,15 @@ android {
4545
}
4646
}
4747

48+
compileOptions {
49+
sourceCompatibility = JavaVersion.VERSION_11
50+
targetCompatibility = JavaVersion.VERSION_11
51+
}
52+
53+
kotlinOptions {
54+
jvmTarget = "11"
55+
}
56+
4857
buildTypes {
4958
getByName("debug") {
5059
signingConfig = signingConfigs.getByName("debug")
@@ -60,11 +69,6 @@ android {
6069
}
6170
}
6271

63-
compileOptions {
64-
sourceCompatibility = JavaVersion.VERSION_17
65-
targetCompatibility = JavaVersion.VERSION_17
66-
}
67-
6872
buildFeatures {
6973
compose = true
7074
}
@@ -78,7 +82,7 @@ android {
7882
}
7983

8084
dependencies {
81-
implementation(libs.profileinstaller)
85+
implementation(libs.androidx.profileinstaller)
8286
"baselineProfile"(project(mapOf("path" to ":baselineprofile")))
8387
val composeBom = platform(libs.androidx.compose.bom)
8488
implementation(composeBom)
@@ -110,7 +114,6 @@ dependencies {
110114
implementation(libs.coil.kt.compose)
111115

112116
implementation(libs.androidx.runtime.tracing)
113-
114117
androidTestImplementation(libs.junit)
115118
androidTestImplementation(libs.androidx.test.core)
116119
androidTestImplementation(libs.androidx.test.runner)

baseline-profiles/app/src/main/java/com/example/baselineprofiles_codelab/model/Search.kt

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.example.baselineprofiles_codelab.model
1818

1919
import androidx.compose.runtime.Immutable
20+
import com.example.baselineprofiles_codelab.R
2021
import kotlinx.coroutines.Dispatchers
2122
import kotlinx.coroutines.delay
2223
import kotlinx.coroutines.withContext
@@ -44,7 +45,7 @@ data class SearchCategoryCollection(
4445
@Immutable
4546
data class SearchCategory(
4647
val name: String,
47-
val imageUrl: String
48+
val imageRes: Int
4849
)
4950

5051
@Immutable
@@ -65,19 +66,19 @@ private val searchCategoryCollections = listOf(
6566
categories = listOf(
6667
SearchCategory(
6768
name = "Chips & crackers",
68-
imageUrl = "https://source.unsplash.com/UsSdMZ78Q3E"
69+
imageRes = R.drawable.chips
6970
),
7071
SearchCategory(
7172
name = "Fruit snacks",
72-
imageUrl = "https://source.unsplash.com/SfP1PtM9Qa8"
73+
imageRes = R.drawable.fruit,
7374
),
7475
SearchCategory(
7576
name = "Desserts",
76-
imageUrl = "https://source.unsplash.com/_jk8KIyN_uA"
77+
imageRes = R.drawable.desserts
7778
),
7879
SearchCategory(
79-
name = "Nuts ",
80-
imageUrl = "https://source.unsplash.com/UsSdMZ78Q3E"
80+
name = "Nuts",
81+
imageRes = R.drawable.nuts,
8182
)
8283
)
8384
),
@@ -87,27 +88,27 @@ private val searchCategoryCollections = listOf(
8788
categories = listOf(
8889
SearchCategory(
8990
name = "Organic",
90-
imageUrl = "https://source.unsplash.com/7meCnGCJ5Ms"
91+
imageRes = R.drawable.organic
9192
),
9293
SearchCategory(
9394
name = "Gluten Free",
94-
imageUrl = "https://source.unsplash.com/m741tj4Cz7M"
95+
imageRes = R.drawable.gluten_free
9596
),
9697
SearchCategory(
9798
name = "Paleo",
98-
imageUrl = "https://source.unsplash.com/dt5-8tThZKg"
99+
imageRes = R.drawable.paleo,
99100
),
100101
SearchCategory(
101102
name = "Vegan",
102-
imageUrl = "https://source.unsplash.com/ReXxkS1m1H0"
103+
imageRes = R.drawable.vegan,
103104
),
104105
SearchCategory(
105-
name = "Vegitarian",
106-
imageUrl = "https://source.unsplash.com/IGfIGP5ONV0"
106+
name = "Vegetarian",
107+
imageRes = R.drawable.organic,
107108
),
108109
SearchCategory(
109110
name = "Whole30",
110-
imageUrl = "https://source.unsplash.com/9MzCd76xLGk"
111+
imageRes = R.drawable.paleo
111112
)
112113
)
113114
)

baseline-profiles/app/src/main/java/com/example/baselineprofiles_codelab/model/Snack.kt

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@
1616

1717
package com.example.baselineprofiles_codelab.model
1818

19+
import androidx.annotation.DrawableRes
1920
import androidx.compose.runtime.Immutable
21+
import com.example.baselineprofiles_codelab.R
2022

2123
@Immutable
2224
data class Snack(
2325
val id: Long,
2426
val name: String,
25-
val imageUrl: String,
27+
@DrawableRes
28+
val imageRes: Int,
2629
val price: Long,
2730
val tagline: String = "",
2831
val tags: Set<String> = emptySet()
@@ -31,196 +34,195 @@ data class Snack(
3134
/**
3235
* Static data
3336
*/
34-
3537
val snacks = listOf(
3638
Snack(
3739
id = 1L,
3840
name = "Cupcake",
3941
tagline = "A tag line",
40-
imageUrl = "https://source.unsplash.com/pGM4sjt_BdQ",
42+
imageRes = R.drawable.cupcake,
4143
price = 299
4244
),
4345
Snack(
4446
id = 2L,
4547
name = "Donut",
4648
tagline = "A tag line",
47-
imageUrl = "https://source.unsplash.com/Yc5sL-ejk6U",
49+
imageRes = R.drawable.donut,
4850
price = 299
4951
),
5052
Snack(
5153
id = 3L,
5254
name = "Eclair",
5355
tagline = "A tag line",
54-
imageUrl = "https://source.unsplash.com/-LojFX9NfPY",
56+
imageRes = R.drawable.eclair,
5557
price = 299
5658
),
5759
Snack(
5860
id = 4L,
5961
name = "Froyo",
6062
tagline = "A tag line",
61-
imageUrl = "https://source.unsplash.com/3U2V5WqK1PQ",
63+
imageRes = R.drawable.froyo,
6264
price = 299
6365
),
6466
Snack(
6567
id = 5L,
6668
name = "Gingerbread",
6769
tagline = "A tag line",
68-
imageUrl = "https://source.unsplash.com/Y4YR9OjdIMk",
70+
imageRes = R.drawable.gingerbread,
6971
price = 499
7072
),
7173
Snack(
7274
id = 6L,
7375
name = "Honeycomb",
7476
tagline = "A tag line",
75-
imageUrl = "https://source.unsplash.com/bELvIg_KZGU",
77+
imageRes = R.drawable.honeycomb,
7678
price = 299
7779
),
7880
Snack(
7981
id = 7L,
8082
name = "Ice Cream Sandwich",
8183
tagline = "A tag line",
82-
imageUrl = "https://source.unsplash.com/YgYJsFDd4AU",
84+
imageRes = R.drawable.ice_cream_sandwich,
8385
price = 1299
8486
),
8587
Snack(
8688
id = 8L,
8789
name = "Jellybean",
8890
tagline = "A tag line",
89-
imageUrl = "https://source.unsplash.com/0u_vbeOkMpk",
91+
imageRes = R.drawable.jelly_bean,
9092
price = 299
9193
),
9294
Snack(
9395
id = 9L,
9496
name = "KitKat",
9597
tagline = "A tag line",
96-
imageUrl = "https://source.unsplash.com/yb16pT5F_jE",
98+
imageRes = R.drawable.kitkat,
9799
price = 549
98100
),
99101
Snack(
100102
id = 10L,
101103
name = "Lollipop",
102104
tagline = "A tag line",
103-
imageUrl = "https://source.unsplash.com/AHF_ZktTL6Q",
105+
imageRes = R.drawable.lollipop,
104106
price = 299
105107
),
106108
Snack(
107109
id = 11L,
108110
name = "Marshmallow",
109111
tagline = "A tag line",
110-
imageUrl = "https://source.unsplash.com/rqFm0IgMVYY",
112+
imageRes = R.drawable.marshmallow,
111113
price = 299
112114
),
113115
Snack(
114116
id = 12L,
115117
name = "Nougat",
116118
tagline = "A tag line",
117-
imageUrl = "https://source.unsplash.com/qRE_OpbVPR8",
119+
imageRes = R.drawable.nougat,
118120
price = 299
119121
),
120122
Snack(
121123
id = 13L,
122124
name = "Oreo",
123125
tagline = "A tag line",
124-
imageUrl = "https://source.unsplash.com/33fWPnyN6tU",
126+
imageRes = R.drawable.oreo,
125127
price = 299
126128
),
127129
Snack(
128130
id = 14L,
129131
name = "Pie",
130132
tagline = "A tag line",
131-
imageUrl = "https://source.unsplash.com/aX_ljOOyWJY",
133+
imageRes = R.drawable.pie,
132134
price = 299
133135
),
134136
Snack(
135137
id = 15L,
136138
name = "Chips",
137-
imageUrl = "https://source.unsplash.com/UsSdMZ78Q3E",
139+
imageRes = R.drawable.chips,
138140
price = 299
139141
),
140142
Snack(
141143
id = 16L,
142144
name = "Pretzels",
143-
imageUrl = "https://source.unsplash.com/7meCnGCJ5Ms",
145+
imageRes = R.drawable.pretzels,
144146
price = 299
145147
),
146148
Snack(
147149
id = 17L,
148150
name = "Smoothies",
149-
imageUrl = "https://source.unsplash.com/m741tj4Cz7M",
151+
imageRes = R.drawable.smoothies,
150152
price = 299
151153
),
152154
Snack(
153155
id = 18L,
154156
name = "Popcorn",
155-
imageUrl = "https://source.unsplash.com/iuwMdNq0-s4",
157+
imageRes = R.drawable.popcorn,
156158
price = 299
157159
),
158160
Snack(
159161
id = 19L,
160162
name = "Almonds",
161-
imageUrl = "https://source.unsplash.com/qgWWQU1SzqM",
163+
imageRes = R.drawable.almonds,
162164
price = 299
163165
),
164166
Snack(
165167
id = 20L,
166168
name = "Cheese",
167-
imageUrl = "https://source.unsplash.com/9MzCd76xLGk",
169+
imageRes = R.drawable.cheese,
168170
price = 299
169171
),
170172
Snack(
171173
id = 21L,
172174
name = "Apples",
173175
tagline = "A tag line",
174-
imageUrl = "https://source.unsplash.com/1d9xXWMtQzQ",
176+
imageRes = R.drawable.apples,
175177
price = 299
176178
),
177179
Snack(
178180
id = 22L,
179181
name = "Apple sauce",
180182
tagline = "A tag line",
181-
imageUrl = "https://source.unsplash.com/wZxpOw84QTU",
183+
imageRes = R.drawable.apple_sauce,
182184
price = 299
183185
),
184186
Snack(
185187
id = 23L,
186188
name = "Apple chips",
187189
tagline = "A tag line",
188-
imageUrl = "https://source.unsplash.com/okzeRxm_GPo",
190+
imageRes = R.drawable.apple_chips,
189191
price = 299
190192
),
191193
Snack(
192194
id = 24L,
193195
name = "Apple juice",
194196
tagline = "A tag line",
195-
imageUrl = "https://source.unsplash.com/l7imGdupuhU",
197+
imageRes = R.drawable.apple_juice,
196198
price = 299
197199
),
198200
Snack(
199201
id = 25L,
200202
name = "Apple pie",
201203
tagline = "A tag line",
202-
imageUrl = "https://source.unsplash.com/bkXzABDt08Q",
204+
imageRes = R.drawable.apple_pie,
203205
price = 299
204206
),
205207
Snack(
206208
id = 26L,
207209
name = "Grapes",
208210
tagline = "A tag line",
209-
imageUrl = "https://source.unsplash.com/y2MeW00BdBo",
211+
imageRes = R.drawable.grapes,
210212
price = 299
211213
),
212214
Snack(
213215
id = 27L,
214216
name = "Kiwi",
215217
tagline = "A tag line",
216-
imageUrl = "https://source.unsplash.com/1oMGgHn-M8k",
218+
imageRes = R.drawable.kiwi,
217219
price = 299
218220
),
219221
Snack(
220222
id = 28L,
221223
name = "Mango",
222224
tagline = "A tag line",
223-
imageUrl = "https://source.unsplash.com/TIGDsyy0TK4",
225+
imageRes = R.drawable.mango,
224226
price = 299
225227
)
226228
)

0 commit comments

Comments
 (0)