commit e911abb9af54f0c8789b9ba94a4855b5c695c4f6 Author: Diego Ezequiel Guillén Date: Tue Apr 26 15:07:36 2022 -0300 Initial commit diff --git a/._.github b/._.github new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/._.github differ diff --git a/._CONTRIBUTING.md b/._CONTRIBUTING.md new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/._CONTRIBUTING.md differ diff --git a/._LICENSE b/._LICENSE new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/._LICENSE differ diff --git a/._README.md b/._README.md new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/._README.md differ diff --git a/._app b/._app new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/._app differ diff --git a/._build.gradle b/._build.gradle new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/._build.gradle differ diff --git a/._code-of-conduct.md b/._code-of-conduct.md new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/._code-of-conduct.md differ diff --git a/._gradle b/._gradle new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/._gradle differ diff --git a/._gradle.properties b/._gradle.properties new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/._gradle.properties differ diff --git a/._gradlew b/._gradlew new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/._gradlew differ diff --git a/._gradlew.bat b/._gradlew.bat new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/._gradlew.bat differ diff --git a/._local.properties b/._local.properties new file mode 100644 index 0000000..388257a Binary files /dev/null and b/._local.properties differ diff --git a/._settings.gradle b/._settings.gradle new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/._settings.gradle differ diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.github/._ISSUE_TEMPLATE b/.github/._ISSUE_TEMPLATE new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/.github/._ISSUE_TEMPLATE differ diff --git a/.github/ISSUE_TEMPLATE b/.github/ISSUE_TEMPLATE new file mode 100644 index 0000000..d9aed04 --- /dev/null +++ b/.github/ISSUE_TEMPLATE @@ -0,0 +1,32 @@ +--- +name: Android Basics Unit 3 issue +about: Report problems with the Android Basics Unit 3 codelabs +title: 'Android Basics Unit 3 issue:' +labels: '' +assignees: '' + +--- + +**URL of codelab** + + +**In which task and step of the codelab can this issue be found?** + + +**Describe the problem** + + + + +**Steps to reproduce?** +1. Go to... +2. Click on... +3. See error... + +**Versions** +_Android Studio version:_ +_API version of the emulator:_ + + +**Additional information** +_Include screenshots if they would be useful in clarifying the problem._ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a68e5b5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Log/OS Files +*.log + +# Android Studio generated files and folders +captures/ +.externalNativeBuild/ +.cxx/ +*.apk +output.json + +# IntelliJ +*.iml +.idea/ + +# Keystore files +*.jks +*.keystore + +# Google Services (e.g. APIs or Firebase) +google-services.json + +# Android Profiling +*.hprof diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b16a466 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,29 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. There are +just a few small guidelines you need to follow. + +## Contributor License Agreement + +Contributions to this project must be accompanied by a Contributor License +Agreement (CLA). You (or your employer) retain the copyright to your +contribution; this simply gives us permission to use and redistribute your +contributions as part of the project. Head over to + to see your current agreements on file or +to sign a new one. + +You generally only need to submit a CLA once, so if you've already submitted one +(even if it was for a different project), you probably don't need to do it +again. + +## Code reviews + +All submissions, including submissions by project members, require review. We +use GitHub pull requests for this purpose. Consult +[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more +information on using pull requests. + +## Community Guidelines + +This project follows +[Google's Open Source Community Guidelines](https://opensource.google/conduct/). \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b09cd78 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..2dd3fae --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +DessertClicker - Code +===================== + +Code for Android Basics Codelab. + +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. + + +Getting Started +--------------- + +1. Download and run the app. diff --git a/app/._build.gradle b/app/._build.gradle new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/._build.gradle differ diff --git a/app/._proguard-rules.pro b/app/._proguard-rules.pro new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/._proguard-rules.pro differ diff --git a/app/._src b/app/._src new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/._src differ diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..4d519e5 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,51 @@ +/* + * Copyright 2020, 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. + */ + +plugins { + id 'com.android.application' + id 'kotlin-android' + id 'kotlin-kapt' +} + +android { + compileSdkVersion 31 + defaultConfig { + applicationId "com.example.android.dessertclicker" + minSdkVersion 19 + targetSdkVersion 31 + 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:$kotlin_version" + implementation 'androidx.appcompat:appcompat:1.3.1' + implementation 'com.google.android.material:material:1.4.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.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 b/app/src/._main new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/._main differ diff --git a/app/src/main/._AndroidManifest.xml b/app/src/main/._AndroidManifest.xml new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/._AndroidManifest.xml differ 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..c4d4fd9 Binary files /dev/null and b/app/src/main/._ic_dessert_clicker-web.png differ diff --git a/app/src/main/._ic_launcher-playstore.png b/app/src/main/._ic_launcher-playstore.png new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/._ic_launcher-playstore.png differ diff --git a/app/src/main/._java b/app/src/main/._java new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/._java differ diff --git a/app/src/main/._res b/app/src/main/._res new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/._res differ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..b682fa1 --- /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/ic_launcher-playstore.png b/app/src/main/ic_launcher-playstore.png new file mode 100644 index 0000000..775bd48 Binary files /dev/null and b/app/src/main/ic_launcher-playstore.png differ diff --git a/app/src/main/java/._com b/app/src/main/java/._com new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/java/._com differ diff --git a/app/src/main/java/com/._example b/app/src/main/java/com/._example new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/java/com/._example differ diff --git a/app/src/main/java/com/example/._android b/app/src/main/java/com/example/._android new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/java/com/example/._android differ diff --git a/app/src/main/java/com/example/android/._dessertclicker b/app/src/main/java/com/example/android/._dessertclicker new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/java/com/example/android/._dessertclicker differ 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..c4d4fd9 Binary files /dev/null and b/app/src/main/java/com/example/android/dessertclicker/._MainActivity.kt differ 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..65b6d26 --- /dev/null +++ b/app/src/main/java/com/example/android/dessertclicker/MainActivity.kt @@ -0,0 +1,201 @@ +/* + * Copyright 2020, 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.util.Log +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 + +const val TAG = "MainActivity" +const val KEY_REVENUE = "revenue_key" +const val KEY_DESSERT_SOLD = "dessert_sold_key" + +class MainActivity : AppCompatActivity() { + + private var revenue = 0 + private var dessertsSold = 0 + + // 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) + Log.d("MainActivity", "onCreate Called") + // Use Data Binding to get reference to the views + binding = DataBindingUtil.setContentView(this, R.layout.activity_main) + + binding.dessertButton.setOnClickListener { + onDessertClicked() + } + + // 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) + + // Restores the state + if (savedInstanceState != null) { + revenue = savedInstanceState.getInt(KEY_REVENUE, 0) + dessertsSold = savedInstanceState.getInt(KEY_DESSERT_SOLD, 0) + showCurrentDessert() + } + } + /** + * LOG + */ + override fun onStart() { + super.onStart() + Log.d(TAG, "onStart Called") + } + + override fun onResume() { + super.onResume() + Log.d(TAG, "onResume Called") + } + + override fun onPause() { + super.onPause() + Log.d(TAG, "onPause Called") + } + + override fun onStop() { + super.onStop() + Log.d(TAG, "onStop Called") + } + + override fun onDestroy() { + super.onDestroy() + Log.d(TAG, "onDestroy Called") + } + + override fun onRestart() { + super.onRestart() + Log.d(TAG, "onRestart Called") + } + + override fun onSaveInstanceState(outState: Bundle) { + super.onSaveInstanceState(outState) + + Log.d(TAG, "onSaveInstanceState Called") + + outState.putInt(KEY_REVENUE, revenue) + outState.putInt(KEY_DESSERT_SOLD, dessertsSold) + } + + /** + * 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 b/app/src/main/res/._drawable new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/._drawable differ diff --git a/app/src/main/res/._layout b/app/src/main/res/._layout new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/._layout differ diff --git a/app/src/main/res/._menu b/app/src/main/res/._menu new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/._menu differ diff --git a/app/src/main/res/._mipmap-anydpi-v26 b/app/src/main/res/._mipmap-anydpi-v26 new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/._mipmap-anydpi-v26 differ diff --git a/app/src/main/res/._mipmap-hdpi b/app/src/main/res/._mipmap-hdpi new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/._mipmap-hdpi differ diff --git a/app/src/main/res/._mipmap-mdpi b/app/src/main/res/._mipmap-mdpi new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/._mipmap-mdpi differ diff --git a/app/src/main/res/._mipmap-xhdpi b/app/src/main/res/._mipmap-xhdpi new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/._mipmap-xhdpi differ diff --git a/app/src/main/res/._mipmap-xxhdpi b/app/src/main/res/._mipmap-xxhdpi new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/._mipmap-xxhdpi differ diff --git a/app/src/main/res/._mipmap-xxxhdpi b/app/src/main/res/._mipmap-xxxhdpi new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/._mipmap-xxxhdpi differ diff --git a/app/src/main/res/._values b/app/src/main/res/._values new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/._values differ 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..c4d4fd9 Binary files /dev/null and b/app/src/main/res/drawable/._bakery_back.xml differ diff --git a/app/src/main/res/drawable/._cupcake.xml b/app/src/main/res/drawable/._cupcake.xml new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/drawable/._cupcake.xml differ diff --git a/app/src/main/res/drawable/._donut.xml b/app/src/main/res/drawable/._donut.xml new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/drawable/._donut.xml differ diff --git a/app/src/main/res/drawable/._eclair.xml b/app/src/main/res/drawable/._eclair.xml new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/drawable/._eclair.xml differ diff --git a/app/src/main/res/drawable/._froyo.xml b/app/src/main/res/drawable/._froyo.xml new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/drawable/._froyo.xml differ diff --git a/app/src/main/res/drawable/._gingerbread.xml b/app/src/main/res/drawable/._gingerbread.xml new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/drawable/._gingerbread.xml differ diff --git a/app/src/main/res/drawable/._honeycomb.xml b/app/src/main/res/drawable/._honeycomb.xml new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/drawable/._honeycomb.xml differ diff --git a/app/src/main/res/drawable/._ic_launcher_background.xml b/app/src/main/res/drawable/._ic_launcher_background.xml new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/drawable/._ic_launcher_background.xml differ 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..c4d4fd9 Binary files /dev/null and b/app/src/main/res/drawable/._ic_launcher_foreground.xml differ diff --git a/app/src/main/res/drawable/._icecreamsandwich.xml b/app/src/main/res/drawable/._icecreamsandwich.xml new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/drawable/._icecreamsandwich.xml differ diff --git a/app/src/main/res/drawable/._jellybean.xml b/app/src/main/res/drawable/._jellybean.xml new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/drawable/._jellybean.xml differ diff --git a/app/src/main/res/drawable/._kitkat.xml b/app/src/main/res/drawable/._kitkat.xml new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/drawable/._kitkat.xml differ diff --git a/app/src/main/res/drawable/._lollipop.xml b/app/src/main/res/drawable/._lollipop.xml new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/drawable/._lollipop.xml differ diff --git a/app/src/main/res/drawable/._marshmallow.xml b/app/src/main/res/drawable/._marshmallow.xml new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/drawable/._marshmallow.xml differ diff --git a/app/src/main/res/drawable/._nougat.xml b/app/src/main/res/drawable/._nougat.xml new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/drawable/._nougat.xml differ diff --git a/app/src/main/res/drawable/._oreo.xml b/app/src/main/res/drawable/._oreo.xml new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/drawable/._oreo.xml differ 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..c4d4fd9 Binary files /dev/null and b/app/src/main/res/drawable/._white_box.xml differ 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..fbd94ed --- /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..14dcbe2 --- /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..ba7163f --- /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..d5da308 --- /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..d5922ac --- /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..60fda95 --- /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..ee10eb7 --- /dev/null +++ b/app/src/main/res/drawable/honeycomb.xml @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..f612194 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..0a363b0 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/icecreamsandwich.xml b/app/src/main/res/drawable/icecreamsandwich.xml new file mode 100644 index 0000000..99d96b6 --- /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..c764b3e --- /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..4d94a4a --- /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..7d1b9ab --- /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..ce9b288 --- /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..1b3fe65 --- /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..4ce9048 --- /dev/null +++ b/app/src/main/res/drawable/oreo.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + 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..d841040 --- /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..c4d4fd9 Binary files /dev/null and b/app/src/main/res/layout/._activity_main.xml differ 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..116166a --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..c4d4fd9 Binary files /dev/null and b/app/src/main/res/menu/._main_menu.xml differ 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..7fc04f1 --- /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..c4d4fd9 Binary files /dev/null and b/app/src/main/res/mipmap-anydpi-v26/._ic_dessert_clicker.xml differ 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..c4d4fd9 Binary files /dev/null and b/app/src/main/res/mipmap-anydpi-v26/._ic_dessert_clicker_round.xml differ diff --git a/app/src/main/res/mipmap-anydpi-v26/._ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/._ic_launcher.xml new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/mipmap-anydpi-v26/._ic_launcher.xml differ diff --git a/app/src/main/res/mipmap-anydpi-v26/._ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/._ic_launcher_round.xml new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/mipmap-anydpi-v26/._ic_launcher_round.xml differ 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..57a3829 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_dessert_clicker.xml @@ -0,0 +1,20 @@ + + + + + + \ 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..57a3829 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_dessert_clicker_round.xml @@ -0,0 +1,20 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..ef07f00 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,20 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..ef07f00 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,20 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/._ic_launcher.png b/app/src/main/res/mipmap-hdpi/._ic_launcher.png new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/._ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/._ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/._ic_launcher_round.png new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/._ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..061c33c Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..fdf524f Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/._ic_launcher.png b/app/src/main/res/mipmap-mdpi/._ic_launcher.png new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/._ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/._ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/._ic_launcher_round.png new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/._ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..1a1873e Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..af83b6f Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/._ic_launcher.png b/app/src/main/res/mipmap-xhdpi/._ic_launcher.png new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/._ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/._ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/._ic_launcher_round.png new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/._ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..c5aec2a Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..48df02e Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/._ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/._ic_launcher.png new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/._ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/._ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/._ic_launcher_round.png new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/._ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..5320c49 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..252db07 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/._ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/._ic_launcher.png new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/._ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/._ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/._ic_launcher_round.png new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/._ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..49e098b Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..0d8d489 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_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..c4d4fd9 Binary files /dev/null and b/app/src/main/res/values/._colors.xml differ diff --git a/app/src/main/res/values/._dimens.xml b/app/src/main/res/values/._dimens.xml new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/values/._dimens.xml differ diff --git a/app/src/main/res/values/._strings.xml b/app/src/main/res/values/._strings.xml new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/values/._strings.xml differ diff --git a/app/src/main/res/values/._styles.xml b/app/src/main/res/values/._styles.xml new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/app/src/main/res/values/._styles.xml 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..2d68a40 --- /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..eab4d23 --- /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/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..71d159a --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,23 @@ + + + + Dessert Clicker + 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..7413895 --- /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..2064b24 --- /dev/null +++ b/build.gradle @@ -0,0 +1,44 @@ +//noinspection GradleDynamicVersion +/* + * Copyright 2020, 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.5.31' + repositories { + google() + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:7.0.3' + 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() + mavenCentral() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/code-of-conduct.md b/code-of-conduct.md new file mode 100644 index 0000000..89b8504 --- /dev/null +++ b/code-of-conduct.md @@ -0,0 +1,93 @@ +# Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of +experience, education, socio-economic status, nationality, personal appearance, +race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviors that they deem inappropriate, threatening, +offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +This Code of Conduct also applies outside the project spaces when the Project +Steward has a reasonable belief that an individual's behavior may have a +negative impact on the project or its community. + +## Conflict Resolution + +We do not believe that all conflict is bad; healthy debate and disagreement +often yield positive results. However, it is never okay to be disrespectful or +to engage in behavior that violates the project’s code of conduct. + +If you see someone violating the code of conduct, you are encouraged to address +the behavior directly with those involved. Many issues can be resolved quickly +and easily, and this gives people more control over the outcome of their +dispute. If you are unable to resolve the matter for any reason, or if the +behavior is threatening or harassing, report it. We are dedicated to providing +an environment where participants feel welcome and safe. + +Reports should be directed to *Jennie Eldon (jenniee@google.com)*, the +Project Steward(s) for *Android Basics*. It is the Project Steward’s duty to +receive and address reported violations of the code of conduct. They will then +work with a committee consisting of representatives from the Open Source +Programs Office and the Google Open Source Strategy team. If for any reason you +are uncomfortable reaching out to the Project Steward, please email +opensource@google.com. + +We will investigate every complaint, but you may not receive a direct response. +We will use our discretion in determining when and how to follow up on reported +incidents, which may range from not taking action to permanent expulsion from +the project and project-sponsored spaces. We will notify the accused of the +report and provide them an opportunity to discuss it before any action is taken. +The identity of the reporter will be omitted from the details of the report +supplied to the accused. In potentially harmful situations, such as ongoing +harassment or threats to anyone's safety, we may take action without notice. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 1.4, +available at +https://www.contributor-covenant.org/version/1/4/code-of-conduct.html \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..652f08d --- /dev/null +++ b/gradle.properties @@ -0,0 +1,30 @@ +# +# Copyright 2020, 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 b/gradle/._wrapper new file mode 100644 index 0000000..c4d4fd9 Binary files /dev/null and b/gradle/._wrapper differ diff --git a/gradle/wrapper/._gradle-wrapper.jar b/gradle/wrapper/._gradle-wrapper.jar new file mode 100644 index 0000000..c4d4fd9 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..c4d4fd9 Binary files /dev/null and b/gradle/wrapper/._gradle-wrapper.properties differ 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..519deb6 --- /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-7.0.2-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/settings.gradle b/settings.gradle new file mode 100644 index 0000000..7499817 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,18 @@ +/* + * Copyright 2020, 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' +rootProject.name = "Dessert Clicker" \ No newline at end of file