diff --git a/MyApplication/.gitignore b/MyApplication/.gitignore
new file mode 100644
index 000000000..2b75303ac
--- /dev/null
+++ b/MyApplication/.gitignore
@@ -0,0 +1,13 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
diff --git a/MyApplication/.idea/codeStyles/Project.xml b/MyApplication/.idea/codeStyles/Project.xml
new file mode 100644
index 000000000..cb22ebb76
--- /dev/null
+++ b/MyApplication/.idea/codeStyles/Project.xml
@@ -0,0 +1,122 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ xmlns:android
+ ^$
+
+
+
+
+
+
+
+
+ xmlns:.*
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*:id
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ .*:name
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ name
+ ^$
+
+
+
+
+
+
+
+
+ style
+ ^$
+
+
+
+
+
+
+
+
+ .*
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*
+ http://schemas.android.com/apk/res/android
+
+
+ ANDROID_ATTRIBUTE_ORDER
+
+
+
+
+
+
+ .*
+ .*
+
+
+ BY_NAME
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication/.idea/codeStyles/codeStyleConfig.xml b/MyApplication/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 000000000..79ee123c2
--- /dev/null
+++ b/MyApplication/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication/.idea/encodings.xml b/MyApplication/.idea/encodings.xml
new file mode 100644
index 000000000..15a15b218
--- /dev/null
+++ b/MyApplication/.idea/encodings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication/.idea/gradle.xml b/MyApplication/.idea/gradle.xml
new file mode 100644
index 000000000..7ac24c777
--- /dev/null
+++ b/MyApplication/.idea/gradle.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication/.idea/misc.xml b/MyApplication/.idea/misc.xml
new file mode 100644
index 000000000..af0bbdde1
--- /dev/null
+++ b/MyApplication/.idea/misc.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication/.idea/runConfigurations.xml b/MyApplication/.idea/runConfigurations.xml
new file mode 100644
index 000000000..7f68460d8
--- /dev/null
+++ b/MyApplication/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication/.idea/vcs.xml b/MyApplication/.idea/vcs.xml
new file mode 100644
index 000000000..6c0b86358
--- /dev/null
+++ b/MyApplication/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication/app/.gitignore b/MyApplication/app/.gitignore
new file mode 100644
index 000000000..796b96d1c
--- /dev/null
+++ b/MyApplication/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/MyApplication/app/build.gradle b/MyApplication/app/build.gradle
new file mode 100644
index 000000000..7daeda822
--- /dev/null
+++ b/MyApplication/app/build.gradle
@@ -0,0 +1,66 @@
+apply plugin: 'com.android.application'
+
+apply plugin: 'kotlin-android'
+
+apply plugin: 'kotlin-android-extensions'
+
+androidExtensions {
+ experimental = true
+}
+
+android {
+ compileSdkVersion 28
+ defaultConfig {
+ applicationId "com.buoy.codetest"
+ minSdkVersion 21
+ targetSdkVersion 28
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation 'com.android.support:appcompat-v7:28.0.0'
+ implementation 'com.android.support.constraint:constraint-layout:1.1.3'
+ testImplementation 'junit:junit:4.12'
+ androidTestImplementation 'com.android.support.test:runner:1.0.2'
+ androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
+
+ //implementation 'android.arch.navigation:navigation-fragment:1.0.0'
+ //implementation 'android.arch.navigation:navigation-ui:1.0.0'
+
+ // Koin for Android
+ implementation 'org.koin:koin-android:2.0.0-rc-2'
+ // or Koin for Lifecycle scoping
+ implementation 'org.koin:koin-androidx-scope:2.0.0-rc-2'
+ // or Koin for Android Architecture ViewModel
+ implementation 'org.koin:koin-androidx-viewmodel:2.0.0-rc-2'
+
+ implementation 'com.squareup.retrofit2:retrofit:2.5.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
+ implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0'
+
+ implementation 'com.google.code.gson:gson:2.8.5'
+
+ // rxandroid
+ implementation "io.reactivex.rxjava2:rxandroid:2.0.2"
+ implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+
+ implementation ("com.github.bumptech.glide:glide:4.9.0") {
+ exclude group: "com.android.support"
+ }
+ implementation "com.android.support:support-fragment:28.0.0"
+
+ implementation 'androidx.navigation:navigation-fragment-ktx:2.0.0'
+ implementation 'androidx.navigation:navigation-ui-ktx:2.0.0'
+
+}
diff --git a/MyApplication/app/proguard-rules.pro b/MyApplication/app/proguard-rules.pro
new file mode 100644
index 000000000..f1b424510
--- /dev/null
+++ b/MyApplication/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/MyApplication/app/src/androidTest/java/com/buoy/codetest/ExampleInstrumentedTest.kt b/MyApplication/app/src/androidTest/java/com/buoy/codetest/ExampleInstrumentedTest.kt
new file mode 100644
index 000000000..d395c041a
--- /dev/null
+++ b/MyApplication/app/src/androidTest/java/com/buoy/codetest/ExampleInstrumentedTest.kt
@@ -0,0 +1,24 @@
+package com.buoy.codetest
+
+import android.support.test.InstrumentationRegistry
+import android.support.test.runner.AndroidJUnit4
+
+import org.junit.Test
+import org.junit.runner.RunWith
+
+import org.junit.Assert.*
+
+/**
+ * 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.buoy.codetest", appContext.packageName)
+ }
+}
diff --git a/MyApplication/app/src/main/AndroidManifest.xml b/MyApplication/app/src/main/AndroidManifest.xml
new file mode 100644
index 000000000..fac25922d
--- /dev/null
+++ b/MyApplication/app/src/main/AndroidManifest.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication/app/src/main/java/com/buoy/codetest/CodeTestApplication.kt b/MyApplication/app/src/main/java/com/buoy/codetest/CodeTestApplication.kt
new file mode 100644
index 000000000..7909d7302
--- /dev/null
+++ b/MyApplication/app/src/main/java/com/buoy/codetest/CodeTestApplication.kt
@@ -0,0 +1,23 @@
+package com.buoy.codetest
+
+import android.app.Application
+import com.buoy.codetest.system.injection.networkModule
+import com.buoy.codetest.system.injection.repositoryModule
+import com.buoy.codetest.system.injection.viewModelModule
+import org.koin.android.ext.koin.androidContext
+import org.koin.android.ext.koin.androidLogger
+import org.koin.core.context.startKoin
+
+class CodeTestApplication: Application() {
+
+ override fun onCreate() {
+ super.onCreate()
+
+ startKoin{
+ androidLogger()
+ androidContext(this@CodeTestApplication)
+ modules(listOf(repositoryModule, networkModule, viewModelModule))
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/MyApplication/app/src/main/java/com/buoy/codetest/model/api/CocktailApi.kt b/MyApplication/app/src/main/java/com/buoy/codetest/model/api/CocktailApi.kt
new file mode 100644
index 000000000..71c328ee4
--- /dev/null
+++ b/MyApplication/app/src/main/java/com/buoy/codetest/model/api/CocktailApi.kt
@@ -0,0 +1,21 @@
+package com.buoy.codetest.model.api
+
+import com.buoy.codetest.model.domain.DrinksList
+import io.reactivex.Single
+
+import retrofit2.http.GET
+import retrofit2.http.Path
+import retrofit2.http.Query
+
+interface CocktailApi {
+
+ @GET("api/json/v1/1/filter.php?g=Cocktail_glass")
+ fun getAllCocktails(): Single
+
+ @GET("api/json/v1/1/lookup.php")
+ fun getCocktailDetail(@Query("i") id: String): Single
+
+ companion object {
+ const val URL = "http://www.thecocktaildb.com"
+ }
+}
\ No newline at end of file
diff --git a/MyApplication/app/src/main/java/com/buoy/codetest/model/domain/Drink.kt b/MyApplication/app/src/main/java/com/buoy/codetest/model/domain/Drink.kt
new file mode 100644
index 000000000..b325d9fb3
--- /dev/null
+++ b/MyApplication/app/src/main/java/com/buoy/codetest/model/domain/Drink.kt
@@ -0,0 +1,40 @@
+package com.buoy.codetest.model.domain
+
+import android.os.Parcelable
+import kotlinx.android.parcel.Parcelize
+
+@Parcelize
+data class Drink(val idDrink: String?,
+ val strDrink: String?,
+ val strDrinkThumb: String?,
+ val strInstructions: String?,
+ val strIngredient1: String?,
+ val strIngredient2: String?,
+ val strIngredient3: String?,
+ val strIngredient4: String?,
+ val strIngredient5: String?,
+ val strIngredient6: String?,
+ val strIngredient7: String?,
+ val strIngredient8: String?,
+ val strIngredient9: String?,
+ val strIngredient10: String?,
+ val strIngredient11: String?,
+ val strIngredient12: String?,
+ val strIngredient13: String?,
+ val strIngredient14: String?,
+ val strIngredient15: String?,
+ val strMeasure1: String?,
+ val strMeasure2: String?,
+ val strMeasure3: String?,
+ val strMeasure4: String?,
+ val strMeasure5: String?,
+ val strMeasure6: String?,
+ val strMeasure7: String?,
+ val strMeasure8: String?,
+ val strMeasure9: String?,
+ val strMeasure10: String?,
+ val strMeasure11: String?,
+ val strMeasure12: String?,
+ val strMeasure13: String?,
+ val strMeasure14: String?,
+ val strMeasure15: String?): Parcelable
\ No newline at end of file
diff --git a/MyApplication/app/src/main/java/com/buoy/codetest/model/domain/DrinksList.kt b/MyApplication/app/src/main/java/com/buoy/codetest/model/domain/DrinksList.kt
new file mode 100644
index 000000000..566c500a1
--- /dev/null
+++ b/MyApplication/app/src/main/java/com/buoy/codetest/model/domain/DrinksList.kt
@@ -0,0 +1,3 @@
+package com.buoy.codetest.model.domain
+
+data class DrinksList(val drinks: List?)
\ No newline at end of file
diff --git a/MyApplication/app/src/main/java/com/buoy/codetest/model/repository/CocktailRepository.kt b/MyApplication/app/src/main/java/com/buoy/codetest/model/repository/CocktailRepository.kt
new file mode 100644
index 000000000..8ea33d575
--- /dev/null
+++ b/MyApplication/app/src/main/java/com/buoy/codetest/model/repository/CocktailRepository.kt
@@ -0,0 +1,13 @@
+package com.buoy.codetest.model.repository
+
+import com.buoy.codetest.model.domain.Drink
+import io.reactivex.Single
+
+
+interface CocktailRepository {
+
+ fun getAllCocktails(): Single>
+
+ fun getCocktailDetail(id: String): Single
+
+}
\ No newline at end of file
diff --git a/MyApplication/app/src/main/java/com/buoy/codetest/model/repository/CocktailRepositoryImpl.kt b/MyApplication/app/src/main/java/com/buoy/codetest/model/repository/CocktailRepositoryImpl.kt
new file mode 100644
index 000000000..015ac8d35
--- /dev/null
+++ b/MyApplication/app/src/main/java/com/buoy/codetest/model/repository/CocktailRepositoryImpl.kt
@@ -0,0 +1,28 @@
+package com.buoy.codetest.model.repository
+
+import com.buoy.codetest.model.api.CocktailApi
+import com.buoy.codetest.model.domain.Drink
+import io.reactivex.Single
+
+class CocktailRepositoryImpl(val cocktailApi: CocktailApi): CocktailRepository {
+
+ override fun getCocktailDetail(id: String): Single {
+ return cocktailApi.getCocktailDetail(id).map { drinkList ->
+ var drink: Drink? = null
+ drinkList.drinks?.let { drinks ->
+ if (drinks.isNotEmpty()) {
+ drink = drinks[0]
+ }
+ }
+ drink
+ }
+
+ }
+
+ override fun getAllCocktails(): Single> {
+ return cocktailApi.getAllCocktails().map { drinksList ->
+ drinksList.drinks
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/MyApplication/app/src/main/java/com/buoy/codetest/system/extentions/Nullability.kt b/MyApplication/app/src/main/java/com/buoy/codetest/system/extentions/Nullability.kt
new file mode 100644
index 000000000..1dd0fbde1
--- /dev/null
+++ b/MyApplication/app/src/main/java/com/buoy/codetest/system/extentions/Nullability.kt
@@ -0,0 +1,5 @@
+package com.buoy.codetest.system.extentions
+
+fun notEmptyStrings(p1: T1?, p2: T2?, block: (T1, T2)->R?): R? {
+ return if (p1 != null && p1.isNotEmpty() && p2 != null && p2.isNotEmpty()) block(p1, p2) else null
+}
\ No newline at end of file
diff --git a/MyApplication/app/src/main/java/com/buoy/codetest/system/extentions/Properties.kt b/MyApplication/app/src/main/java/com/buoy/codetest/system/extentions/Properties.kt
new file mode 100644
index 000000000..b1d336592
--- /dev/null
+++ b/MyApplication/app/src/main/java/com/buoy/codetest/system/extentions/Properties.kt
@@ -0,0 +1,10 @@
+package com.buoy.codetest.system.extentions
+
+inline fun Any.getThroughReflection(propertyName: String): T? {
+ val getterName = "get" + propertyName.capitalize()
+ return try {
+ javaClass.getMethod(getterName).invoke(this) as? T
+ } catch (e: NoSuchMethodException) {
+ null
+ }
+}
\ No newline at end of file
diff --git a/MyApplication/app/src/main/java/com/buoy/codetest/system/injection/GlobalModule.kt b/MyApplication/app/src/main/java/com/buoy/codetest/system/injection/GlobalModule.kt
new file mode 100644
index 000000000..df050eb4a
--- /dev/null
+++ b/MyApplication/app/src/main/java/com/buoy/codetest/system/injection/GlobalModule.kt
@@ -0,0 +1,52 @@
+package com.buoy.codetest.system.injection
+
+import com.buoy.codetest.model.api.CocktailApi
+import com.buoy.codetest.model.repository.CocktailRepository
+import com.buoy.codetest.model.repository.CocktailRepositoryImpl
+import com.buoy.codetest.ui.cocktaildetail.CocktailDetailViewModel
+import com.buoy.codetest.ui.home.HomeViewModel
+import com.google.gson.GsonBuilder
+import org.koin.androidx.viewmodel.dsl.viewModel
+import org.koin.dsl.module
+import retrofit2.Retrofit
+import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
+import retrofit2.converter.gson.GsonConverterFactory
+import okhttp3.OkHttpClient
+
+
+
+private val retrofit: Retrofit = createNetworkClient()
+private val cocktailApi: CocktailApi = retrofit.create(CocktailApi::class.java)
+
+const val DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss"
+
+
+val viewModelModule = module {
+ viewModel { CocktailDetailViewModel(get()) }
+ viewModel { HomeViewModel(get()) }
+}
+
+val repositoryModule = module {
+ single { CocktailRepositoryImpl(cocktailApi = get()) as CocktailRepository }
+}
+
+val networkModule = module {
+ single { cocktailApi }
+}
+
+
+fun createNetworkClient(): Retrofit {
+ val gson = GsonBuilder()
+ .setDateFormat(DATE_FORMAT)
+ .create()
+
+ val okHttpClient = OkHttpClient().newBuilder().build()
+
+ return Retrofit.Builder()
+ .baseUrl(CocktailApi.URL)
+ .client(okHttpClient)
+ .addConverterFactory(GsonConverterFactory.create(gson))
+ .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
+ .build()
+}
+
diff --git a/MyApplication/app/src/main/java/com/buoy/codetest/ui/MainActivity.kt b/MyApplication/app/src/main/java/com/buoy/codetest/ui/MainActivity.kt
new file mode 100644
index 000000000..d4dcf6199
--- /dev/null
+++ b/MyApplication/app/src/main/java/com/buoy/codetest/ui/MainActivity.kt
@@ -0,0 +1,37 @@
+package com.buoy.codetest.ui
+
+import android.os.Bundle
+import android.view.Window
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.app.NavUtils
+import androidx.navigation.Navigation.findNavController
+import androidx.navigation.fragment.NavHostFragment
+import androidx.navigation.fragment.findNavController
+import com.buoy.codetest.R
+import kotlinx.android.synthetic.main.activity_main.*
+
+class MainActivity : AppCompatActivity() {
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ with(window) {
+ requestFeature(Window.FEATURE_CONTENT_TRANSITIONS)
+ }
+
+ setContentView(R.layout.activity_main)
+
+ }
+
+ override fun onBackPressed() {
+ when(NavHostFragment.findNavController(nav_host_fragment).currentDestination?.id) {
+ R.id.cocktailDetailFragment -> {
+ NavHostFragment.findNavController(nav_host_fragment).popBackStack()
+ }
+ else -> {
+ super.onBackPressed()
+ }
+ }
+ }
+
+}
diff --git a/MyApplication/app/src/main/java/com/buoy/codetest/ui/cocktaildetail/CocktailDetailFragment.kt b/MyApplication/app/src/main/java/com/buoy/codetest/ui/cocktaildetail/CocktailDetailFragment.kt
new file mode 100644
index 000000000..03041d210
--- /dev/null
+++ b/MyApplication/app/src/main/java/com/buoy/codetest/ui/cocktaildetail/CocktailDetailFragment.kt
@@ -0,0 +1,92 @@
+package com.buoy.codetest.ui.cocktaildetail
+
+import android.os.Bundle
+import android.transition.TransitionInflater
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.appcompat.app.AppCompatActivity
+import androidx.lifecycle.Observer
+import androidx.transition.ChangeBounds
+import com.bumptech.glide.Glide
+import com.bumptech.glide.load.resource.bitmap.RoundedCorners
+import com.bumptech.glide.request.RequestOptions
+import com.buoy.codetest.R
+import com.buoy.codetest.model.domain.Drink
+import com.buoy.codetest.system.extentions.getThroughReflection
+import com.buoy.codetest.system.extentions.notEmptyStrings
+import com.buoy.codetest.ui.common.BaseFragment
+import kotlinx.android.synthetic.main.fragment_cocktail_detail.*
+import org.koin.androidx.viewmodel.ext.android.viewModel
+
+class CocktailDetailFragment: BaseFragment() {
+
+ val model: CocktailDetailViewModel by viewModel()
+
+ override fun getLayoutResource(): Int = R.layout.fragment_cocktail_detail
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setHasOptionsMenu(true)
+ }
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
+ sharedElementEnterTransition = TransitionInflater.from(context).inflateTransition(android.R.transition.move)
+ return super.onCreateView(inflater, container, savedInstanceState)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+
+ (activity as AppCompatActivity).setSupportActionBar(toolbar)
+
+ arguments?.let { args ->
+ if (args.containsKey(EXTRA_DRINK)) {
+ val drink: Drink = args.getParcelable(EXTRA_DRINK)
+ model.initialize(drink)
+ setCocktailImage(drink.strDrinkThumb)
+ }
+ }
+
+ model.getDrink().observe(viewLifecycleOwner, Observer { drink -> onDrinkUpdate(drink) })
+ }
+
+ private fun setCocktailImage(strDrinkThumb: String?) {
+ Glide.with(this)
+ .load(strDrinkThumb)
+ .fitCenter()
+ .placeholder(R.drawable.placeholder)
+ .apply(RequestOptions.bitmapTransform(RoundedCorners(16)))
+ .into(image)
+ }
+
+ private fun onDrinkUpdate(drink: Drink?) {
+ drink?.let { drink ->
+ setToolbarTitle(drink.strDrink, true)
+ setCocktailImage(drink.strDrinkThumb)
+
+ ingredients.text = getIngredients(drink)
+ instructions.text = drink.strInstructions?.let { it }
+ }
+ }
+
+ private fun getIngredients(drink: Drink): String {
+ var ingredients = ""
+
+ for (i in 1..15) {
+ val ingredient = drink.getThroughReflection("strIngredient$i")
+ val measure = drink.getThroughReflection("strMeasure$i")
+
+ notEmptyStrings(ingredient, measure) { ingredient, measure ->
+ ingredients += "$ingredient $measure \n"
+ }
+
+ }
+
+ return ingredients
+ }
+
+ companion object {
+ const val EXTRA_DRINK = "extra_drink"
+ }
+}
\ No newline at end of file
diff --git a/MyApplication/app/src/main/java/com/buoy/codetest/ui/cocktaildetail/CocktailDetailViewModel.kt b/MyApplication/app/src/main/java/com/buoy/codetest/ui/cocktaildetail/CocktailDetailViewModel.kt
new file mode 100644
index 000000000..882f0e940
--- /dev/null
+++ b/MyApplication/app/src/main/java/com/buoy/codetest/ui/cocktaildetail/CocktailDetailViewModel.kt
@@ -0,0 +1,39 @@
+package com.buoy.codetest.ui.cocktaildetail
+
+import android.util.Log
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
+import com.buoy.codetest.model.domain.Drink
+import com.buoy.codetest.model.repository.CocktailRepository
+import com.buoy.codetest.ui.common.BaseViewModel
+import io.reactivex.android.schedulers.AndroidSchedulers
+import io.reactivex.schedulers.Schedulers
+
+class CocktailDetailViewModel(val cocktailRepository: CocktailRepository): BaseViewModel() {
+
+ private val drink = MutableLiveData()
+ fun getDrink(): LiveData = drink
+
+ fun initialize(drink: Drink) {
+ this.drink.value = drink
+ requestDrinkDetail(drink.idDrink)
+ }
+
+ private fun requestDrinkDetail(cocktailId: String?) {
+ cocktailId?.let { id ->
+ setState(State.LOADING)
+ cocktailRepository.getCocktailDetail(id)
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe ({ result ->
+ drink.value = result
+ setState(State.SUCCESS)
+ }, { error ->
+ Log.e("HomeViewModel", "requestDrinks:", error)
+ setState(State.ERROR)
+ })
+
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/MyApplication/app/src/main/java/com/buoy/codetest/ui/common/BaseFragment.kt b/MyApplication/app/src/main/java/com/buoy/codetest/ui/common/BaseFragment.kt
new file mode 100644
index 000000000..355620d1c
--- /dev/null
+++ b/MyApplication/app/src/main/java/com/buoy/codetest/ui/common/BaseFragment.kt
@@ -0,0 +1,42 @@
+package com.buoy.codetest.ui.common
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.MenuItem
+import android.view.View
+import android.view.ViewGroup
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.app.NavUtils
+import androidx.fragment.app.Fragment
+import androidx.navigation.fragment.findNavController
+import kotlinx.android.synthetic.main.view_load_helper.*
+
+abstract class BaseFragment: Fragment() {
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
+ return inflater.inflate(getLayoutResource(), container, false)
+ }
+
+ abstract fun getLayoutResource(): Int
+
+ fun setToolbarTitle(title: String?, backButton: Boolean) {
+ (activity as AppCompatActivity)?.let {
+ it.supportActionBar?.title = title
+ it.supportActionBar?.setHomeButtonEnabled(backButton)
+ it.supportActionBar?.setDisplayHomeAsUpEnabled(backButton)
+ }
+ }
+
+ override fun onOptionsItemSelected(item: MenuItem?): Boolean {
+ when(item?.itemId) {
+ android.R.id.home -> {
+ activity?.let { it.onBackPressed() }
+ return true
+ }
+ }
+
+ return super.onOptionsItemSelected(item)
+
+ }
+
+}
\ No newline at end of file
diff --git a/MyApplication/app/src/main/java/com/buoy/codetest/ui/common/BaseViewModel.kt b/MyApplication/app/src/main/java/com/buoy/codetest/ui/common/BaseViewModel.kt
new file mode 100644
index 000000000..da206116a
--- /dev/null
+++ b/MyApplication/app/src/main/java/com/buoy/codetest/ui/common/BaseViewModel.kt
@@ -0,0 +1,23 @@
+package com.buoy.codetest.ui.common
+
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+
+open class BaseViewModel: ViewModel() {
+
+ enum class State {
+ LOADING,
+ SUCCESS,
+ ERROR
+ }
+
+ private val state = MutableLiveData()
+ fun getState(): LiveData = state
+
+
+ protected fun setState(state: State) {
+ this.state.value = state
+ }
+
+}
\ No newline at end of file
diff --git a/MyApplication/app/src/main/java/com/buoy/codetest/ui/home/CocktailsAdapter.kt b/MyApplication/app/src/main/java/com/buoy/codetest/ui/home/CocktailsAdapter.kt
new file mode 100644
index 000000000..3d0b93e0e
--- /dev/null
+++ b/MyApplication/app/src/main/java/com/buoy/codetest/ui/home/CocktailsAdapter.kt
@@ -0,0 +1,67 @@
+package com.buoy.codetest.ui.home
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.navigation.Navigation.findNavController
+import androidx.navigation.fragment.FragmentNavigatorExtras
+import androidx.recyclerview.widget.RecyclerView
+import com.bumptech.glide.Glide
+import com.bumptech.glide.load.resource.bitmap.RoundedCorners
+import com.bumptech.glide.request.RequestOptions
+import com.buoy.codetest.R
+import com.buoy.codetest.model.domain.Drink
+import com.buoy.codetest.ui.cocktaildetail.CocktailDetailFragment
+import kotlinx.android.synthetic.main.listitem_cocktail.view.*
+
+class CocktailsAdapter: RecyclerView.Adapter() {
+
+ private val drinks: MutableList = ArrayList()
+
+ fun setDrinks(drinks: List) {
+ this.drinks.clear()
+ this.drinks.addAll(drinks)
+ notifyDataSetChanged()
+ }
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CocktailItemViewHolder {
+ return CocktailItemViewHolder(LayoutInflater.from(parent.context)
+ .inflate(R.layout.listitem_cocktail, parent, false))
+ }
+
+ override fun getItemCount(): Int = drinks.size
+
+ override fun onBindViewHolder(holder: CocktailItemViewHolder, position: Int) {
+ holder.bind(drinks[position])
+ }
+
+ inner class CocktailItemViewHolder(itemView: View): RecyclerView.ViewHolder(itemView) {
+
+ fun bind(drink: Drink) = with(itemView) {
+ name.text = drink.strDrink
+
+ Glide.with(context)
+ .load(drink.strDrinkThumb)
+ .placeholder(R.drawable.placeholder)
+ .fitCenter()
+ .apply(RequestOptions.bitmapTransform(RoundedCorners(16)))
+ .into(image)
+
+ setOnClickListener { onDrinkSelected(drink, this) }
+ }
+
+ private fun onDrinkSelected(drink: Drink, view: View) {
+ val bundle = Bundle()
+ bundle.putParcelable(CocktailDetailFragment.EXTRA_DRINK, drink)
+
+ val extras = FragmentNavigatorExtras(
+ view.image to "cocktailTransitionName_to"
+ )
+
+ findNavController(view).navigate(R.id.action_homeFragment_to_cocktailDetailFragment, bundle, null, extras)
+ }
+ }
+
+}
+
diff --git a/MyApplication/app/src/main/java/com/buoy/codetest/ui/home/HomeFragment.kt b/MyApplication/app/src/main/java/com/buoy/codetest/ui/home/HomeFragment.kt
new file mode 100644
index 000000000..81714523b
--- /dev/null
+++ b/MyApplication/app/src/main/java/com/buoy/codetest/ui/home/HomeFragment.kt
@@ -0,0 +1,97 @@
+package com.buoy.codetest.ui.home
+
+import android.os.Bundle
+import android.view.Menu
+import android.view.MenuInflater
+import android.view.View
+import androidx.appcompat.app.AppCompatActivity
+import androidx.appcompat.widget.SearchView
+import androidx.appcompat.widget.SearchView.OnQueryTextListener
+import androidx.lifecycle.Observer
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.buoy.codetest.R
+import com.buoy.codetest.ui.common.BaseFragment
+import com.buoy.codetest.ui.common.BaseViewModel
+import kotlinx.android.synthetic.main.fragment_home.*
+import kotlinx.android.synthetic.main.view_load_helper.*
+import org.koin.androidx.viewmodel.ext.android.viewModel
+
+
+class HomeFragment: BaseFragment() {
+
+ private val model: HomeViewModel by viewModel()
+ private val adapter = CocktailsAdapter()
+
+ override fun getLayoutResource(): Int = R.layout.fragment_home
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setHasOptionsMenu(true)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+
+ (activity as AppCompatActivity).setSupportActionBar(toolbar)
+
+ cocktail_list.layoutManager = LinearLayoutManager(context, RecyclerView.VERTICAL, false)
+ cocktail_list.adapter = adapter
+
+ error_retry.setOnClickListener { onRetryClicked() }
+
+ model.getDrinks().observe(viewLifecycleOwner, Observer { drinks ->
+ adapter.setDrinks(drinks)
+ })
+
+ model.getState().observe(viewLifecycleOwner, Observer { state ->
+ onStateChanged(state)
+ })
+ }
+
+ override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
+ super.onCreateOptionsMenu(menu, inflater)
+ inflater?.inflate(R.menu.menu_home, menu)
+ val menuItem = menu?.findItem(R.id.search)
+ (menuItem?.actionView as SearchView).setOnQueryTextListener( onQueryListener )
+ }
+
+ private fun onStateChanged(state: BaseViewModel.State?) {
+
+ when(state) {
+ BaseViewModel.State.LOADING -> {
+ progress.visibility = View.VISIBLE
+ error_view.visibility = View.GONE
+ }
+
+ BaseViewModel.State.SUCCESS -> {
+ progress.visibility = View.GONE
+ error_view.visibility = View.GONE
+ }
+
+ BaseViewModel.State.ERROR -> {
+ progress.visibility = View.GONE
+ error_view.visibility = View.VISIBLE
+ }
+ }
+ }
+
+
+ private val onQueryListener = object: OnQueryTextListener {
+ override fun onQueryTextSubmit(query: String?): Boolean {
+ return false
+ }
+
+ override fun onQueryTextChange(newText: String?): Boolean {
+ model.filterList(newText)
+ return true
+ }
+
+ }
+
+ private fun onRetryClicked() {
+ model.requestDrinks()
+ }
+
+
+}
\ No newline at end of file
diff --git a/MyApplication/app/src/main/java/com/buoy/codetest/ui/home/HomeViewModel.kt b/MyApplication/app/src/main/java/com/buoy/codetest/ui/home/HomeViewModel.kt
new file mode 100644
index 000000000..5a7dcea53
--- /dev/null
+++ b/MyApplication/app/src/main/java/com/buoy/codetest/ui/home/HomeViewModel.kt
@@ -0,0 +1,72 @@
+package com.buoy.codetest.ui.home
+
+import android.util.Log
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
+import com.buoy.codetest.model.domain.Drink
+import com.buoy.codetest.model.repository.CocktailRepository
+import com.buoy.codetest.ui.common.BaseViewModel
+import io.reactivex.Single
+import io.reactivex.android.schedulers.AndroidSchedulers
+import io.reactivex.schedulers.Schedulers
+
+class HomeViewModel(val cocktailRepository: CocktailRepository): BaseViewModel() {
+
+
+ private var drinks: List? = null
+ private val filterDrinks = MutableLiveData>()
+
+ private var filterText: String? = null
+
+ fun getDrinks(): LiveData> = filterDrinks
+ fun getFilter(): String? = filterText
+
+ init {
+ requestDrinks()
+ }
+
+ fun requestDrinks() {
+ setState(State.LOADING)
+
+ cocktailRepository.getAllCocktails()
+ .flatMap { drinks ->
+ this.drinks = drinks
+ executeFilter()
+ }
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe ({
+ setState(State.SUCCESS)
+ }, { error ->
+ Log.e("HomeViewModel", "requestDrinks:", error)
+ setState(State.ERROR)
+ })
+
+
+ }
+
+ fun filterList(newText: String?) {
+ filterText = newText
+ executeFilter()
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe ({}, {})
+ }
+
+ private fun executeFilter(): Single {
+ return Single.create { emitter ->
+ drinks?.let { drinks ->
+
+ val filter = filterText?.let { it.toLowerCase() } ?: ""
+ if (filter.isNotEmpty()) {
+ val filterList = drinks.filter { drink -> drink.strDrink?.toLowerCase()?.contains(filter) ?: false }
+ filterDrinks.postValue(filterList)
+ } else {
+ filterDrinks.postValue(drinks)
+ }
+ }
+
+ emitter.onSuccess(true)
+ }
+ }
+}
\ No newline at end of file
diff --git a/MyApplication/app/src/main/res/anim/slide_in_left.xml b/MyApplication/app/src/main/res/anim/slide_in_left.xml
new file mode 100644
index 000000000..96995fa63
--- /dev/null
+++ b/MyApplication/app/src/main/res/anim/slide_in_left.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication/app/src/main/res/anim/slide_in_right.xml b/MyApplication/app/src/main/res/anim/slide_in_right.xml
new file mode 100644
index 000000000..6fb52a3b7
--- /dev/null
+++ b/MyApplication/app/src/main/res/anim/slide_in_right.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication/app/src/main/res/anim/slide_out_left.xml b/MyApplication/app/src/main/res/anim/slide_out_left.xml
new file mode 100644
index 000000000..020a1bee1
--- /dev/null
+++ b/MyApplication/app/src/main/res/anim/slide_out_left.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication/app/src/main/res/anim/slide_out_right.xml b/MyApplication/app/src/main/res/anim/slide_out_right.xml
new file mode 100644
index 000000000..c4de80064
--- /dev/null
+++ b/MyApplication/app/src/main/res/anim/slide_out_right.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/MyApplication/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
new file mode 100644
index 000000000..6348baae3
--- /dev/null
+++ b/MyApplication/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MyApplication/app/src/main/res/drawable-xhdpi/placeholder.png b/MyApplication/app/src/main/res/drawable-xhdpi/placeholder.png
new file mode 100644
index 000000000..b2c6afe47
Binary files /dev/null and b/MyApplication/app/src/main/res/drawable-xhdpi/placeholder.png differ
diff --git a/MyApplication/app/src/main/res/drawable/ic_launcher_background.xml b/MyApplication/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 000000000..a0ad202f9
--- /dev/null
+++ b/MyApplication/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MyApplication/app/src/main/res/layout/activity_main.xml b/MyApplication/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 000000000..03fccc4c6
--- /dev/null
+++ b/MyApplication/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication/app/src/main/res/layout/fragment_cocktail_detail.xml b/MyApplication/app/src/main/res/layout/fragment_cocktail_detail.xml
new file mode 100644
index 000000000..eaa79dff5
--- /dev/null
+++ b/MyApplication/app/src/main/res/layout/fragment_cocktail_detail.xml
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MyApplication/app/src/main/res/layout/fragment_home.xml b/MyApplication/app/src/main/res/layout/fragment_home.xml
new file mode 100644
index 000000000..365b8e7ff
--- /dev/null
+++ b/MyApplication/app/src/main/res/layout/fragment_home.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication/app/src/main/res/layout/listitem_cocktail.xml b/MyApplication/app/src/main/res/layout/listitem_cocktail.xml
new file mode 100644
index 000000000..885e37c4b
--- /dev/null
+++ b/MyApplication/app/src/main/res/layout/listitem_cocktail.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication/app/src/main/res/layout/view_load_helper.xml b/MyApplication/app/src/main/res/layout/view_load_helper.xml
new file mode 100644
index 000000000..b173b542a
--- /dev/null
+++ b/MyApplication/app/src/main/res/layout/view_load_helper.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication/app/src/main/res/menu/menu_home.xml b/MyApplication/app/src/main/res/menu/menu_home.xml
new file mode 100644
index 000000000..e08fee50e
--- /dev/null
+++ b/MyApplication/app/src/main/res/menu/menu_home.xml
@@ -0,0 +1,11 @@
+
+
\ No newline at end of file
diff --git a/MyApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/MyApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 000000000..bbd3e0212
--- /dev/null
+++ b/MyApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/MyApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 000000000..bbd3e0212
--- /dev/null
+++ b/MyApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher.png b/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 000000000..898f3ed59
Binary files /dev/null and b/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 000000000..dffca3601
Binary files /dev/null and b/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher.png b/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 000000000..64ba76f75
Binary files /dev/null and b/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 000000000..dae5e0823
Binary files /dev/null and b/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..e5ed46597
Binary files /dev/null and b/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 000000000..14ed0af35
Binary files /dev/null and b/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 000000000..b0907cac3
Binary files /dev/null and b/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 000000000..d8ae03154
Binary files /dev/null and b/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 000000000..2c18de9e6
Binary files /dev/null and b/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 000000000..beed3cdd2
Binary files /dev/null and b/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/MyApplication/app/src/main/res/navigation/main_nav_graph.xml b/MyApplication/app/src/main/res/navigation/main_nav_graph.xml
new file mode 100644
index 000000000..488b169e0
--- /dev/null
+++ b/MyApplication/app/src/main/res/navigation/main_nav_graph.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication/app/src/main/res/transition/change_image_transform.xml b/MyApplication/app/src/main/res/transition/change_image_transform.xml
new file mode 100644
index 000000000..ca53479e0
--- /dev/null
+++ b/MyApplication/app/src/main/res/transition/change_image_transform.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication/app/src/main/res/values/colors.xml b/MyApplication/app/src/main/res/values/colors.xml
new file mode 100644
index 000000000..9e6401fe7
--- /dev/null
+++ b/MyApplication/app/src/main/res/values/colors.xml
@@ -0,0 +1,7 @@
+
+
+ #53bcd0
+ #00574B
+ #D81B60
+ #FFFFFF
+
diff --git a/MyApplication/app/src/main/res/values/strings.xml b/MyApplication/app/src/main/res/values/strings.xml
new file mode 100644
index 000000000..4a414fbd7
--- /dev/null
+++ b/MyApplication/app/src/main/res/values/strings.xml
@@ -0,0 +1,10 @@
+
+ Code Test
+ Oops something went wrong!
+ Retry
+ Search
+ cocktailTransitionName
+ How to prepare
+
+
+
diff --git a/MyApplication/app/src/main/res/values/styles.xml b/MyApplication/app/src/main/res/values/styles.xml
new file mode 100644
index 000000000..a6ec85449
--- /dev/null
+++ b/MyApplication/app/src/main/res/values/styles.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
diff --git a/MyApplication/app/src/test/java/com/buoy/codetest/ExampleUnitTest.kt b/MyApplication/app/src/test/java/com/buoy/codetest/ExampleUnitTest.kt
new file mode 100644
index 000000000..7def25528
--- /dev/null
+++ b/MyApplication/app/src/test/java/com/buoy/codetest/ExampleUnitTest.kt
@@ -0,0 +1,17 @@
+package com.buoy.codetest
+
+import org.junit.Test
+
+import org.junit.Assert.*
+
+/**
+ * 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/MyApplication/build.gradle b/MyApplication/build.gradle
new file mode 100644
index 000000000..58275ec09
--- /dev/null
+++ b/MyApplication/build.gradle
@@ -0,0 +1,28 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ ext.kotlin_version = '1.3.11'
+ repositories {
+ google()
+ jcenter()
+
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.4.0'
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/MyApplication/gradle.properties b/MyApplication/gradle.properties
new file mode 100644
index 000000000..4a5855f43
--- /dev/null
+++ b/MyApplication/gradle.properties
@@ -0,0 +1,17 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+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
+# Kotlin code style for this project: "official" or "obsolete":
+kotlin.code.style=official
+android.useAndroidX=true
+android.enableJetifier=true
\ No newline at end of file
diff --git a/MyApplication/gradle/wrapper/gradle-wrapper.jar b/MyApplication/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 000000000..f6b961fd5
Binary files /dev/null and b/MyApplication/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/MyApplication/gradle/wrapper/gradle-wrapper.properties b/MyApplication/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 000000000..28f91a46d
--- /dev/null
+++ b/MyApplication/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Thu Apr 18 09:50:25 ART 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/MyApplication/gradlew b/MyApplication/gradlew
new file mode 100755
index 000000000..cccdd3d51
--- /dev/null
+++ b/MyApplication/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/MyApplication/gradlew.bat b/MyApplication/gradlew.bat
new file mode 100644
index 000000000..f9553162f
--- /dev/null
+++ b/MyApplication/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/MyApplication/settings.gradle b/MyApplication/settings.gradle
new file mode 100644
index 000000000..e7b4def49
--- /dev/null
+++ b/MyApplication/settings.gradle
@@ -0,0 +1 @@
+include ':app'