diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b52c533 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +# Project exclude paths +/.gradle/ +/app/build/ +/app/build/intermediates/javac/debug/classes/ \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/DessertClicker.iml b/.idea/DessertClicker.iml new file mode 100644 index 0000000..0e2a785 --- /dev/null +++ b/.idea/DessertClicker.iml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..fb7f4a8 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..6960c9e --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..a5f05cd --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_activity_activity_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_activity_activity_1_0_0_aar.xml new file mode 100644 index 0000000..0e0c5cf --- /dev/null +++ b/.idea/libraries/Gradle__androidx_activity_activity_1_0_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0.xml b/.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0.xml new file mode 100644 index 0000000..b2158ac --- /dev/null +++ b/.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_2_0_aar.xml b/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_2_0_aar.xml new file mode 100644 index 0000000..4905b89 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_2_0_aar.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_2_0_aar.xml b/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_2_0_aar.xml new file mode 100644 index 0000000..07c9763 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_2_0_aar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0.xml b/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0.xml new file mode 100644 index 0000000..2208415 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml b/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml new file mode 100644 index 0000000..2ea55ce --- /dev/null +++ b/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_collection_collection_1_1_0.xml b/.idea/libraries/Gradle__androidx_collection_collection_1_1_0.xml new file mode 100644 index 0000000..eafc05e --- /dev/null +++ b/.idea/libraries/Gradle__androidx_collection_collection_1_1_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_2_1_0_alpha2_aar.xml b/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_2_1_0_alpha2_aar.xml new file mode 100644 index 0000000..4dee9e6 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_2_1_0_alpha2_aar.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_core_1_0_0_alpha3.xml b/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_core_1_0_0_alpha3.xml new file mode 100644 index 0000000..b3fdc34 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_core_1_0_0_alpha3.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_core_core_1_3_2_aar.xml b/.idea/libraries/Gradle__androidx_core_core_1_3_2_aar.xml new file mode 100644 index 0000000..64f9ea8 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_core_core_1_3_2_aar.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml new file mode 100644 index 0000000..632ed38 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml new file mode 100644 index 0000000..42ed673 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_databinding_databinding_adapters_4_2_0_beta04_aar.xml b/.idea/libraries/Gradle__androidx_databinding_databinding_adapters_4_2_0_beta04_aar.xml new file mode 100644 index 0000000..1553bed --- /dev/null +++ b/.idea/libraries/Gradle__androidx_databinding_databinding_adapters_4_2_0_beta04_aar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_databinding_databinding_common_4_2_0_beta04.xml b/.idea/libraries/Gradle__androidx_databinding_databinding_common_4_2_0_beta04.xml new file mode 100644 index 0000000..15fb58b --- /dev/null +++ b/.idea/libraries/Gradle__androidx_databinding_databinding_common_4_2_0_beta04.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_databinding_databinding_runtime_4_2_0_beta04_aar.xml b/.idea/libraries/Gradle__androidx_databinding_databinding_runtime_4_2_0_beta04_aar.xml new file mode 100644 index 0000000..c646a0d --- /dev/null +++ b/.idea/libraries/Gradle__androidx_databinding_databinding_runtime_4_2_0_beta04_aar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_databinding_viewbinding_4_2_0_beta04_aar.xml b/.idea/libraries/Gradle__androidx_databinding_viewbinding_4_2_0_beta04_aar.xml new file mode 100644 index 0000000..742c64d --- /dev/null +++ b/.idea/libraries/Gradle__androidx_databinding_viewbinding_4_2_0_beta04_aar.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml new file mode 100644 index 0000000..52d1b70 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_fragment_fragment_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_fragment_fragment_1_1_0_aar.xml new file mode 100644 index 0000000..a7cf7ce --- /dev/null +++ b/.idea/libraries/Gradle__androidx_fragment_fragment_1_1_0_aar.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml new file mode 100644 index 0000000..400c898 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_1_0.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_1_0.xml new file mode 100644 index 0000000..9354d44 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_1_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml new file mode 100644 index 0000000..3a74310 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_0_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_0_0_aar.xml new file mode 100644 index 0000000..86679c7 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_0_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_1_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_1_0_aar.xml new file mode 100644 index 0000000..2bea8ba --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_1_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_1_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_1_0_aar.xml new file mode 100644 index 0000000..560cf73 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_1_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml new file mode 100644 index 0000000..7fd6a4e --- /dev/null +++ b/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_0_0_aar.xml new file mode 100644 index 0000000..20105fd --- /dev/null +++ b/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_0_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml new file mode 100644 index 0000000..c7846c2 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml new file mode 100644 index 0000000..1a338e2 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml new file mode 100644 index 0000000..7194256 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml new file mode 100644 index 0000000..13cbe36 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_jakewharton_timber_timber_4_7_1_aar.xml b/.idea/libraries/Gradle__com_jakewharton_timber_timber_4_7_1_aar.xml new file mode 100644 index 0000000..127aa9b --- /dev/null +++ b/.idea/libraries/Gradle__com_jakewharton_timber_timber_4_7_1_aar.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_16_0_1.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_16_0_1.xml new file mode 100644 index 0000000..6bc426e --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_annotations_16_0_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_4_30.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_4_30.xml new file mode 100644 index 0000000..b00caa1 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_4_30.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_4_30.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_4_30.xml new file mode 100644 index 0000000..94f3642 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_4_30.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk7_1_4_30.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk7_1_4_30.xml new file mode 100644 index 0000000..56c20c3 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk7_1_4_30.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..59f6372 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..1f47e72 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/app/DessertClicker.app.iml b/.idea/modules/app/DessertClicker.app.iml new file mode 100644 index 0000000..162d5bc --- /dev/null +++ b/.idea/modules/app/DessertClicker.app.iml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..797acea --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..fcb6751 --- /dev/null +++ b/README.md @@ -0,0 +1,49 @@ +DessertClicker - Starter Code +============================== + +Starter code for Android Kotlin Fundamentals Codelab 4.1 Lifecycles and logging. + +Introduction +------------ + +DessertClicker is a game about making desserts. Press the button, make a dessert, +earn the big bucks. + +You use this app in the course to explore the Android lifecycle and log messages to +the Android console (Logcat). + +Pre-requisites +-------------- + +You need to know: +- How to open, build, and run apps with Android Studio. +- What an activity is, and how to create one in your app. +- What the activity's onCreate() method does, and the kind of operations + that are performed in that method. +- How to create layouts in your activity, and how to update a layout in runtime. + + +Getting Started +--------------- + +1. Download and run the app. + +License +------- + +Copyright 2019 Google, Inc. + +Licensed to the Apache Software Foundation (ASF) under one or more contributor +license agreements. See the NOTICE file distributed with this work for +additional information regarding copyright ownership. The ASF licenses this +file to you under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..edc1d67 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,50 @@ +/* + * Copyright 2019, The Android Open Source Project + * + * Licensed 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-kapt' + +android { + compileSdkVersion 30 + defaultConfig { + applicationId "com.example.android.dessertclicker" + minSdkVersion 19 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + vectorDrawables.useSupportLibrary = true + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + buildFeatures { + dataBinding true + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.30" + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.0-alpha2' + implementation 'com.jakewharton.timber:timber:4.7.1' + +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..7deaa35 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + diff --git a/app/src/main/ic_dessert_clicker-web.png b/app/src/main/ic_dessert_clicker-web.png new file mode 100644 index 0000000..7cc09e8 Binary files /dev/null and b/app/src/main/ic_dessert_clicker-web.png differ diff --git a/app/src/main/java/com/example/android/dessertclicker/ClickerApplication.kt b/app/src/main/java/com/example/android/dessertclicker/ClickerApplication.kt new file mode 100644 index 0000000..ef7db72 --- /dev/null +++ b/app/src/main/java/com/example/android/dessertclicker/ClickerApplication.kt @@ -0,0 +1,12 @@ +package com.example.android.dessertclicker + +import android.app.Application +import timber.log.Timber + +class ClickerApplication: Application() { + override fun onCreate() { + super.onCreate() + + Timber.plant(Timber.DebugTree()) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/android/dessertclicker/DessertTimer.kt b/app/src/main/java/com/example/android/dessertclicker/DessertTimer.kt new file mode 100644 index 0000000..d44a635 --- /dev/null +++ b/app/src/main/java/com/example/android/dessertclicker/DessertTimer.kt @@ -0,0 +1,81 @@ +/* + * Copyright 2019, The Android Open Source Project + * + * Licensed 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.dessertclicker + +import android.os.Handler +import timber.log.Timber +import android.os.Looper +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.LifecycleObserver +import androidx.lifecycle.OnLifecycleEvent + +/** + * This is a class representing a timer that you can start or stop. The secondsCount outputs a count of + * how many seconds since it started, every one second. + * + * ----- + * + * Handler and Runnable are beyond the scope of this lesson. This is in part because they deal with + * threading, which is a complex topic that will be covered in a later lesson. + * + * If you want to learn more now, you can take a look on the Android Developer documentation on + * threading: + * + * https://developer.android.com/guide/components/processes-and-threads + * + */ +class DessertTimer(lifecycle: Lifecycle) : LifecycleObserver { + + // The number of seconds counted since the timer started + var secondsCount = 0 + + /** + * [Handler] is a class meant to process a queue of messages (known as [android.os.Message]s) + * or actions (known as [Runnable]s) + */ + private var handler = Handler(Looper.getMainLooper()) + private lateinit var runnable: Runnable + + init { + lifecycle.addObserver(this) + } + + @OnLifecycleEvent(Lifecycle.Event.ON_START) + fun startTimer() { + // Create the runnable action, which prints out a log and increments the seconds counter + runnable = Runnable { + secondsCount++ + Timber.i("Timer is at : $secondsCount") + // postDelayed re-adds the action to the queue of actions the Handler is cycling + // through. The delayMillis param tells the handler to run the runnable in + // 1 second (1000ms) + handler.postDelayed(runnable, 1000) + } + + // This is what initially starts the timer + handler.postDelayed(runnable, 1000) + + // Note that the Thread the handler runs on is determined by a class called Looper. + } + + @OnLifecycleEvent(Lifecycle.Event.ON_STOP) + fun stopTimer() { + // Removes all pending posts of runnable from the handler's queue, effectively stopping the + // timer + handler.removeCallbacks(runnable) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/android/dessertclicker/MainActivity.kt b/app/src/main/java/com/example/android/dessertclicker/MainActivity.kt new file mode 100644 index 0000000..a98bce3 --- /dev/null +++ b/app/src/main/java/com/example/android/dessertclicker/MainActivity.kt @@ -0,0 +1,209 @@ +/* + * Copyright 2019, The Android Open Source Project + * + * Licensed 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.dessertclicker + +import android.content.ActivityNotFoundException +import android.os.Bundle +import android.view.Menu +import android.view.MenuItem +import android.widget.Toast +import androidx.appcompat.app.AppCompatActivity +import androidx.core.app.ShareCompat +import androidx.databinding.DataBindingUtil +import com.example.android.dessertclicker.databinding.ActivityMainBinding +import timber.log.Timber + +const val KEY_REVENUE = "revenue_key" +const val KEY_DESSERT_SOLD = "dessert_sold_key" +const val KEY_TIMER_SECONDS = "timer_seconds_key" + +class MainActivity : AppCompatActivity() { + + private var revenue = 0 + private var dessertsSold = 0 + + private lateinit var dessertTimer: DessertTimer + + // Contains all the views + private lateinit var binding: ActivityMainBinding + + /** Dessert Data **/ + + /** + * Simple data class that represents a dessert. Includes the resource id integer associated with + * the image, the price it's sold for, and the startProductionAmount, which determines when + * the dessert starts to be produced. + */ + data class Dessert(val imageId: Int, val price: Int, val startProductionAmount: Int) + + // Create a list of all desserts, in order of when they start being produced + private val allDesserts = listOf( + Dessert(R.drawable.cupcake, 5, 0), + Dessert(R.drawable.donut, 10, 5), + Dessert(R.drawable.eclair, 15, 20), + Dessert(R.drawable.froyo, 30, 50), + Dessert(R.drawable.gingerbread, 50, 100), + Dessert(R.drawable.honeycomb, 100, 200), + Dessert(R.drawable.icecreamsandwich, 500, 500), + Dessert(R.drawable.jellybean, 1000, 1000), + Dessert(R.drawable.kitkat, 2000, 2000), + Dessert(R.drawable.lollipop, 3000, 4000), + Dessert(R.drawable.marshmallow, 4000, 8000), + Dessert(R.drawable.nougat, 5000, 16000), + Dessert(R.drawable.oreo, 6000, 20000) + ) + private var currentDessert = allDesserts[0] + + override fun onCreate(savedInstanceState: Bundle?) { + + super.onCreate(savedInstanceState) + + Timber.i("onCreate Called") + + // Use Data Binding to get reference to the views + binding = DataBindingUtil.setContentView(this, R.layout.activity_main) + + binding.dessertButton.setOnClickListener { + onDessertClicked() + } + + dessertTimer = DessertTimer(this.lifecycle) + + if (savedInstanceState != null) { + revenue = savedInstanceState.getInt(KEY_REVENUE, 0) + dessertsSold = savedInstanceState.getInt(KEY_DESSERT_SOLD, 0) + dessertTimer.secondsCount = + savedInstanceState.getInt(KEY_TIMER_SECONDS, 0) + showCurrentDessert() + } + + // Set the TextViews to the right values + binding.revenue = revenue + binding.amountSold = dessertsSold + + // Make sure the correct dessert is showing + binding.dessertButton.setImageResource(currentDessert.imageId) + } + + override fun onStart() { + super.onStart() + Timber.i("onStart Called") + } + + override fun onResume() { + super.onResume() + Timber.i("onResume Called") + } + + override fun onPause() { + super.onPause() + Timber.i("onPause Called") + } + + override fun onStop() { + super.onStop() + Timber.i("onStop Called") + } + + override fun onDestroy() { + super.onDestroy() + Timber.i("onDestroy Called") + } + + override fun onRestart() { + super.onRestart() + Timber.i("onRestart Called") + } + + override fun onSaveInstanceState(outState: Bundle) { + super.onSaveInstanceState(outState) + + outState.putInt(KEY_REVENUE, revenue) + outState.putInt(KEY_DESSERT_SOLD, dessertsSold) + outState.putInt(KEY_TIMER_SECONDS, dessertTimer.secondsCount) + + + Timber.i("onSaveInstanceState Called") + } + + /** + * Updates the score when the dessert is clicked. Possibly shows a new dessert. + */ + private fun onDessertClicked() { + + // Update the score + revenue += currentDessert.price + dessertsSold++ + + binding.revenue = revenue + binding.amountSold = dessertsSold + + // Show the next dessert + showCurrentDessert() + } + + /** + * Determine which dessert to show. + */ + private fun showCurrentDessert() { + var newDessert = allDesserts[0] + for (dessert in allDesserts) { + if (dessertsSold >= dessert.startProductionAmount) { + newDessert = dessert + } + // The list of desserts is sorted by startProductionAmount. As you sell more desserts, + // you'll start producing more expensive desserts as determined by startProductionAmount + // We know to break as soon as we see a dessert who's "startProductionAmount" is greater + // than the amount sold. + else break + } + + // If the new dessert is actually different than the current dessert, update the image + if (newDessert != currentDessert) { + currentDessert = newDessert + binding.dessertButton.setImageResource(newDessert.imageId) + } + } + + /** + * Menu methods + */ + private fun onShare() { + val shareIntent = ShareCompat.IntentBuilder.from(this) + .setText(getString(R.string.share_text, dessertsSold, revenue)) + .setType("text/plain") + .intent + try { + startActivity(shareIntent) + } catch (ex: ActivityNotFoundException) { + Toast.makeText(this, getString(R.string.sharing_not_available), + Toast.LENGTH_LONG).show() + } + } + + override fun onCreateOptionsMenu(menu: Menu): Boolean { + menuInflater.inflate(R.menu.main_menu, menu) + return super.onCreateOptionsMenu(menu) + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + when (item.itemId) { + R.id.shareMenuButton -> onShare() + } + return super.onOptionsItemSelected(item) + } +} diff --git a/app/src/main/res/drawable/bakery_back.xml b/app/src/main/res/drawable/bakery_back.xml new file mode 100644 index 0000000..e46b4ed --- /dev/null +++ b/app/src/main/res/drawable/bakery_back.xml @@ -0,0 +1,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/cupcake.xml b/app/src/main/res/drawable/cupcake.xml new file mode 100644 index 0000000..edba515 --- /dev/null +++ b/app/src/main/res/drawable/cupcake.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/donut.xml b/app/src/main/res/drawable/donut.xml new file mode 100644 index 0000000..47b85ed --- /dev/null +++ b/app/src/main/res/drawable/donut.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/eclair.xml b/app/src/main/res/drawable/eclair.xml new file mode 100644 index 0000000..cfb6142 --- /dev/null +++ b/app/src/main/res/drawable/eclair.xml @@ -0,0 +1,37 @@ + + + + + + + + + diff --git a/app/src/main/res/drawable/froyo.xml b/app/src/main/res/drawable/froyo.xml new file mode 100644 index 0000000..26a0dac --- /dev/null +++ b/app/src/main/res/drawable/froyo.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/gingerbread.xml b/app/src/main/res/drawable/gingerbread.xml new file mode 100644 index 0000000..04ab00e --- /dev/null +++ b/app/src/main/res/drawable/gingerbread.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/honeycomb.xml b/app/src/main/res/drawable/honeycomb.xml new file mode 100644 index 0000000..5e10265 --- /dev/null +++ b/app/src/main/res/drawable/honeycomb.xml @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..cbbf04b --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/icecreamsandwich.xml b/app/src/main/res/drawable/icecreamsandwich.xml new file mode 100644 index 0000000..b988e3b --- /dev/null +++ b/app/src/main/res/drawable/icecreamsandwich.xml @@ -0,0 +1,37 @@ + + + + + + + + + diff --git a/app/src/main/res/drawable/jellybean.xml b/app/src/main/res/drawable/jellybean.xml new file mode 100644 index 0000000..f422be6 --- /dev/null +++ b/app/src/main/res/drawable/jellybean.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/kitkat.xml b/app/src/main/res/drawable/kitkat.xml new file mode 100644 index 0000000..4908b54 --- /dev/null +++ b/app/src/main/res/drawable/kitkat.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/lollipop.xml b/app/src/main/res/drawable/lollipop.xml new file mode 100644 index 0000000..7a6370a --- /dev/null +++ b/app/src/main/res/drawable/lollipop.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/marshmallow.xml b/app/src/main/res/drawable/marshmallow.xml new file mode 100644 index 0000000..21a1d89 --- /dev/null +++ b/app/src/main/res/drawable/marshmallow.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/nougat.xml b/app/src/main/res/drawable/nougat.xml new file mode 100644 index 0000000..38bb396 --- /dev/null +++ b/app/src/main/res/drawable/nougat.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/oreo.xml b/app/src/main/res/drawable/oreo.xml new file mode 100644 index 0000000..6f6fe2c --- /dev/null +++ b/app/src/main/res/drawable/oreo.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/white_box.xml b/app/src/main/res/drawable/white_box.xml new file mode 100644 index 0000000..f35819b --- /dev/null +++ b/app/src/main/res/drawable/white_box.xml @@ -0,0 +1,21 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..92e1cfc --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/menu/main_menu.xml b/app/src/main/res/menu/main_menu.xml new file mode 100644 index 0000000..19aef54 --- /dev/null +++ b/app/src/main/res/menu/main_menu.xml @@ -0,0 +1,26 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_dessert_clicker.xml b/app/src/main/res/mipmap-anydpi-v26/ic_dessert_clicker.xml new file mode 100644 index 0000000..ac94b34 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_dessert_clicker.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_dessert_clicker_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_dessert_clicker_round.xml new file mode 100644 index 0000000..ac94b34 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_dessert_clicker_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_dessert_clicker.png b/app/src/main/res/mipmap-hdpi/ic_dessert_clicker.png new file mode 100644 index 0000000..997a9db Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_dessert_clicker.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_dessert_clicker_round.png b/app/src/main/res/mipmap-hdpi/ic_dessert_clicker_round.png new file mode 100644 index 0000000..243afca Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_dessert_clicker_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_dessert_clicker.png b/app/src/main/res/mipmap-mdpi/ic_dessert_clicker.png new file mode 100644 index 0000000..f36f65f Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_dessert_clicker.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_dessert_clicker_round.png b/app/src/main/res/mipmap-mdpi/ic_dessert_clicker_round.png new file mode 100644 index 0000000..c7b1503 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_dessert_clicker_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_dessert_clicker.png b/app/src/main/res/mipmap-xhdpi/ic_dessert_clicker.png new file mode 100644 index 0000000..0c07c50 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_dessert_clicker.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_dessert_clicker_round.png b/app/src/main/res/mipmap-xhdpi/ic_dessert_clicker_round.png new file mode 100644 index 0000000..8ff3f94 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_dessert_clicker_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_dessert_clicker.png b/app/src/main/res/mipmap-xxhdpi/ic_dessert_clicker.png new file mode 100644 index 0000000..8318b70 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_dessert_clicker.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_dessert_clicker_round.png b/app/src/main/res/mipmap-xxhdpi/ic_dessert_clicker_round.png new file mode 100644 index 0000000..0af636a Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_dessert_clicker_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_dessert_clicker.png b/app/src/main/res/mipmap-xxxhdpi/ic_dessert_clicker.png new file mode 100644 index 0000000..e18c447 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_dessert_clicker.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_dessert_clicker_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_dessert_clicker_round.png new file mode 100644 index 0000000..0e258de Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_dessert_clicker_round.png differ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..d46adf7 --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,24 @@ + + + + #008577 + #00574B + #D81B60 + #ffffff + #6ab343 + #99000000 + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..36dd8e5 --- /dev/null +++ b/app/src/main/res/values/dimens.xml @@ -0,0 +1,24 @@ + + + + 16dp + 150dp + 150dp + 20sp + 33sp + 4dp + \ No newline at end of file diff --git a/app/src/main/res/values/ic_launcher_background.xml b/app/src/main/res/values/ic_launcher_background.xml new file mode 100644 index 0000000..c5d5899 --- /dev/null +++ b/app/src/main/res/values/ic_launcher_background.xml @@ -0,0 +1,4 @@ + + + #FFFFFF + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..c124e56 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,25 @@ + + + + Dessert Clicker + $ + 0 + Desserts Sold + I\'ve clicked %1$d Desserts for a total of %2$d$ #AndroidDessertClicker + Share + Sharing Not Available + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..6311a3f --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,27 @@ + + + + + + + + diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..97efd6f --- /dev/null +++ b/build.gradle @@ -0,0 +1,44 @@ +//noinspection GradleDynamicVersion +/* + * Copyright 2019, The Android Open Source Project + * + * Licensed 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + ext.kotlin_version = '1.4.30' + repositories { + google() + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:4.2.0-beta04' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..97187f5 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,30 @@ +# +# Copyright 2019, The Android Open Source Project +# +# Licensed 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +android.enableJetifier=true +android.useAndroidX=true +org.gradle.jvmargs=-Xmx1536m +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..f6b961f Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..5a5dfa9 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jun 26 12:21:11 PDT 2020 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https://services.gradle.org/distributions/gradle-6.7.1-all.zip diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..cccdd3d --- /dev/null +++ b/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..f955316 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/local.properties b/local.properties new file mode 100644 index 0000000..db6cdd2 --- /dev/null +++ b/local.properties @@ -0,0 +1,8 @@ +## This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. +# +# Location of the SDK. This is only used by Gradle. +# For customization when using a Version Control System, please read the +# header note. +#Fri Feb 12 15:32:01 GMT 2021 +sdk.dir=C\:\\Users\\joaof\\AppData\\Local\\Android\\Sdk diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..189bc0b --- /dev/null +++ b/settings.gradle @@ -0,0 +1,17 @@ +/* + * Copyright 2019, The Android Open Source Project + * + * Licensed 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +include ':app'