├── .github ├── ISSUE_TEMPLATE │ ├── material-theming-issue-template.md │ ├── simple-animations-issue-template.md │ └── testing-for-accessibility-issue-template.md ├── renovate.json └── workflows │ └── main.yml ├── .gitignore ├── ASSETS_LICENSE.txt ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle.kts ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── ic_launcher-playstore.png │ ├── java │ └── com │ │ └── example │ │ └── woof │ │ ├── MainActivity.kt │ │ ├── data │ │ └── Dog.kt │ │ └── ui │ │ └── theme │ │ ├── Color.kt │ │ ├── Shape.kt │ │ ├── Theme.kt │ │ └── Type.kt │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ ├── bella.jpg │ ├── faye.jpg │ ├── frankie.jpg │ ├── ic_launcher_background.xml │ ├── ic_launcher_foreground.xml │ ├── ic_woof_logo.xml │ ├── koda.jpg │ ├── leroy.jpg │ ├── lola.jpg │ ├── moana.jpg │ ├── nox.jpg │ └── tzeitel.jpg │ ├── font │ ├── abril_fatface_regular.ttf │ ├── montserrat_bold.ttf │ └── montserrat_regular.ttf │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.webp │ └── ic_launcher_round.webp │ ├── mipmap-mdpi │ ├── ic_launcher.webp │ └── ic_launcher_round.webp │ ├── mipmap-xhdpi │ ├── ic_launcher.webp │ └── ic_launcher_round.webp │ ├── mipmap-xxhdpi │ ├── ic_launcher.webp │ └── ic_launcher_round.webp │ ├── mipmap-xxxhdpi │ ├── ic_launcher.webp │ └── ic_launcher_round.webp │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── themes.xml ├── build.gradle.kts ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle.kts /.github/ISSUE_TEMPLATE/material-theming-issue-template.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Material theming issue template 3 | about: Issue template for Material Theming with Jetpack Compose codelab 4 | title: Material Theming with Jetpack Compose 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 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/simple-animations-issue-template.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Simple Animations issue template 3 | about: 'Issue template for Simple Animation with Jetpack Compose ' 4 | title: 'Simple Animation with Jetpack Compose ' 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 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/testing-for-accessibility-issue-template.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Testing for Accessibility issue template 3 | about: Issue template for Testing for Accessibility codelab 4 | title: Testing for Accessibility 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 | -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "local>android/.github:renovate-config" 5 | ], 6 | 7 | "baseBranches": [ 8 | "main", 9 | "starter" 10 | ] 11 | 12 | } 13 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | - starter 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | 15 | - name: Set Up JDK 16 | uses: actions/setup-java@v4 17 | with: 18 | distribution: 'zulu' # See 'Supported distributions' for available options 19 | java-version: '17' 20 | cache: 'gradle' 21 | 22 | - name: Setup Gradle 23 | uses: gradle/actions/setup-gradle@v4 24 | 25 | - name: Setup Android SDK 26 | uses: android-actions/setup-android@v3 27 | 28 | - name: Build project and run local and device tests 29 | run: ./gradlew :app:assembleDebug 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Mac files 6 | .DS_Store 7 | 8 | # files for the dex VM 9 | *.dex 10 | 11 | # Java class files 12 | *.class 13 | 14 | # generated files 15 | bin/ 16 | gen/ 17 | 18 | # Ignore gradle files 19 | .gradle/ 20 | build/ 21 | 22 | # Local configuration file (sdk path, etc) 23 | local.properties 24 | 25 | # Proguard folder generated by Eclipse 26 | proguard/ 27 | proguard-project.txt 28 | 29 | # Eclipse files 30 | .project 31 | .classpath 32 | .settings/ 33 | 34 | # Android Studio/IDEA 35 | *.iml 36 | .idea 37 | -------------------------------------------------------------------------------- /ASSETS_LICENSE.txt: -------------------------------------------------------------------------------- 1 | All font files are licensed under the SIL OPEN FONT LICENSE license. All other files are licensed under the Apache 2 license. 2 | 3 | ----------------------------------------------------------- 4 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 5 | ----------------------------------------------------------- 6 | 7 | PREAMBLE 8 | The goals of the Open Font License (OFL) are to stimulate worldwide 9 | development of collaborative font projects, to support the font creation 10 | efforts of academic and linguistic communities, and to provide a free and 11 | open framework in which fonts may be shared and improved in partnership 12 | with others. 13 | 14 | The OFL allows the licensed fonts to be used, studied, modified and 15 | redistributed freely as long as they are not sold by themselves. The 16 | fonts, including any derivative works, can be bundled, embedded, 17 | redistributed and/or sold with any software provided that any reserved 18 | names are not used by derivative works. The fonts and derivatives, 19 | however, cannot be released under any other type of license. The 20 | requirement for fonts to remain under this license does not apply 21 | to any document created using the fonts or their derivatives. 22 | 23 | DEFINITIONS 24 | "Font Software" refers to the set of files released by the Copyright 25 | Holder(s) under this license and clearly marked as such. This may 26 | include source files, build scripts and documentation. 27 | 28 | "Reserved Font Name" refers to any names specified as such after the 29 | copyright statement(s). 30 | 31 | "Original Version" refers to the collection of Font Software components as 32 | distributed by the Copyright Holder(s). 33 | 34 | "Modified Version" refers to any derivative made by adding to, deleting, 35 | or substituting -- in part or in whole -- any of the components of the 36 | Original Version, by changing formats or by porting the Font Software to a 37 | new environment. 38 | 39 | "Author" refers to any designer, engineer, programmer, technical 40 | writer or other person who contributed to the Font Software. 41 | 42 | PERMISSION & CONDITIONS 43 | Permission is hereby granted, free of charge, to any person obtaining 44 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 45 | redistribute, and sell modified and unmodified copies of the Font 46 | Software, subject to the following conditions: 47 | 48 | 1) Neither the Font Software nor any of its individual components, 49 | in Original or Modified Versions, may be sold by itself. 50 | 51 | 2) Original or Modified Versions of the Font Software may be bundled, 52 | redistributed and/or sold with any software, provided that each copy 53 | contains the above copyright notice and this license. These can be 54 | included either as stand-alone text files, human-readable headers or 55 | in the appropriate machine-readable metadata fields within text or 56 | binary files as long as those fields can be easily viewed by the user. 57 | 58 | 3) No Modified Version of the Font Software may use the Reserved Font 59 | Name(s) unless explicit written permission is granted by the corresponding 60 | Copyright Holder. This restriction only applies to the primary font name as 61 | presented to the users. 62 | 63 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 64 | Software shall not be used to promote, endorse or advertise any 65 | Modified Version, except to acknowledge the contribution(s) of the 66 | Copyright Holder(s) and the Author(s) or with their explicit written 67 | permission. 68 | 69 | 5) The Font Software, modified or unmodified, in part or in whole, 70 | must be distributed entirely under this license, and must not be 71 | distributed under any other license. The requirement for fonts to 72 | remain under this license does not apply to any document created 73 | using the Font Software. 74 | 75 | TERMINATION 76 | This license becomes null and void if any of the above conditions are 77 | not met. 78 | 79 | DISCLAIMER 80 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 81 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 82 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 83 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 84 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 85 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 86 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 87 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 88 | OTHER DEALINGS IN THE FONT SOFTWARE. -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Woof App 2 | ================================== 3 | 4 | The Woof app is a list of dog photos with information about them including their name, age, and favorite activity. This app also uses Material Design to create a beautiful app experience for the user. 5 | 6 | Introduction 7 | ------------ 8 | 9 | This is the solution code for the Woof app project. This project is an opportunity for you to learn Material3 and reinforce the concepts you've learned so far in Android Basics with Compose. 10 | 11 | Pre-requisites 12 | -------------- 13 | 14 | - Rows/Columns 15 | - Modifiers 16 | - Scaffold 17 | - Adding images 18 | - Button click handlers 19 | - Functions 20 | - Classes 21 | - Lists 22 | - App architecture 23 | 24 | Getting Started 25 | --------------- 26 | 27 | 1. Download the project 28 | 2. Open the project in Android Studio 29 | 3. Run the project 30 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 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 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | plugins { 18 | id("com.android.application") 19 | id("org.jetbrains.kotlin.android") 20 | id("org.jetbrains.kotlin.plugin.compose") 21 | } 22 | 23 | android { 24 | namespace = "com.example.woof" 25 | compileSdk = 35 26 | 27 | defaultConfig { 28 | applicationId = "com.example.woof" 29 | minSdk = 24 30 | targetSdk = 35 31 | versionCode = 1 32 | versionName = "1.0" 33 | 34 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" 35 | vectorDrawables { 36 | useSupportLibrary = true 37 | } 38 | } 39 | 40 | buildTypes { 41 | release { 42 | isMinifyEnabled = false 43 | proguardFiles( 44 | getDefaultProguardFile("proguard-android-optimize.txt"), 45 | "proguard-rules.pro" 46 | ) 47 | } 48 | } 49 | compileOptions { 50 | sourceCompatibility = JavaVersion.VERSION_1_8 51 | targetCompatibility = JavaVersion.VERSION_1_8 52 | } 53 | kotlinOptions { 54 | jvmTarget = "1.8" 55 | freeCompilerArgs += "-opt-in=androidx.compose.material3.ExperimentalMaterial3Api" 56 | } 57 | buildFeatures { 58 | compose = true 59 | } 60 | packaging { 61 | resources { 62 | excludes += "/META-INF/{AL2.0,LGPL2.1}" 63 | } 64 | } 65 | } 66 | 67 | dependencies { 68 | 69 | implementation(platform("androidx.compose:compose-bom:2024.11.00")) 70 | implementation("androidx.activity:activity-compose:1.9.3") 71 | implementation("androidx.compose.material:material-icons-extended") 72 | implementation("androidx.compose.material3:material3") 73 | implementation("androidx.compose.ui:ui") 74 | implementation("androidx.compose.ui:ui-graphics") 75 | implementation("androidx.compose.ui:ui-tooling-preview") 76 | implementation("androidx.core:core-ktx:1.15.0") 77 | implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.7") 78 | 79 | debugImplementation("androidx.compose.ui:ui-test-manifest") 80 | debugImplementation("androidx.compose.ui:ui-tooling") 81 | } 82 | -------------------------------------------------------------------------------- /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/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 28 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/ic_launcher-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/ic_launcher-playstore.png -------------------------------------------------------------------------------- /app/src/main/java/com/example/woof/MainActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 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 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.example.woof 18 | 19 | import android.os.Bundle 20 | import androidx.activity.ComponentActivity 21 | import androidx.activity.compose.setContent 22 | import androidx.annotation.DrawableRes 23 | import androidx.annotation.StringRes 24 | import androidx.compose.animation.animateContentSize 25 | import androidx.compose.animation.core.Spring 26 | import androidx.compose.animation.core.spring 27 | import androidx.compose.foundation.Image 28 | import androidx.compose.foundation.layout.Column 29 | import androidx.compose.foundation.layout.Row 30 | import androidx.compose.foundation.layout.Spacer 31 | import androidx.compose.foundation.layout.fillMaxSize 32 | import androidx.compose.foundation.layout.fillMaxWidth 33 | import androidx.compose.foundation.layout.padding 34 | import androidx.compose.foundation.layout.size 35 | import androidx.compose.foundation.lazy.LazyColumn 36 | import androidx.compose.foundation.lazy.items 37 | import androidx.compose.material.icons.Icons 38 | import androidx.compose.material.icons.filled.ExpandLess 39 | import androidx.compose.material.icons.filled.ExpandMore 40 | import androidx.compose.material3.Card 41 | import androidx.compose.material3.CenterAlignedTopAppBar 42 | import androidx.compose.material3.Icon 43 | import androidx.compose.material3.IconButton 44 | import androidx.compose.material3.MaterialTheme 45 | import androidx.compose.material3.Scaffold 46 | import androidx.compose.material3.Surface 47 | import androidx.compose.material3.Text 48 | import androidx.compose.runtime.Composable 49 | import androidx.compose.runtime.getValue 50 | import androidx.compose.runtime.mutableStateOf 51 | import androidx.compose.runtime.remember 52 | import androidx.compose.runtime.setValue 53 | import androidx.compose.ui.Alignment 54 | import androidx.compose.ui.Modifier 55 | import androidx.compose.ui.draw.clip 56 | import androidx.compose.ui.layout.ContentScale 57 | import androidx.compose.ui.res.dimensionResource 58 | import androidx.compose.ui.res.painterResource 59 | import androidx.compose.ui.res.stringResource 60 | import androidx.compose.ui.tooling.preview.Preview 61 | import com.example.woof.data.Dog 62 | import com.example.woof.data.dogs 63 | import com.example.woof.ui.theme.WoofTheme 64 | 65 | class MainActivity : ComponentActivity() { 66 | override fun onCreate(savedInstanceState: Bundle?) { 67 | super.onCreate(savedInstanceState) 68 | setContent { 69 | WoofTheme { 70 | // A surface container using the 'background' color from the theme 71 | Surface( 72 | modifier = Modifier.fillMaxSize() 73 | ) { 74 | WoofApp() 75 | } 76 | } 77 | } 78 | } 79 | } 80 | 81 | /** 82 | * Composable that displays an app bar and a list of dogs. 83 | */ 84 | @Composable 85 | fun WoofApp() { 86 | Scaffold( 87 | topBar = { 88 | WoofTopAppBar() 89 | } 90 | ) { it -> 91 | LazyColumn(contentPadding = it) { 92 | items(dogs) { 93 | DogItem( 94 | dog = it, 95 | modifier = Modifier.padding(dimensionResource(R.dimen.padding_small)) 96 | ) 97 | } 98 | } 99 | } 100 | } 101 | 102 | /** 103 | * Composable that displays a list item containing a dog icon and their information. 104 | * 105 | * @param dog contains the data that populates the list item 106 | * @param modifier modifiers to set to this composable 107 | */ 108 | @Composable 109 | fun DogItem( 110 | dog: Dog, 111 | modifier: Modifier = Modifier 112 | ) { 113 | var expanded by remember { mutableStateOf(false) } 114 | Card( 115 | modifier = modifier 116 | ) { 117 | Column( 118 | modifier = Modifier 119 | .animateContentSize( 120 | animationSpec = spring( 121 | dampingRatio = Spring.DampingRatioNoBouncy, 122 | stiffness = Spring.StiffnessMedium 123 | ) 124 | ) 125 | ) { 126 | Row( 127 | modifier = Modifier 128 | .fillMaxWidth() 129 | .padding(dimensionResource(R.dimen.padding_small)) 130 | ) { 131 | DogIcon(dog.imageResourceId) 132 | DogInformation(dog.name, dog.age) 133 | Spacer(Modifier.weight(1f)) 134 | DogItemButton( 135 | expanded = expanded, 136 | onClick = { expanded = !expanded }, 137 | ) 138 | } 139 | if (expanded) { 140 | DogHobby( 141 | dog.hobbies, modifier = Modifier.padding( 142 | start = dimensionResource(R.dimen.padding_medium), 143 | top = dimensionResource(R.dimen.padding_small), 144 | bottom = dimensionResource(R.dimen.padding_medium), 145 | end = dimensionResource(R.dimen.padding_medium) 146 | ) 147 | ) 148 | } 149 | } 150 | } 151 | } 152 | 153 | /** 154 | * Composable that displays a button that is clickable and displays an expand more or an expand less 155 | * icon. 156 | * 157 | * @param expanded represents whether the expand more or expand less icon is visible 158 | * @param onClick is the action that happens when the button is clicked 159 | * @param modifier modifiers to set to this composable 160 | */ 161 | @Composable 162 | private fun DogItemButton( 163 | expanded: Boolean, 164 | onClick: () -> Unit, 165 | modifier: Modifier = Modifier 166 | ) { 167 | IconButton( 168 | onClick = onClick, 169 | modifier = modifier 170 | ) { 171 | Icon( 172 | imageVector = if (expanded) Icons.Filled.ExpandLess else Icons.Filled.ExpandMore, 173 | contentDescription = stringResource(R.string.expand_button_content_description), 174 | tint = MaterialTheme.colorScheme.secondary 175 | ) 176 | } 177 | } 178 | 179 | /** 180 | * Composable that displays a Top Bar with an icon and text. 181 | * 182 | * @param modifier modifiers to set to this composable 183 | */ 184 | @Composable 185 | fun WoofTopAppBar(modifier: Modifier = Modifier) { 186 | CenterAlignedTopAppBar( 187 | title = { 188 | Row( 189 | verticalAlignment = Alignment.CenterVertically 190 | ) { 191 | Image( 192 | modifier = Modifier 193 | .size(dimensionResource(R.dimen.image_size)) 194 | .padding(dimensionResource(R.dimen.padding_small)), 195 | painter = painterResource(R.drawable.ic_woof_logo), 196 | 197 | // Content Description is not needed here - image is decorative, and setting a 198 | // null content description allows accessibility services to skip this element 199 | // during navigation. 200 | 201 | contentDescription = null 202 | ) 203 | Text( 204 | text = stringResource(R.string.app_name), 205 | style = MaterialTheme.typography.displayLarge 206 | ) 207 | } 208 | }, 209 | modifier = modifier 210 | ) 211 | } 212 | 213 | /** 214 | * Composable that displays a photo of a dog. 215 | * 216 | * @param dogIcon is the resource ID for the image of the dog 217 | * @param modifier modifiers to set to this composable 218 | */ 219 | @Composable 220 | fun DogIcon( 221 | @DrawableRes dogIcon: Int, 222 | modifier: Modifier = Modifier 223 | ) { 224 | Image( 225 | modifier = modifier 226 | .size(dimensionResource(R.dimen.image_size)) 227 | .padding(dimensionResource(R.dimen.padding_small)) 228 | .clip(MaterialTheme.shapes.small), 229 | contentScale = ContentScale.Crop, 230 | painter = painterResource(dogIcon), 231 | 232 | // Content Description is not needed here - image is decorative, and setting a null content 233 | // description allows accessibility services to skip this element during navigation. 234 | 235 | contentDescription = null 236 | ) 237 | } 238 | 239 | /** 240 | * Composable that displays a dog's name and age. 241 | * 242 | * @param dogName is the resource ID for the string of the dog's name 243 | * @param dogAge is the Int that represents the dog's age 244 | * @param modifier modifiers to set to this composable 245 | */ 246 | @Composable 247 | fun DogInformation( 248 | @StringRes dogName: Int, 249 | dogAge: Int, 250 | modifier: Modifier = Modifier 251 | ) { 252 | Column(modifier = modifier) { 253 | Text( 254 | text = stringResource(dogName), 255 | style = MaterialTheme.typography.displayMedium, 256 | modifier = Modifier.padding(top = dimensionResource(R.dimen.padding_small)) 257 | ) 258 | Text( 259 | text = stringResource(R.string.years_old, dogAge), 260 | style = MaterialTheme.typography.bodyLarge 261 | ) 262 | } 263 | } 264 | 265 | /** 266 | * Composable that displays a dog's hobbies. 267 | * 268 | * @param dogHobby is the resource ID for the text string of the hobby to display 269 | * @param modifier modifiers to set to this composable 270 | */ 271 | @Composable 272 | fun DogHobby( 273 | @StringRes dogHobby: Int, 274 | modifier: Modifier = Modifier 275 | ) { 276 | Column( 277 | modifier = modifier 278 | ) { 279 | Text( 280 | text = stringResource(R.string.about), 281 | style = MaterialTheme.typography.labelSmall 282 | ) 283 | Text( 284 | text = stringResource(dogHobby), 285 | style = MaterialTheme.typography.bodyLarge 286 | ) 287 | } 288 | } 289 | 290 | /** 291 | * Composable that displays what the UI of the app looks like in light theme in the design tab. 292 | */ 293 | @Preview 294 | @Composable 295 | fun WoofPreview() { 296 | WoofTheme(darkTheme = false) { 297 | WoofApp() 298 | } 299 | } 300 | 301 | /** 302 | * Composable that displays what the UI of the app looks like in dark theme in the design tab. 303 | */ 304 | @Preview 305 | @Composable 306 | fun WoofDarkThemePreview() { 307 | WoofTheme(darkTheme = true) { 308 | WoofApp() 309 | } 310 | } 311 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/woof/data/Dog.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 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 | * https://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.woof.data 17 | 18 | import androidx.annotation.DrawableRes 19 | import androidx.annotation.StringRes 20 | import com.example.woof.R 21 | 22 | /** 23 | * A data class to represent the information presented in the dog card 24 | */ 25 | data class Dog( 26 | @DrawableRes val imageResourceId: Int, 27 | @StringRes val name: Int, 28 | val age: Int, 29 | @StringRes val hobbies: Int 30 | ) 31 | 32 | val dogs = listOf( 33 | Dog(R.drawable.koda, R.string.dog_name_1, 2, R.string.dog_description_1), 34 | Dog(R.drawable.lola, R.string.dog_name_2, 16, R.string.dog_description_2), 35 | Dog(R.drawable.frankie, R.string.dog_name_3, 2, R.string.dog_description_3), 36 | Dog(R.drawable.nox, R.string.dog_name_4, 8, R.string.dog_description_4), 37 | Dog(R.drawable.faye, R.string.dog_name_5, 8, R.string.dog_description_5), 38 | Dog(R.drawable.bella, R.string.dog_name_6, 14, R.string.dog_description_6), 39 | Dog(R.drawable.moana, R.string.dog_name_7, 2, R.string.dog_description_7), 40 | Dog(R.drawable.tzeitel, R.string.dog_name_8, 7, R.string.dog_description_8), 41 | Dog(R.drawable.leroy, R.string.dog_name_9, 4, R.string.dog_description_9) 42 | ) 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/woof/ui/theme/Color.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 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 | * https://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.woof.ui.theme 17 | 18 | import androidx.compose.ui.graphics.Color 19 | 20 | val md_theme_light_primary = Color(0xFF006C4C) 21 | val md_theme_light_onPrimary = Color(0xFFFFFFFF) 22 | val md_theme_light_primaryContainer = Color(0xFF89F8C7) 23 | val md_theme_light_onPrimaryContainer = Color(0xFF002114) 24 | val md_theme_light_secondary = Color(0xFF4D6357) 25 | val md_theme_light_onSecondary = Color(0xFFFFFFFF) 26 | val md_theme_light_secondaryContainer = Color(0xFFCFE9D9) 27 | val md_theme_light_onSecondaryContainer = Color(0xFF092016) 28 | val md_theme_light_tertiary = Color(0xFF3D6373) 29 | val md_theme_light_onTertiary = Color(0xFFFFFFFF) 30 | val md_theme_light_tertiaryContainer = Color(0xFFC1E8FB) 31 | val md_theme_light_onTertiaryContainer = Color(0xFF001F29) 32 | val md_theme_light_error = Color(0xFFBA1A1A) 33 | val md_theme_light_errorContainer = Color(0xFFFFDAD6) 34 | val md_theme_light_onError = Color(0xFFFFFFFF) 35 | val md_theme_light_onErrorContainer = Color(0xFF410002) 36 | val md_theme_light_background = Color(0xFFFBFDF9) 37 | val md_theme_light_onBackground = Color(0xFF191C1A) 38 | val md_theme_light_surface = Color(0xFFFBFDF9) 39 | val md_theme_light_onSurface = Color(0xFF191C1A) 40 | val md_theme_light_surfaceVariant = Color(0xFFDBE5DD) 41 | val md_theme_light_onSurfaceVariant = Color(0xFF404943) 42 | val md_theme_light_outline = Color(0xFF707973) 43 | val md_theme_light_inverseOnSurface = Color(0xFFEFF1ED) 44 | val md_theme_light_inverseSurface = Color(0xFF2E312F) 45 | val md_theme_light_inversePrimary = Color(0xFF6CDBAC) 46 | val md_theme_light_shadow = Color(0xFF000000) 47 | val md_theme_light_surfaceTint = Color(0xFF006C4C) 48 | val md_theme_light_outlineVariant = Color(0xFFBFC9C2) 49 | val md_theme_light_scrim = Color(0xFF000000) 50 | 51 | val md_theme_dark_primary = Color(0xFF6CDBAC) 52 | val md_theme_dark_onPrimary = Color(0xFF003826) 53 | val md_theme_dark_primaryContainer = Color(0xFF005138) 54 | val md_theme_dark_onPrimaryContainer = Color(0xFF89F8C7) 55 | val md_theme_dark_secondary = Color(0xFFB3CCBE) 56 | val md_theme_dark_onSecondary = Color(0xFF1F352A) 57 | val md_theme_dark_secondaryContainer = Color(0xFF354B40) 58 | val md_theme_dark_onSecondaryContainer = Color(0xFFCFE9D9) 59 | val md_theme_dark_tertiary = Color(0xFFA5CCDF) 60 | val md_theme_dark_onTertiary = Color(0xFF073543) 61 | val md_theme_dark_tertiaryContainer = Color(0xFF244C5B) 62 | val md_theme_dark_onTertiaryContainer = Color(0xFFC1E8FB) 63 | val md_theme_dark_error = Color(0xFFFFB4AB) 64 | val md_theme_dark_errorContainer = Color(0xFF93000A) 65 | val md_theme_dark_onError = Color(0xFF690005) 66 | val md_theme_dark_onErrorContainer = Color(0xFFFFDAD6) 67 | val md_theme_dark_background = Color(0xFF191C1A) 68 | val md_theme_dark_onBackground = Color(0xFFE1E3DF) 69 | val md_theme_dark_surface = Color(0xFF191C1A) 70 | val md_theme_dark_onSurface = Color(0xFFE1E3DF) 71 | val md_theme_dark_surfaceVariant = Color(0xFF404943) 72 | val md_theme_dark_onSurfaceVariant = Color(0xFFBFC9C2) 73 | val md_theme_dark_outline = Color(0xFF8A938C) 74 | val md_theme_dark_inverseOnSurface = Color(0xFF191C1A) 75 | val md_theme_dark_inverseSurface = Color(0xFFE1E3DF) 76 | val md_theme_dark_inversePrimary = Color(0xFF006C4C) 77 | val md_theme_dark_shadow = Color(0xFF000000) 78 | val md_theme_dark_surfaceTint = Color(0xFF6CDBAC) 79 | val md_theme_dark_outlineVariant = Color(0xFF404943) 80 | val md_theme_dark_scrim = Color(0xFF000000) 81 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/woof/ui/theme/Shape.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 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 | * https://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.woof.ui.theme 17 | 18 | import androidx.compose.foundation.shape.RoundedCornerShape 19 | import androidx.compose.material3.Shapes 20 | import androidx.compose.ui.unit.dp 21 | 22 | val Shapes = Shapes( 23 | small = RoundedCornerShape(50.dp), 24 | medium = RoundedCornerShape(bottomStart = 16.dp, topEnd = 16.dp) 25 | ) 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/woof/ui/theme/Theme.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 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 | * https://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.woof.ui.theme 17 | 18 | import android.app.Activity 19 | import android.os.Build 20 | import androidx.compose.foundation.isSystemInDarkTheme 21 | import androidx.compose.material3.MaterialTheme 22 | import androidx.compose.material3.darkColorScheme 23 | import androidx.compose.material3.dynamicDarkColorScheme 24 | import androidx.compose.material3.dynamicLightColorScheme 25 | import androidx.compose.material3.lightColorScheme 26 | import androidx.compose.runtime.Composable 27 | import androidx.compose.runtime.SideEffect 28 | import androidx.compose.ui.graphics.toArgb 29 | import androidx.compose.ui.platform.LocalContext 30 | import androidx.compose.ui.platform.LocalView 31 | import androidx.core.view.WindowCompat 32 | 33 | private val LightColors = lightColorScheme( 34 | primary = md_theme_light_primary, 35 | onPrimary = md_theme_light_onPrimary, 36 | primaryContainer = md_theme_light_primaryContainer, 37 | onPrimaryContainer = md_theme_light_onPrimaryContainer, 38 | secondary = md_theme_light_secondary, 39 | onSecondary = md_theme_light_onSecondary, 40 | secondaryContainer = md_theme_light_secondaryContainer, 41 | onSecondaryContainer = md_theme_light_onSecondaryContainer, 42 | tertiary = md_theme_light_tertiary, 43 | onTertiary = md_theme_light_onTertiary, 44 | tertiaryContainer = md_theme_light_tertiaryContainer, 45 | onTertiaryContainer = md_theme_light_onTertiaryContainer, 46 | error = md_theme_light_error, 47 | errorContainer = md_theme_light_errorContainer, 48 | onError = md_theme_light_onError, 49 | onErrorContainer = md_theme_light_onErrorContainer, 50 | background = md_theme_light_background, 51 | onBackground = md_theme_light_onBackground, 52 | surface = md_theme_light_surface, 53 | onSurface = md_theme_light_onSurface, 54 | surfaceVariant = md_theme_light_surfaceVariant, 55 | onSurfaceVariant = md_theme_light_onSurfaceVariant, 56 | outline = md_theme_light_outline, 57 | inverseOnSurface = md_theme_light_inverseOnSurface, 58 | inverseSurface = md_theme_light_inverseSurface, 59 | inversePrimary = md_theme_light_inversePrimary, 60 | surfaceTint = md_theme_light_surfaceTint, 61 | outlineVariant = md_theme_light_outlineVariant, 62 | scrim = md_theme_light_scrim, 63 | ) 64 | 65 | 66 | private val DarkColors = darkColorScheme( 67 | primary = md_theme_dark_primary, 68 | onPrimary = md_theme_dark_onPrimary, 69 | primaryContainer = md_theme_dark_primaryContainer, 70 | onPrimaryContainer = md_theme_dark_onPrimaryContainer, 71 | secondary = md_theme_dark_secondary, 72 | onSecondary = md_theme_dark_onSecondary, 73 | secondaryContainer = md_theme_dark_secondaryContainer, 74 | onSecondaryContainer = md_theme_dark_onSecondaryContainer, 75 | tertiary = md_theme_dark_tertiary, 76 | onTertiary = md_theme_dark_onTertiary, 77 | tertiaryContainer = md_theme_dark_tertiaryContainer, 78 | onTertiaryContainer = md_theme_dark_onTertiaryContainer, 79 | error = md_theme_dark_error, 80 | errorContainer = md_theme_dark_errorContainer, 81 | onError = md_theme_dark_onError, 82 | onErrorContainer = md_theme_dark_onErrorContainer, 83 | background = md_theme_dark_background, 84 | onBackground = md_theme_dark_onBackground, 85 | surface = md_theme_dark_surface, 86 | onSurface = md_theme_dark_onSurface, 87 | surfaceVariant = md_theme_dark_surfaceVariant, 88 | onSurfaceVariant = md_theme_dark_onSurfaceVariant, 89 | outline = md_theme_dark_outline, 90 | inverseOnSurface = md_theme_dark_inverseOnSurface, 91 | inverseSurface = md_theme_dark_inverseSurface, 92 | inversePrimary = md_theme_dark_inversePrimary, 93 | surfaceTint = md_theme_dark_surfaceTint, 94 | outlineVariant = md_theme_dark_outlineVariant, 95 | scrim = md_theme_dark_scrim, 96 | ) 97 | 98 | @Composable 99 | fun WoofTheme( 100 | darkTheme: Boolean = isSystemInDarkTheme(), 101 | // Dynamic color is available on Android 12+ 102 | dynamicColor: Boolean = false, 103 | content: @Composable () -> Unit 104 | ) { 105 | val colorScheme = when { 106 | dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { 107 | val context = LocalContext.current 108 | if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) 109 | } 110 | 111 | darkTheme -> DarkColors 112 | else -> LightColors 113 | } 114 | val view = LocalView.current 115 | if (!view.isInEditMode) { 116 | SideEffect { 117 | val window = (view.context as Activity).window 118 | window.statusBarColor = colorScheme.primary.toArgb() 119 | WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme 120 | } 121 | } 122 | 123 | MaterialTheme( 124 | colorScheme = colorScheme, 125 | shapes = Shapes, 126 | typography = Typography, 127 | content = content 128 | ) 129 | } 130 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/woof/ui/theme/Type.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 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 | * https://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.woof.ui.theme 17 | 18 | import androidx.compose.material3.Typography 19 | import androidx.compose.ui.text.TextStyle 20 | import androidx.compose.ui.text.font.Font 21 | import androidx.compose.ui.text.font.FontFamily 22 | import androidx.compose.ui.text.font.FontWeight 23 | import androidx.compose.ui.unit.sp 24 | import com.example.woof.R 25 | 26 | val AbrilFatface = FontFamily( 27 | Font(R.font.abril_fatface_regular) 28 | ) 29 | 30 | val Montserrat = FontFamily( 31 | Font(R.font.montserrat_regular), 32 | Font(R.font.montserrat_bold, FontWeight.Bold) 33 | ) 34 | 35 | val Typography = Typography( 36 | displayLarge = TextStyle( 37 | fontFamily = AbrilFatface, 38 | fontWeight = FontWeight.Normal, 39 | fontSize = 36.sp 40 | ), 41 | displayMedium = TextStyle( 42 | fontFamily = Montserrat, 43 | fontWeight = FontWeight.Bold, 44 | fontSize = 20.sp 45 | ), 46 | labelSmall = TextStyle( 47 | fontFamily = Montserrat, 48 | fontWeight = FontWeight.Bold, 49 | fontSize = 14.sp 50 | ), 51 | bodyLarge = TextStyle( 52 | fontFamily = Montserrat, 53 | fontWeight = FontWeight.Normal, 54 | fontSize = 14.sp 55 | ) 56 | ) 57 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 16 | 22 | 23 | 24 | 30 | 33 | 36 | 37 | 38 | 39 | 45 | 46 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bella.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/drawable/bella.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/faye.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/drawable/faye.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/frankie.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/drawable/frankie.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 22 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 175 | 180 | 185 | 186 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 22 | 23 | 25 | 28 | 31 | 34 | 37 | 40 | 43 | 46 | 49 | 52 | 55 | 56 | 58 | 61 | 64 | 67 | 70 | 73 | 76 | 79 | 82 | 85 | 88 | 91 | 94 | 95 | 96 | 98 | 101 | 104 | 107 | 110 | 113 | 116 | 119 | 122 | 125 | 128 | 131 | 134 | 137 | 140 | 143 | 146 | 147 | 148 | 150 | 153 | 156 | 159 | 162 | 165 | 168 | 171 | 174 | 177 | 180 | 183 | 186 | 187 | 188 | 189 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_woof_logo.xml: -------------------------------------------------------------------------------- 1 | 16 | 22 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 56 | 57 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 72 | 73 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 88 | 89 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/koda.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/drawable/koda.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/leroy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/drawable/leroy.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/lola.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/drawable/lola.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/moana.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/drawable/moana.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/nox.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/drawable/nox.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/tzeitel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/drawable/tzeitel.jpg -------------------------------------------------------------------------------- /app/src/main/res/font/abril_fatface_regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/font/abril_fatface_regular.ttf -------------------------------------------------------------------------------- /app/src/main/res/font/montserrat_bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/font/montserrat_bold.ttf -------------------------------------------------------------------------------- /app/src/main/res/font/montserrat_regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/font/montserrat_regular.ttf -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/mipmap-hdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/mipmap-mdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google-developer-training/basic-android-kotlin-compose-training-woof/beea42ec44d41d6e7350e15139b90ba294b4558a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /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/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 8dp 19 | 16dp 20 | 64dp 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | Woof 18 | Koda 19 | Lola 20 | Frankie 21 | Nox 22 | Faye 23 | Bella 24 | Moana 25 | Tzeitel 26 | Leroy 27 | Eating treats on the terrace 28 | Barking at Daddy 29 | Stealing socks 30 | Meeting new animals 31 | Digging in the garden 32 | Chasing sea foam 33 | Bothering her paw-rents 34 | Sunbathing 35 | Sleeping in dangerous places 36 | About: 37 | %d years old 38 | See more or less information about a dog. 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 |