├── README.md └── deep-links-introduction ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── original ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ ├── release │ │ └── app-release.aab │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── devrel │ │ │ └── deeplinksbasics │ │ │ ├── DeepLinksBasicsApplication.kt │ │ │ ├── MainActivity.kt │ │ │ ├── data │ │ │ ├── Restaurant.kt │ │ │ ├── RestaurantLocalDataSource.kt │ │ │ └── RestaurantRepository.kt │ │ │ └── ui │ │ │ ├── RestaurantApp.kt │ │ │ ├── RestaurantAppState.kt │ │ │ ├── RestaurantCardDetails.kt │ │ │ ├── RestaurantCell.kt │ │ │ ├── RestaurantGrid.kt │ │ │ ├── restaurant │ │ │ └── RestaurantViewModel.kt │ │ │ └── theme │ │ │ ├── Color.kt │ │ │ ├── Shape.kt │ │ │ ├── Theme.kt │ │ │ └── Type.kt │ │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── ic_launcher_background.xml │ │ ├── restaurant1.jpeg │ │ ├── restaurant10.jpeg │ │ ├── restaurant2.jpg │ │ ├── restaurant3.jpeg │ │ ├── restaurant4.jpeg │ │ ├── restaurant5.jpeg │ │ ├── restaurant6.jpeg │ │ ├── restaurant7.jpg │ │ ├── restaurant8.jpeg │ │ └── restaurant9.jpeg │ │ ├── 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 │ │ ├── strings.xml │ │ └── themes.xml │ │ └── xml │ │ ├── backup_rules.xml │ │ └── data_extraction_rules.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── solution ├── .gitignore ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ ├── release │ │ └── app-release.aab │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── devrel │ │ │ └── deeplinksbasics │ │ │ ├── DeepLinksBasicsApplication.kt │ │ │ ├── MainActivity.kt │ │ │ ├── data │ │ │ ├── Restaurant.kt │ │ │ ├── RestaurantLocalDataSource.kt │ │ │ └── RestaurantRepository.kt │ │ │ └── ui │ │ │ ├── RestaurantApp.kt │ │ │ ├── RestaurantAppState.kt │ │ │ ├── RestaurantCardDetails.kt │ │ │ ├── RestaurantCell.kt │ │ │ ├── RestaurantGrid.kt │ │ │ ├── restaurant │ │ │ └── RestaurantViewModel.kt │ │ │ └── theme │ │ │ ├── Color.kt │ │ │ ├── Shape.kt │ │ │ ├── Theme.kt │ │ │ └── Type.kt │ │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── ic_launcher_background.xml │ │ ├── restaurant1.jpeg │ │ ├── restaurant10.jpeg │ │ ├── restaurant2.jpg │ │ ├── restaurant3.jpeg │ │ ├── restaurant4.jpeg │ │ ├── restaurant5.jpeg │ │ ├── restaurant6.jpeg │ │ ├── restaurant7.jpg │ │ ├── restaurant8.jpeg │ │ └── restaurant9.jpeg │ │ ├── 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 │ │ ├── strings.xml │ │ └── themes.xml │ │ └── xml │ │ ├── backup_rules.xml │ │ └── data_extraction_rules.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle └── website ├── firebase.json └── public ├── .well-known └── assetlinks.json ├── 404.html ├── images ├── restaurant1.jpeg ├── restaurant10.jpeg ├── restaurant2.jpg ├── restaurant3.jpeg ├── restaurant4.jpeg ├── restaurant5.jpeg ├── restaurant6.jpeg ├── restaurant7.jpg ├── restaurant8.jpeg └── restaurant9.jpeg ├── index.html └── restaurants ├── bbq └── index.html ├── gyrosAndMoar └── index.html ├── keybabs ├── index.html └── orders │ └── latest.html ├── pawtato └── index.html ├── peruvianCeviche └── index.html ├── pizzabus └── index.html ├── rawrbucha └── index.html ├── salades └── index.html ├── taquitos ├── index.html └── orders │ └── latest.html └── veganBurgers └── index.html /README.md: -------------------------------------------------------------------------------- 1 | # Deep Links 2 | 3 | ## Purpose 4 | 5 | This repository holds all the public code from codelabs for deep links in Android. 6 | 7 | ## Index 8 | 9 | Each directory holds a codelab code. 10 | 11 | - deep-links-introduction: Deep links introduction codelab code 12 | -------------------------------------------------------------------------------- /deep-links-introduction/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | 3 | We'd love to accept your patches and contributions to this project. 4 | 5 | ## Before you begin 6 | 7 | ### Sign our Contributor License Agreement 8 | 9 | Contributions to this project must be accompanied by a 10 | [Contributor License Agreement](https://cla.developers.google.com/about) (CLA). 11 | You (or your employer) retain the copyright to your contribution; this simply 12 | gives us permission to use and redistribute your contributions as part of the 13 | project. 14 | 15 | If you or your current employer have already signed the Google CLA (even if it 16 | was for a different project), you probably don't need to do it again. 17 | 18 | Visit to see your current agreements or to 19 | sign a new one. 20 | 21 | ### Review our Community Guidelines 22 | 23 | This project follows 24 | [Google's Open Source Community Guidelines](https://opensource.google/conduct/). 25 | 26 | ## Contribution process 27 | 28 | ### Code Reviews 29 | 30 | All submissions, including submissions by project members, require review. We 31 | use GitHub pull requests for this purpose. Consult 32 | [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more 33 | information on using pull requests. 34 | -------------------------------------------------------------------------------- /deep-links-introduction/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /deep-links-introduction/README.md: -------------------------------------------------------------------------------- 1 | # DeepLinksBasics 2 | 3 | ## Introduction 4 | 5 | The main objective users following links have is to get to the content they want to see. Android handles the following types of links: deep links, web links, and Android App Links. 6 | 7 | This sample shows how to design, configure, implement and verify the different types of deep links, specially Android App Links. 8 | 9 | ## Pre-requisites 10 | 11 | - Android Studio Dolphin (2021.3.1) 12 | - Basic knowledge of adb activity manager 13 | - A domain for hosting the Google DAL file 14 | - Basic knowledge of Android development and navigation with Jetpack Compose 15 | - (Optional) Google Play Console developer account set up. This will enable another approach to debug your Android App Links configuration 16 | 17 | ## Getting Started 18 | 19 | 1. [Install Android Studio](https://developer.android.com/studio/install.html), if you don't already have it. 20 | 1. Download the codelab. 21 | 1. Import the code into Android Studio. 22 | 1. Build and run the codelab. 23 | 24 | ## License 25 | Copyright 2023 Google LLC. 26 | 27 | All image and audio files (including *.png, *.jpg, *.svg, *.mp3, *.wav and *.ogg) are licensed under the CC BY 4.0 license. All other files are licensed under the Apache 2 license. 28 | 29 | Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the LICENSE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at 30 | 31 | http://www.apache.org/licenses/LICENSE-2.0 32 | 33 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 34 | 35 | -------------------------------------------------------------------------------- /deep-links-introduction/original/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /deep-links-introduction/original/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'org.jetbrains.kotlin.android' 4 | id 'kotlin-kapt' 5 | id 'dagger.hilt.android.plugin' 6 | 7 | } 8 | 9 | android { 10 | namespace 'com.devrel.deeplinksbasics' 11 | compileSdk 33 12 | 13 | defaultConfig { 14 | applicationId "com.devrel.deeplinksbasics" 15 | minSdk 21 16 | targetSdk 33 17 | versionCode 1 18 | versionName "1.0" 19 | 20 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 21 | vectorDrawables { 22 | useSupportLibrary true 23 | } 24 | } 25 | 26 | buildTypes { 27 | release { 28 | minifyEnabled false 29 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 30 | } 31 | } 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | kotlinOptions { 37 | jvmTarget = '1.8' 38 | } 39 | buildFeatures { 40 | compose true 41 | } 42 | composeOptions { 43 | kotlinCompilerExtensionVersion '1.4.2' 44 | } 45 | packagingOptions { 46 | resources { 47 | excludes += '/META-INF/{AL2.0,LGPL2.1}' 48 | } 49 | } 50 | } 51 | 52 | dependencies { 53 | implementation(libs.android.core) 54 | implementation(libs.lifecycle.runtime) 55 | implementation(libs.activity.compose) 56 | implementation(libs.compose.ui) 57 | implementation(libs.compose.ui.tooling.preview) 58 | implementation(libs.compose.material) 59 | testImplementation(libs.junit) 60 | androidTestImplementation(libs.test.junit) 61 | androidTestImplementation(libs.test.expresso.core) 62 | androidTestImplementation(libs.compose.ui.tooling) 63 | debugImplementation(libs.compose.ui.tooling) 64 | debugImplementation(libs.compose.ui.test.manifest) 65 | implementation(libs.lifecycle.viewmodel) 66 | implementation(libs.lifecycle.viewmodel.compose) 67 | implementation(libs.lifecycle.runtime.compose) 68 | implementation(libs.hilt.navigation.compose) 69 | implementation(libs.hilt.android) 70 | kapt(libs.hilt.compiler) 71 | } 72 | -------------------------------------------------------------------------------- /deep-links-introduction/original/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 -------------------------------------------------------------------------------- /deep-links-introduction/original/app/release/app-release.aab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/release/app-release.aab -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | 32 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/java/com/devrel/deeplinksbasics/DeepLinksBasicsApplication.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics 18 | 19 | import android.app.Application 20 | import dagger.hilt.android.HiltAndroidApp 21 | 22 | @HiltAndroidApp 23 | class DeepLinksBasicsApplication : Application() {} -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/java/com/devrel/deeplinksbasics/MainActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics 18 | 19 | import android.os.Bundle 20 | import androidx.activity.ComponentActivity 21 | import androidx.activity.compose.setContent 22 | import androidx.compose.foundation.layout.fillMaxSize 23 | import androidx.compose.material.MaterialTheme 24 | import androidx.compose.material.Surface 25 | import androidx.compose.ui.Modifier 26 | import com.devrel.deeplinksbasics.ui.RestaurantApp 27 | import com.devrel.deeplinksbasics.ui.theme.DeepLinksBasicsTheme 28 | import dagger.hilt.android.AndroidEntryPoint 29 | 30 | @AndroidEntryPoint 31 | class MainActivity : ComponentActivity() { 32 | override fun onCreate(savedInstanceState: Bundle?) { 33 | super.onCreate(savedInstanceState) 34 | setContent { 35 | DeepLinksBasicsTheme { 36 | Surface( 37 | modifier = Modifier.fillMaxSize(), 38 | color = MaterialTheme.colors.background 39 | ) { 40 | RestaurantApp() 41 | } 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/java/com/devrel/deeplinksbasics/data/Restaurant.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.data 18 | 19 | import androidx.annotation.DrawableRes 20 | import androidx.compose.runtime.Immutable 21 | 22 | @Immutable 23 | data class Restaurant( 24 | val id: Int = -1, 25 | val name: String = "", 26 | val address: String = "", 27 | val type: String = "", 28 | val website: String = "", 29 | @DrawableRes val drawable: Int = -1 30 | ) -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/java/com/devrel/deeplinksbasics/data/RestaurantLocalDataSource.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.data 18 | 19 | import com.devrel.deeplinksbasics.R 20 | import javax.inject.Inject 21 | import javax.inject.Singleton 22 | 23 | @Singleton 24 | class RestaurantLocalDataSource @Inject constructor() { 25 | val restaurantList = listOf( 26 | Restaurant( 27 | id = 1, 28 | name = "Pawtato", 29 | address = "3140 Skinner Hollow Road, Medford, Oregon 97501", 30 | type = "Potato and gnochi", 31 | // TODO: Update with your own domain 32 | website = "https://your.own.domain/restaurants/pawtato/", 33 | drawable = R.drawable.restaurant1, 34 | ), 35 | Restaurant( 36 | id = 2, 37 | name = "Rawrbucha", 38 | address = "2064 Carriage Lane, Mansfield, Ohio 44907", 39 | type = "Kombucha", 40 | // TODO: Update with your own domain 41 | website = "https://your.own.domain/restaurants/rawrbucha/", 42 | drawable = R.drawable.restaurant2, 43 | ), 44 | Restaurant( 45 | id = 3, 46 | name = "Pizzabus", 47 | address = "1447 Davis Avenue, Petaluma, California 94952", 48 | type = "Pizza", 49 | // TODO: Update with your own domain 50 | website = "https://your.own.domain/restaurants/pizzabus/", 51 | drawable = R.drawable.restaurant3, 52 | ), 53 | Restaurant( 54 | id = 4, 55 | name = "Keybabs", 56 | address = "3708 Pinnickinnick Street, Perth Amboy, New Jersey 08861", 57 | type = "Kebabs", 58 | // TODO: Update with your own domain 59 | website = "https://your.own.domain/restaurants/keybabs/", 60 | drawable = R.drawable.restaurant4, 61 | ), 62 | Restaurant( 63 | id = 5, 64 | name = "BBQ", 65 | address = "998 Newton Street, Saint Cloud, Minnesota 56301", 66 | type = "BBQ", 67 | // TODO: Update with your own domain 68 | website = "https://your.own.domain/restaurants/bbq/", 69 | drawable = R.drawable.restaurant5, 70 | ), 71 | Restaurant( 72 | id = 6, 73 | name = "Salades", 74 | address = "4522 Rockford Mountain Lane, Oshkosh, Wisconsin 54901", 75 | type = "salads", 76 | // TODO: Update with your own domain 77 | website = "https://your.own.domain/restaurants/salades/", 78 | drawable = R.drawable.restaurant6, 79 | ), 80 | Restaurant( 81 | id = 7, 82 | name = "Gyros and moar", 83 | address = "1993 Bird Spring Lane, Houston, Texas 77077", 84 | type = "Gyro", 85 | // TODO: Update with your own domain 86 | website = "https://your.own.domain/restaurants/gyrosAndMoar/", 87 | drawable = R.drawable.restaurant7, 88 | ), 89 | Restaurant( 90 | id = 8, 91 | name = "Peruvian ceviche", 92 | address = "2125 Deer Ridge Drive, Newark, New Jersey 07102", 93 | type = "seafood", 94 | // TODO: Update with your own domain 95 | website = "https://your.own.domain/restaurants/peruvianCeviche/", 96 | drawable = R.drawable.restaurant8, 97 | ), 98 | Restaurant( 99 | id = 9, 100 | name = "Vegan burgers", 101 | address = "594 Warner Street, Casper, Wyoming 82601", 102 | type = "vegan", 103 | // TODO: Update with your own domain 104 | website = "https://your.own.domain/restaurants/veganBurgers/", 105 | drawable = R.drawable.restaurant9, 106 | ), 107 | Restaurant( 108 | id = 10, 109 | name = "Taquitos", 110 | address = "1654 Hart Country Lane, Blue Ridge, Georgia 30513", 111 | type = "mexican", 112 | // TODO: Update with your own domain 113 | website = "https://your.own.domain/restaurants/taquitos/", 114 | drawable = R.drawable.restaurant10, 115 | ), 116 | ) 117 | } -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/java/com/devrel/deeplinksbasics/data/RestaurantRepository.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.data 18 | 19 | import javax.inject.Inject 20 | 21 | class RestaurantRepository @Inject constructor( 22 | private val restaurantLocalDataSource: RestaurantLocalDataSource 23 | ){ 24 | val restaurants: List = restaurantLocalDataSource.restaurantList 25 | 26 | // Method to obtain a restaurant object by its name 27 | fun getRestaurantByName(name: String): Restaurant ? { 28 | return restaurantLocalDataSource.restaurantList.find { 29 | val processedName = it.name.filterNot { it.isWhitespace() }.lowercase() 30 | val nameToTest = name.filterNot { it.isWhitespace() }.lowercase() 31 | nameToTest == processedName 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/java/com/devrel/deeplinksbasics/ui/RestaurantApp.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.ui 18 | 19 | import androidx.compose.runtime.Composable 20 | import androidx.compose.runtime.LaunchedEffect 21 | import androidx.compose.runtime.collectAsState 22 | import androidx.compose.runtime.getValue 23 | import androidx.lifecycle.compose.collectAsStateWithLifecycle 24 | import androidx.lifecycle.viewmodel.compose.viewModel 25 | import androidx.navigation.NavType 26 | import androidx.navigation.compose.NavHost 27 | import androidx.navigation.compose.composable 28 | import androidx.navigation.navArgument 29 | import androidx.navigation.navDeepLink 30 | import com.devrel.deeplinksbasics.ui.restaurant.RestaurantViewModel 31 | 32 | /** 33 | * This is the main composable app. It handles the general app logic such as navigation, 34 | * state management and UI logic 35 | * 36 | * @property viewModel Handles the data layer, such as the restaurants to be displayed 37 | * @property appState UI state holder class for the Restaurant Composable. This will handle 38 | * UI navigation state. 39 | */ 40 | @Composable 41 | fun RestaurantApp( 42 | viewModel: RestaurantViewModel = viewModel(), 43 | appState: RestaurantAppState = rememberRestaurantAppState(), 44 | ) { 45 | val selectedRestaurant by viewModel.selectedRestaurant.collectAsStateWithLifecycle() 46 | val onRestaurantSelected: (String) -> Unit = { viewModel.updateSelectedRestaurantByName(it) } 47 | 48 | NavHost( 49 | navController = appState.navController, 50 | startDestination = Screen.Grid.route, 51 | ) { 52 | 53 | // Default route that points to the restaurant grid 54 | composable(Screen.Grid.route) { 55 | RestaurantGrid( 56 | restaurants = viewModel.restaurants, 57 | onRestaurantSelected = onRestaurantSelected, 58 | navigateToRestaurant = { restaurantName -> 59 | appState.navigateToRestaurant(restaurantName) 60 | }, 61 | ) 62 | } 63 | 64 | // Route for the navigation to a particular restaurant when a user clicks on it 65 | // TODO: update for Android App Link Route 66 | composable(Screen.Name.route) { 67 | RestaurantCardDetails(restaurant = selectedRestaurant!!, onBack = appState::navigateBack) 68 | } 69 | } 70 | } -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/java/com/devrel/deeplinksbasics/ui/RestaurantAppState.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.ui 18 | 19 | import androidx.compose.runtime.Composable 20 | import androidx.compose.runtime.remember 21 | import androidx.navigation.NavHostController 22 | import androidx.navigation.compose.rememberNavController 23 | 24 | sealed class Screen(val route: String) { 25 | object Grid : Screen("restaurants") 26 | object Name : Screen("restaurants/{name}") { 27 | fun createRoute(name: String) = "restaurants/$name" 28 | } 29 | } 30 | 31 | @Composable 32 | fun rememberRestaurantAppState( 33 | navController: NavHostController = rememberNavController(), 34 | ) = remember(navController) { 35 | RestaurantAppState(navController) 36 | } 37 | 38 | class RestaurantAppState( 39 | val navController: NavHostController, 40 | ) { 41 | fun navigateToRestaurant(restaurantName: String) { 42 | navController.navigate(Screen.Name.createRoute(restaurantName)) 43 | } 44 | 45 | fun navigateBack() { 46 | navController.popBackStack() 47 | } 48 | } -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/java/com/devrel/deeplinksbasics/ui/RestaurantCardDetails.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.ui 18 | 19 | import androidx.activity.compose.BackHandler 20 | import androidx.compose.foundation.Image 21 | import androidx.compose.foundation.clickable 22 | import androidx.compose.foundation.layout.Arrangement 23 | import androidx.compose.foundation.layout.Column 24 | import androidx.compose.foundation.layout.Row 25 | import androidx.compose.foundation.layout.Spacer 26 | import androidx.compose.foundation.layout.fillMaxWidth 27 | import androidx.compose.foundation.layout.padding 28 | import androidx.compose.foundation.layout.width 29 | import androidx.compose.foundation.shape.CornerSize 30 | import androidx.compose.foundation.shape.RoundedCornerShape 31 | import androidx.compose.foundation.text.selection.SelectionContainer 32 | import androidx.compose.material.Card 33 | import androidx.compose.material.Icon 34 | import androidx.compose.material.MaterialTheme 35 | import androidx.compose.material.Scaffold 36 | import androidx.compose.material.Text 37 | import androidx.compose.material.TopAppBar 38 | import androidx.compose.material.icons.Icons 39 | import androidx.compose.material.icons.filled.ArrowBack 40 | import androidx.compose.runtime.Composable 41 | import androidx.compose.ui.Modifier 42 | import androidx.compose.ui.graphics.Color 43 | import androidx.compose.ui.res.painterResource 44 | import androidx.compose.ui.unit.dp 45 | import com.devrel.deeplinksbasics.data.Restaurant 46 | 47 | @Composable 48 | fun RestaurantCardDetails ( 49 | restaurant: Restaurant, 50 | onBack: () -> Unit, 51 | modifier: Modifier = Modifier 52 | ) { 53 | BackHandler() { 54 | onBack() 55 | } 56 | Scaffold( 57 | topBar = { 58 | TopAppBar( 59 | backgroundColor = Color.Transparent, 60 | elevation = 0.dp, 61 | ) { 62 | Row( 63 | horizontalArrangement = Arrangement.Start, 64 | modifier = modifier.padding(start = 8.dp) 65 | ) { 66 | Icon( 67 | imageVector = Icons.Default.ArrowBack, 68 | contentDescription = "Arrow Back", 69 | modifier = modifier.clickable { 70 | onBack() 71 | } 72 | ) 73 | Spacer(modifier = modifier.width(8.dp)) 74 | Text(text = restaurant.name) 75 | } 76 | } 77 | } 78 | ) { paddingValues -> 79 | Card( 80 | modifier = modifier 81 | .padding(paddingValues) 82 | .fillMaxWidth(), 83 | elevation = 2.dp, 84 | shape = RoundedCornerShape(corner = CornerSize(8.dp)) 85 | ) { 86 | Column( 87 | modifier = modifier 88 | .padding(16.dp) 89 | .fillMaxWidth() 90 | ) { 91 | Text(text = restaurant.name, style = MaterialTheme.typography.h6) 92 | Text(text = restaurant.type, style = MaterialTheme.typography.caption) 93 | Text(text = restaurant.address, style = MaterialTheme.typography.caption) 94 | SelectionContainer { 95 | Text(text = restaurant.website, style = MaterialTheme.typography.caption) 96 | } 97 | Image(painter = painterResource(id = restaurant.drawable), contentDescription = "${restaurant.name}") 98 | } 99 | } 100 | } 101 | } -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/java/com/devrel/deeplinksbasics/ui/RestaurantCell.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.ui 18 | 19 | import androidx.compose.foundation.Image 20 | import androidx.compose.foundation.layout.Column 21 | import androidx.compose.foundation.layout.fillMaxWidth 22 | import androidx.compose.foundation.layout.padding 23 | import androidx.compose.foundation.shape.CornerSize 24 | import androidx.compose.foundation.shape.RoundedCornerShape 25 | import androidx.compose.material.Card 26 | import androidx.compose.material.MaterialTheme 27 | import androidx.compose.material.Text 28 | import androidx.compose.runtime.Composable 29 | import androidx.compose.ui.Modifier 30 | import androidx.compose.ui.res.painterResource 31 | import androidx.compose.ui.unit.dp 32 | import com.devrel.deeplinksbasics.data.Restaurant 33 | 34 | @Composable 35 | fun RestaurantCell( 36 | restaurant: Restaurant, 37 | modifier: Modifier = Modifier 38 | ){ 39 | Card( 40 | modifier = modifier 41 | .padding(horizontal = 8.dp, vertical = 8.dp) 42 | .fillMaxWidth(), 43 | elevation = 2.dp, 44 | shape = RoundedCornerShape(corner = CornerSize(8.dp)) 45 | ) { 46 | Column( 47 | modifier = modifier 48 | .padding(16.dp) 49 | .fillMaxWidth() 50 | ) { 51 | Text(text = restaurant.name, style = MaterialTheme.typography.h6) 52 | Text(text = restaurant.address, style = MaterialTheme.typography.caption) 53 | Image(painter = painterResource(id = restaurant.drawable), contentDescription = restaurant.name) 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/java/com/devrel/deeplinksbasics/ui/RestaurantGrid.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.ui 18 | 19 | import androidx.compose.foundation.clickable 20 | import androidx.compose.foundation.layout.Column 21 | import androidx.compose.foundation.layout.fillMaxWidth 22 | import androidx.compose.foundation.layout.padding 23 | import androidx.compose.foundation.lazy.grid.GridCells 24 | import androidx.compose.foundation.lazy.grid.LazyVerticalGrid 25 | import androidx.compose.foundation.lazy.grid.items 26 | import androidx.compose.material.Scaffold 27 | import androidx.compose.material.Text 28 | import androidx.compose.material.TopAppBar 29 | import androidx.compose.runtime.Composable 30 | import androidx.compose.ui.Modifier 31 | import androidx.compose.ui.graphics.Color 32 | import androidx.compose.ui.text.font.FontWeight 33 | import androidx.compose.ui.unit.dp 34 | import com.devrel.deeplinksbasics.data.Restaurant 35 | 36 | @Composable 37 | fun RestaurantGrid( 38 | restaurants: List, 39 | onRestaurantSelected: (String) -> Unit, 40 | navigateToRestaurant: (String) -> Unit, 41 | modifier: Modifier = Modifier 42 | ) { 43 | Scaffold(topBar = { 44 | TopAppBar( 45 | backgroundColor = Color.Transparent, 46 | elevation = 0.dp, 47 | ) { 48 | Text(text = "Restaurants", fontWeight = FontWeight.Bold) 49 | } 50 | }) { paddingValues -> 51 | LazyVerticalGrid( 52 | columns = GridCells.Adaptive(minSize = 200.dp), 53 | modifier = modifier.padding(paddingValues) 54 | ) { 55 | items(items = restaurants) { restaurant -> 56 | Column( 57 | modifier = modifier 58 | .fillMaxWidth() 59 | .clickable(onClick = { 60 | onRestaurantSelected(restaurant.name) 61 | navigateToRestaurant(restaurant.name) 62 | }) 63 | ) { 64 | RestaurantCell(restaurant) 65 | } 66 | } 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/java/com/devrel/deeplinksbasics/ui/restaurant/RestaurantViewModel.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.ui.restaurant 18 | 19 | import androidx.lifecycle.ViewModel 20 | import androidx.lifecycle.viewModelScope 21 | import com.devrel.deeplinksbasics.data.Restaurant 22 | import com.devrel.deeplinksbasics.data.RestaurantRepository 23 | import dagger.hilt.android.lifecycle.HiltViewModel 24 | import kotlinx.coroutines.flow.MutableStateFlow 25 | import kotlinx.coroutines.flow.StateFlow 26 | import kotlinx.coroutines.launch 27 | import javax.inject.Inject 28 | 29 | @HiltViewModel 30 | class RestaurantViewModel @Inject constructor( 31 | private val restaurantRepository: RestaurantRepository, 32 | ) : ViewModel() { 33 | // restaurants and selected restaurant could be used as one UIState stream 34 | // which will scale better when exposing more data. 35 | // Since there are only these two, it is okay to expose them as separate streams 36 | val restaurants: List = restaurantRepository.restaurants 37 | 38 | private val _selectedRestaurant = MutableStateFlow(value = null) 39 | val selectedRestaurant: StateFlow 40 | get() = _selectedRestaurant 41 | 42 | // Method to update the current restaurant selection 43 | fun updateSelectedRestaurantByName(name: String) { 44 | viewModelScope.launch { 45 | val selectedRestaurant: Restaurant? = restaurantRepository.getRestaurantByName(name) 46 | if (selectedRestaurant != null) { 47 | _selectedRestaurant.value = selectedRestaurant 48 | } 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/java/com/devrel/deeplinksbasics/ui/theme/Color.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.ui.theme 18 | 19 | import androidx.compose.ui.graphics.Color 20 | 21 | val Purple200 = Color(0xFFBB86FC) 22 | val Purple500 = Color(0xFF6200EE) 23 | val Purple700 = Color(0xFF3700B3) 24 | val Teal200 = Color(0xFF03DAC5) -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/java/com/devrel/deeplinksbasics/ui/theme/Shape.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.ui.theme 18 | 19 | import androidx.compose.foundation.shape.RoundedCornerShape 20 | import androidx.compose.material.Shapes 21 | import androidx.compose.ui.unit.dp 22 | 23 | val Shapes = Shapes( 24 | small = RoundedCornerShape(4.dp), 25 | medium = RoundedCornerShape(4.dp), 26 | large = RoundedCornerShape(0.dp) 27 | ) -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/java/com/devrel/deeplinksbasics/ui/theme/Theme.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.ui.theme 18 | 19 | import androidx.compose.foundation.isSystemInDarkTheme 20 | import androidx.compose.material.MaterialTheme 21 | import androidx.compose.material.darkColors 22 | import androidx.compose.material.lightColors 23 | import androidx.compose.runtime.Composable 24 | 25 | private val DarkColorPalette = darkColors( 26 | primary = Purple200, 27 | primaryVariant = Purple700, 28 | secondary = Teal200 29 | ) 30 | 31 | private val LightColorPalette = lightColors( 32 | primary = Purple500, 33 | primaryVariant = Purple700, 34 | secondary = Teal200 35 | 36 | /* Other default colors to override 37 | background = Color.White, 38 | surface = Color.White, 39 | onPrimary = Color.White, 40 | onSecondary = Color.Black, 41 | onBackground = Color.Black, 42 | onSurface = Color.Black, 43 | */ 44 | ) 45 | 46 | @Composable 47 | fun DeepLinksBasicsTheme( 48 | darkTheme: Boolean = isSystemInDarkTheme(), 49 | content: @Composable () -> Unit 50 | ) { 51 | val colors = if (darkTheme) { 52 | DarkColorPalette 53 | } else { 54 | LightColorPalette 55 | } 56 | 57 | MaterialTheme( 58 | colors = colors, 59 | typography = Typography, 60 | shapes = Shapes, 61 | content = content 62 | ) 63 | } -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/java/com/devrel/deeplinksbasics/ui/theme/Type.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.ui.theme 18 | 19 | import androidx.compose.material.Typography 20 | import androidx.compose.ui.text.TextStyle 21 | import androidx.compose.ui.text.font.FontFamily 22 | import androidx.compose.ui.text.font.FontWeight 23 | import androidx.compose.ui.unit.sp 24 | 25 | // Set of Material typography styles to start with 26 | val Typography = Typography( 27 | body1 = TextStyle( 28 | fontFamily = FontFamily.Default, 29 | fontWeight = FontWeight.Normal, 30 | fontSize = 16.sp 31 | ) 32 | /* Other default text styles to override 33 | button = TextStyle( 34 | fontFamily = FontFamily.Default, 35 | fontWeight = FontWeight.W500, 36 | fontSize = 14.sp 37 | ), 38 | caption = TextStyle( 39 | fontFamily = FontFamily.Default, 40 | fontWeight = FontWeight.Normal, 41 | fontSize = 12.sp 42 | ) 43 | */ 44 | ) -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 24 | 25 | 31 | 34 | 37 | 38 | 39 | 40 | 46 | -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 26 | 31 | 36 | 41 | 46 | 51 | 56 | 61 | 66 | 71 | 76 | 81 | 86 | 91 | 96 | 101 | 106 | 111 | 116 | 121 | 126 | 131 | 136 | 141 | 146 | 151 | 156 | 161 | 166 | 171 | 176 | 181 | 186 | 187 | -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/drawable/restaurant1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/src/main/res/drawable/restaurant1.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/drawable/restaurant10.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/src/main/res/drawable/restaurant10.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/drawable/restaurant2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/src/main/res/drawable/restaurant2.jpg -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/drawable/restaurant3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/src/main/res/drawable/restaurant3.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/drawable/restaurant4.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/src/main/res/drawable/restaurant4.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/drawable/restaurant5.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/src/main/res/drawable/restaurant5.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/drawable/restaurant6.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/src/main/res/drawable/restaurant6.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/drawable/restaurant7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/src/main/res/drawable/restaurant7.jpg -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/drawable/restaurant8.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/src/main/res/drawable/restaurant8.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/drawable/restaurant9.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/src/main/res/drawable/restaurant9.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/mipmap-hdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/src/main/res/mipmap-hdpi/ic_launcher.webp -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/mipmap-mdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/src/main/res/mipmap-mdpi/ic_launcher.webp -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/mipmap-xhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/src/main/res/mipmap-xhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | #FFBB86FC 20 | #FF6200EE 21 | #FF3700B3 22 | #FF03DAC5 23 | #FF018786 24 | #FF000000 25 | #FFFFFFFF 26 | -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | Deep Links Basics 19 | -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/xml/backup_rules.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 24 | 25 | 29 | -------------------------------------------------------------------------------- /deep-links-introduction/original/app/src/main/res/xml/data_extraction_rules.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 23 | 24 | 28 | 29 | 35 | -------------------------------------------------------------------------------- /deep-links-introduction/original/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | dependencies { 3 | classpath "com.google.dagger:hilt-android-gradle-plugin:2.43" 4 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20" 5 | } 6 | }// Top-level build file where you can add configuration options common to all sub-projects/modules. 7 | plugins { 8 | id 'com.android.application' version '7.4.1' apply false 9 | id 'com.android.library' version '7.4.1' apply false 10 | id 'org.jetbrains.kotlin.android' version '1.8.10' apply false 11 | } -------------------------------------------------------------------------------- /deep-links-introduction/original/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 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 | # Project-wide Gradle settings. 18 | # IDE (e.g. Android Studio) users: 19 | # Gradle settings configured through the IDE *will override* 20 | # any settings specified in this file. 21 | # For more details on how to configure your build environment visit 22 | # http://www.gradle.org/docs/current/userguide/build_environment.html 23 | # Specifies the JVM arguments used for the daemon process. 24 | # The setting is particularly useful for tweaking memory settings. 25 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 26 | # When configured, Gradle will run in incubating parallel mode. 27 | # This option should only be used with decoupled projects. More details, visit 28 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 29 | # org.gradle.parallel=true 30 | # AndroidX package structure to make it clearer which packages are bundled with the 31 | # Android operating system, and which are packaged with your app's APK 32 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 33 | android.useAndroidX=true 34 | # Kotlin code style for this project: "official" or "obsolete": 35 | kotlin.code.style=official 36 | # Enables namespacing of each library's R class so that its R class includes only the 37 | # resources declared in the library itself and none from the library's dependencies, 38 | # thereby reducing the size of the R class for that library 39 | android.nonTransitiveRClass=true -------------------------------------------------------------------------------- /deep-links-introduction/original/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/original/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /deep-links-introduction/original/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 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 | #Mon Dec 12 09:13:52 CST 2022 18 | distributionBase=GRADLE_USER_HOME 19 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip 20 | distributionPath=wrapper/dists 21 | zipStorePath=wrapper/dists 22 | zipStoreBase=GRADLE_USER_HOME 23 | -------------------------------------------------------------------------------- /deep-links-introduction/original/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /deep-links-introduction/original/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /deep-links-introduction/original/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | google() 5 | mavenCentral() 6 | } 7 | } 8 | dependencyResolutionManagement { 9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 10 | repositories { 11 | google() 12 | mavenCentral() 13 | } 14 | versionCatalogs { 15 | libs { 16 | version('compose', '1.2.1') 17 | library('compose-ui', 'androidx.compose.ui', 'ui').versionRef('compose') 18 | library('compose-ui-test', 'androidx.compose.ui', 'ui-test-junit4').versionRef('compose') 19 | library('compose-ui-tooling', 'androidx.compose.ui', 'ui-tooling').versionRef('compose') 20 | library('compose-ui-tooling-preview', 'androidx.compose.ui', 'ui-tooling-preview').versionRef('compose') 21 | library('compose-ui-test-manifest', 'androidx.compose.ui', 'ui-test-manifest').versionRef('compose') 22 | library('android-core', 'androidx.core:core-ktx:1.7.0') 23 | library('compose-material', 'androidx.compose.material:material:1.2.1') 24 | library('activity-compose', 'androidx.activity:activity-compose:1.3.1') 25 | library('lifecycle-viewmodel', 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1') 26 | library('lifecycle-viewmodel-compose', 'androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1') 27 | library('lifecycle-runtime-compose', 'androidx.lifecycle:lifecycle-runtime-compose:2.6.0-beta01') 28 | library('lifecycle-runtime', 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1') 29 | library('hilt-android', 'com.google.dagger:hilt-android:2.43') 30 | library('hilt-compiler', 'com.google.dagger:hilt-compiler:2.43') 31 | library('hilt-navigation-compose', 'androidx.hilt:hilt-navigation-compose:1.0.0') 32 | library('junit', 'junit:junit:4.13.2') 33 | library('test-junit', 'androidx.test.ext:junit:1.1.4') 34 | library('test-expresso-core', 'androidx.test.espresso:espresso-core:3.5.0') 35 | } 36 | } 37 | } 38 | rootProject.name = "Deep Links Basics" 39 | include ':app' 40 | -------------------------------------------------------------------------------- /deep-links-introduction/solution/.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 | -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'org.jetbrains.kotlin.android' 4 | id 'kotlin-kapt' 5 | id 'dagger.hilt.android.plugin' 6 | 7 | } 8 | 9 | android { 10 | namespace 'com.devrel.deeplinksbasics' 11 | compileSdk 33 12 | 13 | defaultConfig { 14 | applicationId "com.devrel.deeplinksbasics" 15 | minSdk 21 16 | targetSdk 33 17 | versionCode 1 18 | versionName "1.0" 19 | 20 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 21 | vectorDrawables { 22 | useSupportLibrary true 23 | } 24 | } 25 | 26 | buildTypes { 27 | release { 28 | minifyEnabled false 29 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 30 | } 31 | } 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | kotlinOptions { 37 | jvmTarget = '1.8' 38 | } 39 | buildFeatures { 40 | compose true 41 | } 42 | composeOptions { 43 | kotlinCompilerExtensionVersion '1.4.2' 44 | } 45 | packagingOptions { 46 | resources { 47 | excludes += '/META-INF/{AL2.0,LGPL2.1}' 48 | } 49 | } 50 | } 51 | 52 | dependencies { 53 | implementation(libs.android.core) 54 | implementation(libs.lifecycle.runtime) 55 | implementation(libs.activity.compose) 56 | implementation(libs.compose.ui) 57 | implementation(libs.compose.ui.tooling.preview) 58 | implementation(libs.compose.material) 59 | testImplementation(libs.junit) 60 | androidTestImplementation(libs.test.junit) 61 | androidTestImplementation(libs.test.expresso.core) 62 | androidTestImplementation(libs.compose.ui.tooling) 63 | debugImplementation(libs.compose.ui.tooling) 64 | debugImplementation(libs.compose.ui.test.manifest) 65 | implementation(libs.lifecycle.viewmodel) 66 | implementation(libs.lifecycle.viewmodel.compose) 67 | implementation(libs.lifecycle.runtime.compose) 68 | implementation(libs.hilt.navigation.compose) 69 | implementation(libs.hilt.android) 70 | kapt(libs.hilt.compiler) 71 | } 72 | -------------------------------------------------------------------------------- /deep-links-introduction/solution/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 -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/release/app-release.aab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/release/app-release.aab -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | 32 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/java/com/devrel/deeplinksbasics/DeepLinksBasicsApplication.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics 18 | 19 | import android.app.Application 20 | import dagger.hilt.android.HiltAndroidApp 21 | 22 | @HiltAndroidApp 23 | class DeepLinksBasicsApplication : Application() {} -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/java/com/devrel/deeplinksbasics/MainActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics 18 | 19 | import android.os.Bundle 20 | import androidx.activity.ComponentActivity 21 | import androidx.activity.compose.setContent 22 | import androidx.compose.foundation.layout.fillMaxSize 23 | import androidx.compose.material.MaterialTheme 24 | import androidx.compose.material.Surface 25 | import androidx.compose.ui.Modifier 26 | import com.devrel.deeplinksbasics.ui.RestaurantApp 27 | import com.devrel.deeplinksbasics.ui.theme.DeepLinksBasicsTheme 28 | import dagger.hilt.android.AndroidEntryPoint 29 | 30 | @AndroidEntryPoint 31 | class MainActivity : ComponentActivity() { 32 | override fun onCreate(savedInstanceState: Bundle?) { 33 | super.onCreate(savedInstanceState) 34 | setContent { 35 | DeepLinksBasicsTheme { 36 | Surface( 37 | modifier = Modifier.fillMaxSize(), 38 | color = MaterialTheme.colors.background 39 | ) { 40 | RestaurantApp() 41 | } 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/java/com/devrel/deeplinksbasics/data/Restaurant.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.data 18 | 19 | import androidx.annotation.DrawableRes 20 | import androidx.compose.runtime.Immutable 21 | 22 | @Immutable 23 | data class Restaurant( 24 | val id: Int = -1, 25 | val name: String = "", 26 | val address: String = "", 27 | val type: String = "", 28 | val website: String = "", 29 | @DrawableRes val drawable: Int = -1 30 | ) -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/java/com/devrel/deeplinksbasics/data/RestaurantLocalDataSource.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.data 18 | 19 | import com.devrel.deeplinksbasics.R 20 | import javax.inject.Inject 21 | import javax.inject.Singleton 22 | 23 | @Singleton 24 | class RestaurantLocalDataSource @Inject constructor() { 25 | val restaurantList = listOf( 26 | Restaurant( 27 | id = 1, 28 | name = "Pawtato", 29 | address = "3140 Skinner Hollow Road, Medford, Oregon 97501", 30 | type = "Potato and gnochi", 31 | website = "https://sabs-deeplinks-test.web.app/restaurants/pawtato/", 32 | drawable = R.drawable.restaurant1, 33 | ), 34 | Restaurant( 35 | id = 2, 36 | name = "Rawrbucha", 37 | address = "2064 Carriage Lane, Mansfield, Ohio 44907", 38 | type = "Kombucha", 39 | website = "https://sabs-deeplinks-test.web.app/restaurants/rawrbucha/", 40 | drawable = R.drawable.restaurant2, 41 | ), 42 | Restaurant( 43 | id = 3, 44 | name = "Pizzabus", 45 | address = "1447 Davis Avenue, Petaluma, California 94952", 46 | type = "Pizza", 47 | website = "https://sabs-deeplinks-test.web.app/restaurants/pizzabus/", 48 | drawable = R.drawable.restaurant3, 49 | ), 50 | Restaurant( 51 | id = 4, 52 | name = "Keybabs", 53 | address = "3708 Pinnickinnick Street, Perth Amboy, New Jersey 08861", 54 | type = "Kebabs", 55 | website = "https://sabs-deeplinks-test.web.app/restaurants/keybabs/", 56 | drawable = R.drawable.restaurant4, 57 | ), 58 | Restaurant( 59 | id = 5, 60 | name = "BBQ", 61 | address = "998 Newton Street, Saint Cloud, Minnesota 56301", 62 | type = "BBQ", 63 | website = "https://sabs-deeplinks-test.web.app/restaurants/bbq/", 64 | drawable = R.drawable.restaurant5, 65 | ), 66 | Restaurant( 67 | id = 6, 68 | name = "Salades", 69 | address = "4522 Rockford Mountain Lane, Oshkosh, Wisconsin 54901", 70 | type = "salads", 71 | website = "https://sabs-deeplinks-test.web.app/restaurants/salades/", 72 | drawable = R.drawable.restaurant6, 73 | ), 74 | Restaurant( 75 | id = 7, 76 | name = "Gyros and moar", 77 | address = "1993 Bird Spring Lane, Houston, Texas 77077", 78 | type = "Gyro", 79 | website = "https://sabs-deeplinks-test.web.app/restaurants/gyrosAndMoar/", 80 | drawable = R.drawable.restaurant7, 81 | ), 82 | Restaurant( 83 | id = 8, 84 | name = "Peruvian ceviche", 85 | address = "2125 Deer Ridge Drive, Newark, New Jersey 07102", 86 | type = "seafood", 87 | website = "https://sabs-deeplinks-test.web.app/restaurants/peruvianCeviche/", 88 | drawable = R.drawable.restaurant8, 89 | ), 90 | Restaurant( 91 | id = 9, 92 | name = "Vegan burgers", 93 | address = "594 Warner Street, Casper, Wyoming 82601", 94 | type = "vegan", 95 | website = "https://sabs-deeplinks-test.web.app/restaurants/veganBurgers/", 96 | drawable = R.drawable.restaurant9, 97 | ), 98 | Restaurant( 99 | id = 10, 100 | name = "Taquitos", 101 | address = "1654 Hart Country Lane, Blue Ridge, Georgia 30513", 102 | type = "mexican", 103 | website = "https://sabs-deeplinks-test.web.app/restaurants/taquitos/", 104 | drawable = R.drawable.restaurant10, 105 | ), 106 | ) 107 | } -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/java/com/devrel/deeplinksbasics/data/RestaurantRepository.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.data 18 | 19 | import javax.inject.Inject 20 | 21 | class RestaurantRepository @Inject constructor( 22 | private val restaurantLocalDataSource: RestaurantLocalDataSource 23 | ){ 24 | val restaurants: List = restaurantLocalDataSource.restaurantList 25 | 26 | // Method to obtain a restaurant object by its name 27 | fun getRestaurantByName(name: String): Restaurant ? { 28 | return restaurantLocalDataSource.restaurantList.find { 29 | val processedName = it.name.filterNot { it.isWhitespace() }.lowercase() 30 | val nameToTest = name.filterNot { it.isWhitespace() }.lowercase() 31 | nameToTest == processedName 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/java/com/devrel/deeplinksbasics/ui/RestaurantApp.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.ui 18 | 19 | import androidx.compose.runtime.Composable 20 | import androidx.compose.runtime.LaunchedEffect 21 | import androidx.compose.runtime.collectAsState 22 | import androidx.compose.runtime.getValue 23 | import androidx.lifecycle.compose.collectAsStateWithLifecycle 24 | import androidx.lifecycle.viewmodel.compose.viewModel 25 | import androidx.navigation.NavType 26 | import androidx.navigation.compose.NavHost 27 | import androidx.navigation.compose.composable 28 | import androidx.navigation.navArgument 29 | import androidx.navigation.navDeepLink 30 | import com.devrel.deeplinksbasics.ui.restaurant.RestaurantViewModel 31 | 32 | /** 33 | * This is the main composable app. It handles the general app logic such as navigation, 34 | * state management and UI logic 35 | * 36 | * @property viewModel Handles the data layer, such as the restaurants to be displayed 37 | * @property appState UI state holder class for the Restaurant Composable. This will handle 38 | * UI navigation state. 39 | */ 40 | @Composable 41 | fun RestaurantApp( 42 | viewModel: RestaurantViewModel = viewModel(), 43 | appState: RestaurantAppState = rememberRestaurantAppState(), 44 | ) { 45 | val selectedRestaurant by viewModel.selectedRestaurant.collectAsStateWithLifecycle() 46 | val onRestaurantSelected: (String) -> Unit = { viewModel.updateSelectedRestaurantByName(it) } 47 | 48 | NavHost( 49 | navController = appState.navController, 50 | startDestination = Screen.Grid.route, 51 | ) { 52 | 53 | // Default route that points to the restaurant grid 54 | composable(Screen.Grid.route) { 55 | RestaurantGrid( 56 | restaurants = viewModel.restaurants, 57 | onRestaurantSelected = onRestaurantSelected, 58 | navigateToRestaurant = { restaurantName -> 59 | appState.navigateToRestaurant(restaurantName) 60 | }, 61 | ) 62 | } 63 | 64 | // Route for the navigation to a particular restaurant when a user clicks on it 65 | // and for an incoming deep link 66 | composable(Screen.Name.route, 67 | deepLinks = listOf( 68 | navDeepLink { uriPattern = "https://sabs-deeplinks-test.web.app/restaurants/{name}" } 69 | ), 70 | arguments = listOf( 71 | navArgument("name") { 72 | type = NavType.StringType 73 | } 74 | ) 75 | ) { entry -> 76 | val restaurantName = entry.arguments?.getString("name") 77 | if (restaurantName != null) { 78 | LaunchedEffect(restaurantName) { 79 | viewModel.updateSelectedRestaurantByName(restaurantName) 80 | } 81 | } 82 | 83 | if (selectedRestaurant != null) { 84 | RestaurantCardDetails( 85 | restaurant = selectedRestaurant!!, 86 | onBack = appState::navigateBack 87 | ) 88 | } 89 | } 90 | } 91 | } -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/java/com/devrel/deeplinksbasics/ui/RestaurantAppState.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.ui 18 | 19 | import androidx.compose.runtime.Composable 20 | import androidx.compose.runtime.remember 21 | import androidx.navigation.NavHostController 22 | import androidx.navigation.compose.rememberNavController 23 | 24 | sealed class Screen(val route: String) { 25 | object Grid : Screen("restaurants") 26 | object Name : Screen("restaurants/{name}") { 27 | fun createRoute(name: String) = "restaurants/$name" 28 | } 29 | object DeepLink : Screen("deeplink") 30 | } 31 | 32 | @Composable 33 | fun rememberRestaurantAppState( 34 | navController: NavHostController = rememberNavController(), 35 | ) = remember(navController) { 36 | RestaurantAppState(navController) 37 | } 38 | 39 | class RestaurantAppState( 40 | val navController: NavHostController, 41 | ) { 42 | fun navigateToRestaurant(restaurantName: String) { 43 | navController.navigate(Screen.Name.createRoute(restaurantName)) 44 | } 45 | 46 | fun navigateBack() { 47 | navController.popBackStack() 48 | } 49 | } -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/java/com/devrel/deeplinksbasics/ui/RestaurantCardDetails.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.ui 18 | 19 | import androidx.activity.compose.BackHandler 20 | import androidx.compose.foundation.Image 21 | import androidx.compose.foundation.clickable 22 | import androidx.compose.foundation.layout.Arrangement 23 | import androidx.compose.foundation.layout.Column 24 | import androidx.compose.foundation.layout.Row 25 | import androidx.compose.foundation.layout.Spacer 26 | import androidx.compose.foundation.layout.fillMaxWidth 27 | import androidx.compose.foundation.layout.padding 28 | import androidx.compose.foundation.layout.width 29 | import androidx.compose.foundation.shape.CornerSize 30 | import androidx.compose.foundation.shape.RoundedCornerShape 31 | import androidx.compose.foundation.text.selection.SelectionContainer 32 | import androidx.compose.material.Card 33 | import androidx.compose.material.Icon 34 | import androidx.compose.material.MaterialTheme 35 | import androidx.compose.material.Scaffold 36 | import androidx.compose.material.Text 37 | import androidx.compose.material.TopAppBar 38 | import androidx.compose.material.icons.Icons 39 | import androidx.compose.material.icons.filled.ArrowBack 40 | import androidx.compose.runtime.Composable 41 | import androidx.compose.ui.Modifier 42 | import androidx.compose.ui.graphics.Color 43 | import androidx.compose.ui.res.painterResource 44 | import androidx.compose.ui.unit.dp 45 | import com.devrel.deeplinksbasics.data.Restaurant 46 | 47 | @Composable 48 | fun RestaurantCardDetails ( 49 | restaurant: Restaurant, 50 | onBack: () -> Unit, 51 | modifier: Modifier = Modifier 52 | ) { 53 | BackHandler() { 54 | onBack() 55 | } 56 | Scaffold( 57 | topBar = { 58 | TopAppBar( 59 | backgroundColor = Color.Transparent, 60 | elevation = 0.dp, 61 | ) { 62 | Row( 63 | horizontalArrangement = Arrangement.Start, 64 | modifier = modifier.padding(start = 8.dp) 65 | ) { 66 | Icon( 67 | imageVector = Icons.Default.ArrowBack, 68 | contentDescription = "Arrow Back", 69 | modifier = modifier.clickable { 70 | onBack() 71 | } 72 | ) 73 | Spacer(modifier = modifier.width(8.dp)) 74 | Text(text = restaurant.name) 75 | } 76 | } 77 | } 78 | ) { paddingValues -> 79 | Card( 80 | modifier = modifier 81 | .padding(paddingValues) 82 | .fillMaxWidth(), 83 | elevation = 2.dp, 84 | shape = RoundedCornerShape(corner = CornerSize(8.dp)) 85 | ) { 86 | Column( 87 | modifier = modifier 88 | .padding(16.dp) 89 | .fillMaxWidth() 90 | ) { 91 | Text(text = restaurant.name, style = MaterialTheme.typography.h6) 92 | Text(text = restaurant.type, style = MaterialTheme.typography.caption) 93 | Text(text = restaurant.address, style = MaterialTheme.typography.caption) 94 | SelectionContainer { 95 | Text(text = restaurant.website, style = MaterialTheme.typography.caption) 96 | } 97 | Image(painter = painterResource(id = restaurant.drawable), contentDescription = "${restaurant.name}") 98 | } 99 | } 100 | } 101 | } -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/java/com/devrel/deeplinksbasics/ui/RestaurantCell.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.ui 18 | 19 | import androidx.compose.foundation.Image 20 | import androidx.compose.foundation.layout.Column 21 | import androidx.compose.foundation.layout.fillMaxWidth 22 | import androidx.compose.foundation.layout.padding 23 | import androidx.compose.foundation.shape.CornerSize 24 | import androidx.compose.foundation.shape.RoundedCornerShape 25 | import androidx.compose.material.Card 26 | import androidx.compose.material.MaterialTheme 27 | import androidx.compose.material.Text 28 | import androidx.compose.runtime.Composable 29 | import androidx.compose.ui.Modifier 30 | import androidx.compose.ui.res.painterResource 31 | import androidx.compose.ui.unit.dp 32 | import com.devrel.deeplinksbasics.data.Restaurant 33 | 34 | @Composable 35 | fun RestaurantCell( 36 | restaurant: Restaurant, 37 | modifier: Modifier = Modifier 38 | ){ 39 | Card( 40 | modifier = modifier 41 | .padding(horizontal = 8.dp, vertical = 8.dp) 42 | .fillMaxWidth(), 43 | elevation = 2.dp, 44 | shape = RoundedCornerShape(corner = CornerSize(8.dp)) 45 | ) { 46 | Column( 47 | modifier = modifier 48 | .padding(16.dp) 49 | .fillMaxWidth() 50 | ) { 51 | Text(text = restaurant.name, style = MaterialTheme.typography.h6) 52 | Text(text = restaurant.address, style = MaterialTheme.typography.caption) 53 | Image(painter = painterResource(id = restaurant.drawable), contentDescription = restaurant.name) 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/java/com/devrel/deeplinksbasics/ui/RestaurantGrid.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.ui 18 | 19 | import androidx.compose.foundation.clickable 20 | import androidx.compose.foundation.layout.Column 21 | import androidx.compose.foundation.layout.fillMaxWidth 22 | import androidx.compose.foundation.layout.padding 23 | import androidx.compose.foundation.lazy.grid.GridCells 24 | import androidx.compose.foundation.lazy.grid.LazyVerticalGrid 25 | import androidx.compose.foundation.lazy.grid.items 26 | import androidx.compose.material.Scaffold 27 | import androidx.compose.material.Text 28 | import androidx.compose.material.TopAppBar 29 | import androidx.compose.runtime.Composable 30 | import androidx.compose.ui.Modifier 31 | import androidx.compose.ui.graphics.Color 32 | import androidx.compose.ui.text.font.FontWeight 33 | import androidx.compose.ui.unit.dp 34 | import com.devrel.deeplinksbasics.data.Restaurant 35 | 36 | @Composable 37 | fun RestaurantGrid( 38 | restaurants: List, 39 | onRestaurantSelected: (String) -> Unit, 40 | navigateToRestaurant: (String) -> Unit, 41 | modifier: Modifier = Modifier 42 | ) { 43 | Scaffold(topBar = { 44 | TopAppBar( 45 | backgroundColor = Color.Transparent, 46 | elevation = 0.dp, 47 | ) { 48 | Text(text = "Restaurants", fontWeight = FontWeight.Bold) 49 | } 50 | }) { paddingValues -> 51 | LazyVerticalGrid( 52 | columns = GridCells.Adaptive(minSize = 200.dp), 53 | modifier = modifier.padding(paddingValues) 54 | ) { 55 | items(items = restaurants) { restaurant -> 56 | Column( 57 | modifier = modifier 58 | .fillMaxWidth() 59 | .clickable(onClick = { 60 | onRestaurantSelected(restaurant.name) 61 | navigateToRestaurant(restaurant.name) 62 | }) 63 | ) { 64 | RestaurantCell(restaurant) 65 | } 66 | } 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/java/com/devrel/deeplinksbasics/ui/restaurant/RestaurantViewModel.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.ui.restaurant 18 | 19 | import androidx.lifecycle.ViewModel 20 | import androidx.lifecycle.viewModelScope 21 | import com.devrel.deeplinksbasics.data.Restaurant 22 | import com.devrel.deeplinksbasics.data.RestaurantRepository 23 | import dagger.hilt.android.lifecycle.HiltViewModel 24 | import kotlinx.coroutines.flow.MutableStateFlow 25 | import kotlinx.coroutines.flow.StateFlow 26 | import kotlinx.coroutines.launch 27 | import javax.inject.Inject 28 | 29 | @HiltViewModel 30 | class RestaurantViewModel @Inject constructor( 31 | private val restaurantRepository: RestaurantRepository, 32 | ) : ViewModel() { 33 | // restaurants and selected restaurant could be used as one UIState stream 34 | // which will scale better when exposing more data. 35 | // Since there are only these two, it is okay to expose them as separate streams 36 | val restaurants: List = restaurantRepository.restaurants 37 | 38 | private val _selectedRestaurant = MutableStateFlow(value = null) 39 | val selectedRestaurant: StateFlow 40 | get() = _selectedRestaurant 41 | 42 | // Method to update the current restaurant selection 43 | fun updateSelectedRestaurantByName(name: String) { 44 | viewModelScope.launch { 45 | val selectedRestaurant: Restaurant? = restaurantRepository.getRestaurantByName(name) 46 | if (selectedRestaurant != null) { 47 | _selectedRestaurant.value = selectedRestaurant 48 | } 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/java/com/devrel/deeplinksbasics/ui/theme/Color.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.ui.theme 18 | 19 | import androidx.compose.ui.graphics.Color 20 | 21 | val Purple200 = Color(0xFFBB86FC) 22 | val Purple500 = Color(0xFF6200EE) 23 | val Purple700 = Color(0xFF3700B3) 24 | val Teal200 = Color(0xFF03DAC5) -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/java/com/devrel/deeplinksbasics/ui/theme/Shape.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.ui.theme 18 | 19 | import androidx.compose.foundation.shape.RoundedCornerShape 20 | import androidx.compose.material.Shapes 21 | import androidx.compose.ui.unit.dp 22 | 23 | val Shapes = Shapes( 24 | small = RoundedCornerShape(4.dp), 25 | medium = RoundedCornerShape(4.dp), 26 | large = RoundedCornerShape(0.dp) 27 | ) -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/java/com/devrel/deeplinksbasics/ui/theme/Theme.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.ui.theme 18 | 19 | import androidx.compose.foundation.isSystemInDarkTheme 20 | import androidx.compose.material.MaterialTheme 21 | import androidx.compose.material.darkColors 22 | import androidx.compose.material.lightColors 23 | import androidx.compose.runtime.Composable 24 | 25 | private val DarkColorPalette = darkColors( 26 | primary = Purple200, 27 | primaryVariant = Purple700, 28 | secondary = Teal200 29 | ) 30 | 31 | private val LightColorPalette = lightColors( 32 | primary = Purple500, 33 | primaryVariant = Purple700, 34 | secondary = Teal200 35 | 36 | /* Other default colors to override 37 | background = Color.White, 38 | surface = Color.White, 39 | onPrimary = Color.White, 40 | onSecondary = Color.Black, 41 | onBackground = Color.Black, 42 | onSurface = Color.Black, 43 | */ 44 | ) 45 | 46 | @Composable 47 | fun DeepLinksBasicsTheme( 48 | darkTheme: Boolean = isSystemInDarkTheme(), 49 | content: @Composable () -> Unit 50 | ) { 51 | val colors = if (darkTheme) { 52 | DarkColorPalette 53 | } else { 54 | LightColorPalette 55 | } 56 | 57 | MaterialTheme( 58 | colors = colors, 59 | typography = Typography, 60 | shapes = Shapes, 61 | content = content 62 | ) 63 | } -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/java/com/devrel/deeplinksbasics/ui/theme/Type.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 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.devrel.deeplinksbasics.ui.theme 18 | 19 | import androidx.compose.material.Typography 20 | import androidx.compose.ui.text.TextStyle 21 | import androidx.compose.ui.text.font.FontFamily 22 | import androidx.compose.ui.text.font.FontWeight 23 | import androidx.compose.ui.unit.sp 24 | 25 | // Set of Material typography styles to start with 26 | val Typography = Typography( 27 | body1 = TextStyle( 28 | fontFamily = FontFamily.Default, 29 | fontWeight = FontWeight.Normal, 30 | fontSize = 16.sp 31 | ) 32 | /* Other default text styles to override 33 | button = TextStyle( 34 | fontFamily = FontFamily.Default, 35 | fontWeight = FontWeight.W500, 36 | fontSize = 14.sp 37 | ), 38 | caption = TextStyle( 39 | fontFamily = FontFamily.Default, 40 | fontWeight = FontWeight.Normal, 41 | fontSize = 12.sp 42 | ) 43 | */ 44 | ) -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 24 | 25 | 31 | 34 | 37 | 38 | 39 | 40 | 46 | -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 26 | 31 | 36 | 41 | 46 | 51 | 56 | 61 | 66 | 71 | 76 | 81 | 86 | 91 | 96 | 101 | 106 | 111 | 116 | 121 | 126 | 131 | 136 | 141 | 146 | 151 | 156 | 161 | 166 | 171 | 176 | 181 | 186 | 187 | -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/drawable/restaurant1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/src/main/res/drawable/restaurant1.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/drawable/restaurant10.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/src/main/res/drawable/restaurant10.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/drawable/restaurant2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/src/main/res/drawable/restaurant2.jpg -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/drawable/restaurant3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/src/main/res/drawable/restaurant3.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/drawable/restaurant4.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/src/main/res/drawable/restaurant4.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/drawable/restaurant5.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/src/main/res/drawable/restaurant5.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/drawable/restaurant6.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/src/main/res/drawable/restaurant6.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/drawable/restaurant7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/src/main/res/drawable/restaurant7.jpg -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/drawable/restaurant8.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/src/main/res/drawable/restaurant8.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/drawable/restaurant9.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/src/main/res/drawable/restaurant9.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/mipmap-hdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/src/main/res/mipmap-hdpi/ic_launcher.webp -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/mipmap-mdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/src/main/res/mipmap-mdpi/ic_launcher.webp -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/mipmap-xhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/src/main/res/mipmap-xhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | #FFBB86FC 20 | #FF6200EE 21 | #FF3700B3 22 | #FF03DAC5 23 | #FF018786 24 | #FF000000 25 | #FFFFFFFF 26 | -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | Deep Links Basics 19 | -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/xml/backup_rules.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 24 | 25 | 29 | -------------------------------------------------------------------------------- /deep-links-introduction/solution/app/src/main/res/xml/data_extraction_rules.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 23 | 24 | 28 | 29 | 35 | -------------------------------------------------------------------------------- /deep-links-introduction/solution/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | dependencies { 3 | classpath "com.google.dagger:hilt-android-gradle-plugin:2.43" 4 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20" 5 | } 6 | }// Top-level build file where you can add configuration options common to all sub-projects/modules. 7 | plugins { 8 | id 'com.android.application' version '7.4.1' apply false 9 | id 'com.android.library' version '7.4.1' apply false 10 | id 'org.jetbrains.kotlin.android' version '1.8.10' apply false 11 | } -------------------------------------------------------------------------------- /deep-links-introduction/solution/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 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 | # Project-wide Gradle settings. 18 | # IDE (e.g. Android Studio) users: 19 | # Gradle settings configured through the IDE *will override* 20 | # any settings specified in this file. 21 | # For more details on how to configure your build environment visit 22 | # http://www.gradle.org/docs/current/userguide/build_environment.html 23 | # Specifies the JVM arguments used for the daemon process. 24 | # The setting is particularly useful for tweaking memory settings. 25 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 26 | # When configured, Gradle will run in incubating parallel mode. 27 | # This option should only be used with decoupled projects. More details, visit 28 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 29 | # org.gradle.parallel=true 30 | # AndroidX package structure to make it clearer which packages are bundled with the 31 | # Android operating system, and which are packaged with your app's APK 32 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 33 | android.useAndroidX=true 34 | # Kotlin code style for this project: "official" or "obsolete": 35 | kotlin.code.style=official 36 | # Enables namespacing of each library's R class so that its R class includes only the 37 | # resources declared in the library itself and none from the library's dependencies, 38 | # thereby reducing the size of the R class for that library 39 | android.nonTransitiveRClass=true -------------------------------------------------------------------------------- /deep-links-introduction/solution/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/solution/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /deep-links-introduction/solution/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 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 | #Mon Dec 12 09:13:52 CST 2022 18 | distributionBase=GRADLE_USER_HOME 19 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip 20 | distributionPath=wrapper/dists 21 | zipStorePath=wrapper/dists 22 | zipStoreBase=GRADLE_USER_HOME 23 | -------------------------------------------------------------------------------- /deep-links-introduction/solution/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /deep-links-introduction/solution/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /deep-links-introduction/solution/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | google() 5 | mavenCentral() 6 | } 7 | } 8 | dependencyResolutionManagement { 9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 10 | repositories { 11 | google() 12 | mavenCentral() 13 | } 14 | versionCatalogs { 15 | libs { 16 | version('compose', '1.2.1') 17 | library('compose-ui', 'androidx.compose.ui', 'ui').versionRef('compose') 18 | library('compose-ui-test', 'androidx.compose.ui', 'ui-test-junit4').versionRef('compose') 19 | library('compose-ui-tooling', 'androidx.compose.ui', 'ui-tooling').versionRef('compose') 20 | library('compose-ui-tooling-preview', 'androidx.compose.ui', 'ui-tooling-preview').versionRef('compose') 21 | library('compose-ui-test-manifest', 'androidx.compose.ui', 'ui-test-manifest').versionRef('compose') 22 | library('android-core', 'androidx.core:core-ktx:1.7.0') 23 | library('compose-material', 'androidx.compose.material:material:1.2.1') 24 | library('activity-compose', 'androidx.activity:activity-compose:1.3.1') 25 | library('lifecycle-viewmodel', 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1') 26 | library('lifecycle-viewmodel-compose', 'androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1') 27 | library('lifecycle-runtime-compose', 'androidx.lifecycle:lifecycle-runtime-compose:2.6.0-beta01') 28 | library('lifecycle-runtime', 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1') 29 | library('hilt-android', 'com.google.dagger:hilt-android:2.43') 30 | library('hilt-compiler', 'com.google.dagger:hilt-compiler:2.43') 31 | library('hilt-navigation-compose', 'androidx.hilt:hilt-navigation-compose:1.0.0') 32 | library('junit', 'junit:junit:4.13.2') 33 | library('test-junit', 'androidx.test.ext:junit:1.1.4') 34 | library('test-expresso-core', 'androidx.test.espresso:espresso-core:3.5.0') 35 | } 36 | } 37 | } 38 | rootProject.name = "Deep Links Basics" 39 | include ':app' 40 | -------------------------------------------------------------------------------- /deep-links-introduction/website/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "hosting": { 3 | "public": "public", 4 | "ignore": [ 5 | "firebase.json", 6 | "**/.*", 7 | "**/node_modules/**" 8 | ] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /deep-links-introduction/website/public/.well-known/assetlinks.json: -------------------------------------------------------------------------------- 1 | [{ 2 | "relation": ["delegate_permission/common.handle_all_urls"], 3 | "target": { 4 | "namespace": "android_app", 5 | "package_name": "com.devrel.deeplinksbasics", 6 | "sha256_cert_fingerprints": 7 | ["B0:4E:29:05:4E:AB:44:C6:9A:CB:D5:89:A3:A8:1C:FF:09:6B:45:00:C5:FD:D1:3E:3E:12:C5:F3:FB:BD:BA:D3", 8 | "D4:BC:56:A9:59:7A:7A:4F:2E:1A:88:44:72:AB:5E:51:A9:22:53:6E:76:FF:EC:47:91:96:6A:42:40:E6:11:DF" 9 | ] 10 | } 11 | }] 12 | -------------------------------------------------------------------------------- /deep-links-introduction/website/public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Page Not Found 7 | 8 | 23 | 24 | 25 |
26 |

404

27 |

Page Not Found

28 |

The specified file was not found on this website. Please check the URL for mistakes and try again.

29 |

Why am I seeing this?

30 |

This page was generated by the Firebase Command-Line Interface. To modify it, edit the 404.html file in your project's configured public directory.

31 |
32 | 33 | 34 | -------------------------------------------------------------------------------- /deep-links-introduction/website/public/images/restaurant1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/website/public/images/restaurant1.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/website/public/images/restaurant10.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/website/public/images/restaurant10.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/website/public/images/restaurant2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/website/public/images/restaurant2.jpg -------------------------------------------------------------------------------- /deep-links-introduction/website/public/images/restaurant3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/website/public/images/restaurant3.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/website/public/images/restaurant4.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/website/public/images/restaurant4.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/website/public/images/restaurant5.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/website/public/images/restaurant5.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/website/public/images/restaurant6.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/website/public/images/restaurant6.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/website/public/images/restaurant7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/website/public/images/restaurant7.jpg -------------------------------------------------------------------------------- /deep-links-introduction/website/public/images/restaurant8.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/website/public/images/restaurant8.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/website/public/images/restaurant9.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/deep-links/d94c9970410b1d0d053e7ee54c96e5beb6b57454/deep-links-introduction/website/public/images/restaurant9.jpeg -------------------------------------------------------------------------------- /deep-links-introduction/website/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 34 | 35 | 36 |

Restaurant List

37 | 38 |
    39 |
  • 40 |
    Pawtato
    41 |
    42 |

    3140 Skinner Hollow Road

    43 |

    Medford, Oregon

    44 |

    Phone: 541-774-1680

    45 |

    Type: Potato and gnochi

    46 | Website 47 |
    48 |
  • 49 |
  • 50 |
    Rawrbucha
    51 |
    52 |

    2064 Carriage Lane,

    53 |

    Mansfield, Ohio

    54 |

    Phone: 567-876-0309

    55 |

    Type: Kombucha

    56 | Website 57 |
    58 |
  • 59 |
  • 60 |
    Pizzabus
    61 |
    62 |

    1447 Davis Avenue

    63 |

    Petaluma, California

    64 |

    Phone: 707-763-4223

    65 |

    Type: Pizza

    66 | Website 67 |
    68 |
  • 69 |
  • 70 |
    Gyros and moar
    71 |
    72 |

    1993 Bird Spring Lane

    73 |

    Houston, Texas

    74 |

    Phone: 281-544-3812

    75 |

    Type: gyro

    76 | Website 77 |
    78 |
  • 79 |
  • 80 |
    Keybabs
    81 |
    82 |

    3708 Pinnickinnick Street

    83 |

    New Jersey

    84 |

    Phone: 732-826-7403

    85 |

    Type: Kebab

    86 | Website 87 |
    88 |
  • 89 |
  • 90 |
    BBQ
    91 |
    92 |

    98 Newton Street

    93 |

    Saint Cloud, Minnesota

    94 |

    Phone: 320-321-4333

    95 |

    Type: BBQ

    96 | Website 97 |
    98 |
  • 99 |
  • 100 |
    Salades
    101 |
    102 |

    4522 Rockford Mountain Lane

    103 |

    Oshkosh, Wisconsin

    104 |

    Phone: 920-235-9864

    105 |

    Type: Salads

    106 | Website 107 |
    108 |
  • 109 |
  • 110 |
    Peruvian Ceviche
    111 |
    112 |

    2125 Deer Rigde Drive

    113 |

    Newark, New Jersek

    114 |

    Phone: 973-607-1930

    115 |

    Type: seafood

    116 | Website 117 |
    118 |
  • 119 |
  • 120 |
    Vegan Burgers
    121 |
    122 |

    594 Warner Street

    123 |

    Casper, Wyoming

    124 |

    Phone: 307-209-5849

    125 |

    Type: seafood

    126 | Website 127 |
    128 |
  • 129 |
  • 130 |
    Taquitos
    131 |
    132 |

    1654 Hart Country Lane

    133 |

    Blue Ridge, Georgia

    134 |

    Phone: 706-632-7120

    135 |

    Type: seafood

    136 | Website 137 |
    138 |
  • 139 |
140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /deep-links-introduction/website/public/restaurants/bbq/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | BBQ Restaurant 4 | 41 | 42 | 43 |
44 | 45 |

Welcome to Pawtato

46 |

We are a BBQ restaurant located in Saint Cloud, Minnesota. Our address is 998 Newton Street and our phone number is 320-321-4333.

47 |
48 |

Address: 998 Newton Street, Saint Cloud, Minnesota 56301

49 |

Phone: 320-321-4333

50 |
51 |
52 | 53 | 54 | -------------------------------------------------------------------------------- /deep-links-introduction/website/public/restaurants/gyrosAndMoar/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Gyros and Moar Restaurant 4 | 41 | 42 | 43 |
44 | 45 |

Welcome to Gyros and Moar

46 |

We are a Gyro restaurant located in Houston, Texas. Our address is 1993 Bird Spring Lane and our phone number is 281-544-3812.

47 |
48 |

Address: 1993 Bird Spring Lane, Houston, Texas 77077

49 |

Phone: 281-544-3812

50 |
51 |
52 | 53 | 54 | -------------------------------------------------------------------------------- /deep-links-introduction/website/public/restaurants/keybabs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Keybabs Restaurant 4 | 41 | 42 | 43 |
44 | 45 |

Welcome to Keybabs

46 |

We are a kebab restaurant located in Perth Amboy, New Jersey. Our address is 3708 Pinnickinnick Street and our phone number is 732-826-7403.

47 |
48 |

Address: 3708 Pinnickinnick Street, Perth Amboy, New Jersey 08861

49 |

Phone: 732-826-7403

50 |
51 |
52 | 53 | 54 | -------------------------------------------------------------------------------- /deep-links-introduction/website/public/restaurants/keybabs/orders/latest.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Keybabs Orders 4 | 41 | 42 | 43 |
44 |

Latest Order

45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
ItemQuantityPrice
Lamb kebab3$15
Olive Salad1$5
Soda2$6
Total$26
71 |
72 | 73 | 74 | -------------------------------------------------------------------------------- /deep-links-introduction/website/public/restaurants/pawtato/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pawtato Restaurant 4 | 41 | 42 | 43 |
44 | 45 |

Welcome to Pawtato

46 |

We are a potato and gnocchi restaurant located in Medford, Oregon. Our address is 3140 Skinner Hollow Road and our phone number is 541-774-1680.

47 |
48 |

Address: 3140 Skinner Hollow Road, Medford, Oregon 97501

49 |

Phone: 541-774-1680

50 |
51 |
52 | 53 | 54 | -------------------------------------------------------------------------------- /deep-links-introduction/website/public/restaurants/peruvianCeviche/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Peruvian Ceviche Restaurant 4 | 41 | 42 | 43 |
44 | 45 |

Welcome to Peruvian Ceviche

46 |

We are a seafood restaurant located in Newark, New Jersey. Our address is 2125 Deer Rigde Drive and our phone number is 973-607-1930.

47 |
48 |

Address: 2125 Deer Rigde Drive, Newark, New Jersey 07102

49 |

Phone: 973-607-1930

50 |
51 |
52 | 53 | 54 | -------------------------------------------------------------------------------- /deep-links-introduction/website/public/restaurants/pizzabus/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pizzabus Restaurant 4 | 41 | 42 | 43 |
44 | 45 |

Welcome to Pizzabus

46 |

We are a Pizza restaurant located in Petaluma, California. Our address is 1447 Davis Avenue and our phone number is 707-763-4223.

47 |
48 |

Address: 1447 Davis Avenue, Petaluma, California 94952

49 |

Phone: 707-763-4223

50 |
51 |
52 | 53 | 54 | -------------------------------------------------------------------------------- /deep-links-introduction/website/public/restaurants/rawrbucha/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Rawrbucha Restaurant 4 | 41 | 42 | 43 |
44 | 45 |

Welcome to Rawrbucha

46 |

We are a kombucha restaurant located in Mansfield, Ohio. Our address is 2064 Carriage Lane and our phone number is 567-876-0309.

47 |
48 |

Address: 2064 Carriage Lane, Mansfield, Ohio 44907

49 |

Phone: 567-876-0309

50 |
51 |
52 | 53 | 54 | -------------------------------------------------------------------------------- /deep-links-introduction/website/public/restaurants/salades/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Salades Restaurant 4 | 41 | 42 | 43 |
44 | 45 |

Welcome to Salades

46 |

We are a Salads restaurant located in Oshkosh, Wisconsin. Our address is 4522 Rockford Mountain Lane and our phone number is 920-235-9864.

47 |
48 |

Address: 4522 Rockford Mountain Lane, Oshkosh, Wisconsin 54901

49 |

Phone: 920-235-9864

50 |
51 |
52 | 53 | 54 | -------------------------------------------------------------------------------- /deep-links-introduction/website/public/restaurants/taquitos/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Taquitos Restaurant 4 | 41 | 42 | 43 |
44 | 45 |

Welcome to Taquitos

46 |

We are a taqueria located in Blue Ridge, Georgia. Our address is 1654 Hart Country Lane and our phone number is 706-632-7120.

47 |
48 |

Address: 1654 Hart Country Lane, Blue Ridge, Georgia 30513

49 |

Phone: 706-632-7120

50 |
51 |
52 | 53 | 54 | -------------------------------------------------------------------------------- /deep-links-introduction/website/public/restaurants/taquitos/orders/latest.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Taquito Orders 4 | 41 | 42 | 43 |
44 |

Latest Order

45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
ItemQuantityPrice
Carnitas taco3$15
Salad1$5
Soda2$6
Total$26
71 |
72 | 73 | 74 | -------------------------------------------------------------------------------- /deep-links-introduction/website/public/restaurants/veganBurgers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Vegan Burgers Restaurant 4 | 41 | 42 | 43 |
44 | 45 |

Welcome to Vegan Burgers

46 |

We are a vegan restaurant located in Casper, Wyoming. Our address is 594 Warner Street and our phone number is 307-209-5849.

47 |
48 |

Address: 594 Warner Street, Casper, Wyoming 82601

49 |

Phone: 307-209-5849

50 |
51 |
52 | 53 | 54 | --------------------------------------------------------------------------------