Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions baseline-profiles/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ plugins {
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.androidx.baselineprofile)
alias(libs.plugins.baselineprofile)
}

android {
Expand All @@ -45,6 +45,15 @@ android {
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = "11"
}

buildTypes {
getByName("debug") {
signingConfig = signingConfigs.getByName("debug")
Expand All @@ -60,11 +69,6 @@ android {
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

buildFeatures {
compose = true
}
Expand All @@ -78,7 +82,7 @@ android {
}

dependencies {
implementation(libs.profileinstaller)
implementation(libs.androidx.profileinstaller)
"baselineProfile"(project(mapOf("path" to ":baselineprofile")))
val composeBom = platform(libs.androidx.compose.bom)
implementation(composeBom)
Expand Down Expand Up @@ -110,7 +114,6 @@ dependencies {
implementation(libs.coil.kt.compose)

implementation(libs.androidx.runtime.tracing)

androidTestImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.core)
androidTestImplementation(libs.androidx.test.runner)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.example.baselineprofiles_codelab.model

import androidx.compose.runtime.Immutable
import com.example.baselineprofiles_codelab.R
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.withContext
Expand Down Expand Up @@ -44,7 +45,7 @@ data class SearchCategoryCollection(
@Immutable
data class SearchCategory(
val name: String,
val imageUrl: String
val imageRes: Int
)

@Immutable
Expand All @@ -65,19 +66,19 @@ private val searchCategoryCollections = listOf(
categories = listOf(
SearchCategory(
name = "Chips & crackers",
imageUrl = "https://source.unsplash.com/UsSdMZ78Q3E"
imageRes = R.drawable.chips
),
SearchCategory(
name = "Fruit snacks",
imageUrl = "https://source.unsplash.com/SfP1PtM9Qa8"
imageRes = R.drawable.fruit,
),
SearchCategory(
name = "Desserts",
imageUrl = "https://source.unsplash.com/_jk8KIyN_uA"
imageRes = R.drawable.desserts
),
SearchCategory(
name = "Nuts ",
imageUrl = "https://source.unsplash.com/UsSdMZ78Q3E"
name = "Nuts",
imageRes = R.drawable.nuts,
)
)
),
Expand All @@ -87,27 +88,27 @@ private val searchCategoryCollections = listOf(
categories = listOf(
SearchCategory(
name = "Organic",
imageUrl = "https://source.unsplash.com/7meCnGCJ5Ms"
imageRes = R.drawable.organic
),
SearchCategory(
name = "Gluten Free",
imageUrl = "https://source.unsplash.com/m741tj4Cz7M"
imageRes = R.drawable.gluten_free
),
SearchCategory(
name = "Paleo",
imageUrl = "https://source.unsplash.com/dt5-8tThZKg"
imageRes = R.drawable.paleo,
),
SearchCategory(
name = "Vegan",
imageUrl = "https://source.unsplash.com/ReXxkS1m1H0"
imageRes = R.drawable.vegan,
),
SearchCategory(
name = "Vegitarian",
imageUrl = "https://source.unsplash.com/IGfIGP5ONV0"
name = "Vegetarian",
imageRes = R.drawable.organic,
),
SearchCategory(
name = "Whole30",
imageUrl = "https://source.unsplash.com/9MzCd76xLGk"
imageRes = R.drawable.paleo
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@

package com.example.baselineprofiles_codelab.model

import androidx.annotation.DrawableRes
import androidx.compose.runtime.Immutable
import com.example.baselineprofiles_codelab.R

@Immutable
data class Snack(
val id: Long,
val name: String,
val imageUrl: String,
@DrawableRes
val imageRes: Int,
val price: Long,
val tagline: String = "",
val tags: Set<String> = emptySet()
Expand All @@ -31,196 +34,195 @@ data class Snack(
/**
* Static data
*/

val snacks = listOf(
Snack(
id = 1L,
name = "Cupcake",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/pGM4sjt_BdQ",
imageRes = R.drawable.cupcake,
price = 299
),
Snack(
id = 2L,
name = "Donut",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/Yc5sL-ejk6U",
imageRes = R.drawable.donut,
price = 299
),
Snack(
id = 3L,
name = "Eclair",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/-LojFX9NfPY",
imageRes = R.drawable.eclair,
price = 299
),
Snack(
id = 4L,
name = "Froyo",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/3U2V5WqK1PQ",
imageRes = R.drawable.froyo,
price = 299
),
Snack(
id = 5L,
name = "Gingerbread",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/Y4YR9OjdIMk",
imageRes = R.drawable.gingerbread,
price = 499
),
Snack(
id = 6L,
name = "Honeycomb",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/bELvIg_KZGU",
imageRes = R.drawable.honeycomb,
price = 299
),
Snack(
id = 7L,
name = "Ice Cream Sandwich",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/YgYJsFDd4AU",
imageRes = R.drawable.ice_cream_sandwich,
price = 1299
),
Snack(
id = 8L,
name = "Jellybean",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/0u_vbeOkMpk",
imageRes = R.drawable.jelly_bean,
price = 299
),
Snack(
id = 9L,
name = "KitKat",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/yb16pT5F_jE",
imageRes = R.drawable.kitkat,
price = 549
),
Snack(
id = 10L,
name = "Lollipop",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/AHF_ZktTL6Q",
imageRes = R.drawable.lollipop,
price = 299
),
Snack(
id = 11L,
name = "Marshmallow",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/rqFm0IgMVYY",
imageRes = R.drawable.marshmallow,
price = 299
),
Snack(
id = 12L,
name = "Nougat",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/qRE_OpbVPR8",
imageRes = R.drawable.nougat,
price = 299
),
Snack(
id = 13L,
name = "Oreo",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/33fWPnyN6tU",
imageRes = R.drawable.oreo,
price = 299
),
Snack(
id = 14L,
name = "Pie",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/aX_ljOOyWJY",
imageRes = R.drawable.pie,
price = 299
),
Snack(
id = 15L,
name = "Chips",
imageUrl = "https://source.unsplash.com/UsSdMZ78Q3E",
imageRes = R.drawable.chips,
price = 299
),
Snack(
id = 16L,
name = "Pretzels",
imageUrl = "https://source.unsplash.com/7meCnGCJ5Ms",
imageRes = R.drawable.pretzels,
price = 299
),
Snack(
id = 17L,
name = "Smoothies",
imageUrl = "https://source.unsplash.com/m741tj4Cz7M",
imageRes = R.drawable.smoothies,
price = 299
),
Snack(
id = 18L,
name = "Popcorn",
imageUrl = "https://source.unsplash.com/iuwMdNq0-s4",
imageRes = R.drawable.popcorn,
price = 299
),
Snack(
id = 19L,
name = "Almonds",
imageUrl = "https://source.unsplash.com/qgWWQU1SzqM",
imageRes = R.drawable.almonds,
price = 299
),
Snack(
id = 20L,
name = "Cheese",
imageUrl = "https://source.unsplash.com/9MzCd76xLGk",
imageRes = R.drawable.cheese,
price = 299
),
Snack(
id = 21L,
name = "Apples",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/1d9xXWMtQzQ",
imageRes = R.drawable.apples,
price = 299
),
Snack(
id = 22L,
name = "Apple sauce",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/wZxpOw84QTU",
imageRes = R.drawable.apple_sauce,
price = 299
),
Snack(
id = 23L,
name = "Apple chips",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/okzeRxm_GPo",
imageRes = R.drawable.apple_chips,
price = 299
),
Snack(
id = 24L,
name = "Apple juice",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/l7imGdupuhU",
imageRes = R.drawable.apple_juice,
price = 299
),
Snack(
id = 25L,
name = "Apple pie",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/bkXzABDt08Q",
imageRes = R.drawable.apple_pie,
price = 299
),
Snack(
id = 26L,
name = "Grapes",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/y2MeW00BdBo",
imageRes = R.drawable.grapes,
price = 299
),
Snack(
id = 27L,
name = "Kiwi",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/1oMGgHn-M8k",
imageRes = R.drawable.kiwi,
price = 299
),
Snack(
id = 28L,
name = "Mango",
tagline = "A tag line",
imageUrl = "https://source.unsplash.com/TIGDsyy0TK4",
imageRes = R.drawable.mango,
price = 299
)
)
Loading