├── settings.gradle ├── debug.keystore ├── results ├── video.mp4 ├── screenshot_1.png └── screenshot_2.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── app ├── src │ ├── main │ │ ├── res │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── dorkie.jpg │ │ │ │ ├── horgi.jpg │ │ │ │ ├── cavachon.jpg │ │ │ │ ├── eurasier.jpg │ │ │ │ ├── jack_chi.jpg │ │ │ │ ├── kishu_ken.jpg │ │ │ │ ├── terripoo.jpg │ │ │ │ ├── westiepoo.jpg │ │ │ │ ├── bernedoodle.jpg │ │ │ │ ├── otterhound.jpg │ │ │ │ ├── pyredoodle.jpg │ │ │ │ ├── rat_terrier.jpg │ │ │ │ ├── sheepadoodle.jpg │ │ │ │ ├── valley_bulldog.jpg │ │ │ │ ├── alaskan_klee_kai.jpg │ │ │ │ ├── french_bullhuahua.jpg │ │ │ │ ├── lagotto_romagnolo.jpg │ │ │ │ ├── maremma_sheepdog.jpg │ │ │ │ ├── norfolk_terrier.jpg │ │ │ │ ├── icelandic_sheepdog.jpg │ │ │ │ └── golden_retriever_corgi.jpg │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.webp │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.webp │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.webp │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.webp │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.webp │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── themes.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ └── ic_launcher.xml │ │ │ ├── drawable │ │ │ │ ├── ic_back.xml │ │ │ │ └── ic_launcher_background.xml │ │ │ ├── values-night │ │ │ │ └── themes.xml │ │ │ └── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── androiddevchallenge │ │ │ │ ├── ui │ │ │ │ └── theme │ │ │ │ │ ├── Color.kt │ │ │ │ │ ├── Shape.kt │ │ │ │ │ ├── Type.kt │ │ │ │ │ └── Theme.kt │ │ │ │ ├── extension │ │ │ │ └── CustomColor.kt │ │ │ │ ├── model │ │ │ │ └── Dog.kt │ │ │ │ ├── logic │ │ │ │ ├── Repository.kt │ │ │ │ └── DataHelper.kt │ │ │ │ ├── util │ │ │ │ ├── Resource.kt │ │ │ │ └── ServiceLocator.kt │ │ │ │ ├── GlobalApp.kt │ │ │ │ ├── MainViewModelFactory.kt │ │ │ │ ├── BaseActivity.kt │ │ │ │ ├── MainViewModel.kt │ │ │ │ ├── DogDetailActivity.kt │ │ │ │ └── MainActivity.kt │ │ ├── AndroidManifest.xml │ │ └── assets │ │ │ └── dogs.json │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── androiddevchallenge │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── example │ │ └── androiddevchallenge │ │ └── ExampleInstrumentedTest.kt ├── .gitignore ├── proguard-rules.pro └── build.gradle ├── .gitignore ├── spotless └── copyright.kt ├── .github ├── ci-gradle.properties └── workflows │ └── Check.yaml ├── CONTRIBUTING.md ├── gradle.properties ├── README-template.md ├── README.md ├── gradlew.bat ├── gradlew └── LICENSE /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = "AndroidDevChallenge" 2 | include ':app' 3 | -------------------------------------------------------------------------------- /debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/debug.keystore -------------------------------------------------------------------------------- /results/video.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/results/video.mp4 -------------------------------------------------------------------------------- /results/screenshot_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/results/screenshot_1.png -------------------------------------------------------------------------------- /results/screenshot_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/results/screenshot_2.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/dorkie.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/dorkie.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/horgi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/horgi.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/cavachon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/cavachon.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/eurasier.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/eurasier.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/jack_chi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/jack_chi.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/kishu_ken.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/kishu_ken.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/terripoo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/terripoo.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/westiepoo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/westiepoo.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/bernedoodle.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/bernedoodle.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/otterhound.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/otterhound.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/pyredoodle.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/pyredoodle.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/rat_terrier.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/rat_terrier.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/sheepadoodle.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/sheepadoodle.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/valley_bulldog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/valley_bulldog.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/alaskan_klee_kai.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/alaskan_klee_kai.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/french_bullhuahua.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/french_bullhuahua.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/lagotto_romagnolo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/lagotto_romagnolo.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/maremma_sheepdog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/maremma_sheepdog.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/norfolk_terrier.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/norfolk_terrier.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/icelandic_sheepdog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/icelandic_sheepdog.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/golden_retriever_corgi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guolindev/android-dev-challenge-compose/HEAD/app/src/main/res/drawable-xxhdpi/golden_retriever_corgi.jpg -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | # Gradle 2 | .gradle 3 | build/ 4 | 5 | captures 6 | 7 | /local.properties 8 | 9 | # IntelliJ .idea folder 10 | /.idea 11 | *.iml 12 | 13 | # General 14 | .DS_Store 15 | .externalNativeBuild -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Feb 24 18:05:51 CET 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Mac files 6 | .DS_Store 7 | 8 | # files for the dex VM 9 | *.dex 10 | 11 | # Java class files 12 | *.class 13 | 14 | # generated files 15 | bin/ 16 | gen/ 17 | 18 | # Ignore gradle files 19 | .gradle/ 20 | build/ 21 | 22 | # Local configuration file (sdk path, etc) 23 | local.properties 24 | 25 | # Proguard folder generated by Eclipse 26 | proguard/ 27 | proguard-project.txt 28 | 29 | # Eclipse files 30 | .project 31 | .classpath 32 | .settings/ 33 | 34 | # Android Studio/IDEA 35 | *.iml 36 | .idea -------------------------------------------------------------------------------- /spotless/copyright.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright $YEAR 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 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | Puppies Home 13 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /.github/ci-gradle.properties: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Copyright 2020 The Android Open Source Project 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | org.gradle.daemon=false 19 | org.gradle.parallel=true 20 | org.gradle.jvmargs=-Xmx5120m 21 | org.gradle.workers.max=2 22 | 23 | kotlin.incremental=false 24 | kotlin.compiler.execution.strategy=in-process 25 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddevchallenge/ui/theme/Color.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.androiddevchallenge.ui.theme 17 | 18 | import androidx.compose.ui.graphics.Color 19 | 20 | val purple200 = Color(0xFFBB86FC) 21 | val purple500 = Color(0xFF6200EE) 22 | val purple700 = Color(0xFF3700B3) 23 | val teal200 = Color(0xFF03DAC5) 24 | -------------------------------------------------------------------------------- /app/src/test/java/com/example/androiddevchallenge/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.androiddevchallenge 17 | 18 | /** 19 | * Example local unit test, which will execute on the development machine (host). 20 | * 21 | * See [testing documentation](http://d.android.com/tools/testing). 22 | */ 23 | class ExampleUnitTest { 24 | // Add unit tests here 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddevchallenge/extension/CustomColor.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.androiddevchallenge.extension 17 | 18 | import androidx.compose.ui.graphics.Color 19 | 20 | /** 21 | * Color extensions. 22 | * 23 | * @author Lin Guo 24 | * @since 2021/2/27 25 | */ 26 | 27 | val Color.Companion.Shadow: Color 28 | get() { 29 | return Color(0x99000000) 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_back.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 17 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | #FFBB86FC 14 | #FF6200EE 15 | #FF3700B3 16 | #FF03DAC5 17 | #FF018786 18 | #FF000000 19 | #FFFFFFFF 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddevchallenge/ui/theme/Shape.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.androiddevchallenge.ui.theme 17 | 18 | import androidx.compose.foundation.shape.RoundedCornerShape 19 | import androidx.compose.material.Shapes 20 | import androidx.compose.ui.unit.dp 21 | 22 | val shapes = Shapes( 23 | small = RoundedCornerShape(4.dp), 24 | medium = RoundedCornerShape(4.dp), 25 | large = RoundedCornerShape(0.dp) 26 | ) 27 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | 3 | We'd love to accept your patches and contributions to this project. There are 4 | just a few small guidelines you need to follow. 5 | 6 | ## Contributor License Agreement 7 | 8 | Contributions to this project must be accompanied by a Contributor License 9 | Agreement. You (or your employer) retain the copyright to your contribution, 10 | this simply gives us permission to use and redistribute your contributions as 11 | part of the project. Head over to to see 12 | your current agreements on file or to sign a new one. 13 | 14 | You generally only need to submit a CLA once, so if you've already submitted one 15 | (even if it was for a different project), you probably don't need to do it 16 | again. 17 | 18 | ## Code reviews 19 | 20 | All submissions, including submissions by project members, require review. We 21 | use GitHub pull requests for this purpose. Consult 22 | [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more 23 | information on using pull requests. 24 | 25 | ## Community Guidelines 26 | 27 | This project follows [Google's Open Source Community 28 | Guidelines](https://opensource.google.com/conduct/). -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddevchallenge/model/Dog.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.androiddevchallenge.model 17 | 18 | import android.os.Parcelable 19 | import com.google.gson.annotations.SerializedName 20 | import kotlinx.parcelize.Parcelize 21 | 22 | /** 23 | * The model class represents the data in dogs.json. 24 | * 25 | * @author Lin Guo 26 | * @since 2021/2/26 27 | */ 28 | @Parcelize 29 | class Dog( 30 | val name: String, 31 | @SerializedName("avatar_filename") 32 | val avatarFilename: String, 33 | val introduction: String, 34 | var adopted: Boolean 35 | ) : Parcelable 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddevchallenge/logic/Repository.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.androiddevchallenge.logic 17 | 18 | import kotlinx.coroutines.Dispatchers 19 | import kotlinx.coroutines.withContext 20 | 21 | /** 22 | * Repository to communicate with MainViewModel and DataHelper. 23 | * 24 | * @author Lin Guo 25 | * @since 2021/2/26 26 | */ 27 | class Repository(private val dataHelper: DataHelper) { 28 | 29 | /** 30 | * Get the dogs by DataHelper and return them. 31 | */ 32 | suspend fun getDogs() = withContext(Dispatchers.IO) { 33 | dataHelper.getDogs() 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddevchallenge/util/Resource.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.androiddevchallenge.util 17 | 18 | /** 19 | * A generic class that holds a value with its success, error or loading status. 20 | * 21 | * @author Lin Guo 22 | * @since 2021/2/26 23 | */ 24 | data class Resource(val status: Int, val data: T?, val message: String?) { 25 | 26 | companion object { 27 | const val SUCCESS = 0 28 | const val ERROR = 1 29 | const val LOADING = 2 30 | 31 | fun success(data: T) = Resource(SUCCESS, data, null) 32 | fun error(msg: String) = Resource(ERROR, null, msg) 33 | fun loading() = Resource(LOADING, null, null) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddevchallenge/GlobalApp.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.androiddevchallenge 17 | 18 | import android.annotation.SuppressLint 19 | import android.app.Application 20 | import android.content.Context 21 | 22 | /** 23 | * Custom Application class to provide Global application context for the project. 24 | * 25 | * @author Lin Guo 26 | * @since 2021/2/26 27 | */ 28 | class GlobalApp : Application() { 29 | 30 | companion object { 31 | /** 32 | * Global application context. 33 | */ 34 | @SuppressLint("StaticFieldLeak") 35 | lateinit var context: Context 36 | } 37 | 38 | override fun onCreate() { 39 | super.onCreate() 40 | context = applicationContext 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddevchallenge/MainViewModelFactory.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.androiddevchallenge 17 | 18 | import androidx.lifecycle.ViewModel 19 | import androidx.lifecycle.ViewModelProvider 20 | import com.example.androiddevchallenge.util.ServiceLocator 21 | 22 | /** 23 | * The ViewModel Factory to create MainViewModel instance and pass a Repository instance as parameter 24 | * which provided by ServiceLocator. 25 | * 26 | * @author Lin Guo 27 | * @since 2022/2/26 28 | */ 29 | class MainViewModelFactory : ViewModelProvider.Factory { 30 | 31 | @Suppress("UNCHECKED_CAST") 32 | override fun create(modelClass: Class): T { 33 | return MainViewModel(ServiceLocator.provideRepository()) as T 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddevchallenge/util/ServiceLocator.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.androiddevchallenge.util 17 | 18 | import com.example.androiddevchallenge.logic.DataHelper 19 | import com.example.androiddevchallenge.logic.Repository 20 | 21 | /** 22 | * ServiceLocator to provide instances that no one is responsible to create. 23 | * 24 | * @author Lin Guo 25 | * @since 2020/2/26 26 | */ 27 | object ServiceLocator { 28 | 29 | /** 30 | * Provide the Repository instance that ViewModel should depend on. 31 | */ 32 | fun provideRepository() = Repository(provideDataHelper()) 33 | 34 | /** 35 | * Provide the DataHelper instance that Repository should depend on. 36 | */ 37 | private fun provideDataHelper() = DataHelper() 38 | } 39 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/example/androiddevchallenge/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.androiddevchallenge 17 | 18 | import androidx.compose.ui.test.junit4.createAndroidComposeRule 19 | import androidx.test.ext.junit.runners.AndroidJUnit4 20 | import org.junit.Rule 21 | import org.junit.Test 22 | import org.junit.runner.RunWith 23 | 24 | /** 25 | * Instrumented test, which will execute on an Android device. 26 | * 27 | * See [testing documentation](http://d.android.com/tools/testing). 28 | */ 29 | @RunWith(AndroidJUnit4::class) 30 | class ExampleInstrumentedTest { 31 | @get:Rule 32 | val composeTestRule = createAndroidComposeRule() 33 | 34 | @Test 35 | fun sampleTest() { 36 | // Add instrumented tests here 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /README-template.md: -------------------------------------------------------------------------------- 1 | # Put title of your app here 2 | 3 | 4 | 5 | ![Workflow result](https://github.com///workflows/Check/badge.svg) 6 | 7 | 8 | ## :scroll: Description 9 | 10 | 11 | 12 | ## :bulb: Motivation and Context 13 | 14 | 15 | 16 | 17 | ## :camera_flash: Screenshots 18 | 19 | 20 | 21 | ## License 22 | ``` 23 | Copyright 2020 The Android Open Source Project 24 | 25 | Licensed under the Apache License, Version 2.0 (the "License"); 26 | you may not use this file except in compliance with the License. 27 | You may obtain a copy of the License at 28 | 29 | https://www.apache.org/licenses/LICENSE-2.0 30 | 31 | Unless required by applicable law or agreed to in writing, software 32 | distributed under the License is distributed on an "AS IS" BASIS, 33 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 34 | See the License for the specific language governing permissions and 35 | limitations under the License. 36 | ``` -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddevchallenge/ui/theme/Type.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.androiddevchallenge.ui.theme 17 | 18 | import androidx.compose.material.Typography 19 | import androidx.compose.ui.text.TextStyle 20 | import androidx.compose.ui.text.font.FontFamily 21 | import androidx.compose.ui.text.font.FontWeight 22 | import androidx.compose.ui.unit.sp 23 | 24 | // Set of Material typography styles to start with 25 | val typography = Typography( 26 | body1 = TextStyle( 27 | fontFamily = FontFamily.Default, 28 | fontWeight = FontWeight.Normal, 29 | fontSize = 16.sp 30 | ) 31 | /* Other default text styles to override 32 | button = TextStyle( 33 | fontFamily = FontFamily.Default, 34 | fontWeight = FontWeight.W500, 35 | fontSize = 14.sp 36 | ), 37 | caption = TextStyle( 38 | fontFamily = FontFamily.Default, 39 | fontWeight = FontWeight.Normal, 40 | fontSize = 12.sp 41 | ) 42 | */ 43 | ) 44 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddevchallenge/BaseActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.androiddevchallenge 17 | 18 | import android.os.Build 19 | import android.view.View 20 | import android.view.WindowInsetsController 21 | import androidx.appcompat.app.AppCompatActivity 22 | import androidx.core.view.doOnLayout 23 | 24 | open class BaseActivity : AppCompatActivity() { 25 | 26 | /** 27 | * Make status bar always be light mode. 28 | */ 29 | @Suppress("DEPRECATION") 30 | protected fun setStatusBarToLight() { 31 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { 32 | window.decorView.doOnLayout { 33 | it.windowInsetsController?.setSystemBarsAppearance( 34 | WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS, 35 | WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS 36 | ) 37 | } 38 | } else { 39 | window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 15 | 16 | 23 | 26 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Puppies Home 2 | 3 | 4 | 5 | ![Workflow result](https://github.com/guolindev/android-dev-challenge-compose/workflows/Check/badge.svg) 6 | 7 | 8 | ## :scroll: Description 9 | 10 | This is a challenge app for adopting puppies written by Jetpack Compose. 11 | 12 | The app contains an overview screen that displays a list of puppies, and a detail screen showing each puppy's details. 13 | 14 | ## :bulb: Motivation and Context 15 | 16 | 17 | The UI layer is all implemented by Jetpack Compose. This is a simple and clean project for beginners to read and learn. 18 | Also the project included other Jetpack components, so you can learn how Jetpack Compose can work with them as well. 19 | 20 | ## :camera_flash: Screenshots 21 | 22 | 23 | 24 | ## License 25 | ``` 26 | Copyright 2020 The Android Open Source Project 27 | 28 | Licensed under the Apache License, Version 2.0 (the "License"); 29 | you may not use this file except in compliance with the License. 30 | You may obtain a copy of the License at 31 | 32 | https://www.apache.org/licenses/LICENSE-2.0 33 | 34 | Unless required by applicable law or agreed to in writing, software 35 | distributed under the License is distributed on an "AS IS" BASIS, 36 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 37 | See the License for the specific language governing permissions and 38 | limitations under the License. 39 | ``` -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 26 | 27 | 31 | 32 |