diff --git a/GuessTheWordDataBinding/README.md b/GuessTheWordDataBinding/README.md
new file mode 100644
index 0000000..a9a2c0e
--- /dev/null
+++ b/GuessTheWordDataBinding/README.md
@@ -0,0 +1,45 @@
+ViewModel and LiveData with Data Binding - Solution Code
+==================================
+
+This is the starter code for the ViewModel and LiveData with Data Binding codelab.
+
+Introduction
+------------
+
+This starter app is a two player game, GuessTheWord. It is a word guessing app you can play with one or more friends. To play, hold the device in landscape, facing away from you with your thumbs on the **Skip** and **Got It** buttons. Your friends can then give you clues to help you guess the word. If you get the word right, press **Got It**. If you're stuck, press **Skip** or you can use the **End** button to end the game.
+This code demostrates how to use Data Binding with the Android Architecture components, LiveData and ViewModel.
+
+Pre-requisites
+--------------
+
+You need to know:
+- How to open, build, and run Android apps with Android Studio.
+- How to use the Navigation Architecture Component
+- Passing the data between navigation destinations.
+- Read the logs using the Logcat.
+
+
+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.
diff --git a/GuessTheWordDataBinding/app/.gitignore b/GuessTheWordDataBinding/app/.gitignore
new file mode 100755
index 0000000..796b96d
--- /dev/null
+++ b/GuessTheWordDataBinding/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/GuessTheWordDataBinding/app/build.gradle b/GuessTheWordDataBinding/app/build.gradle
new file mode 100755
index 0000000..b282b87
--- /dev/null
+++ b/GuessTheWordDataBinding/app/build.gradle
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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'
+apply plugin: 'kotlin-android-extensions'
+apply plugin: "androidx.navigation.safeargs"
+
+android {
+ compileSdkVersion 28
+ defaultConfig {
+ applicationId "com.example.android.guesstheword"
+ minSdkVersion 19
+ targetSdkVersion 28
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ dataBinding {
+ enabled = true
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation 'androidx.appcompat:appcompat:1.0.2'
+ implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+ testImplementation 'junit:junit:4.12'
+
+ // KTX
+ implementation 'androidx.core:core-ktx:1.0.1'
+
+ // Navigation
+ implementation "android.arch.navigation:navigation-fragment-ktx:1.0.0"
+ implementation "android.arch.navigation:navigation-ui-ktx:1.0.0"
+
+ //ViewModel and LiveData
+ implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
+}
diff --git a/GuessTheWordDataBinding/app/proguard-rules.pro b/GuessTheWordDataBinding/app/proguard-rules.pro
new file mode 100755
index 0000000..f1b4245
--- /dev/null
+++ b/GuessTheWordDataBinding/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/GuessTheWordDataBinding/app/src/androidTest/java/com/example/android/guesstheword/ExampleInstrumentedTest.kt b/GuessTheWordDataBinding/app/src/androidTest/java/com/example/android/guesstheword/ExampleInstrumentedTest.kt
new file mode 100755
index 0000000..20f64d6
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/androidTest/java/com/example/android/guesstheword/ExampleInstrumentedTest.kt
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword
+
+import androidx.test.InstrumentationRegistry
+import androidx.test.runner.AndroidJUnit4
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import org.junit.runner.RunWith
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+@RunWith(AndroidJUnit4::class)
+class ExampleInstrumentedTest {
+
+ @Test
+ fun useAppContext() {
+ // Context of the app under test.
+ val appContext = InstrumentationRegistry.getTargetContext()
+ assertEquals("com.example.android.guesstheword", appContext.packageName)
+ }
+}
diff --git a/GuessTheWordDataBinding/app/src/main/AndroidManifest.xml b/GuessTheWordDataBinding/app/src/main/AndroidManifest.xml
new file mode 100755
index 0000000..5e86e0e
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/AndroidManifest.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordDataBinding/app/src/main/ic_guess_it-web.png b/GuessTheWordDataBinding/app/src/main/ic_guess_it-web.png
new file mode 100755
index 0000000..e78aef1
Binary files /dev/null and b/GuessTheWordDataBinding/app/src/main/ic_guess_it-web.png differ
diff --git a/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/MainActivity.kt b/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/MainActivity.kt
new file mode 100755
index 0000000..8d99816
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/MainActivity.kt
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+
+/**
+ * Creates an Activity that hosts all of the fragments in the app
+ */
+class MainActivity : AppCompatActivity() {
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.main_activity)
+ }
+
+}
diff --git a/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/screens/game/GameFragment.kt b/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/screens/game/GameFragment.kt
new file mode 100755
index 0000000..a7cd6f1
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/screens/game/GameFragment.kt
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.game
+
+import android.os.Bundle
+import android.util.Log
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.Toast
+import androidx.databinding.DataBindingUtil
+import androidx.fragment.app.Fragment
+import androidx.lifecycle.Observer
+import androidx.lifecycle.ViewModelProviders
+import androidx.navigation.fragment.NavHostFragment.findNavController
+import com.example.android.guesstheword.R
+import com.example.android.guesstheword.databinding.GameFragmentBinding
+
+/**
+ * Fragment where the game is played
+ */
+class GameFragment : Fragment() {
+
+ private lateinit var binding: GameFragmentBinding
+
+ private lateinit var viewModel: GameViewModel
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?): View? {
+
+ // Inflate view and obtain an instance of the binding class
+ binding = DataBindingUtil.inflate(
+ inflater,
+ R.layout.game_fragment,
+ container,
+ false
+ )
+ Log.i("GameFragment", "Called ViewModelProviders.of")
+
+ viewModel = ViewModelProviders.of(this).get(GameViewModel::class.java)
+
+ // Set the viewmodel for databinding - this allows the bound layout access
+ // to all the data in the VieWModel
+ binding.gameViewModel = viewModel
+
+ // Specify the current activity as the lifecycle owner of the binding.
+ // This is used so that the binding can observe LiveData updates
+ binding.lifecycleOwner = this
+
+ // Observer for the Game finished event
+ viewModel.eventGameFinish.observe(this, Observer { hasFinished ->
+ if (hasFinished) gameFinished()
+ })
+
+ return binding.root
+ }
+
+ private fun gameFinished() {
+ Toast.makeText(activity, "Game has just finished", Toast.LENGTH_SHORT).show()
+ val action = GameFragmentDirections.actionGameToScore()
+ action.score = viewModel.score.value?:0
+ findNavController(this).navigate(action)
+ viewModel.onGameFinishComplete()
+ }
+}
diff --git a/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/screens/game/GameViewModel.kt b/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/screens/game/GameViewModel.kt
new file mode 100644
index 0000000..d2f60c7
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/screens/game/GameViewModel.kt
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.game
+
+import android.util.Log
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+
+/**
+ * ViewModel containing all the logic needed to run the game
+ */
+class GameViewModel : ViewModel() {
+
+ // The current _word
+ private val _word = MutableLiveData()
+ val word: LiveData
+ get() = _word
+
+ // The current score
+ private val _score = MutableLiveData()
+ val score: LiveData
+ get() = _score
+
+ // Countdown time
+ private val _eventGameFinish = MutableLiveData()
+ val eventGameFinish: LiveData
+ get() = _eventGameFinish
+
+
+ // The list of words - the front of the list is the next _word to guess
+ private lateinit var wordList: MutableList
+
+
+ /**
+ * Resets the list of words and randomizes the order
+ */
+ private fun resetList() {
+ wordList = mutableListOf(
+ "queen",
+ "hospital",
+ "basketball",
+ "cat",
+ "change",
+ "snail",
+ "soup",
+ "calendar",
+ "sad",
+ "desk",
+ "guitar",
+ "home",
+ "railway",
+ "zebra",
+ "jelly",
+ "car",
+ "crow",
+ "trade",
+ "bag",
+ "roll",
+ "bubble"
+ )
+ wordList.shuffle()
+ }
+
+ init {
+ _word.value = ""
+ _score.value = 0
+ Log.i("GameViewModel", "GameViewModel created!")
+ resetList()
+ nextWord()
+ }
+
+ /**
+ * Callback called when the ViewModel is destroyed
+ */
+ override fun onCleared() {
+ super.onCleared()
+ Log.i("GameViewModel", "GameViewModel destroyed!")
+ }
+
+ /** Methods for updating the UI **/
+ fun onSkip() {
+ if (!wordList.isEmpty()) {
+ _score.value = (_score.value)?.minus(1)
+ }
+ nextWord()
+ }
+ fun onCorrect() {
+ if (!wordList.isEmpty()) {
+ _score.value = (_score.value)?.plus(1)
+ }
+ nextWord()
+ }
+
+ /**
+ * Moves to the next _word in the list.
+ */
+ private fun nextWord() {
+ if (wordList.isEmpty()) {
+ onGameFinish()
+
+ } else {
+ //Select and remove a _word from the list
+ _word.value = wordList.removeAt(0)
+ }
+ }
+
+
+
+ /** Method for the game completed event **/
+
+ fun onGameFinishComplete() {
+ _eventGameFinish.value = false
+ }
+
+ fun onGameFinish() {
+ _eventGameFinish.value = true
+ }
+
+}
diff --git a/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreFragment.kt b/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreFragment.kt
new file mode 100755
index 0000000..952ebbd
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreFragment.kt
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.score
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.databinding.DataBindingUtil
+import androidx.fragment.app.Fragment
+import androidx.lifecycle.Observer
+import androidx.lifecycle.ViewModelProviders
+import androidx.navigation.fragment.findNavController
+import com.example.android.guesstheword.R
+import com.example.android.guesstheword.databinding.ScoreFragmentBinding
+
+/**
+ * Fragment where the final score is shown, after the game is over
+ */
+class ScoreFragment : Fragment() {
+
+ private lateinit var viewModel: ScoreViewModel
+ private lateinit var viewModelFactory: ScoreViewModelFactory
+
+ override fun onCreateView(
+ inflater: LayoutInflater,
+ container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+
+ // Inflate view and obtain an instance of the binding class.
+ val binding: ScoreFragmentBinding = DataBindingUtil.inflate(
+ inflater,
+ R.layout.score_fragment,
+ container,
+ false
+ )
+
+ viewModelFactory = ScoreViewModelFactory(ScoreFragmentArgs.fromBundle(arguments!!).score)
+ viewModel = ViewModelProviders.of(this, viewModelFactory)
+ .get(ScoreViewModel::class.java)
+ binding.scoreViewModel = viewModel
+
+ // Specify the current activity as the lifecycle owner of the binding.
+ // This is used so that the binding can observe LiveData updates
+ binding.lifecycleOwner = this
+
+ // Navigates back to game when button is pressed
+ viewModel.eventPlayAgain.observe(this, Observer { playAgain ->
+ if (playAgain) {
+ findNavController().navigate(ScoreFragmentDirections.actionRestart())
+ viewModel.onPlayAgainComplete()
+ }
+ })
+
+ return binding.root
+ }
+}
diff --git a/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModel.kt b/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModel.kt
new file mode 100644
index 0000000..a47a91e
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModel.kt
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.score
+
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+
+/**
+ * ViewModel for the final screen showing the score
+ */
+class ScoreViewModel(finalScore: Int) : ViewModel() {
+
+ private val _score = MutableLiveData()
+ val score: LiveData
+ get() = _score
+
+ private val _eventPlayAgain = MutableLiveData()
+ val eventPlayAgain: LiveData
+ get() = _eventPlayAgain
+
+
+ init {
+ _score.value = finalScore
+ }
+
+ fun onPlayAgain() {
+ _eventPlayAgain.value = true
+ }
+
+ fun onPlayAgainComplete() {
+ _eventPlayAgain.value = false
+ }
+
+
+}
diff --git a/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModelFactory.kt b/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModelFactory.kt
new file mode 100644
index 0000000..1671608
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModelFactory.kt
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.score
+
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.ViewModelProvider
+
+class ScoreViewModelFactory (private val finalScore: Int) : ViewModelProvider.Factory {
+
+ override fun create(modelClass: Class): T {
+ if (modelClass.isAssignableFrom(ScoreViewModel::class.java)) {
+ return ScoreViewModel(finalScore) as T
+ }
+ throw IllegalArgumentException("Unknown ViewModel class")
+ }
+
+}
diff --git a/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/screens/title/TitleFragment.kt b/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/screens/title/TitleFragment.kt
new file mode 100755
index 0000000..9fa0a68
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/java/com/example/android/guesstheword/screens/title/TitleFragment.kt
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.title
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.databinding.DataBindingUtil
+import androidx.fragment.app.Fragment
+import androidx.navigation.fragment.findNavController
+import com.example.android.guesstheword.R
+import com.example.android.guesstheword.databinding.TitleFragmentBinding
+
+/**
+ * Fragment for the starting or title screen of the app
+ */
+class TitleFragment : Fragment() {
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?): View {
+ // Inflate the layout for this fragment
+ val binding: TitleFragmentBinding = DataBindingUtil.inflate(
+ inflater, R.layout.title_fragment, container, false)
+
+ binding.playGameButton.setOnClickListener {
+ findNavController().navigate(TitleFragmentDirections.actionTitleToGame())
+ }
+ return binding.root
+ }
+}
diff --git a/GuessTheWordDataBinding/app/src/main/res/anim/slide_in_right.xml b/GuessTheWordDataBinding/app/src/main/res/anim/slide_in_right.xml
new file mode 100755
index 0000000..dc03344
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/res/anim/slide_in_right.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
diff --git a/GuessTheWordDataBinding/app/src/main/res/anim/slide_out_left.xml b/GuessTheWordDataBinding/app/src/main/res/anim/slide_out_left.xml
new file mode 100755
index 0000000..ec2c114
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/res/anim/slide_out_left.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
diff --git a/GuessTheWordDataBinding/app/src/main/res/drawable/ic_launcher_background.xml b/GuessTheWordDataBinding/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100755
index 0000000..cf04c59
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordDataBinding/app/src/main/res/drawable/ic_launcher_foreground.xml b/GuessTheWordDataBinding/app/src/main/res/drawable/ic_launcher_foreground.xml
new file mode 100755
index 0000000..1b3e6a7
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordDataBinding/app/src/main/res/layout/game_fragment.xml b/GuessTheWordDataBinding/app/src/main/res/layout/game_fragment.xml
new file mode 100755
index 0000000..dd4731e
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/res/layout/game_fragment.xml
@@ -0,0 +1,150 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuessTheWordDataBinding/app/src/main/res/layout/main_activity.xml b/GuessTheWordDataBinding/app/src/main/res/layout/main_activity.xml
new file mode 100755
index 0000000..40a862f
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/res/layout/main_activity.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
diff --git a/GuessTheWordDataBinding/app/src/main/res/layout/score_fragment.xml b/GuessTheWordDataBinding/app/src/main/res/layout/score_fragment.xml
new file mode 100755
index 0000000..e52b12d
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/res/layout/score_fragment.xml
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuessTheWordDataBinding/app/src/main/res/layout/title_fragment.xml b/GuessTheWordDataBinding/app/src/main/res/layout/title_fragment.xml
new file mode 100755
index 0000000..8f598ca
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/res/layout/title_fragment.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordDataBinding/app/src/main/res/mipmap-anydpi-v26/ic_guess_it.xml b/GuessTheWordDataBinding/app/src/main/res/mipmap-anydpi-v26/ic_guess_it.xml
new file mode 100755
index 0000000..9b4f225
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/res/mipmap-anydpi-v26/ic_guess_it.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuessTheWordDataBinding/app/src/main/res/mipmap-anydpi-v26/ic_guess_it_round.xml b/GuessTheWordDataBinding/app/src/main/res/mipmap-anydpi-v26/ic_guess_it_round.xml
new file mode 100755
index 0000000..9b4f225
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/res/mipmap-anydpi-v26/ic_guess_it_round.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuessTheWordDataBinding/app/src/main/res/mipmap-hdpi/ic_guess_it.png b/GuessTheWordDataBinding/app/src/main/res/mipmap-hdpi/ic_guess_it.png
new file mode 100755
index 0000000..23b77ba
Binary files /dev/null and b/GuessTheWordDataBinding/app/src/main/res/mipmap-hdpi/ic_guess_it.png differ
diff --git a/GuessTheWordDataBinding/app/src/main/res/mipmap-hdpi/ic_guess_it_round.png b/GuessTheWordDataBinding/app/src/main/res/mipmap-hdpi/ic_guess_it_round.png
new file mode 100755
index 0000000..ba1992f
Binary files /dev/null and b/GuessTheWordDataBinding/app/src/main/res/mipmap-hdpi/ic_guess_it_round.png differ
diff --git a/GuessTheWordDataBinding/app/src/main/res/mipmap-mdpi/ic_guess_it.png b/GuessTheWordDataBinding/app/src/main/res/mipmap-mdpi/ic_guess_it.png
new file mode 100755
index 0000000..30509d9
Binary files /dev/null and b/GuessTheWordDataBinding/app/src/main/res/mipmap-mdpi/ic_guess_it.png differ
diff --git a/GuessTheWordDataBinding/app/src/main/res/mipmap-mdpi/ic_guess_it_round.png b/GuessTheWordDataBinding/app/src/main/res/mipmap-mdpi/ic_guess_it_round.png
new file mode 100755
index 0000000..3332698
Binary files /dev/null and b/GuessTheWordDataBinding/app/src/main/res/mipmap-mdpi/ic_guess_it_round.png differ
diff --git a/GuessTheWordDataBinding/app/src/main/res/mipmap-xhdpi/ic_guess_it.png b/GuessTheWordDataBinding/app/src/main/res/mipmap-xhdpi/ic_guess_it.png
new file mode 100755
index 0000000..7528c03
Binary files /dev/null and b/GuessTheWordDataBinding/app/src/main/res/mipmap-xhdpi/ic_guess_it.png differ
diff --git a/GuessTheWordDataBinding/app/src/main/res/mipmap-xhdpi/ic_guess_it_round.png b/GuessTheWordDataBinding/app/src/main/res/mipmap-xhdpi/ic_guess_it_round.png
new file mode 100755
index 0000000..3a03ac2
Binary files /dev/null and b/GuessTheWordDataBinding/app/src/main/res/mipmap-xhdpi/ic_guess_it_round.png differ
diff --git a/GuessTheWordDataBinding/app/src/main/res/mipmap-xxhdpi/ic_guess_it.png b/GuessTheWordDataBinding/app/src/main/res/mipmap-xxhdpi/ic_guess_it.png
new file mode 100755
index 0000000..7e08481
Binary files /dev/null and b/GuessTheWordDataBinding/app/src/main/res/mipmap-xxhdpi/ic_guess_it.png differ
diff --git a/GuessTheWordDataBinding/app/src/main/res/mipmap-xxhdpi/ic_guess_it_round.png b/GuessTheWordDataBinding/app/src/main/res/mipmap-xxhdpi/ic_guess_it_round.png
new file mode 100755
index 0000000..ce95305
Binary files /dev/null and b/GuessTheWordDataBinding/app/src/main/res/mipmap-xxhdpi/ic_guess_it_round.png differ
diff --git a/GuessTheWordDataBinding/app/src/main/res/mipmap-xxxhdpi/ic_guess_it.png b/GuessTheWordDataBinding/app/src/main/res/mipmap-xxxhdpi/ic_guess_it.png
new file mode 100755
index 0000000..af9781f
Binary files /dev/null and b/GuessTheWordDataBinding/app/src/main/res/mipmap-xxxhdpi/ic_guess_it.png differ
diff --git a/GuessTheWordDataBinding/app/src/main/res/mipmap-xxxhdpi/ic_guess_it_round.png b/GuessTheWordDataBinding/app/src/main/res/mipmap-xxxhdpi/ic_guess_it_round.png
new file mode 100755
index 0000000..314cc75
Binary files /dev/null and b/GuessTheWordDataBinding/app/src/main/res/mipmap-xxxhdpi/ic_guess_it_round.png differ
diff --git a/GuessTheWordDataBinding/app/src/main/res/navigation/main_navigation.xml b/GuessTheWordDataBinding/app/src/main/res/navigation/main_navigation.xml
new file mode 100755
index 0000000..eb5f687
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/res/navigation/main_navigation.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuessTheWordDataBinding/app/src/main/res/values/colors.xml b/GuessTheWordDataBinding/app/src/main/res/values/colors.xml
new file mode 100755
index 0000000..2142b44
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/res/values/colors.xml
@@ -0,0 +1,29 @@
+
+
+
+ #6ab343
+ #388310
+ #D81B60
+ #6ab343
+ #388310
+ #f44336
+ #ba000d
+ #de000000
+ #99000000
+ #606060
+ #ffffff
+
diff --git a/GuessTheWordDataBinding/app/src/main/res/values/strings.xml b/GuessTheWordDataBinding/app/src/main/res/values/strings.xml
new file mode 100755
index 0000000..cc0669a
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/res/values/strings.xml
@@ -0,0 +1,30 @@
+
+
+
+ Guess the Word
+ Skip
+ Play Again
+ You Scored
+ guess the word!
+ Play
+ Get ready to
+ Got it
+ End game
+ The word is…
+ \"%s\"
+ Current Score: %d
+
diff --git a/GuessTheWordDataBinding/app/src/main/res/values/styles.xml b/GuessTheWordDataBinding/app/src/main/res/values/styles.xml
new file mode 100755
index 0000000..c35b963
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/main/res/values/styles.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordDataBinding/app/src/test/java/com/example/android/guesstheword/ExampleUnitTest.kt b/GuessTheWordDataBinding/app/src/test/java/com/example/android/guesstheword/ExampleUnitTest.kt
new file mode 100755
index 0000000..6c938fc
--- /dev/null
+++ b/GuessTheWordDataBinding/app/src/test/java/com/example/android/guesstheword/ExampleUnitTest.kt
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword
+
+import org.junit.Assert.assertEquals
+import org.junit.Test
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+class ExampleUnitTest {
+
+ @Test
+ fun addition_isCorrect() {
+ assertEquals(4, 2 + 2)
+ }
+}
diff --git a/GuessTheWordDataBinding/build.gradle b/GuessTheWordDataBinding/build.gradle
new file mode 100755
index 0000000..b685998
--- /dev/null
+++ b/GuessTheWordDataBinding/build.gradle
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.3.30'
+ repositories {
+ google()
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.4.0'
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0"
+
+ // 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
+}
\ No newline at end of file
diff --git a/GuessTheWordDataBinding/gradle.properties b/GuessTheWordDataBinding/gradle.properties
new file mode 100755
index 0000000..3de209c
--- /dev/null
+++ b/GuessTheWordDataBinding/gradle.properties
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2019 Google Inc.
+#
+# 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.
+#
+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
+android.databinding.enableV2=true
+android.useAndroidX=true
+android.enableJetifier=true
diff --git a/GuessTheWordDataBinding/gradle/wrapper/gradle-wrapper.jar b/GuessTheWordDataBinding/gradle/wrapper/gradle-wrapper.jar
new file mode 100755
index 0000000..f6b961f
Binary files /dev/null and b/GuessTheWordDataBinding/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/GuessTheWordDataBinding/gradle/wrapper/gradle-wrapper.properties b/GuessTheWordDataBinding/gradle/wrapper/gradle-wrapper.properties
new file mode 100755
index 0000000..4c6e178
--- /dev/null
+++ b/GuessTheWordDataBinding/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Thu Apr 25 11:40:45 PDT 2019
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
diff --git a/GuessTheWordDataBinding/gradlew b/GuessTheWordDataBinding/gradlew
new file mode 100755
index 0000000..cccdd3d
--- /dev/null
+++ b/GuessTheWordDataBinding/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/GuessTheWordDataBinding/gradlew.bat b/GuessTheWordDataBinding/gradlew.bat
new file mode 100755
index 0000000..f955316
--- /dev/null
+++ b/GuessTheWordDataBinding/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/GuessTheWordDataBinding/settings.gradle b/GuessTheWordDataBinding/settings.gradle
new file mode 100755
index 0000000..116b21c
--- /dev/null
+++ b/GuessTheWordDataBinding/settings.gradle
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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'
diff --git a/GuessTheWordLiveData/README.md b/GuessTheWordLiveData/README.md
new file mode 100644
index 0000000..fdff60e
--- /dev/null
+++ b/GuessTheWordLiveData/README.md
@@ -0,0 +1,45 @@
+LiveData - Solution Code
+==================================
+
+This is solution code for Use as starter code for the LiveData codelab.
+
+Introduction
+------------
+
+This starter app is a two player game, GuessTheWord. It is a word guessing app you can play with one or more friends. To play, hold the device in landscape, facing away from you with your thumbs on the **Skip** and **Got It** buttons. Your friends can then give you clues to help you guess the word. If you get the word right, press **Got It**. If you're stuck, press **Skip** or you can use the **End** button to end the game.
+This code demostrates the Android Architecture components, LiveData and LiveData observer pattern.
+
+Pre-requisites
+--------------
+
+You need to know:
+- How to open, build, and run Android apps with Android Studio.
+- How to use the Navigation Architecture Component
+- Passing the data between navigation destinations.
+- Read the logs using the Logcat.
+
+
+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.
diff --git a/GuessTheWordLiveData/app/.gitignore b/GuessTheWordLiveData/app/.gitignore
new file mode 100755
index 0000000..796b96d
--- /dev/null
+++ b/GuessTheWordLiveData/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/GuessTheWordLiveData/app/build.gradle b/GuessTheWordLiveData/app/build.gradle
new file mode 100755
index 0000000..b282b87
--- /dev/null
+++ b/GuessTheWordLiveData/app/build.gradle
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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'
+apply plugin: 'kotlin-android-extensions'
+apply plugin: "androidx.navigation.safeargs"
+
+android {
+ compileSdkVersion 28
+ defaultConfig {
+ applicationId "com.example.android.guesstheword"
+ minSdkVersion 19
+ targetSdkVersion 28
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ dataBinding {
+ enabled = true
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation 'androidx.appcompat:appcompat:1.0.2'
+ implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+ testImplementation 'junit:junit:4.12'
+
+ // KTX
+ implementation 'androidx.core:core-ktx:1.0.1'
+
+ // Navigation
+ implementation "android.arch.navigation:navigation-fragment-ktx:1.0.0"
+ implementation "android.arch.navigation:navigation-ui-ktx:1.0.0"
+
+ //ViewModel and LiveData
+ implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
+}
diff --git a/GuessTheWordLiveData/app/proguard-rules.pro b/GuessTheWordLiveData/app/proguard-rules.pro
new file mode 100755
index 0000000..f1b4245
--- /dev/null
+++ b/GuessTheWordLiveData/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/GuessTheWordLiveData/app/src/androidTest/java/com/example/android/guesstheword/ExampleInstrumentedTest.kt b/GuessTheWordLiveData/app/src/androidTest/java/com/example/android/guesstheword/ExampleInstrumentedTest.kt
new file mode 100755
index 0000000..20f64d6
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/androidTest/java/com/example/android/guesstheword/ExampleInstrumentedTest.kt
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword
+
+import androidx.test.InstrumentationRegistry
+import androidx.test.runner.AndroidJUnit4
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import org.junit.runner.RunWith
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+@RunWith(AndroidJUnit4::class)
+class ExampleInstrumentedTest {
+
+ @Test
+ fun useAppContext() {
+ // Context of the app under test.
+ val appContext = InstrumentationRegistry.getTargetContext()
+ assertEquals("com.example.android.guesstheword", appContext.packageName)
+ }
+}
diff --git a/GuessTheWordLiveData/app/src/main/AndroidManifest.xml b/GuessTheWordLiveData/app/src/main/AndroidManifest.xml
new file mode 100755
index 0000000..5e86e0e
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/AndroidManifest.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordLiveData/app/src/main/ic_guess_it-web.png b/GuessTheWordLiveData/app/src/main/ic_guess_it-web.png
new file mode 100755
index 0000000..e78aef1
Binary files /dev/null and b/GuessTheWordLiveData/app/src/main/ic_guess_it-web.png differ
diff --git a/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/MainActivity.kt b/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/MainActivity.kt
new file mode 100755
index 0000000..8d99816
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/MainActivity.kt
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+
+/**
+ * Creates an Activity that hosts all of the fragments in the app
+ */
+class MainActivity : AppCompatActivity() {
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.main_activity)
+ }
+
+}
diff --git a/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/screens/game/GameFragment.kt b/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/screens/game/GameFragment.kt
new file mode 100755
index 0000000..ed46d52
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/screens/game/GameFragment.kt
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.game
+
+import android.os.Bundle
+import android.util.Log
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.Toast
+import androidx.databinding.DataBindingUtil
+import androidx.fragment.app.Fragment
+import androidx.lifecycle.Observer
+import androidx.lifecycle.ViewModelProviders
+import androidx.navigation.fragment.NavHostFragment.findNavController
+import com.example.android.guesstheword.R
+import com.example.android.guesstheword.databinding.GameFragmentBinding
+
+/**
+ * Fragment where the game is played
+ */
+class GameFragment : Fragment() {
+
+ private lateinit var binding: GameFragmentBinding
+
+ private lateinit var viewModel: GameViewModel
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?): View? {
+
+ // Inflate view and obtain an instance of the binding class
+ binding = DataBindingUtil.inflate(
+ inflater,
+ R.layout.game_fragment,
+ container,
+ false
+ )
+ Log.i("GameFragment", "Called ViewModelProviders.of")
+
+ viewModel = ViewModelProviders.of(this).get(GameViewModel::class.java)
+
+ /** Setting up LiveData observation relationship **/
+ viewModel.word.observe(this, Observer { newWord ->
+ binding.wordText.text = newWord
+ })
+
+ viewModel.score.observe(this, Observer { newScore ->
+ binding.scoreText.text = newScore.toString()
+
+ })
+
+ // Observer for the Game finished event
+ viewModel.eventGameFinish.observe(this, Observer { hasFinished ->
+ if (hasFinished) gameFinished()
+ })
+
+ binding.correctButton.setOnClickListener { onCorrect() }
+ binding.skipButton.setOnClickListener { onSkip() }
+ binding.endGameButton.setOnClickListener { onEndGame() }
+ return binding.root
+ }
+
+
+ /** Methods for buttons presses **/
+
+ private fun onSkip() {
+ viewModel.onSkip()
+ }
+ private fun onCorrect() {
+ viewModel.onCorrect()
+ }
+ private fun onEndGame() {
+ gameFinished()
+ }
+
+ private fun gameFinished() {
+ Toast.makeText(activity, "Game has just finished", Toast.LENGTH_SHORT).show()
+ val action = GameFragmentDirections.actionGameToScore()
+ action.score = viewModel.score.value?:0
+ findNavController(this).navigate(action)
+ viewModel.onGameFinishComplete()
+ }
+}
diff --git a/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/screens/game/GameViewModel.kt b/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/screens/game/GameViewModel.kt
new file mode 100644
index 0000000..15fe71f
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/screens/game/GameViewModel.kt
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.game
+
+import android.util.Log
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+
+
+class GameViewModel : ViewModel() {
+
+ // The current _word
+ private val _word = MutableLiveData()
+
+ // The current score
+ private val _score = MutableLiveData()
+ val score: LiveData
+ get() = _score
+
+ val word: LiveData
+ get() = _word
+
+
+
+ private val _eventGameFinish = MutableLiveData()
+ val eventGameFinish: LiveData
+ get() = _eventGameFinish
+
+
+ // The list of words - the front of the list is the next _word to guess
+ private lateinit var wordList: MutableList
+
+
+ /**
+ * Resets the list of words and randomizes the order
+ */
+ private fun resetList() {
+ wordList = mutableListOf(
+ "queen",
+ "hospital",
+ "basketball",
+ "cat",
+ "change",
+ "snail",
+ "soup",
+ "calendar",
+ "sad",
+ "desk",
+ "guitar",
+ "home",
+ "railway",
+ "zebra",
+ "jelly",
+ "car",
+ "crow",
+ "trade",
+ "bag",
+ "roll",
+ "bubble"
+ )
+ wordList.shuffle()
+ }
+
+ init {
+ _word.value = ""
+ _score.value = 0
+ Log.i("GameViewModel", "GameViewModel created!")
+ resetList()
+ nextWord()
+ }
+
+ /**
+ * Callback called when the ViewModel is destroyed
+ */
+ override fun onCleared() {
+ super.onCleared()
+ Log.i("GameViewModel", "GameViewModel destroyed!")
+ }
+
+ /** Methods for updating the UI **/
+ fun onSkip() {
+ if (!wordList.isEmpty()) {
+ _score.value = (_score.value)?.minus(1)
+ }
+ nextWord()
+ }
+ fun onCorrect() {
+ if (!wordList.isEmpty()) {
+ _score.value = (_score.value)?.plus(1)
+ }
+ nextWord()
+ }
+
+ /**
+ * Moves to the next _word in the list.
+ */
+ private fun nextWord() {
+ if (wordList.isEmpty()) {
+ onGameFinish()
+
+ } else {
+ //Select and remove a _word from the list
+ _word.value = wordList.removeAt(0)
+ }
+ }
+
+
+
+ /** Method for the game completed event **/
+
+ fun onGameFinish() {
+ _eventGameFinish.value = true
+ }
+
+ fun onGameFinishComplete() {
+ _eventGameFinish.value = false
+ }
+
+}
diff --git a/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreFragment.kt b/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreFragment.kt
new file mode 100755
index 0000000..d9de174
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreFragment.kt
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.score
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.databinding.DataBindingUtil
+import androidx.fragment.app.Fragment
+import androidx.lifecycle.Observer
+import androidx.lifecycle.ViewModelProviders
+import androidx.navigation.fragment.findNavController
+import com.example.android.guesstheword.R
+import com.example.android.guesstheword.databinding.ScoreFragmentBinding
+
+/**
+ * Fragment where the final score is shown, after the game is over
+ */
+class ScoreFragment : Fragment() {
+
+ private lateinit var viewModel: ScoreViewModel
+ private lateinit var viewModelFactory: ScoreViewModelFactory
+
+ override fun onCreateView(
+ inflater: LayoutInflater,
+ container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+
+ // Inflate view and obtain an instance of the binding class.
+ val binding: ScoreFragmentBinding = DataBindingUtil.inflate(
+ inflater,
+ R.layout.score_fragment,
+ container,
+ false
+ )
+
+
+ viewModelFactory = ScoreViewModelFactory(ScoreFragmentArgs.fromBundle(arguments!!).score)
+ viewModel = ViewModelProviders.of(this, viewModelFactory)
+ .get(ScoreViewModel::class.java)
+
+ // Add observer for score
+ viewModel.score.observe(this, Observer { newScore ->
+ binding.scoreText.text = newScore.toString()
+ })
+
+ binding.playAgainButton.setOnClickListener { viewModel.onPlayAgain() }
+
+ // Navigates back to game when button is pressed
+ viewModel.eventPlayAgain.observe(this, Observer { playAgain ->
+ if (playAgain) {
+ findNavController().navigate(ScoreFragmentDirections.actionRestart())
+ viewModel.onPlayAgainComplete()
+ }
+ })
+
+ return binding.root
+ }
+}
diff --git a/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModel.kt b/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModel.kt
new file mode 100644
index 0000000..fadad35
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModel.kt
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.score
+
+import android.util.Log
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+
+
+class ScoreViewModel(finalScore: Int) : ViewModel() {
+
+ private val _score = MutableLiveData()
+ val score: LiveData
+ get() = _score
+
+ private val _eventPlayAgain = MutableLiveData()
+ val eventPlayAgain: LiveData
+ get() = _eventPlayAgain
+
+
+ init {
+ _score.value = finalScore
+ }
+
+ fun onPlayAgain() {
+ _eventPlayAgain.value = true
+ }
+
+ fun onPlayAgainComplete() {
+ _eventPlayAgain.value = false
+ }
+
+
+}
diff --git a/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModelFactory.kt b/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModelFactory.kt
new file mode 100644
index 0000000..1671608
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModelFactory.kt
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.score
+
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.ViewModelProvider
+
+class ScoreViewModelFactory (private val finalScore: Int) : ViewModelProvider.Factory {
+
+ override fun create(modelClass: Class): T {
+ if (modelClass.isAssignableFrom(ScoreViewModel::class.java)) {
+ return ScoreViewModel(finalScore) as T
+ }
+ throw IllegalArgumentException("Unknown ViewModel class")
+ }
+
+}
diff --git a/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/screens/title/TitleFragment.kt b/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/screens/title/TitleFragment.kt
new file mode 100755
index 0000000..9fa0a68
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/java/com/example/android/guesstheword/screens/title/TitleFragment.kt
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.title
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.databinding.DataBindingUtil
+import androidx.fragment.app.Fragment
+import androidx.navigation.fragment.findNavController
+import com.example.android.guesstheword.R
+import com.example.android.guesstheword.databinding.TitleFragmentBinding
+
+/**
+ * Fragment for the starting or title screen of the app
+ */
+class TitleFragment : Fragment() {
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?): View {
+ // Inflate the layout for this fragment
+ val binding: TitleFragmentBinding = DataBindingUtil.inflate(
+ inflater, R.layout.title_fragment, container, false)
+
+ binding.playGameButton.setOnClickListener {
+ findNavController().navigate(TitleFragmentDirections.actionTitleToGame())
+ }
+ return binding.root
+ }
+}
diff --git a/GuessTheWordLiveData/app/src/main/res/anim/slide_in_right.xml b/GuessTheWordLiveData/app/src/main/res/anim/slide_in_right.xml
new file mode 100755
index 0000000..dc03344
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/res/anim/slide_in_right.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
diff --git a/GuessTheWordLiveData/app/src/main/res/anim/slide_out_left.xml b/GuessTheWordLiveData/app/src/main/res/anim/slide_out_left.xml
new file mode 100755
index 0000000..ec2c114
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/res/anim/slide_out_left.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
diff --git a/GuessTheWordLiveData/app/src/main/res/drawable/ic_launcher_background.xml b/GuessTheWordLiveData/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100755
index 0000000..cf04c59
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordLiveData/app/src/main/res/drawable/ic_launcher_foreground.xml b/GuessTheWordLiveData/app/src/main/res/drawable/ic_launcher_foreground.xml
new file mode 100755
index 0000000..1b3e6a7
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordLiveData/app/src/main/res/layout/game_fragment.xml b/GuessTheWordLiveData/app/src/main/res/layout/game_fragment.xml
new file mode 100755
index 0000000..184ac97
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/res/layout/game_fragment.xml
@@ -0,0 +1,137 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuessTheWordLiveData/app/src/main/res/layout/main_activity.xml b/GuessTheWordLiveData/app/src/main/res/layout/main_activity.xml
new file mode 100755
index 0000000..40a862f
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/res/layout/main_activity.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
diff --git a/GuessTheWordLiveData/app/src/main/res/layout/score_fragment.xml b/GuessTheWordLiveData/app/src/main/res/layout/score_fragment.xml
new file mode 100755
index 0000000..1974036
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/res/layout/score_fragment.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuessTheWordLiveData/app/src/main/res/layout/title_fragment.xml b/GuessTheWordLiveData/app/src/main/res/layout/title_fragment.xml
new file mode 100755
index 0000000..8f598ca
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/res/layout/title_fragment.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordLiveData/app/src/main/res/mipmap-anydpi-v26/ic_guess_it.xml b/GuessTheWordLiveData/app/src/main/res/mipmap-anydpi-v26/ic_guess_it.xml
new file mode 100755
index 0000000..9b4f225
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/res/mipmap-anydpi-v26/ic_guess_it.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuessTheWordLiveData/app/src/main/res/mipmap-anydpi-v26/ic_guess_it_round.xml b/GuessTheWordLiveData/app/src/main/res/mipmap-anydpi-v26/ic_guess_it_round.xml
new file mode 100755
index 0000000..9b4f225
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/res/mipmap-anydpi-v26/ic_guess_it_round.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuessTheWordLiveData/app/src/main/res/mipmap-hdpi/ic_guess_it.png b/GuessTheWordLiveData/app/src/main/res/mipmap-hdpi/ic_guess_it.png
new file mode 100755
index 0000000..23b77ba
Binary files /dev/null and b/GuessTheWordLiveData/app/src/main/res/mipmap-hdpi/ic_guess_it.png differ
diff --git a/GuessTheWordLiveData/app/src/main/res/mipmap-hdpi/ic_guess_it_round.png b/GuessTheWordLiveData/app/src/main/res/mipmap-hdpi/ic_guess_it_round.png
new file mode 100755
index 0000000..ba1992f
Binary files /dev/null and b/GuessTheWordLiveData/app/src/main/res/mipmap-hdpi/ic_guess_it_round.png differ
diff --git a/GuessTheWordLiveData/app/src/main/res/mipmap-mdpi/ic_guess_it.png b/GuessTheWordLiveData/app/src/main/res/mipmap-mdpi/ic_guess_it.png
new file mode 100755
index 0000000..30509d9
Binary files /dev/null and b/GuessTheWordLiveData/app/src/main/res/mipmap-mdpi/ic_guess_it.png differ
diff --git a/GuessTheWordLiveData/app/src/main/res/mipmap-mdpi/ic_guess_it_round.png b/GuessTheWordLiveData/app/src/main/res/mipmap-mdpi/ic_guess_it_round.png
new file mode 100755
index 0000000..3332698
Binary files /dev/null and b/GuessTheWordLiveData/app/src/main/res/mipmap-mdpi/ic_guess_it_round.png differ
diff --git a/GuessTheWordLiveData/app/src/main/res/mipmap-xhdpi/ic_guess_it.png b/GuessTheWordLiveData/app/src/main/res/mipmap-xhdpi/ic_guess_it.png
new file mode 100755
index 0000000..7528c03
Binary files /dev/null and b/GuessTheWordLiveData/app/src/main/res/mipmap-xhdpi/ic_guess_it.png differ
diff --git a/GuessTheWordLiveData/app/src/main/res/mipmap-xhdpi/ic_guess_it_round.png b/GuessTheWordLiveData/app/src/main/res/mipmap-xhdpi/ic_guess_it_round.png
new file mode 100755
index 0000000..3a03ac2
Binary files /dev/null and b/GuessTheWordLiveData/app/src/main/res/mipmap-xhdpi/ic_guess_it_round.png differ
diff --git a/GuessTheWordLiveData/app/src/main/res/mipmap-xxhdpi/ic_guess_it.png b/GuessTheWordLiveData/app/src/main/res/mipmap-xxhdpi/ic_guess_it.png
new file mode 100755
index 0000000..7e08481
Binary files /dev/null and b/GuessTheWordLiveData/app/src/main/res/mipmap-xxhdpi/ic_guess_it.png differ
diff --git a/GuessTheWordLiveData/app/src/main/res/mipmap-xxhdpi/ic_guess_it_round.png b/GuessTheWordLiveData/app/src/main/res/mipmap-xxhdpi/ic_guess_it_round.png
new file mode 100755
index 0000000..ce95305
Binary files /dev/null and b/GuessTheWordLiveData/app/src/main/res/mipmap-xxhdpi/ic_guess_it_round.png differ
diff --git a/GuessTheWordLiveData/app/src/main/res/mipmap-xxxhdpi/ic_guess_it.png b/GuessTheWordLiveData/app/src/main/res/mipmap-xxxhdpi/ic_guess_it.png
new file mode 100755
index 0000000..af9781f
Binary files /dev/null and b/GuessTheWordLiveData/app/src/main/res/mipmap-xxxhdpi/ic_guess_it.png differ
diff --git a/GuessTheWordLiveData/app/src/main/res/mipmap-xxxhdpi/ic_guess_it_round.png b/GuessTheWordLiveData/app/src/main/res/mipmap-xxxhdpi/ic_guess_it_round.png
new file mode 100755
index 0000000..314cc75
Binary files /dev/null and b/GuessTheWordLiveData/app/src/main/res/mipmap-xxxhdpi/ic_guess_it_round.png differ
diff --git a/GuessTheWordLiveData/app/src/main/res/navigation/main_navigation.xml b/GuessTheWordLiveData/app/src/main/res/navigation/main_navigation.xml
new file mode 100755
index 0000000..eb5f687
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/res/navigation/main_navigation.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuessTheWordLiveData/app/src/main/res/values/colors.xml b/GuessTheWordLiveData/app/src/main/res/values/colors.xml
new file mode 100755
index 0000000..2142b44
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/res/values/colors.xml
@@ -0,0 +1,29 @@
+
+
+
+ #6ab343
+ #388310
+ #D81B60
+ #6ab343
+ #388310
+ #f44336
+ #ba000d
+ #de000000
+ #99000000
+ #606060
+ #ffffff
+
diff --git a/GuessTheWordLiveData/app/src/main/res/values/strings.xml b/GuessTheWordLiveData/app/src/main/res/values/strings.xml
new file mode 100755
index 0000000..1b67f57
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/res/values/strings.xml
@@ -0,0 +1,28 @@
+
+
+
+ Guess the Word
+ Skip
+ Play Again
+ You Scored
+ guess the word!
+ Play
+ Get ready to
+ Got it
+ End game
+ The word is…
+
diff --git a/GuessTheWordLiveData/app/src/main/res/values/styles.xml b/GuessTheWordLiveData/app/src/main/res/values/styles.xml
new file mode 100755
index 0000000..c35b963
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/main/res/values/styles.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordLiveData/app/src/test/java/com/example/android/guesstheword/ExampleUnitTest.kt b/GuessTheWordLiveData/app/src/test/java/com/example/android/guesstheword/ExampleUnitTest.kt
new file mode 100755
index 0000000..6c938fc
--- /dev/null
+++ b/GuessTheWordLiveData/app/src/test/java/com/example/android/guesstheword/ExampleUnitTest.kt
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword
+
+import org.junit.Assert.assertEquals
+import org.junit.Test
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+class ExampleUnitTest {
+
+ @Test
+ fun addition_isCorrect() {
+ assertEquals(4, 2 + 2)
+ }
+}
diff --git a/GuessTheWordLiveData/build.gradle b/GuessTheWordLiveData/build.gradle
new file mode 100755
index 0000000..b685998
--- /dev/null
+++ b/GuessTheWordLiveData/build.gradle
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.3.30'
+ repositories {
+ google()
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.4.0'
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0"
+
+ // 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
+}
\ No newline at end of file
diff --git a/GuessTheWordLiveData/gradle.properties b/GuessTheWordLiveData/gradle.properties
new file mode 100755
index 0000000..3de209c
--- /dev/null
+++ b/GuessTheWordLiveData/gradle.properties
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2019 Google Inc.
+#
+# 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.
+#
+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
+android.databinding.enableV2=true
+android.useAndroidX=true
+android.enableJetifier=true
diff --git a/GuessTheWordLiveData/gradle/wrapper/gradle-wrapper.jar b/GuessTheWordLiveData/gradle/wrapper/gradle-wrapper.jar
new file mode 100755
index 0000000..f6b961f
Binary files /dev/null and b/GuessTheWordLiveData/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/GuessTheWordLiveData/gradle/wrapper/gradle-wrapper.properties b/GuessTheWordLiveData/gradle/wrapper/gradle-wrapper.properties
new file mode 100755
index 0000000..f5e6c37
--- /dev/null
+++ b/GuessTheWordLiveData/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Thu Apr 25 11:45:20 PDT 2019
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
diff --git a/GuessTheWordLiveData/gradlew b/GuessTheWordLiveData/gradlew
new file mode 100755
index 0000000..cccdd3d
--- /dev/null
+++ b/GuessTheWordLiveData/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/GuessTheWordLiveData/gradlew.bat b/GuessTheWordLiveData/gradlew.bat
new file mode 100755
index 0000000..f955316
--- /dev/null
+++ b/GuessTheWordLiveData/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/GuessTheWordLiveData/settings.gradle b/GuessTheWordLiveData/settings.gradle
new file mode 100755
index 0000000..116b21c
--- /dev/null
+++ b/GuessTheWordLiveData/settings.gradle
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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'
diff --git a/GuessTheWordTransformation/README.md b/GuessTheWordTransformation/README.md
new file mode 100644
index 0000000..b386b81
--- /dev/null
+++ b/GuessTheWordTransformation/README.md
@@ -0,0 +1,45 @@
+LiveData - Solution Code
+==================================
+
+Use as starter code for the LiveData and ViewModel codelab.
+
+Introduction
+------------
+
+This starter app is a two player game, GuessTheWord. It is a word guessing app you can play with one or more friends. To play, hold the device in landscape, facing away from you with your thumbs on the **Skip** and **Got It** buttons. Your friends can then give you clues to help you guess the word. If you get the word right, press **Got It**. If you're stuck, press **Skip** or you can use the **End** button to end the game.
+This code demostrates the Android Architecture components, LiveData and LiveData observer pattern.
+
+Pre-requisites
+--------------
+
+You need to know:
+- How to open, build, and run Android apps with Android Studio.
+- How to use the Navigation Architecture Component
+- Passing the data between navigation destinations.
+- Read the logs using the Logcat.
+
+
+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.
diff --git a/GuessTheWordTransformation/app/.gitignore b/GuessTheWordTransformation/app/.gitignore
new file mode 100755
index 0000000..796b96d
--- /dev/null
+++ b/GuessTheWordTransformation/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/GuessTheWordTransformation/app/build.gradle b/GuessTheWordTransformation/app/build.gradle
new file mode 100755
index 0000000..b282b87
--- /dev/null
+++ b/GuessTheWordTransformation/app/build.gradle
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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'
+apply plugin: 'kotlin-android-extensions'
+apply plugin: "androidx.navigation.safeargs"
+
+android {
+ compileSdkVersion 28
+ defaultConfig {
+ applicationId "com.example.android.guesstheword"
+ minSdkVersion 19
+ targetSdkVersion 28
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ dataBinding {
+ enabled = true
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation 'androidx.appcompat:appcompat:1.0.2'
+ implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+ testImplementation 'junit:junit:4.12'
+
+ // KTX
+ implementation 'androidx.core:core-ktx:1.0.1'
+
+ // Navigation
+ implementation "android.arch.navigation:navigation-fragment-ktx:1.0.0"
+ implementation "android.arch.navigation:navigation-ui-ktx:1.0.0"
+
+ //ViewModel and LiveData
+ implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
+}
diff --git a/GuessTheWordTransformation/app/proguard-rules.pro b/GuessTheWordTransformation/app/proguard-rules.pro
new file mode 100755
index 0000000..f1b4245
--- /dev/null
+++ b/GuessTheWordTransformation/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/GuessTheWordTransformation/app/src/androidTest/java/com/example/android/guesstheword/ExampleInstrumentedTest.kt b/GuessTheWordTransformation/app/src/androidTest/java/com/example/android/guesstheword/ExampleInstrumentedTest.kt
new file mode 100755
index 0000000..20f64d6
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/androidTest/java/com/example/android/guesstheword/ExampleInstrumentedTest.kt
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword
+
+import androidx.test.InstrumentationRegistry
+import androidx.test.runner.AndroidJUnit4
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import org.junit.runner.RunWith
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+@RunWith(AndroidJUnit4::class)
+class ExampleInstrumentedTest {
+
+ @Test
+ fun useAppContext() {
+ // Context of the app under test.
+ val appContext = InstrumentationRegistry.getTargetContext()
+ assertEquals("com.example.android.guesstheword", appContext.packageName)
+ }
+}
diff --git a/GuessTheWordTransformation/app/src/main/AndroidManifest.xml b/GuessTheWordTransformation/app/src/main/AndroidManifest.xml
new file mode 100755
index 0000000..5e86e0e
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/AndroidManifest.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordTransformation/app/src/main/ic_guess_it-web.png b/GuessTheWordTransformation/app/src/main/ic_guess_it-web.png
new file mode 100755
index 0000000..e78aef1
Binary files /dev/null and b/GuessTheWordTransformation/app/src/main/ic_guess_it-web.png differ
diff --git a/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/MainActivity.kt b/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/MainActivity.kt
new file mode 100755
index 0000000..8d99816
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/MainActivity.kt
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+
+/**
+ * Creates an Activity that hosts all of the fragments in the app
+ */
+class MainActivity : AppCompatActivity() {
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.main_activity)
+ }
+
+}
diff --git a/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/screens/game/GameFragment.kt b/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/screens/game/GameFragment.kt
new file mode 100755
index 0000000..02d303e
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/screens/game/GameFragment.kt
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.game
+
+import android.os.Bundle
+import android.util.Log
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.Toast
+import androidx.databinding.DataBindingUtil
+import androidx.fragment.app.Fragment
+import androidx.lifecycle.Observer
+import androidx.lifecycle.ViewModelProviders
+import androidx.navigation.fragment.NavHostFragment.findNavController
+import com.example.android.guesstheword.R
+import com.example.android.guesstheword.databinding.GameFragmentBinding
+
+/**
+ * Fragment where the game is played
+ */
+class GameFragment : Fragment() {
+
+ private lateinit var binding: GameFragmentBinding
+
+ private lateinit var viewModel: GameViewModel
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?): View? {
+
+ // Inflate view and obtain an instance of the binding class
+ binding = DataBindingUtil.inflate(
+ inflater,
+ R.layout.game_fragment,
+ container,
+ false
+ )
+ Log.i("GameFragment", "Called ViewModelProviders.of")
+
+ viewModel = ViewModelProviders.of(this).get(GameViewModel::class.java)
+
+ // Set the viewModel for databinding - this allows the bound layout access
+ // to all the data in the VieWModel
+ binding.gameViewModel = viewModel
+
+ // Specify the current activity as the lifecycle owner of the binding.
+ // This is used so that the binding can observe LiveData updates
+ binding.lifecycleOwner = this
+
+
+ // Observer for the Game finished event
+ viewModel.eventGameFinish.observe(this, Observer { hasFinished ->
+ if (hasFinished) gameFinished()
+ })
+
+ return binding.root
+ }
+
+ /**
+ * Called when the game is finished
+ */
+ private fun gameFinished() {
+ Toast.makeText(activity, "Game has just finished", Toast.LENGTH_SHORT).show()
+ val action = GameFragmentDirections.actionGameToScore()
+ action.score = viewModel.score.value?:0
+ findNavController(this).navigate(action)
+ viewModel.onGameFinishComplete()
+ }
+}
diff --git a/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/screens/game/GameViewModel.kt b/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/screens/game/GameViewModel.kt
new file mode 100644
index 0000000..8a35257
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/screens/game/GameViewModel.kt
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.game
+
+import android.os.CountDownTimer
+import android.text.format.DateUtils
+import android.util.Log
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.Transformations
+import androidx.lifecycle.ViewModel
+
+/**
+ * ViewModel containing all the logic needed to run the game
+ */
+class GameViewModel : ViewModel() {
+ private val timer: CountDownTimer
+
+ companion object {
+
+ // Time when the game is over
+ private const val DONE = 0L
+
+ // Countdown time interval
+ private const val ONE_SECOND = 1000L
+
+ // Total time for the game
+ private const val COUNTDOWN_TIME = 60000L
+
+ }
+
+ // The current _word
+ private val _word = MutableLiveData()
+ val word: LiveData
+ get() = _word
+
+ // The current score
+ private val _score = MutableLiveData()
+ val score: LiveData
+ get() = _score
+
+ // Countdown time
+ private val _currentTime = MutableLiveData()
+ val currentTime: LiveData
+ get() = _currentTime
+
+
+ // The String version of the current time
+ val currentTimeString = Transformations.map(currentTime) { time ->
+ DateUtils.formatElapsedTime(time)
+ }
+
+ // Event which triggers the end of the game
+ private val _eventGameFinish = MutableLiveData()
+ val eventGameFinish: LiveData
+ get() = _eventGameFinish
+
+
+ // The list of words - the front of the list is the next _word to guess
+ private lateinit var wordList: MutableList
+
+
+ /**
+ * Resets the list of words and randomizes the order
+ */
+ private fun resetList() {
+ wordList = mutableListOf(
+ "queen",
+ "hospital",
+ "basketball",
+ "cat",
+ "change",
+ "snail",
+ "soup",
+ "calendar",
+ "sad",
+ "desk",
+ "guitar",
+ "home",
+ "railway",
+ "zebra",
+ "jelly",
+ "car",
+ "crow",
+ "trade",
+ "bag",
+ "roll",
+ "bubble"
+ )
+ wordList.shuffle()
+ }
+
+ init {
+ _word.value = ""
+ _score.value = 0
+ Log.i("GameViewModel", "GameViewModel created!")
+ resetList()
+ nextWord()
+
+ // Creates a timer which triggers the end of the game when it finishes
+ timer = object : CountDownTimer(COUNTDOWN_TIME, ONE_SECOND) {
+
+ override fun onTick(millisUntilFinished: Long) {
+ _currentTime.value = millisUntilFinished/ONE_SECOND
+ }
+
+ override fun onFinish() {
+ _currentTime.value = DONE
+ onGameFinish()
+ }
+ }
+
+ timer.start()
+ }
+
+ /**
+ * Callback called when the ViewModel is destroyed
+ */
+ override fun onCleared() {
+ super.onCleared()
+ Log.i("GameViewModel", "GameViewModel destroyed!")
+ timer.cancel()
+ }
+
+ /** Methods for updating the UI **/
+ fun onSkip() {
+ if (!wordList.isEmpty()) {
+ _score.value = (_score.value)?.minus(1)
+ }
+ nextWord()
+ }
+ fun onCorrect() {
+ if (!wordList.isEmpty()) {
+ _score.value = (_score.value)?.plus(1)
+ }
+ nextWord()
+ }
+
+ /**
+ * Moves to the next _word in the list.
+ */
+ private fun nextWord() {
+ if (wordList.isEmpty()) {
+ resetList()
+
+ } else {
+ //Select and remove a _word from the list
+ _word.value = wordList.removeAt(0)
+ }
+ }
+
+ /** Method for the game completed event **/
+
+ fun onGameFinishComplete() {
+ _eventGameFinish.value = false
+ }
+
+ fun onGameFinish() {
+ _eventGameFinish.value = true
+ }
+
+}
diff --git a/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreFragment.kt b/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreFragment.kt
new file mode 100755
index 0000000..952ebbd
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreFragment.kt
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.score
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.databinding.DataBindingUtil
+import androidx.fragment.app.Fragment
+import androidx.lifecycle.Observer
+import androidx.lifecycle.ViewModelProviders
+import androidx.navigation.fragment.findNavController
+import com.example.android.guesstheword.R
+import com.example.android.guesstheword.databinding.ScoreFragmentBinding
+
+/**
+ * Fragment where the final score is shown, after the game is over
+ */
+class ScoreFragment : Fragment() {
+
+ private lateinit var viewModel: ScoreViewModel
+ private lateinit var viewModelFactory: ScoreViewModelFactory
+
+ override fun onCreateView(
+ inflater: LayoutInflater,
+ container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+
+ // Inflate view and obtain an instance of the binding class.
+ val binding: ScoreFragmentBinding = DataBindingUtil.inflate(
+ inflater,
+ R.layout.score_fragment,
+ container,
+ false
+ )
+
+ viewModelFactory = ScoreViewModelFactory(ScoreFragmentArgs.fromBundle(arguments!!).score)
+ viewModel = ViewModelProviders.of(this, viewModelFactory)
+ .get(ScoreViewModel::class.java)
+ binding.scoreViewModel = viewModel
+
+ // Specify the current activity as the lifecycle owner of the binding.
+ // This is used so that the binding can observe LiveData updates
+ binding.lifecycleOwner = this
+
+ // Navigates back to game when button is pressed
+ viewModel.eventPlayAgain.observe(this, Observer { playAgain ->
+ if (playAgain) {
+ findNavController().navigate(ScoreFragmentDirections.actionRestart())
+ viewModel.onPlayAgainComplete()
+ }
+ })
+
+ return binding.root
+ }
+}
diff --git a/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModel.kt b/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModel.kt
new file mode 100644
index 0000000..a47a91e
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModel.kt
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.score
+
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+
+/**
+ * ViewModel for the final screen showing the score
+ */
+class ScoreViewModel(finalScore: Int) : ViewModel() {
+
+ private val _score = MutableLiveData()
+ val score: LiveData
+ get() = _score
+
+ private val _eventPlayAgain = MutableLiveData()
+ val eventPlayAgain: LiveData
+ get() = _eventPlayAgain
+
+
+ init {
+ _score.value = finalScore
+ }
+
+ fun onPlayAgain() {
+ _eventPlayAgain.value = true
+ }
+
+ fun onPlayAgainComplete() {
+ _eventPlayAgain.value = false
+ }
+
+
+}
diff --git a/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModelFactory.kt b/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModelFactory.kt
new file mode 100644
index 0000000..1671608
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModelFactory.kt
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.score
+
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.ViewModelProvider
+
+class ScoreViewModelFactory (private val finalScore: Int) : ViewModelProvider.Factory {
+
+ override fun create(modelClass: Class): T {
+ if (modelClass.isAssignableFrom(ScoreViewModel::class.java)) {
+ return ScoreViewModel(finalScore) as T
+ }
+ throw IllegalArgumentException("Unknown ViewModel class")
+ }
+
+}
diff --git a/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/screens/title/TitleFragment.kt b/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/screens/title/TitleFragment.kt
new file mode 100755
index 0000000..9fa0a68
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/java/com/example/android/guesstheword/screens/title/TitleFragment.kt
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.title
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.databinding.DataBindingUtil
+import androidx.fragment.app.Fragment
+import androidx.navigation.fragment.findNavController
+import com.example.android.guesstheword.R
+import com.example.android.guesstheword.databinding.TitleFragmentBinding
+
+/**
+ * Fragment for the starting or title screen of the app
+ */
+class TitleFragment : Fragment() {
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?): View {
+ // Inflate the layout for this fragment
+ val binding: TitleFragmentBinding = DataBindingUtil.inflate(
+ inflater, R.layout.title_fragment, container, false)
+
+ binding.playGameButton.setOnClickListener {
+ findNavController().navigate(TitleFragmentDirections.actionTitleToGame())
+ }
+ return binding.root
+ }
+}
diff --git a/GuessTheWordTransformation/app/src/main/res/anim/slide_in_right.xml b/GuessTheWordTransformation/app/src/main/res/anim/slide_in_right.xml
new file mode 100755
index 0000000..dc03344
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/res/anim/slide_in_right.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
diff --git a/GuessTheWordTransformation/app/src/main/res/anim/slide_out_left.xml b/GuessTheWordTransformation/app/src/main/res/anim/slide_out_left.xml
new file mode 100755
index 0000000..ec2c114
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/res/anim/slide_out_left.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
diff --git a/GuessTheWordTransformation/app/src/main/res/drawable/ic_launcher_background.xml b/GuessTheWordTransformation/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100755
index 0000000..cf04c59
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordTransformation/app/src/main/res/drawable/ic_launcher_foreground.xml b/GuessTheWordTransformation/app/src/main/res/drawable/ic_launcher_foreground.xml
new file mode 100755
index 0000000..1b3e6a7
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordTransformation/app/src/main/res/layout/game_fragment.xml b/GuessTheWordTransformation/app/src/main/res/layout/game_fragment.xml
new file mode 100755
index 0000000..fd3bc6b
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/res/layout/game_fragment.xml
@@ -0,0 +1,151 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuessTheWordTransformation/app/src/main/res/layout/main_activity.xml b/GuessTheWordTransformation/app/src/main/res/layout/main_activity.xml
new file mode 100755
index 0000000..40a862f
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/res/layout/main_activity.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
diff --git a/GuessTheWordTransformation/app/src/main/res/layout/score_fragment.xml b/GuessTheWordTransformation/app/src/main/res/layout/score_fragment.xml
new file mode 100755
index 0000000..6e9cfa7
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/res/layout/score_fragment.xml
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuessTheWordTransformation/app/src/main/res/layout/title_fragment.xml b/GuessTheWordTransformation/app/src/main/res/layout/title_fragment.xml
new file mode 100755
index 0000000..8f598ca
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/res/layout/title_fragment.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordTransformation/app/src/main/res/mipmap-anydpi-v26/ic_guess_it.xml b/GuessTheWordTransformation/app/src/main/res/mipmap-anydpi-v26/ic_guess_it.xml
new file mode 100755
index 0000000..9b4f225
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/res/mipmap-anydpi-v26/ic_guess_it.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuessTheWordTransformation/app/src/main/res/mipmap-anydpi-v26/ic_guess_it_round.xml b/GuessTheWordTransformation/app/src/main/res/mipmap-anydpi-v26/ic_guess_it_round.xml
new file mode 100755
index 0000000..9b4f225
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/res/mipmap-anydpi-v26/ic_guess_it_round.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuessTheWordTransformation/app/src/main/res/mipmap-hdpi/ic_guess_it.png b/GuessTheWordTransformation/app/src/main/res/mipmap-hdpi/ic_guess_it.png
new file mode 100755
index 0000000..23b77ba
Binary files /dev/null and b/GuessTheWordTransformation/app/src/main/res/mipmap-hdpi/ic_guess_it.png differ
diff --git a/GuessTheWordTransformation/app/src/main/res/mipmap-hdpi/ic_guess_it_round.png b/GuessTheWordTransformation/app/src/main/res/mipmap-hdpi/ic_guess_it_round.png
new file mode 100755
index 0000000..ba1992f
Binary files /dev/null and b/GuessTheWordTransformation/app/src/main/res/mipmap-hdpi/ic_guess_it_round.png differ
diff --git a/GuessTheWordTransformation/app/src/main/res/mipmap-mdpi/ic_guess_it.png b/GuessTheWordTransformation/app/src/main/res/mipmap-mdpi/ic_guess_it.png
new file mode 100755
index 0000000..30509d9
Binary files /dev/null and b/GuessTheWordTransformation/app/src/main/res/mipmap-mdpi/ic_guess_it.png differ
diff --git a/GuessTheWordTransformation/app/src/main/res/mipmap-mdpi/ic_guess_it_round.png b/GuessTheWordTransformation/app/src/main/res/mipmap-mdpi/ic_guess_it_round.png
new file mode 100755
index 0000000..3332698
Binary files /dev/null and b/GuessTheWordTransformation/app/src/main/res/mipmap-mdpi/ic_guess_it_round.png differ
diff --git a/GuessTheWordTransformation/app/src/main/res/mipmap-xhdpi/ic_guess_it.png b/GuessTheWordTransformation/app/src/main/res/mipmap-xhdpi/ic_guess_it.png
new file mode 100755
index 0000000..7528c03
Binary files /dev/null and b/GuessTheWordTransformation/app/src/main/res/mipmap-xhdpi/ic_guess_it.png differ
diff --git a/GuessTheWordTransformation/app/src/main/res/mipmap-xhdpi/ic_guess_it_round.png b/GuessTheWordTransformation/app/src/main/res/mipmap-xhdpi/ic_guess_it_round.png
new file mode 100755
index 0000000..3a03ac2
Binary files /dev/null and b/GuessTheWordTransformation/app/src/main/res/mipmap-xhdpi/ic_guess_it_round.png differ
diff --git a/GuessTheWordTransformation/app/src/main/res/mipmap-xxhdpi/ic_guess_it.png b/GuessTheWordTransformation/app/src/main/res/mipmap-xxhdpi/ic_guess_it.png
new file mode 100755
index 0000000..7e08481
Binary files /dev/null and b/GuessTheWordTransformation/app/src/main/res/mipmap-xxhdpi/ic_guess_it.png differ
diff --git a/GuessTheWordTransformation/app/src/main/res/mipmap-xxhdpi/ic_guess_it_round.png b/GuessTheWordTransformation/app/src/main/res/mipmap-xxhdpi/ic_guess_it_round.png
new file mode 100755
index 0000000..ce95305
Binary files /dev/null and b/GuessTheWordTransformation/app/src/main/res/mipmap-xxhdpi/ic_guess_it_round.png differ
diff --git a/GuessTheWordTransformation/app/src/main/res/mipmap-xxxhdpi/ic_guess_it.png b/GuessTheWordTransformation/app/src/main/res/mipmap-xxxhdpi/ic_guess_it.png
new file mode 100755
index 0000000..af9781f
Binary files /dev/null and b/GuessTheWordTransformation/app/src/main/res/mipmap-xxxhdpi/ic_guess_it.png differ
diff --git a/GuessTheWordTransformation/app/src/main/res/mipmap-xxxhdpi/ic_guess_it_round.png b/GuessTheWordTransformation/app/src/main/res/mipmap-xxxhdpi/ic_guess_it_round.png
new file mode 100755
index 0000000..314cc75
Binary files /dev/null and b/GuessTheWordTransformation/app/src/main/res/mipmap-xxxhdpi/ic_guess_it_round.png differ
diff --git a/GuessTheWordTransformation/app/src/main/res/navigation/main_navigation.xml b/GuessTheWordTransformation/app/src/main/res/navigation/main_navigation.xml
new file mode 100755
index 0000000..eb5f687
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/res/navigation/main_navigation.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuessTheWordTransformation/app/src/main/res/values/colors.xml b/GuessTheWordTransformation/app/src/main/res/values/colors.xml
new file mode 100755
index 0000000..2142b44
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/res/values/colors.xml
@@ -0,0 +1,29 @@
+
+
+
+ #6ab343
+ #388310
+ #D81B60
+ #6ab343
+ #388310
+ #f44336
+ #ba000d
+ #de000000
+ #99000000
+ #606060
+ #ffffff
+
diff --git a/GuessTheWordTransformation/app/src/main/res/values/strings.xml b/GuessTheWordTransformation/app/src/main/res/values/strings.xml
new file mode 100755
index 0000000..cc0669a
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/res/values/strings.xml
@@ -0,0 +1,30 @@
+
+
+
+ Guess the Word
+ Skip
+ Play Again
+ You Scored
+ guess the word!
+ Play
+ Get ready to
+ Got it
+ End game
+ The word is…
+ \"%s\"
+ Current Score: %d
+
diff --git a/GuessTheWordTransformation/app/src/main/res/values/styles.xml b/GuessTheWordTransformation/app/src/main/res/values/styles.xml
new file mode 100755
index 0000000..c35b963
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/main/res/values/styles.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordTransformation/app/src/test/java/com/example/android/guesstheword/ExampleUnitTest.kt b/GuessTheWordTransformation/app/src/test/java/com/example/android/guesstheword/ExampleUnitTest.kt
new file mode 100755
index 0000000..6c938fc
--- /dev/null
+++ b/GuessTheWordTransformation/app/src/test/java/com/example/android/guesstheword/ExampleUnitTest.kt
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword
+
+import org.junit.Assert.assertEquals
+import org.junit.Test
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+class ExampleUnitTest {
+
+ @Test
+ fun addition_isCorrect() {
+ assertEquals(4, 2 + 2)
+ }
+}
diff --git a/GuessTheWordTransformation/build.gradle b/GuessTheWordTransformation/build.gradle
new file mode 100755
index 0000000..b685998
--- /dev/null
+++ b/GuessTheWordTransformation/build.gradle
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.3.30'
+ repositories {
+ google()
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.4.0'
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0"
+
+ // 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
+}
\ No newline at end of file
diff --git a/GuessTheWordTransformation/gradle.properties b/GuessTheWordTransformation/gradle.properties
new file mode 100755
index 0000000..3de209c
--- /dev/null
+++ b/GuessTheWordTransformation/gradle.properties
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2019 Google Inc.
+#
+# 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.
+#
+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
+android.databinding.enableV2=true
+android.useAndroidX=true
+android.enableJetifier=true
diff --git a/GuessTheWordTransformation/gradle/wrapper/gradle-wrapper.jar b/GuessTheWordTransformation/gradle/wrapper/gradle-wrapper.jar
new file mode 100755
index 0000000..f6b961f
Binary files /dev/null and b/GuessTheWordTransformation/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/GuessTheWordTransformation/gradle/wrapper/gradle-wrapper.properties b/GuessTheWordTransformation/gradle/wrapper/gradle-wrapper.properties
new file mode 100755
index 0000000..6f0d23f
--- /dev/null
+++ b/GuessTheWordTransformation/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Thu Apr 25 11:49:54 PDT 2019
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
diff --git a/GuessTheWordTransformation/gradlew b/GuessTheWordTransformation/gradlew
new file mode 100755
index 0000000..cccdd3d
--- /dev/null
+++ b/GuessTheWordTransformation/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/GuessTheWordTransformation/gradlew.bat b/GuessTheWordTransformation/gradlew.bat
new file mode 100755
index 0000000..f955316
--- /dev/null
+++ b/GuessTheWordTransformation/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/GuessTheWordTransformation/settings.gradle b/GuessTheWordTransformation/settings.gradle
new file mode 100755
index 0000000..116b21c
--- /dev/null
+++ b/GuessTheWordTransformation/settings.gradle
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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'
diff --git a/GuessTheWordViewModel/README.md b/GuessTheWordViewModel/README.md
new file mode 100644
index 0000000..37a1ed9
--- /dev/null
+++ b/GuessTheWordViewModel/README.md
@@ -0,0 +1,45 @@
+ViewModel and ViewModelFactory - Solution Code
+==================================
+
+This is the solution code for the ViewModel and ViewModelFactory codelab.
+
+Introduction
+------------
+
+This starter app is a two player game, GuessTheWord. It is a word guessing app you can play with one or more friends. To play, hold the device in landscape, facing away from you with your thumbs on the **Skip** and **Got It** buttons. Your friends can then give you clues to help you guess the word. If you get the word right, press **Got It**. If you're stuck, press **Skip**.
+This code demostrates the Android Architecture components, ViewModel and ViewModelFactory.
+
+Pre-requisites
+--------------
+
+You need to know:
+- How to open, build, and run Android apps with Android Studio.
+- How to use the Navigation Architecture Component
+- Passing the data between navigation destinations.
+- Read the logs using the Logcat.
+
+
+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.
diff --git a/GuessTheWordViewModel/app/.gitignore b/GuessTheWordViewModel/app/.gitignore
new file mode 100755
index 0000000..796b96d
--- /dev/null
+++ b/GuessTheWordViewModel/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/GuessTheWordViewModel/app/build.gradle b/GuessTheWordViewModel/app/build.gradle
new file mode 100755
index 0000000..af3a9e4
--- /dev/null
+++ b/GuessTheWordViewModel/app/build.gradle
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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'
+apply plugin: 'kotlin-android-extensions'
+apply plugin: "androidx.navigation.safeargs"
+
+android {
+ compileSdkVersion 28
+ defaultConfig {
+ applicationId "com.example.android.guesstheword"
+ minSdkVersion 19
+ targetSdkVersion 28
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ dataBinding {
+ enabled = true
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation 'androidx.appcompat:appcompat:1.0.2'
+ implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+ testImplementation 'junit:junit:4.12'
+
+ // KTX
+ implementation 'androidx.core:core-ktx:1.0.1'
+
+ // Navigation
+ implementation "android.arch.navigation:navigation-fragment-ktx:1.0.0"
+ implementation "android.arch.navigation:navigation-ui-ktx:1.0.0"
+
+ //ViewModel
+ implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
+}
diff --git a/GuessTheWordViewModel/app/proguard-rules.pro b/GuessTheWordViewModel/app/proguard-rules.pro
new file mode 100755
index 0000000..f1b4245
--- /dev/null
+++ b/GuessTheWordViewModel/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/GuessTheWordViewModel/app/src/main/AndroidManifest.xml b/GuessTheWordViewModel/app/src/main/AndroidManifest.xml
new file mode 100755
index 0000000..5e86e0e
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/AndroidManifest.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordViewModel/app/src/main/ic_guess_it-web.png b/GuessTheWordViewModel/app/src/main/ic_guess_it-web.png
new file mode 100755
index 0000000..e78aef1
Binary files /dev/null and b/GuessTheWordViewModel/app/src/main/ic_guess_it-web.png differ
diff --git a/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/MainActivity.kt b/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/MainActivity.kt
new file mode 100755
index 0000000..8d99816
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/MainActivity.kt
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+
+/**
+ * Creates an Activity that hosts all of the fragments in the app
+ */
+class MainActivity : AppCompatActivity() {
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.main_activity)
+ }
+
+}
diff --git a/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/screens/game/GameFragment.kt b/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/screens/game/GameFragment.kt
new file mode 100755
index 0000000..f884e16
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/screens/game/GameFragment.kt
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.game
+
+import android.os.Bundle
+import android.util.Log
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.Toast
+import androidx.databinding.DataBindingUtil
+import androidx.fragment.app.Fragment
+import androidx.lifecycle.ViewModelProviders
+import androidx.navigation.fragment.NavHostFragment
+import com.example.android.guesstheword.R
+import com.example.android.guesstheword.databinding.GameFragmentBinding
+
+/**
+ * Fragment where the game is played
+ */
+class GameFragment : Fragment() {
+
+ private lateinit var binding: GameFragmentBinding
+
+ private lateinit var viewModel: GameViewModel
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?): View? {
+
+ // Inflate view and obtain an instance of the binding class
+ binding = DataBindingUtil.inflate(
+ inflater,
+ R.layout.game_fragment,
+ container,
+ false
+ )
+ Log.i("GameFragment", "Called ViewModelProviders.of")
+
+ // Get the viewModel
+ viewModel = ViewModelProviders.of(this).get(GameViewModel::class.java)
+
+ binding.correctButton.setOnClickListener { onCorrect() }
+ binding.skipButton.setOnClickListener { onSkip() }
+ binding.endGameButton.setOnClickListener { onEndGame() }
+ updateScoreText()
+ updateWordText()
+ return binding.root
+ }
+
+ /** Methods for buttons presses **/
+
+ private fun onSkip() {
+ viewModel.onSkip()
+ updateWordText()
+ updateScoreText()
+ }
+ private fun onCorrect() {
+ viewModel.onCorrect()
+ updateScoreText()
+ updateWordText()
+ }
+
+ private fun onEndGame() {
+ gameFinished()
+ }
+
+ /** Methods for updating the UI **/
+
+ private fun updateWordText() {
+ binding.wordText.text = viewModel.word
+
+ }
+
+ private fun updateScoreText() {
+ binding.scoreText.text = viewModel.score.toString()
+ }
+
+ /**
+ * Called when the game is finished
+ */
+ private fun gameFinished() {
+ Toast.makeText(activity, "Game has just finished", Toast.LENGTH_SHORT).show()
+ val action = GameFragmentDirections.actionGameToScore()
+ action.score = viewModel.score
+ NavHostFragment.findNavController(this).navigate(action)
+ }
+}
diff --git a/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/screens/game/GameViewModel.kt b/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/screens/game/GameViewModel.kt
new file mode 100644
index 0000000..f48c37c
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/screens/game/GameViewModel.kt
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.game
+
+import android.util.Log
+import androidx.lifecycle.ViewModel
+
+/**
+ * ViewModel containing all the logic needed to run the game
+ */
+class GameViewModel : ViewModel() {
+
+ // The current word
+ var word = ""
+
+ // The current score
+ var score = 0
+
+ // The list of words - the front of the list is the next word to guess
+ private lateinit var wordList: MutableList
+
+
+ /**
+ * Resets the list of words and randomizes the order
+ */
+ private fun resetList() {
+ wordList = mutableListOf(
+ "queen",
+ "hospital",
+ "basketball",
+ "cat",
+ "change",
+ "snail",
+ "soup",
+ "calendar",
+ "sad",
+ "desk",
+ "guitar",
+ "home",
+ "railway",
+ "zebra",
+ "jelly",
+ "car",
+ "crow",
+ "trade",
+ "bag",
+ "roll",
+ "bubble"
+ )
+ wordList.shuffle()
+ }
+
+ init {
+ Log.i("GameViewModel", "GameViewModel created!")
+ resetList()
+ nextWord()
+ }
+
+ /**
+ * Callback called when the ViewModel is destroyed
+ */
+ override fun onCleared() {
+ super.onCleared()
+ Log.i("GameViewModel", "GameViewModel destroyed!")
+ }
+
+ /** Methods for updating the UI **/
+ fun onSkip() {
+ if (!wordList.isEmpty()) {
+ score--
+ }
+ nextWord()
+ }
+ fun onCorrect() {
+ if (!wordList.isEmpty()) {
+ score++
+ }
+ nextWord()
+ }
+
+ /**
+ * Moves to the next word in the list.
+ */
+ private fun nextWord() {
+ //Select and remove a word from the list
+ if (!wordList.isEmpty()) {
+ word = wordList.removeAt(0)
+ }
+ }
+}
diff --git a/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreFragment.kt b/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreFragment.kt
new file mode 100755
index 0000000..e0d0085
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreFragment.kt
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.score
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.databinding.DataBindingUtil
+import androidx.fragment.app.Fragment
+import androidx.lifecycle.ViewModelProviders
+import androidx.navigation.fragment.navArgs
+import com.example.android.guesstheword.R
+import com.example.android.guesstheword.databinding.ScoreFragmentBinding
+
+/**
+ * Fragment where the final score is shown, after the game is over
+ */
+class ScoreFragment : Fragment() {
+
+ private lateinit var viewModel: ScoreViewModel
+ private lateinit var viewModelFactory: ScoreViewModelFactory
+
+ override fun onCreateView(
+ inflater: LayoutInflater,
+ container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+
+ // Inflate view and obtain an instance of the binding class.
+ val binding: ScoreFragmentBinding = DataBindingUtil.inflate(
+ inflater,
+ R.layout.score_fragment,
+ container,
+ false
+ )
+
+ viewModelFactory = ScoreViewModelFactory(ScoreFragmentArgs.fromBundle(arguments!!).score)
+ viewModel = ViewModelProviders.of(this, viewModelFactory)
+ .get(ScoreViewModel::class.java)
+
+ binding.scoreText.text = viewModel.score.toString()
+
+ return binding.root
+ }
+}
diff --git a/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModel.kt b/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModel.kt
new file mode 100644
index 0000000..27ff8ba
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModel.kt
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.score
+
+import android.util.Log
+import androidx.lifecycle.ViewModel
+
+/**
+ * ViewModel for the final screen showing the score
+ */
+class ScoreViewModel(finalScore: Int) : ViewModel() {
+
+ // The final score
+ var score = finalScore
+
+ init {
+ Log.i("ScoreViewModel", "Final score is $finalScore")
+ }
+}
diff --git a/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModelFactory.kt b/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModelFactory.kt
new file mode 100644
index 0000000..1671608
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/screens/score/ScoreViewModelFactory.kt
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.score
+
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.ViewModelProvider
+
+class ScoreViewModelFactory (private val finalScore: Int) : ViewModelProvider.Factory {
+
+ override fun create(modelClass: Class): T {
+ if (modelClass.isAssignableFrom(ScoreViewModel::class.java)) {
+ return ScoreViewModel(finalScore) as T
+ }
+ throw IllegalArgumentException("Unknown ViewModel class")
+ }
+
+}
diff --git a/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/screens/title/TitleFragment.kt b/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/screens/title/TitleFragment.kt
new file mode 100755
index 0000000..9fa0a68
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/java/com/example/android/guesstheword/screens/title/TitleFragment.kt
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.guesstheword.screens.title
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.databinding.DataBindingUtil
+import androidx.fragment.app.Fragment
+import androidx.navigation.fragment.findNavController
+import com.example.android.guesstheword.R
+import com.example.android.guesstheword.databinding.TitleFragmentBinding
+
+/**
+ * Fragment for the starting or title screen of the app
+ */
+class TitleFragment : Fragment() {
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?): View {
+ // Inflate the layout for this fragment
+ val binding: TitleFragmentBinding = DataBindingUtil.inflate(
+ inflater, R.layout.title_fragment, container, false)
+
+ binding.playGameButton.setOnClickListener {
+ findNavController().navigate(TitleFragmentDirections.actionTitleToGame())
+ }
+ return binding.root
+ }
+}
diff --git a/GuessTheWordViewModel/app/src/main/res/anim/slide_in_right.xml b/GuessTheWordViewModel/app/src/main/res/anim/slide_in_right.xml
new file mode 100755
index 0000000..dc03344
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/res/anim/slide_in_right.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
diff --git a/GuessTheWordViewModel/app/src/main/res/anim/slide_out_left.xml b/GuessTheWordViewModel/app/src/main/res/anim/slide_out_left.xml
new file mode 100755
index 0000000..ec2c114
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/res/anim/slide_out_left.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
diff --git a/GuessTheWordViewModel/app/src/main/res/drawable/ic_launcher_background.xml b/GuessTheWordViewModel/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100755
index 0000000..cf04c59
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordViewModel/app/src/main/res/drawable/ic_launcher_foreground.xml b/GuessTheWordViewModel/app/src/main/res/drawable/ic_launcher_foreground.xml
new file mode 100755
index 0000000..1b3e6a7
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordViewModel/app/src/main/res/layout/game_fragment.xml b/GuessTheWordViewModel/app/src/main/res/layout/game_fragment.xml
new file mode 100755
index 0000000..3a51ce8
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/res/layout/game_fragment.xml
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuessTheWordViewModel/app/src/main/res/layout/main_activity.xml b/GuessTheWordViewModel/app/src/main/res/layout/main_activity.xml
new file mode 100755
index 0000000..40a862f
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/res/layout/main_activity.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
diff --git a/GuessTheWordViewModel/app/src/main/res/layout/score_fragment.xml b/GuessTheWordViewModel/app/src/main/res/layout/score_fragment.xml
new file mode 100755
index 0000000..a755315
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/res/layout/score_fragment.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordViewModel/app/src/main/res/layout/title_fragment.xml b/GuessTheWordViewModel/app/src/main/res/layout/title_fragment.xml
new file mode 100755
index 0000000..8f598ca
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/res/layout/title_fragment.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordViewModel/app/src/main/res/mipmap-anydpi-v26/ic_guess_it.xml b/GuessTheWordViewModel/app/src/main/res/mipmap-anydpi-v26/ic_guess_it.xml
new file mode 100755
index 0000000..9b4f225
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/res/mipmap-anydpi-v26/ic_guess_it.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuessTheWordViewModel/app/src/main/res/mipmap-anydpi-v26/ic_guess_it_round.xml b/GuessTheWordViewModel/app/src/main/res/mipmap-anydpi-v26/ic_guess_it_round.xml
new file mode 100755
index 0000000..9b4f225
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/res/mipmap-anydpi-v26/ic_guess_it_round.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuessTheWordViewModel/app/src/main/res/mipmap-hdpi/ic_guess_it.png b/GuessTheWordViewModel/app/src/main/res/mipmap-hdpi/ic_guess_it.png
new file mode 100755
index 0000000..23b77ba
Binary files /dev/null and b/GuessTheWordViewModel/app/src/main/res/mipmap-hdpi/ic_guess_it.png differ
diff --git a/GuessTheWordViewModel/app/src/main/res/mipmap-hdpi/ic_guess_it_round.png b/GuessTheWordViewModel/app/src/main/res/mipmap-hdpi/ic_guess_it_round.png
new file mode 100755
index 0000000..ba1992f
Binary files /dev/null and b/GuessTheWordViewModel/app/src/main/res/mipmap-hdpi/ic_guess_it_round.png differ
diff --git a/GuessTheWordViewModel/app/src/main/res/mipmap-mdpi/ic_guess_it.png b/GuessTheWordViewModel/app/src/main/res/mipmap-mdpi/ic_guess_it.png
new file mode 100755
index 0000000..30509d9
Binary files /dev/null and b/GuessTheWordViewModel/app/src/main/res/mipmap-mdpi/ic_guess_it.png differ
diff --git a/GuessTheWordViewModel/app/src/main/res/mipmap-mdpi/ic_guess_it_round.png b/GuessTheWordViewModel/app/src/main/res/mipmap-mdpi/ic_guess_it_round.png
new file mode 100755
index 0000000..3332698
Binary files /dev/null and b/GuessTheWordViewModel/app/src/main/res/mipmap-mdpi/ic_guess_it_round.png differ
diff --git a/GuessTheWordViewModel/app/src/main/res/mipmap-xhdpi/ic_guess_it.png b/GuessTheWordViewModel/app/src/main/res/mipmap-xhdpi/ic_guess_it.png
new file mode 100755
index 0000000..7528c03
Binary files /dev/null and b/GuessTheWordViewModel/app/src/main/res/mipmap-xhdpi/ic_guess_it.png differ
diff --git a/GuessTheWordViewModel/app/src/main/res/mipmap-xhdpi/ic_guess_it_round.png b/GuessTheWordViewModel/app/src/main/res/mipmap-xhdpi/ic_guess_it_round.png
new file mode 100755
index 0000000..3a03ac2
Binary files /dev/null and b/GuessTheWordViewModel/app/src/main/res/mipmap-xhdpi/ic_guess_it_round.png differ
diff --git a/GuessTheWordViewModel/app/src/main/res/mipmap-xxhdpi/ic_guess_it.png b/GuessTheWordViewModel/app/src/main/res/mipmap-xxhdpi/ic_guess_it.png
new file mode 100755
index 0000000..7e08481
Binary files /dev/null and b/GuessTheWordViewModel/app/src/main/res/mipmap-xxhdpi/ic_guess_it.png differ
diff --git a/GuessTheWordViewModel/app/src/main/res/mipmap-xxhdpi/ic_guess_it_round.png b/GuessTheWordViewModel/app/src/main/res/mipmap-xxhdpi/ic_guess_it_round.png
new file mode 100755
index 0000000..ce95305
Binary files /dev/null and b/GuessTheWordViewModel/app/src/main/res/mipmap-xxhdpi/ic_guess_it_round.png differ
diff --git a/GuessTheWordViewModel/app/src/main/res/mipmap-xxxhdpi/ic_guess_it.png b/GuessTheWordViewModel/app/src/main/res/mipmap-xxxhdpi/ic_guess_it.png
new file mode 100755
index 0000000..af9781f
Binary files /dev/null and b/GuessTheWordViewModel/app/src/main/res/mipmap-xxxhdpi/ic_guess_it.png differ
diff --git a/GuessTheWordViewModel/app/src/main/res/mipmap-xxxhdpi/ic_guess_it_round.png b/GuessTheWordViewModel/app/src/main/res/mipmap-xxxhdpi/ic_guess_it_round.png
new file mode 100755
index 0000000..314cc75
Binary files /dev/null and b/GuessTheWordViewModel/app/src/main/res/mipmap-xxxhdpi/ic_guess_it_round.png differ
diff --git a/GuessTheWordViewModel/app/src/main/res/navigation/main_navigation.xml b/GuessTheWordViewModel/app/src/main/res/navigation/main_navigation.xml
new file mode 100755
index 0000000..eb5f687
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/res/navigation/main_navigation.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuessTheWordViewModel/app/src/main/res/values/colors.xml b/GuessTheWordViewModel/app/src/main/res/values/colors.xml
new file mode 100755
index 0000000..2142b44
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/res/values/colors.xml
@@ -0,0 +1,29 @@
+
+
+
+ #6ab343
+ #388310
+ #D81B60
+ #6ab343
+ #388310
+ #f44336
+ #ba000d
+ #de000000
+ #99000000
+ #606060
+ #ffffff
+
diff --git a/GuessTheWordViewModel/app/src/main/res/values/strings.xml b/GuessTheWordViewModel/app/src/main/res/values/strings.xml
new file mode 100755
index 0000000..1b67f57
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/res/values/strings.xml
@@ -0,0 +1,28 @@
+
+
+
+ Guess the Word
+ Skip
+ Play Again
+ You Scored
+ guess the word!
+ Play
+ Get ready to
+ Got it
+ End game
+ The word is…
+
diff --git a/GuessTheWordViewModel/app/src/main/res/values/styles.xml b/GuessTheWordViewModel/app/src/main/res/values/styles.xml
new file mode 100755
index 0000000..c35b963
--- /dev/null
+++ b/GuessTheWordViewModel/app/src/main/res/values/styles.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GuessTheWordViewModel/build.gradle b/GuessTheWordViewModel/build.gradle
new file mode 100755
index 0000000..c243ab9
--- /dev/null
+++ b/GuessTheWordViewModel/build.gradle
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.3.21'
+ repositories {
+ google()
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.4.0'
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0"
+
+ // 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
+}
\ No newline at end of file
diff --git a/GuessTheWordViewModel/gradle.properties b/GuessTheWordViewModel/gradle.properties
new file mode 100755
index 0000000..3de209c
--- /dev/null
+++ b/GuessTheWordViewModel/gradle.properties
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2019 Google Inc.
+#
+# 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.
+#
+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
+android.databinding.enableV2=true
+android.useAndroidX=true
+android.enableJetifier=true
diff --git a/GuessTheWordViewModel/gradle/wrapper/gradle-wrapper.jar b/GuessTheWordViewModel/gradle/wrapper/gradle-wrapper.jar
new file mode 100755
index 0000000..f6b961f
Binary files /dev/null and b/GuessTheWordViewModel/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/GuessTheWordViewModel/gradle/wrapper/gradle-wrapper.properties b/GuessTheWordViewModel/gradle/wrapper/gradle-wrapper.properties
new file mode 100755
index 0000000..6301014
--- /dev/null
+++ b/GuessTheWordViewModel/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Thu Apr 25 11:57:55 PDT 2019
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
diff --git a/GuessTheWordViewModel/gradlew b/GuessTheWordViewModel/gradlew
new file mode 100755
index 0000000..cccdd3d
--- /dev/null
+++ b/GuessTheWordViewModel/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/GuessTheWordViewModel/gradlew.bat b/GuessTheWordViewModel/gradlew.bat
new file mode 100755
index 0000000..f955316
--- /dev/null
+++ b/GuessTheWordViewModel/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/GuessTheWordViewModel/settings.gradle b/GuessTheWordViewModel/settings.gradle
new file mode 100755
index 0000000..116b21c
--- /dev/null
+++ b/GuessTheWordViewModel/settings.gradle
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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'