Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into m3
Browse files Browse the repository at this point in the history
  • Loading branch information
MagicalMeghan authored Aug 23, 2023
2 parents 267fce5 + 13144ae commit 1cf0da0
Show file tree
Hide file tree
Showing 25 changed files with 263 additions and 57 deletions.
53 changes: 53 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Bug Report
description: File a bug report
title: "[Bug]: "
labels: ["bug", "triage me"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: checkboxes
attributes:
label: Is there a StackOverflow question about this issue?
description: Please search [StackOverflow](https://stackoverflow.com/questions/tagged/android-jetpack-compose) if an issue with an answer already exists for the bug you encountered.
options:
- label: I have searched StackOverflow
required: true
- type: checkboxes
attributes:
label: Is this an issue related to the sample app?
description: Please confirm that this is an issue related to this sample repo. If this is a bug related to Compose, file an issue on the Compose [issue tracker](https://issuetracker.google.com/issues/new?component=612128) instead.
options:
- label: Yes, this is a specific issue related to this samples repo.
required: true
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
value: "A bug happened!"
validations:
required: true
- type: textarea
id: logs
attributes:
label: Relevant logcat output
description: Please copy and paste any relevant logcat output. This will be automatically formatted into code, so no need for backticks.
render: shell
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true
53 changes: 53 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Feature request
description: File a feature request
title: "[FR]: "
labels: ["enhancement", "triage me"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for this feature request.
options:
- label: I have searched the existing issues
required: true
- type: checkboxes
attributes:
label: Is this a feature request for the samples?
description: Please confirm that this is a feature request related to this samples repo. If this is a request related to Compose, file a feature request on the Compose [issue tracker](https://issuetracker.google.com/issues/new?component=612128) instead.
options:
- label: Yes, this is a specific request related to this samples repo.
required: true
- type: textarea
id: describe-problem
attributes:
label: Describe the problem
description: Is your feature request related to a problem? Please describe.
placeholder: I'm always frustrated when...
validations:
required: true
- type: textarea
id: solution
attributes:
label: Describe the solution
description: Please describe the solution you'd like. A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
id: context
attributes:
label: Additional context
description: Add any other context or screenshots about the feature request here.
validations:
required: false
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true
11 changes: 11 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: Pull request
about: Create a pull request
label: 'triage me'
---
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
- [ ] Make sure to open a GitHub issue as a bug/feature request before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
- [ ] Ensure the tests and linter pass
- [ ] Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕
6 changes: 3 additions & 3 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ jobs:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v1
- name: set up JDK 11
- uses: actions/checkout@v3
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
- name: Build project
run: .github/scripts/gradlew_recursive.sh assembleDebug
Expand Down
1 change: 0 additions & 1 deletion .google/packaging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ solutions:
- Flow
- JetpackHilt
- JetpackRoom
- JetpackDataStore
- JetpackWorkManager
- JetpackNavigation
- JetpackLifecycle
Expand Down
63 changes: 63 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Google Open Source Community Guidelines

At Google, we recognize and celebrate the creativity and collaboration of open
source contributors and the diversity of skills, experiences, cultures, and
opinions they bring to the projects and communities they participate in.

Every one of Google's open source projects and communities are inclusive
environments, based on treating all individuals respectfully, regardless of
gender identity and expression, sexual orientation, disabilities,
neurodiversity, physical appearance, body size, ethnicity, nationality, race,
age, religion, or similar personal characteristic.

We value diverse opinions, but we value respectful behavior more.

Respectful behavior includes:

* Being considerate, kind, constructive, and helpful.
* Not engaging in demeaning, discriminatory, harassing, hateful, sexualized, or
physically threatening behavior, speech, and imagery.
* Not engaging in unwanted physical contact.

Some Google open source projects [may adopt][] an explicit project code of
conduct, which may have additional detailed expectations for participants. Most
of those projects will use our [modified Contributor Covenant][].

[may adopt]: https://opensource.google/docs/releasing/preparing/#conduct
[modified Contributor Covenant]: https://opensource.google/docs/releasing/template/CODE_OF_CONDUCT/

## Resolve peacefully

We do not believe that all conflict is necessarily bad; healthy debate and
disagreement often yields positive results. However, it is never okay to be
disrespectful.

If you see someone behaving disrespectfully, you are encouraged to address the
behavior directly with those involved. Many issues can be resolved quickly and
easily, and this gives people more control over the outcome of their dispute.
If you are unable to resolve the matter for any reason, or if the behavior is
threatening or harassing, report it. We are dedicated to providing an
environment where participants feel welcome and safe.

## Reporting problems

Some Google open source projects may adopt a project-specific code of conduct.
In those cases, a Google employee will be identified as the Project Steward,
who will receive and handle reports of code of conduct violations. In the event
that a project hasn’t identified a Project Steward, you can report problems by
emailing opensource@google.com.

We will investigate every complaint, but you may not receive a direct response.
We will use our discretion in determining when and how to follow up on reported
incidents, which may range from not taking action to permanent expulsion from
the project and project-sponsored spaces. We will notify the accused of the
report and provide them an opportunity to discuss it before any action is
taken. The identity of the reporter will be omitted from the details of the
report supplied to the accused. In potentially harmful situations, such as
ongoing harassment or threats to anyone's safety, we may take action without
notice.

*This document was adapted from the [IndieWeb Code of Conduct][] and can also
be found at <https://opensource.google/conduct/>.*

[IndieWeb Code of Conduct]: https://indieweb.org/code-of-conduct
19 changes: 0 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,3 @@ Select text used for describing the plants (in `plants.json`) are used from Wiki

"[seed](https://thenounproject.com/search/?q=seed&i=1585971)" by [Aisyah](https://thenounproject.com/aisyahalmasyira/) is licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/us/legalcode)

License
-------

Copyright 2018 Google, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for
additional information regarding copyright ownership. The ASF licenses this
file to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
10 changes: 6 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ android {
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
// work-runtime-ktx 2.1.0 and above now requires Java 8
jvmTarget = "1.8"
jvmTarget = JavaVersion.VERSION_17.toString()

// Enable Coroutines and Flow APIs
freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi"
Expand All @@ -75,6 +75,7 @@ android {
buildFeatures {
compose = true
dataBinding = true
buildConfig = true
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
Expand All @@ -97,6 +98,7 @@ android {
}
}
}
namespace = "com.google.samples.apps.sunflower"
}

androidComponents {
Expand Down Expand Up @@ -170,4 +172,4 @@ dependencies {

fun getUnsplashAccess(): String? {
return project.findProperty("unsplash_access_key") as? String
}
}
32 changes: 32 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,35 @@
-keepclassmembernames class kotlinx.** {
volatile <fields>;
}
-keepclassmembers class com.google.samples.apps.sunflower.** { <fields>; }


# Keep annotation default values (e.g., retrofit2.http.Field.encoded).
-keepattributes AnnotationDefault

# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items).
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response

# With R8 full mode generic signatures are stripped for classes that are not
# kept. Suspend functions are wrapped in continuations where the type argument
# is used.
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
# -keep class hilt_aggregated_deps.** { *; }


##---------------Begin: proguard configuration for Gson ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keep class com.google.gson.** { *; }
-keepattributes Signature
# For using GSON @Expose annotation
-keepattributes *Annotation*
# Gson specific classes
-keep class sun.misc.Unsafe { *; }
#-keep class com.google.gson.stream.** { *; }
# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { *; }
##---------------End: proguard configuration for Gson ----------


Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class GardenPlantingDaoTest {
database = Room.inMemoryDatabaseBuilder(context, AppDatabase::class.java).build()
gardenPlantingDao = database.gardenPlantingDao()

database.plantDao().insertAll(testPlants)
database.plantDao().upsertAll(testPlants)
testGardenPlantingId = gardenPlantingDao.insertGardenPlanting(testGardenPlanting)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class PlantDaoTest {
plantDao = database.plantDao()

// Insert plants in non-alphabetical order to test that results are sorted by name
plantDao.insertAll(listOf(plantB, plantC, plantA))
plantDao.upsertAll(listOf(plantB, plantC, plantA))
}

@After fun closeDb() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class PlantDetailViewModelTest {
lateinit var plantRepository: PlantRepository

@Inject
lateinit var gardenPlantRepository: GardenPlantingRepository
lateinit var gardenPlantingRepository: GardenPlantingRepository

@Before
fun setUp() {
Expand All @@ -70,7 +70,7 @@ class PlantDetailViewModelTest {
val savedStateHandle: SavedStateHandle = SavedStateHandle().apply {
set("plantId", testPlant.plantId)
}
viewModel = PlantDetailViewModel(savedStateHandle, plantRepository, gardenPlantRepository)
viewModel = PlantDetailViewModel(savedStateHandle, plantRepository, gardenPlantingRepository)
}

@After
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.google.samples.apps.sunflower">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down Expand Up @@ -58,4 +57,4 @@

</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ class GardenActivity : ComponentActivity() {

// Displaying edge-to-edge
WindowCompat.setDecorFitsSystemWindows(window, false)

setContent {
SunflowerTheme {
SunflowerApp()
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ fun bindImageFromUrl(view: ImageView, imageUrl: String?) {
}
Glide.with(view)
.load(imageUrl)
.placeholder(android.R.drawable.progress_indeterminate_horizontal)
.into(view)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import com.google.samples.apps.sunflower.R
import com.google.samples.apps.sunflower.compose.gallery.GalleryScreen
import com.google.samples.apps.sunflower.compose.home.HomeScreen
import com.google.samples.apps.sunflower.compose.plantdetail.PlantDetailsScreen
import com.google.samples.apps.sunflower.viewmodels.PlantListViewModel

@Composable
fun SunflowerApp() {
Expand All @@ -51,7 +52,7 @@ fun SunFlowerNavHost(
HomeScreen(
onPlantClick = {
navController.navigate("plantDetail/${it.plantId}")
},
}
)
}
composable(
Expand Down
Loading

0 comments on commit 1cf0da0

Please sign in to comment.