├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── ic_launcher-playstore.png
│ │ ├── res
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── drawable
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ ├── ic_add_24.xml
│ │ │ │ ├── ic_notes_24.xml
│ │ │ │ ├── ic_edit_24.xml
│ │ │ │ ├── ic_location_24.xml
│ │ │ │ ├── ic_calendar_24.xml
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── menu
│ │ │ │ └── menu_main.xml
│ │ │ ├── values
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── colors.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── themes.xml
│ │ │ ├── values-night
│ │ │ │ └── themes.xml
│ │ │ ├── layout
│ │ │ │ ├── content_main.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── fragment_forageable_list.xml
│ │ │ │ ├── list_item_forageable.xml
│ │ │ │ ├── fragment_add_forageable.xml
│ │ │ │ └── fragment_forageable_detail.xml
│ │ │ └── navigation
│ │ │ │ └── nav_graph.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── forage
│ │ │ │ ├── BaseApplication.kt
│ │ │ │ ├── data
│ │ │ │ ├── ForageDatabase.kt
│ │ │ │ └── ForageableDao.kt
│ │ │ │ ├── model
│ │ │ │ └── Forageable.kt
│ │ │ │ ├── ui
│ │ │ │ ├── adapter
│ │ │ │ │ └── ForageableListAdapter.kt
│ │ │ │ ├── viewmodel
│ │ │ │ │ └── ForageableViewModel.kt
│ │ │ │ ├── ForageableListFragment.kt
│ │ │ │ ├── ForageableDetailFragment.kt
│ │ │ │ └── AddForageableFragment.kt
│ │ │ │ └── MainActivity.kt
│ │ └── AndroidManifest.xml
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── forage
│ │ └── PersistenceInstrumentationTests.kt
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── .github
└── ISSUE_TEMPLATE
├── gradle.properties
├── CONTRIBUTING.md
├── README.md
├── gradlew.bat
├── code-of-conduct.md
├── gradlew
└── LICENSE
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = "Forage"
2 | include ':app'
3 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google-developer-training/android-basics-kotlin-forage-app/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google-developer-training/android-basics-kotlin-forage-app/HEAD/app/src/main/ic_launcher-playstore.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Aug 09 14:37:25 PDT 2021
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # built application files
2 | *.apk
3 | *.ap_
4 | # Mac files
5 | .DS_Store
6 | # files for the dex VM
7 | *.dex
8 | # Java class files
9 | *.class
10 | # generated files
11 | bin/
12 | gen/
13 | # Ignore gradle files
14 | .gradle/
15 | build/
16 | # Local configuration file (sdk path, etc)
17 | local.properties
18 | # Proguard folder generated by Eclipse
19 | proguard/
20 | proguard-project.txt
21 | # Eclipse files
22 | .project
23 | .classpath
24 | .settings/
25 | # Android Studio/IDEA
26 | *.iml
27 | .idea
28 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE:
--------------------------------------------------------------------------------
1 | ---
2 | name: 'Android Basics: Forage app'
3 | about: Describe this issue template's purpose here.
4 | title: 'Android Basics: Forage app'
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **URL of codelab**
11 |
12 |
13 | **In which task and step of the codelab can this issue be found?**
14 |
15 |
16 | **Describe the problem**
17 |
18 |
19 |
20 |
21 | **Steps to reproduce?**
22 | 1. Go to...
23 | 2. Click on...
24 | 3. See error...
25 |
26 | **Versions**
27 | _Android Studio version:_
28 | _API version of the emulator:_
29 |
30 |
31 | **Additional information**
32 | _Include screenshots if they would be useful in clarifying the problem._
33 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 | 16dp
18 |
19 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_add_24.xml:
--------------------------------------------------------------------------------
1 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/forage/BaseApplication.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 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 | package com.example.forage
17 |
18 | import android.app.Application
19 | import com.example.forage.data.ForageDatabase
20 |
21 | /**
22 | * An application class that inherits from [Application], allows for the creation of a singleton
23 | * instance of the [ForageDatabase]
24 | */
25 | class BaseApplication : Application() {
26 |
27 | // TODO: provide a ForageDatabase value by lazy here
28 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/forage/data/ForageDatabase.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 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 | package com.example.forage.data
17 |
18 | import androidx.room.RoomDatabase
19 | import com.example.forage.model.Forageable
20 |
21 | /**
22 | * Room database to persist data for the Forage app.
23 | * This database stores a [Forageable] entity
24 | */
25 | // TODO: create the database with all necessary annotations, methods, variables, etc.
26 | abstract class ForageDatabase : RoomDatabase()
27 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 | #FFBB86FC
19 | #FF6200EE
20 | #FF3700B3
21 | #FF03DAC5
22 | #FF018786
23 | #FF000000
24 | #FFFFFFFF
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_notes_24.xml:
--------------------------------------------------------------------------------
1 |
16 |
22 |
25 |
26 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Kotlin code style for this project: "official" or "obsolete":
19 | kotlin.code.style=official
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_edit_24.xml:
--------------------------------------------------------------------------------
1 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_location_24.xml:
--------------------------------------------------------------------------------
1 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How to Contribute
2 |
3 | We'd love to accept your patches and contributions to this project. There are
4 | just a few small guidelines you need to follow.
5 |
6 | ## Contributor License Agreement
7 |
8 | Contributions to this project must be accompanied by a Contributor License
9 | Agreement (CLA). You (or your employer) retain the copyright to your
10 | contribution; this simply gives us permission to use and redistribute your
11 | contributions as part of the project. Head over to
12 | to see your current agreements on file or
13 | to sign a new one.
14 |
15 | You generally only need to submit a CLA once, so if you've already submitted one
16 | (even if it was for a different project), you probably don't need to do it
17 | again.
18 |
19 | ## Code reviews
20 |
21 | All submissions, including submissions by project members, require review. We
22 | use GitHub pull requests for this purpose. Consult
23 | [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
24 | information on using pull requests.
25 |
26 | ## Community Guidelines
27 |
28 | This project follows
29 | [Google's Open Source Community Guidelines](https://opensource.google/conduct/).
30 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_calendar_24.xml:
--------------------------------------------------------------------------------
1 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Forage - Starter Code
2 | ==================================
3 |
4 | Starter code for the fifth independent project for Android Basics in Kotlin. This project pairs
5 | with Unit 5 of Android Basics in Kotlin
6 |
7 | Introduction
8 | ------------
9 |
10 | This is the starter code for the Forage app project. This project is an opportunity for you to
11 | demonstrate the concepts you learned in Unit 5 of Android Basics in Kotlin.
12 |
13 | Pre-requisites
14 | --------------
15 |
16 | - Complete Unit 1 of Android Basics in Kotlin
17 | - Complete Project 1: Lemonade App
18 | - Complete Unit 2 of Android Basics in Kotlin
19 | - Complete Project 2: Dogglers
20 | - Complete Unit 3 of Android Basics in Kotlin
21 | - Complete Project 3: Lunch Tray
22 | - Complete Unit 4 of Android Basics in Kotlin
23 | - Complete Project 4: Amphibians
24 | - Complete Unit 5 of Android Basics in Kotlin
25 |
26 | Getting Started
27 | ---------------
28 |
29 | 1. Download the starter code
30 | 2. Open the project in Android Studio
31 | 3. Complete the project in accordance with the app requirements
32 |
33 |
34 | Tasks
35 | ---------------
36 |
37 | Tips
38 | ----
39 |
40 | - Use the provided tests to ensure your app is running as expected
41 | - DO NOT ALTER THE PROVIDED TESTS
42 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/forage/model/Forageable.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 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 | package com.example.forage.model
17 |
18 | /**
19 | * Forageable entity to be stored in the forageable_database.
20 | */
21 | // TODO: annotate this data class as an entity with a parameter for the table name
22 | data class Forageable(
23 | // TODO: declare the id to be an autogenerated primary key
24 | val id: Long = 0,
25 | val name: String,
26 | val address: String,
27 | // TODO: make a custom column name for the inSeason variable that follows SQL column name
28 | // conventions (the column name should be in_season)
29 | val inSeason: Boolean,
30 | val notes: String?
31 | )
32 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/forage/data/ForageableDao.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 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 | package com.example.forage.data
17 |
18 | import androidx.room.Dao
19 |
20 | /**
21 | * Data Access Object for database interaction.
22 | */
23 | @Dao
24 | interface ForageableDao {
25 |
26 | // TODO: implement a method to retrieve all Forageables from the database
27 |
28 | // TODO: implement a method to retrieve a Forageable from the database by id
29 |
30 | // TODO: implement a method to insert a Forageable into the database
31 | // (use OnConflictStrategy.REPLACE)
32 |
33 | // TODO: implement a method to update a Forageable that is already in the database
34 |
35 | // TODO: implement a method to delete a Forageable from the database.
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 | Forage
18 | Settings
19 |
20 | List Fragment
21 | Add Fragment
22 |
23 | Name
24 | Location
25 | Currently in season
26 | Currently out of season
27 | Notes
28 | Save
29 | Delete
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
19 |
20 |
28 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
23 |
24 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
24 |
25 |
29 |
30 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
31 |
32 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_forageable_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
24 |
25 |
33 |
34 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/forage/ui/adapter/ForageableListAdapter.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 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 | package com.example.forage.ui.adapter
17 |
18 | import android.view.LayoutInflater
19 | import android.view.ViewGroup
20 | import androidx.recyclerview.widget.DiffUtil
21 | import androidx.recyclerview.widget.ListAdapter
22 | import androidx.recyclerview.widget.RecyclerView
23 | import com.example.forage.databinding.ListItemForageableBinding
24 | import com.example.forage.model.Forageable
25 |
26 | /**
27 | * ListAdapter for the list of [Forageable]s retrieved from the database
28 | */
29 | class ForageableListAdapter(
30 | private val clickListener: (Forageable) -> Unit
31 | ) : ListAdapter(DiffCallback) {
32 |
33 | class ForageableViewHolder(
34 | private var binding: ListItemForageableBinding
35 | ): RecyclerView.ViewHolder(binding.root) {
36 |
37 | fun bind(forageable: Forageable) {
38 | binding.forageable = forageable
39 | binding.executePendingBindings()
40 | }
41 | }
42 |
43 | companion object DiffCallback: DiffUtil.ItemCallback() {
44 | override fun areItemsTheSame(oldItem: Forageable, newItem: Forageable): Boolean {
45 | return oldItem.id == newItem.id
46 | }
47 |
48 | override fun areContentsTheSame(oldItem: Forageable, newItem: Forageable): Boolean {
49 | return oldItem == newItem
50 | }
51 |
52 | }
53 |
54 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ForageableViewHolder {
55 | val layoutInflater = LayoutInflater.from(parent.context)
56 | return ForageableViewHolder(
57 | ListItemForageableBinding.inflate(layoutInflater, parent, false)
58 | )
59 | }
60 |
61 | override fun onBindViewHolder(holder: ForageableViewHolder, position: Int) {
62 | val forageable = getItem(position)
63 | holder.itemView.setOnClickListener{
64 | clickListener(forageable)
65 | }
66 | holder.bind(forageable)
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/list_item_forageable.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
21 |
22 |
23 |
26 |
27 |
28 |
33 |
34 |
44 |
45 |
54 |
55 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/app/src/main/res/navigation/nav_graph.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
22 |
23 |
27 |
30 |
33 |
34 |
39 |
42 |
46 |
47 |
52 |
56 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/forage/MainActivity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 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 | package com.example.forage
17 |
18 | import android.os.Bundle
19 | import android.view.Menu
20 | import android.view.MenuItem
21 | import androidx.appcompat.app.AppCompatActivity
22 | import androidx.navigation.findNavController
23 | import androidx.navigation.ui.AppBarConfiguration
24 | import androidx.navigation.ui.navigateUp
25 | import androidx.navigation.ui.setupActionBarWithNavController
26 | import com.example.forage.databinding.ActivityMainBinding
27 |
28 | /**
29 | * A Main activity that hosts all [Fragment]s for this application and hosts the nav controller.
30 | */
31 | class MainActivity : AppCompatActivity() {
32 |
33 | private lateinit var appBarConfiguration: AppBarConfiguration
34 | private lateinit var binding: ActivityMainBinding
35 |
36 | override fun onCreate(savedInstanceState: Bundle?) {
37 | super.onCreate(savedInstanceState)
38 |
39 | binding = ActivityMainBinding.inflate(layoutInflater)
40 | setContentView(binding.root)
41 |
42 | setSupportActionBar(binding.toolbar)
43 |
44 | val navController = findNavController(R.id.nav_host_fragment_content_main)
45 | appBarConfiguration = AppBarConfiguration(navController.graph)
46 | setupActionBarWithNavController(navController, appBarConfiguration)
47 | }
48 |
49 | override fun onCreateOptionsMenu(menu: Menu): Boolean {
50 | // Inflate the menu; this adds items to the action bar if it is present.
51 | menuInflater.inflate(R.menu.menu_main, menu)
52 | return true
53 | }
54 |
55 | override fun onOptionsItemSelected(item: MenuItem): Boolean {
56 | // Handle action bar item clicks here. The action bar will
57 | // automatically handle clicks on the Home/Up button, so long
58 | // as you specify a parent activity in AndroidManifest.xml.
59 | return when (item.itemId) {
60 | R.id.action_settings -> true
61 | else -> super.onOptionsItemSelected(item)
62 | }
63 | }
64 |
65 | override fun onSupportNavigateUp(): Boolean {
66 | val navController = findNavController(R.id.nav_host_fragment_content_main)
67 | return navController.navigateUp(appBarConfiguration)
68 | || super.onSupportNavigateUp()
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/forage/ui/viewmodel/ForageableViewModel.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 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 | package com.example.forage.ui.viewmodel
17 |
18 | import androidx.lifecycle.ViewModel
19 | import androidx.lifecycle.ViewModelProvider
20 | import androidx.lifecycle.viewModelScope
21 | import com.example.forage.data.ForageableDao
22 | import com.example.forage.model.Forageable
23 | import kotlinx.coroutines.Dispatchers
24 | import kotlinx.coroutines.launch
25 |
26 | /**
27 | * Shared [ViewModel] to provide data to the [ForageableListFragment], [ForageableDetailFragment],
28 | * and [AddForageableFragment] and allow for interaction the the [ForageableDao]
29 | */
30 |
31 | // TODO: pass a ForageableDao value as a parameter to the view model constructor
32 | class ForageableViewModel(
33 | // Pass dao here
34 | ): ViewModel() {
35 |
36 | // TODO: create a property to set to a list of all forageables from the DAO
37 |
38 | // TODO : create method that takes id: Long as a parameter and retrieve a Forageable from the
39 | // database by id via the DAO.
40 |
41 | fun addForageable(
42 | name: String,
43 | address: String,
44 | inSeason: Boolean,
45 | notes: String
46 | ) {
47 | val forageable = Forageable(
48 | name = name,
49 | address = address,
50 | inSeason = inSeason,
51 | notes = notes
52 | )
53 |
54 | // TODO: launch a coroutine and call the DAO method to add a Forageable to the database within it
55 |
56 | }
57 |
58 | fun updateForageable(
59 | id: Long,
60 | name: String,
61 | address: String,
62 | inSeason: Boolean,
63 | notes: String
64 | ) {
65 | val forageable = Forageable(
66 | id = id,
67 | name = name,
68 | address = address,
69 | inSeason = inSeason,
70 | notes = notes
71 | )
72 | viewModelScope.launch(Dispatchers.IO) {
73 | // TODO: call the DAO method to update a forageable to the database here
74 | }
75 | }
76 |
77 | fun deleteForageable(forageable: Forageable) {
78 | viewModelScope.launch(Dispatchers.IO) {
79 | // TODO: call the DAO method to delete a forageable to the database here
80 | }
81 | }
82 |
83 | fun isValidEntry(name: String, address: String): Boolean {
84 | return name.isNotBlank() && address.isNotBlank()
85 | }
86 | }
87 |
88 | // TODO: create a view model factory that takes a ForageableDao as a property and
89 | // creates a ForageableViewModel
90 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/forage/ui/ForageableListFragment.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 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 | package com.example.forage.ui
17 |
18 | import android.os.Bundle
19 | import android.view.LayoutInflater
20 | import android.view.View
21 | import android.view.ViewGroup
22 | import androidx.fragment.app.Fragment
23 | import androidx.fragment.app.activityViewModels
24 | import androidx.navigation.fragment.findNavController
25 | import com.example.forage.R
26 | import com.example.forage.databinding.FragmentForageableListBinding
27 | import com.example.forage.ui.adapter.ForageableListAdapter
28 | import com.example.forage.ui.viewmodel.ForageableViewModel
29 |
30 | /**
31 | * A fragment to view the list of [Forageable]s stored in the database.
32 | * Clicking on a [Forageable] list item launches the [ForageableDetailFragment].
33 | * Clicking the [FloatingActionButton] launched the [AddForageableFragment]
34 | */
35 | class ForageableListFragment : Fragment() {
36 |
37 | // TODO: Refactor the creation of the view model to take an instance of
38 | // ForageableViewModelFactory. The factory should take an instance of the Database retrieved
39 | // from BaseApplication
40 | private val viewModel: ForageableViewModel by activityViewModels()
41 |
42 | private var _binding: FragmentForageableListBinding? = null
43 |
44 | // This property is only valid between onCreateView and
45 | // onDestroyView.
46 | private val binding get() = _binding!!
47 |
48 | override fun onCreateView(
49 | inflater: LayoutInflater, container: ViewGroup?,
50 | savedInstanceState: Bundle?
51 | ): View? {
52 |
53 | _binding = FragmentForageableListBinding.inflate(inflater, container, false)
54 | return binding.root
55 | }
56 |
57 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
58 | super.onViewCreated(view, savedInstanceState)
59 |
60 | val adapter = ForageableListAdapter { forageable ->
61 | val action = ForageableListFragmentDirections
62 | .actionForageableListFragmentToForageableDetailFragment(forageable.id)
63 | findNavController().navigate(action)
64 | }
65 |
66 | // TODO: observe the list of forageables from the view model and submit it the adapter
67 |
68 | binding.apply {
69 | recyclerView.adapter = adapter
70 | addForageableFab.setOnClickListener {
71 | findNavController().navigate(
72 | R.id.action_forageableListFragment_to_addForageableFragment
73 | )
74 | }
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 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 | plugins {
17 | id 'com.android.application'
18 | id 'kotlin-android'
19 | id 'kotlin-kapt'
20 | id 'androidx.navigation.safeargs.kotlin'
21 | }
22 |
23 | android {
24 | compileSdkVersion 30
25 | buildToolsVersion "30.0.3"
26 |
27 | defaultConfig {
28 | applicationId "com.example.forage"
29 | minSdkVersion 21
30 | targetSdkVersion 30
31 | versionCode 1
32 | versionName "1.0"
33 |
34 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
35 | testInstrumentationRunnerArguments clearPackageData: 'true'
36 | }
37 |
38 | buildTypes {
39 | release {
40 | minifyEnabled false
41 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
42 | }
43 | }
44 | compileOptions {
45 | sourceCompatibility JavaVersion.VERSION_1_8
46 | targetCompatibility JavaVersion.VERSION_1_8
47 | }
48 | kotlinOptions {
49 | jvmTarget = '1.8'
50 | }
51 | testOptions {
52 | execution 'ANDROIDX_TEST_ORCHESTRATOR'
53 | }
54 | buildFeatures {
55 | dataBinding true
56 | viewBinding true
57 | }
58 | }
59 |
60 | dependencies {
61 |
62 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
63 | implementation 'androidx.core:core-ktx:1.6.0'
64 | implementation 'androidx.appcompat:appcompat:1.3.1'
65 | implementation 'com.google.android.material:material:1.4.0'
66 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
67 | implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
68 | implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
69 |
70 | // Lifecycle
71 | implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
72 | implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
73 |
74 | // Navigation
75 | implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
76 | implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
77 |
78 | // Room
79 | implementation "androidx.room:room-runtime:$room_version"
80 | implementation 'androidx.legacy:legacy-support-v4:1.0.0'
81 | kapt "androidx.room:room-compiler:$room_version"
82 | implementation "androidx.room:room-ktx:$room_version"
83 |
84 | testImplementation 'junit:junit:4.+'
85 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
86 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
87 | androidTestImplementation "androidx.test:core-ktx:1.3.0"
88 | androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
89 | androidTestImplementation 'androidx.test:runner:1.4.0'
90 | androidTestUtil 'androidx.test:orchestrator:1.4.0'
91 | debugImplementation "androidx.fragment:fragment-testing:1.3.3"
92 | }
93 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/example/forage/PersistenceInstrumentationTests.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 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 | package com.example.forage
17 |
18 | import androidx.test.core.app.launchActivity
19 | import androidx.test.espresso.Espresso.onView
20 | import androidx.test.espresso.action.ViewActions.click
21 | import androidx.test.espresso.action.ViewActions.replaceText
22 | import androidx.test.espresso.assertion.ViewAssertions.doesNotExist
23 | import androidx.test.espresso.assertion.ViewAssertions.matches
24 | import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
25 | import androidx.test.espresso.matcher.ViewMatchers.withId
26 | import androidx.test.espresso.matcher.ViewMatchers.withText
27 | import androidx.test.ext.junit.runners.AndroidJUnit4
28 | import org.junit.Before
29 | import org.junit.Test
30 | import org.junit.runner.RunWith
31 |
32 | /**
33 | * Test the UI features that involved persisted data.
34 | */
35 | @RunWith(AndroidJUnit4::class)
36 | class PersistenceInstrumentationTests {
37 |
38 | @Before
39 | fun setup() {
40 | launchActivity()
41 | onView(withId(R.id.add_forageable_fab)).perform(click())
42 |
43 | onView(withId(R.id.name_input)).perform(replaceText("Name"))
44 | onView(withId(R.id.location_address_input)).perform(replaceText("Address"))
45 | onView(withId(R.id.notes_input)).perform(replaceText("Notes"))
46 | onView(withId(R.id.save_btn)).perform(click())
47 | }
48 |
49 | @Test
50 | fun new_forageable_is_displayed_in_list() {
51 | onView(withText("Name")).check(matches(isDisplayed()))
52 | onView(withText("Address")).check(matches(isDisplayed()))
53 | }
54 |
55 | @Test
56 | fun new_forageable_is_displayed_in_detail() {
57 | onView(withText("Name")).perform(click())
58 | onView(withText("Name")).check(matches(isDisplayed()))
59 | onView(withText("Address")).check(matches(isDisplayed()))
60 | onView(withText(("Currently out of season"))).check(matches(isDisplayed()))
61 | onView(withText("Notes")).check(matches(isDisplayed()))
62 | }
63 |
64 | @Test
65 | fun edit_new_forageable() {
66 | onView(withText("Name")).perform(click())
67 | onView(withId(R.id.edit_forageable_fab)).perform(click())
68 | onView(withId(R.id.name_input)).perform(replaceText("New Name"))
69 | onView(withId(R.id.location_address_input)).perform(replaceText("New Address"))
70 | onView(withId(R.id.notes_input)).perform(replaceText("New Notes"))
71 | onView(withId(R.id.in_season_checkbox)).perform(click())
72 | onView(withId(R.id.save_btn)).perform(click())
73 | Thread.sleep(1000)
74 | onView(withText("New Name")).perform(click())
75 | Thread.sleep(2000)
76 | onView(withText("New Name")).check(matches(isDisplayed()))
77 | onView(withText("New Address")).check(matches(isDisplayed()))
78 | onView(withText(("Currently in season"))).check(matches(isDisplayed()))
79 | onView(withText("New Notes")).check(matches(isDisplayed()))
80 | }
81 |
82 | @Test
83 | fun delete_new_forageable() {
84 | onView(withText("Name")).perform(click())
85 | onView(withId(R.id.edit_forageable_fab)).perform(click())
86 | onView(withId(R.id.delete_btn)).perform(click())
87 | Thread.sleep(1000)
88 | onView(withText("Name")).check(doesNotExist())
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/forage/ui/ForageableDetailFragment.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 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 | package com.example.forage.ui
17 |
18 | import android.content.Intent
19 | import android.net.Uri
20 | import android.os.Bundle
21 | import android.view.LayoutInflater
22 | import android.view.View
23 | import android.view.ViewGroup
24 | import androidx.fragment.app.Fragment
25 | import androidx.fragment.app.activityViewModels
26 | import androidx.navigation.fragment.findNavController
27 | import androidx.navigation.fragment.navArgs
28 | import com.example.forage.R
29 | import com.example.forage.databinding.FragmentForageableDetailBinding
30 | import com.example.forage.model.Forageable
31 | import com.example.forage.ui.viewmodel.ForageableViewModel
32 |
33 | /**
34 | * A fragment to display the details of a [Forageable] currently stored in the database.
35 | * The [AddForageableFragment] can be launched from this fragment to edit the [Forageable]
36 | */
37 | class ForageableDetailFragment : Fragment() {
38 |
39 | private val navigationArgs: ForageableDetailFragmentArgs by navArgs()
40 |
41 | // TODO: Refactor the creation of the view model to take an instance of
42 | // ForageableViewModelFactory. The factory should take an instance of the Database retrieved
43 | // from BaseApplication
44 | private val viewModel: ForageableViewModel by activityViewModels()
45 |
46 | private lateinit var forageable: Forageable
47 |
48 | private var _binding: FragmentForageableDetailBinding? = null
49 | private val binding get() = _binding!!
50 |
51 | override fun onCreateView(
52 | inflater: LayoutInflater, container: ViewGroup?,
53 | savedInstanceState: Bundle?
54 | ): View? {
55 | _binding = FragmentForageableDetailBinding.inflate(inflater, container, false)
56 | // Inflate the layout for this fragment
57 | return binding.root
58 | }
59 |
60 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
61 | super.onViewCreated(view, savedInstanceState)
62 | val id = navigationArgs.id
63 | // TODO: Observe a forageable that is retrieved by id, set the forageable variable,
64 | // and call the bind forageable method
65 | }
66 |
67 | private fun bindForageable() {
68 | binding.apply {
69 | name.text = forageable.name
70 | location.text = forageable.address
71 | notes.text = forageable.notes
72 | if (forageable.inSeason) {
73 | season.text = getString(R.string.in_season)
74 | } else {
75 | season.text = getString(R.string.out_of_season)
76 | }
77 | editForageableFab.setOnClickListener {
78 | val action = ForageableDetailFragmentDirections
79 | .actionForageableDetailFragmentToAddForageableFragment(forageable.id)
80 | findNavController().navigate(action)
81 | }
82 |
83 | location.setOnClickListener {
84 | launchMap()
85 | }
86 | }
87 | }
88 |
89 | private fun launchMap() {
90 | val address = forageable.address.let {
91 | it.replace(", ", ",")
92 | it.replace(". ", " ")
93 | it.replace(" ", "+")
94 | }
95 | val gmmIntentUri = Uri.parse("geo:0,0?q=$address")
96 | val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
97 | mapIntent.setPackage("com.google.android.apps.maps")
98 | startActivity(mapIntent)
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/code-of-conduct.md:
--------------------------------------------------------------------------------
1 | # Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, gender identity and expression, level of
9 | experience, education, socio-economic status, nationality, personal appearance,
10 | race, religion, or sexual identity and orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | * Using welcoming and inclusive language
18 | * Being respectful of differing viewpoints and experiences
19 | * Gracefully accepting constructive criticism
20 | * Focusing on what is best for the community
21 | * Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | * The use of sexualized language or imagery and unwelcome sexual attention or
26 | advances
27 | * Trolling, insulting/derogatory comments, and personal or political attacks
28 | * Public or private harassment
29 | * Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | * Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or reject
41 | comments, commits, code, wiki edits, issues, and other contributions that are
42 | not aligned to this Code of Conduct, or to ban temporarily or permanently any
43 | contributor for other behaviors that they deem inappropriate, threatening,
44 | offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies both within project spaces and in public spaces
49 | when an individual is representing the project or its community. Examples of
50 | representing a project or community include using an official project e-mail
51 | address, posting via an official social media account, or acting as an appointed
52 | representative at an online or offline event. Representation of a project may be
53 | further defined and clarified by project maintainers.
54 |
55 | This Code of Conduct also applies outside the project spaces when the Project
56 | Steward has a reasonable belief that an individual's behavior may have a
57 | negative impact on the project or its community.
58 |
59 | ## Conflict Resolution
60 |
61 | We do not believe that all conflict is bad; healthy debate and disagreement
62 | often yield positive results. However, it is never okay to be disrespectful or
63 | to engage in behavior that violates the project’s code of conduct.
64 |
65 | If you see someone violating the code of conduct, you are encouraged to address
66 | the behavior directly with those involved. Many issues can be resolved quickly
67 | and easily, and this gives people more control over the outcome of their
68 | dispute. If you are unable to resolve the matter for any reason, or if the
69 | behavior is threatening or harassing, report it. We are dedicated to providing
70 | an environment where participants feel welcome and safe.
71 |
72 | Reports should be directed to *[PROJECT STEWARD NAME(s) AND EMAIL(s)]*, the
73 | Project Steward(s) for *[PROJECT NAME]*. It is the Project Steward’s duty to
74 | receive and address reported violations of the code of conduct. They will then
75 | work with a committee consisting of representatives from the Open Source
76 | Programs Office and the Google Open Source Strategy team. If for any reason you
77 | are uncomfortable reaching out to the Project Steward, please email
78 | opensource@google.com.
79 |
80 | We will investigate every complaint, but you may not receive a direct response.
81 | We will use our discretion in determining when and how to follow up on reported
82 | incidents, which may range from not taking action to permanent expulsion from
83 | the project and project-sponsored spaces. We will notify the accused of the
84 | report and provide them an opportunity to discuss it before any action is taken.
85 | The identity of the reporter will be omitted from the details of the report
86 | supplied to the accused. In potentially harmful situations, such as ongoing
87 | harassment or threats to anyone's safety, we may take action without notice.
88 |
89 | ## Attribution
90 |
91 | This Code of Conduct is adapted from the Contributor Covenant, version 1.4,
92 | available at
93 | https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
94 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_add_forageable.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
26 |
27 |
34 |
40 |
41 |
42 |
43 |
51 |
52 |
57 |
58 |
59 |
60 |
68 |
69 |
77 |
78 |
84 |
85 |
86 |
87 |
96 |
97 |
103 |
104 |
111 |
112 |
113 |
114 |
115 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/forage/ui/AddForageableFragment.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 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 | package com.example.forage.ui
17 |
18 | import android.os.Bundle
19 | import android.view.LayoutInflater
20 | import android.view.View
21 | import android.view.ViewGroup
22 | import android.widget.TextView
23 | import androidx.fragment.app.Fragment
24 | import androidx.fragment.app.activityViewModels
25 | import androidx.navigation.fragment.findNavController
26 | import androidx.navigation.fragment.navArgs
27 | import com.example.forage.R
28 | import com.example.forage.databinding.FragmentAddForageableBinding
29 | import com.example.forage.model.Forageable
30 | import com.example.forage.ui.viewmodel.ForageableViewModel
31 |
32 |
33 | /**
34 | * A fragment to enter data for a new [Forageable] or edit data for an existing [Forageable].
35 | * [Forageable]s can be saved or deleted from this fragment.
36 | */
37 | class AddForageableFragment : Fragment() {
38 |
39 | private val navigationArgs: AddForageableFragmentArgs by navArgs()
40 |
41 | private var _binding: FragmentAddForageableBinding? = null
42 |
43 | private lateinit var forageable: Forageable
44 |
45 | // This property is only valid between onCreateView and
46 | // onDestroyView.
47 | private val binding get() = _binding!!
48 |
49 | // TODO: Refactor the creation of the view model to take an instance of
50 | // ForageableViewModelFactory. The factory should take an instance of the Database retrieved
51 | // from BaseApplication
52 | private val viewModel: ForageableViewModel by activityViewModels()
53 |
54 | override fun onCreateView(
55 | inflater: LayoutInflater, container: ViewGroup?,
56 | savedInstanceState: Bundle?
57 | ): View? {
58 |
59 | _binding = FragmentAddForageableBinding.inflate(inflater, container, false)
60 | return binding.root
61 |
62 | }
63 |
64 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
65 | super.onViewCreated(view, savedInstanceState)
66 | val id = navigationArgs.id
67 | if (id > 0) {
68 |
69 | // TODO: Observe a Forageable that is retrieved by id, set the forageable variable,
70 | // and call the bindForageable method
71 |
72 | binding.deleteBtn.visibility = View.VISIBLE
73 | binding.deleteBtn.setOnClickListener {
74 | deleteForageable(forageable)
75 | }
76 | } else {
77 | binding.saveBtn.setOnClickListener {
78 | addForageable()
79 | }
80 | }
81 | }
82 |
83 | private fun deleteForageable(forageable: Forageable) {
84 | viewModel.deleteForageable(forageable)
85 | findNavController().navigate(
86 | R.id.action_addForageableFragment_to_forageableListFragment
87 | )
88 | }
89 |
90 | private fun addForageable() {
91 | if (isValidEntry()) {
92 | viewModel.addForageable(
93 | binding.nameInput.text.toString(),
94 | binding.locationAddressInput.text.toString(),
95 | binding.inSeasonCheckbox.isChecked,
96 | binding.notesInput.text.toString()
97 | )
98 | findNavController().navigate(
99 | R.id.action_addForageableFragment_to_forageableListFragment
100 | )
101 | }
102 | }
103 |
104 | private fun updateForageable() {
105 | if (isValidEntry()) {
106 | viewModel.updateForageable(
107 | id = navigationArgs.id,
108 | name = binding.nameInput.text.toString(),
109 | address = binding.locationAddressInput.text.toString(),
110 | inSeason = binding.inSeasonCheckbox.isChecked,
111 | notes = binding.notesInput.text.toString()
112 | )
113 | findNavController().navigate(
114 | R.id.action_addForageableFragment_to_forageableListFragment
115 | )
116 | }
117 | }
118 |
119 | private fun bindForageable(forageable: Forageable) {
120 | binding.apply{
121 | nameInput.setText(forageable.name, TextView.BufferType.SPANNABLE)
122 | locationAddressInput.setText(forageable.address, TextView.BufferType.SPANNABLE)
123 | inSeasonCheckbox.isChecked = forageable.inSeason
124 | notesInput.setText(forageable.notes, TextView.BufferType.SPANNABLE)
125 | saveBtn.setOnClickListener {
126 | updateForageable()
127 | }
128 | }
129 |
130 | }
131 |
132 | private fun isValidEntry() = viewModel.isValidEntry(
133 | binding.nameInput.text.toString(),
134 | binding.locationAddressInput.text.toString()
135 | )
136 |
137 | override fun onDestroyView() {
138 | super.onDestroyView()
139 | _binding = null
140 | }
141 | }
142 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_forageable_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
24 |
25 |
34 |
35 |
43 |
44 |
54 |
55 |
63 |
64 |
72 |
73 |
83 |
84 |
92 |
93 |
101 |
102 |
116 |
117 |
126 |
127 |
128 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
9 |
12 |
15 |
18 |
21 |
24 |
27 |
30 |
33 |
36 |
39 |
42 |
45 |
48 |
51 |
54 |
57 |
60 |
63 |
66 |
69 |
72 |
75 |
78 |
81 |
84 |
87 |
90 |
93 |
96 |
99 |
102 |
105 |
108 |
111 |
114 |
117 |
120 |
123 |
126 |
129 |
132 |
135 |
138 |
141 |
144 |
147 |
150 |
153 |
156 |
159 |
162 |
165 |
168 |
171 |
174 |
177 |
180 |
183 |
186 |
189 |
192 |
195 |
198 |
201 |
204 |
207 |
210 |
213 |
216 |
219 |
222 |
225 |
228 |
231 |
234 |
237 |
240 |
243 |
246 |
249 |
252 |
255 |
258 |
261 |
264 |
267 |
270 |
273 |
276 |
279 |
282 |
285 |
288 |
291 |
294 |
297 |
300 |
303 |
306 |
307 |
308 |
--------------------------------------------------------------------------------