diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..a1bea7da
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,16 @@
+*.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
+.cxx
+
+.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 00000000..42afabfd
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 00000000..a8e076a5
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,62 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+apply plugin: "androidx.navigation.safeargs.kotlin"
+apply plugin: 'kotlin-kapt'
+
+android {
+ compileSdkVersion 29
+
+ defaultConfig {
+ applicationId "com.challenge.nexaas"
+ minSdkVersion 21
+ targetSdkVersion 29
+ versionCode 1
+ versionName "1.0"
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+ kotlinOptions {
+ jvmTarget = "1.8"
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: "libs", include: ["*.jar"])
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
+ implementation 'androidx.core:core-ktx:1.3.0'
+ implementation 'androidx.appcompat:appcompat:1.1.0'
+ implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+ //navigation component
+ implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
+ implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
+ //koin
+ implementation "org.koin:koin-android:$koin_version"
+ implementation "org.koin:koin-android-viewmodel:$koin_version"
+ // Retrofit
+ implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
+ implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
+ //coroutines
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutine_version"
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutine_version"
+ testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutine_version"
+ //room
+ implementation "androidx.room:room-runtime:$room_version"
+ kapt "androidx.room:room-compiler:$room_version"
+ implementation 'com.github.bumptech.glide:glide:4.11.0'
+ implementation 'com.google.android.material:material:1.1.0'
+ testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0"
+ testImplementation "androidx.arch.core:core-testing:$arch_testing_version"
+ testImplementation "com.google.truth:truth:$truth_version"
+ testImplementation 'junit:junit:4.12'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.1'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
+
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 00000000..481bb434
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/app/src/androidTest/java/com/challenge/nexaas/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/challenge/nexaas/ExampleInstrumentedTest.kt
new file mode 100644
index 00000000..2df3f4db
--- /dev/null
+++ b/app/src/androidTest/java/com/challenge/nexaas/ExampleInstrumentedTest.kt
@@ -0,0 +1,24 @@
+package com.challenge.nexaas
+
+import androidx.test.platform.app.InstrumentationRegistry
+import androidx.test.ext.junit.runners.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.getInstrumentation().targetContext
+ assertEquals("com.challenge.nexaas", appContext.packageName)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..040c4747
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/challenge/nexaas/AppDatabase.kt b/app/src/main/java/com/challenge/nexaas/AppDatabase.kt
new file mode 100644
index 00000000..f0c3eb86
--- /dev/null
+++ b/app/src/main/java/com/challenge/nexaas/AppDatabase.kt
@@ -0,0 +1,36 @@
+package com.challenge.nexaas
+
+import android.content.Context
+import androidx.room.Database
+import androidx.room.Room
+import androidx.room.RoomDatabase
+import com.challenge.nexaas.data.Product
+import com.challenge.nexaas.data.ProductDAO
+
+@Database(
+ version = 1,
+ entities = [Product::class],
+ exportSchema = false
+)
+abstract class AppDatabase : RoomDatabase() {
+ abstract fun productDao(): ProductDAO
+
+ companion object {
+ private const val DATABASE_NAME = "nexaas.db"
+
+ @Volatile
+ private var instance: AppDatabase? = null
+
+ fun getInstance(context: Context): AppDatabase {
+ return instance ?: synchronized(this) {
+ instance ?: buildDatabase(context).also { instance = it }
+ }
+ }
+
+ private fun buildDatabase(context: Context): AppDatabase {
+ return Room.databaseBuilder(context, AppDatabase::class.java, DATABASE_NAME)
+ .fallbackToDestructiveMigration()
+ .build()
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/challenge/nexaas/MainActivity.kt b/app/src/main/java/com/challenge/nexaas/MainActivity.kt
new file mode 100644
index 00000000..696e89b3
--- /dev/null
+++ b/app/src/main/java/com/challenge/nexaas/MainActivity.kt
@@ -0,0 +1,28 @@
+package com.challenge.nexaas
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.navigation.findNavController
+import androidx.navigation.fragment.NavHostFragment
+import androidx.navigation.ui.AppBarConfiguration
+import androidx.navigation.ui.setupWithNavController
+import kotlinx.android.synthetic.main.activity_main.*
+import kotlinx.android.synthetic.main.content_main.*
+
+class MainActivity : AppCompatActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_main)
+ setSupportActionBar(toolbar)
+ configActionBar()
+ }
+
+ private fun configActionBar() {
+ val navController = findNavController(R.id.nav_host_fragment)
+ val appBarConfiguration = AppBarConfiguration(navController.graph)
+ toolbar.setupWithNavController(navController, appBarConfiguration)
+ }
+
+ override fun onSupportNavigateUp() =
+ NavHostFragment.findNavController(nav_host_fragment).navigateUp()
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/challenge/nexaas/NexaasApplication.kt b/app/src/main/java/com/challenge/nexaas/NexaasApplication.kt
new file mode 100644
index 00000000..fdae6965
--- /dev/null
+++ b/app/src/main/java/com/challenge/nexaas/NexaasApplication.kt
@@ -0,0 +1,20 @@
+package com.challenge.nexaas
+
+import android.app.Application
+import com.challenge.nexaas.di.apiModule
+import com.challenge.nexaas.di.daoModule
+import com.challenge.nexaas.di.repositoryModule
+import com.challenge.nexaas.di.viewModelModule
+import org.koin.android.ext.koin.androidContext
+import org.koin.core.context.startKoin
+
+class NexaasApplication : Application() {
+
+ override fun onCreate() {
+ super.onCreate()
+ startKoin {
+ androidContext(this@NexaasApplication)
+ modules(listOf(apiModule, daoModule, repositoryModule, viewModelModule))
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/challenge/nexaas/data/Product.kt b/app/src/main/java/com/challenge/nexaas/data/Product.kt
new file mode 100644
index 00000000..a4f466a5
--- /dev/null
+++ b/app/src/main/java/com/challenge/nexaas/data/Product.kt
@@ -0,0 +1,22 @@
+package com.challenge.nexaas.data
+
+import android.os.Parcelable
+import androidx.room.Entity
+import androidx.room.PrimaryKey
+import com.google.gson.annotations.SerializedName
+import kotlinx.android.parcel.Parcelize
+
+@Entity
+@Parcelize
+data class Product(
+ @PrimaryKey
+ val name: String,
+ val description: String,
+ @SerializedName("image_url")
+ val imageUrl: String,
+ val price: Int,
+ val quantity: Int,
+ val shipping: Int,
+ val stock: Int,
+ val tax: Int
+) : Parcelable
\ No newline at end of file
diff --git a/app/src/main/java/com/challenge/nexaas/data/ProductDAO.kt b/app/src/main/java/com/challenge/nexaas/data/ProductDAO.kt
new file mode 100644
index 00000000..8dfdb1a1
--- /dev/null
+++ b/app/src/main/java/com/challenge/nexaas/data/ProductDAO.kt
@@ -0,0 +1,17 @@
+package com.challenge.nexaas.data
+
+import androidx.room.Dao
+import androidx.room.Insert
+import androidx.room.OnConflictStrategy
+import androidx.room.Query
+
+@Dao
+interface ProductDAO {
+
+ @Query("SELECT * FROM Product")
+ fun getAll(): List
+
+ @Insert(onConflict = OnConflictStrategy.REPLACE)
+ fun saveAll(products: List)
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/challenge/nexaas/data/ProductRepository.kt b/app/src/main/java/com/challenge/nexaas/data/ProductRepository.kt
new file mode 100644
index 00000000..ed69c6f8
--- /dev/null
+++ b/app/src/main/java/com/challenge/nexaas/data/ProductRepository.kt
@@ -0,0 +1,16 @@
+package com.challenge.nexaas.data
+
+interface ProductRepository : ProductService
+
+class ProductRepositoryImpl(private val service: ProductService, private val dao: ProductDAO) :
+ ProductRepository {
+ override suspend fun getProducts(): List {
+ return try {
+ val product = service.getProducts()
+ dao.saveAll(product)
+ dao.getAll()
+ } catch (e: Exception) {
+ dao.getAll()
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/challenge/nexaas/data/ProductService.kt b/app/src/main/java/com/challenge/nexaas/data/ProductService.kt
new file mode 100644
index 00000000..c0d3c85a
--- /dev/null
+++ b/app/src/main/java/com/challenge/nexaas/data/ProductService.kt
@@ -0,0 +1,9 @@
+package com.challenge.nexaas.data
+
+import retrofit2.http.GET
+
+interface ProductService {
+
+ @GET("data.json")
+ suspend fun getProducts(): List
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/challenge/nexaas/di/ApiViewModule.kt b/app/src/main/java/com/challenge/nexaas/di/ApiViewModule.kt
new file mode 100644
index 00000000..2f3f6665
--- /dev/null
+++ b/app/src/main/java/com/challenge/nexaas/di/ApiViewModule.kt
@@ -0,0 +1,33 @@
+package com.challenge.nexaas.di
+
+import com.challenge.nexaas.data.ProductService
+import okhttp3.OkHttpClient
+import org.koin.dsl.module
+import retrofit2.Retrofit
+import retrofit2.converter.gson.GsonConverterFactory
+
+val apiModule = module {
+ single { provideDefaultOkhttpClient() }
+ single { provideRetrofit(get()) }
+}
+
+private const val URL =
+ "https://raw.githubusercontent.com/myfreecomm/desafio-mobile-android/master/api/"
+
+fun provideDefaultOkhttpClient(): OkHttpClient {
+ return OkHttpClient.Builder()
+ .addInterceptor { chain ->
+ val request = chain.request()
+ chain.proceed(request)
+ }
+ .build()
+}
+
+fun provideRetrofit(client: OkHttpClient): ProductService {
+ return Retrofit.Builder()
+ .baseUrl(URL)
+ .client(client)
+ .addConverterFactory(GsonConverterFactory.create())
+ .build()
+ .create(ProductService::class.java)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/challenge/nexaas/di/DaoModule.kt b/app/src/main/java/com/challenge/nexaas/di/DaoModule.kt
new file mode 100644
index 00000000..7239a549
--- /dev/null
+++ b/app/src/main/java/com/challenge/nexaas/di/DaoModule.kt
@@ -0,0 +1,9 @@
+package com.challenge.nexaas.di
+
+import com.challenge.nexaas.AppDatabase
+import org.koin.dsl.module
+
+val daoModule = module {
+ single { AppDatabase.getInstance(get()) }
+ single { get().productDao() }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/challenge/nexaas/di/RepositoryModule.kt b/app/src/main/java/com/challenge/nexaas/di/RepositoryModule.kt
new file mode 100644
index 00000000..75a1f1b4
--- /dev/null
+++ b/app/src/main/java/com/challenge/nexaas/di/RepositoryModule.kt
@@ -0,0 +1,9 @@
+package com.challenge.nexaas.di
+
+import com.challenge.nexaas.data.ProductRepository
+import com.challenge.nexaas.data.ProductRepositoryImpl
+import org.koin.dsl.module
+
+val repositoryModule = module {
+ single { ProductRepositoryImpl(get(), get()) }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/challenge/nexaas/di/ViewModelModule.kt b/app/src/main/java/com/challenge/nexaas/di/ViewModelModule.kt
new file mode 100644
index 00000000..b39d9c5a
--- /dev/null
+++ b/app/src/main/java/com/challenge/nexaas/di/ViewModelModule.kt
@@ -0,0 +1,9 @@
+package com.challenge.nexaas.di
+
+import com.challenge.nexaas.ui.ProdutcListViewModel
+import org.koin.android.viewmodel.dsl.viewModel
+import org.koin.dsl.module
+
+val viewModelModule = module {
+ viewModel { ProdutcListViewModel(get()) }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/challenge/nexaas/extension/IntExtension.kt b/app/src/main/java/com/challenge/nexaas/extension/IntExtension.kt
new file mode 100644
index 00000000..dcbb2956
--- /dev/null
+++ b/app/src/main/java/com/challenge/nexaas/extension/IntExtension.kt
@@ -0,0 +1,18 @@
+package com.challenge.nexaas.extension
+
+import java.text.DecimalFormat
+import java.util.*
+
+fun Int.formatMonetary(): String = DecimalFormat.getCurrencyInstance(Locale.US).format(this / 100.0)
+
+fun Int.formatStock(): String = when (this) {
+ 0 -> {
+ "out of stock"
+ }
+ in 1..3 -> {
+ "only $this left in stock"
+ }
+ else -> {
+ "in stock"
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/challenge/nexaas/ui/ProductAdapter.kt b/app/src/main/java/com/challenge/nexaas/ui/ProductAdapter.kt
new file mode 100644
index 00000000..7988e090
--- /dev/null
+++ b/app/src/main/java/com/challenge/nexaas/ui/ProductAdapter.kt
@@ -0,0 +1,41 @@
+package com.challenge.nexaas.ui
+
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
+import com.bumptech.glide.Glide
+import com.challenge.nexaas.R
+import com.challenge.nexaas.data.Product
+import com.challenge.nexaas.extension.formatMonetary
+import com.challenge.nexaas.extension.formatStock
+import kotlinx.android.synthetic.main.item_product.view.*
+
+class ProductAdapter(private val list: List, private val onClick: (Product) -> Unit = {}) :
+ RecyclerView.Adapter() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
+ val view = LayoutInflater.from(parent.context).inflate(R.layout.item_product, parent, false)
+ return ViewHolder(view)
+ }
+
+ override fun getItemCount(): Int = list.size
+
+ override fun onBindViewHolder(holder: ViewHolder, position: Int) {
+ holder.bind(list[position])
+ }
+
+ inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ fun bind(item: Product) {
+ with(itemView) {
+ txv_name.text = item.name
+ txv_price.text = item.price.formatMonetary()
+ txv_stock.text = item.stock.formatStock()
+ Glide.with(this).load(item.imageUrl).into(img_product)
+ setOnClickListener {
+ onClick(item)
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/challenge/nexaas/ui/ProductDetailsFragment.kt b/app/src/main/java/com/challenge/nexaas/ui/ProductDetailsFragment.kt
new file mode 100644
index 00000000..c09ff90f
--- /dev/null
+++ b/app/src/main/java/com/challenge/nexaas/ui/ProductDetailsFragment.kt
@@ -0,0 +1,46 @@
+package com.challenge.nexaas.ui
+
+import android.os.Bundle
+import android.view.*
+import androidx.fragment.app.Fragment
+import androidx.navigation.fragment.navArgs
+import com.bumptech.glide.Glide
+import com.challenge.nexaas.R
+import com.challenge.nexaas.extension.formatMonetary
+import com.challenge.nexaas.extension.formatStock
+import kotlinx.android.synthetic.main.fragment_product_details.*
+
+class ProductDetailsFragment : Fragment() {
+
+ private val arguments by navArgs()
+ private val product by lazy {
+ arguments.product
+ }
+
+ override fun onCreateView(
+ inflater: LayoutInflater,
+ container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ return inflater.inflate(R.layout.fragment_product_details, container, false)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+ setHasOptionsMenu(true)
+ setupView()
+ }
+
+ private fun setupView() {
+ txv_details_name.text = product.name
+ txv_details_stock.text = product.stock.formatStock()
+ txv_details_price.text = product.price.formatMonetary()
+ txv_details_description.text = product.description
+ Glide.with(this).load(product.imageUrl).into(img_product)
+ }
+
+ override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
+ inflater.inflate(R.menu.menu_settings, menu)
+ super.onCreateOptionsMenu(menu, inflater)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/challenge/nexaas/ui/ProdutcListFragment.kt b/app/src/main/java/com/challenge/nexaas/ui/ProdutcListFragment.kt
new file mode 100644
index 00000000..42ed709e
--- /dev/null
+++ b/app/src/main/java/com/challenge/nexaas/ui/ProdutcListFragment.kt
@@ -0,0 +1,89 @@
+package com.challenge.nexaas.ui
+
+import android.os.Bundle
+import android.view.*
+import androidx.fragment.app.Fragment
+import androidx.lifecycle.Observer
+import androidx.navigation.fragment.findNavController
+import com.challenge.nexaas.R
+import com.challenge.nexaas.data.Product
+import com.challenge.nexaas.extension.formatMonetary
+import kotlinx.android.synthetic.main.fragment_product_list.*
+import org.koin.android.ext.android.inject
+
+class ProdutcListFragment : Fragment() {
+
+ private val mViewModel: ProdutcListViewModel by inject()
+
+ override fun onCreateView(
+ inflater: LayoutInflater,
+ container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ return inflater.inflate(R.layout.fragment_product_list, container, false)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+ setHasOptionsMenu(true)
+ observeProducts()
+ observeLoading()
+ observeError()
+ }
+
+ private fun observeError() {
+ mViewModel.onError.observe(viewLifecycleOwner, Observer { error ->
+ if (error.isNotEmpty()) {
+ txv_error.visibility = View.VISIBLE
+ txv_error.text = error
+ }
+ })
+ }
+
+ private fun observeLoading() {
+ mViewModel.isLoading.observe(viewLifecycleOwner, Observer { isLoading ->
+ if (isLoading) {
+ progress_bar_loading.visibility = View.VISIBLE
+ } else {
+ progress_bar_loading.visibility = View.GONE
+ }
+ })
+ }
+
+ private fun observeProducts() {
+ mViewModel.products.observe(viewLifecycleOwner, Observer {
+ val adapter = ProductAdapter(it) { product ->
+ openDetails(product)
+ }
+ recycler_view_products.adapter = adapter
+ calculateTotal(it)
+ })
+ }
+
+ override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
+ inflater.inflate(R.menu.menu_search, menu)
+ super.onCreateOptionsMenu(menu, inflater)
+ }
+
+ private fun calculateTotal(products: List) {
+ txv_total_items.text = "${products.size} ITEMS IN YOUR CART"
+
+ val totalPrice = products.sumBy { it.price }
+ txv_total.text = totalPrice.formatMonetary()
+
+ val totalShipping = products.sumBy { it.shipping }
+ txv_total_shipping.text = totalShipping.formatMonetary()
+
+ val totalTax = products.sumBy { it.tax }
+ txv_total_tax.text = totalTax.formatMonetary()
+
+ val subTotal = (totalPrice - totalShipping - totalTax) / 100
+ txv_sub_total.text = subTotal.formatMonetary()
+ }
+
+ private fun openDetails(product: Product) {
+ val nextAction =
+ ProdutcListFragmentDirections.actionProdutcListFragmentToProductDetailsFragment(product)
+ findNavController().navigate(nextAction)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/challenge/nexaas/ui/ProdutcListViewModel.kt b/app/src/main/java/com/challenge/nexaas/ui/ProdutcListViewModel.kt
new file mode 100644
index 00000000..16aaa76b
--- /dev/null
+++ b/app/src/main/java/com/challenge/nexaas/ui/ProdutcListViewModel.kt
@@ -0,0 +1,40 @@
+package com.challenge.nexaas.ui
+
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import com.challenge.nexaas.data.Product
+import com.challenge.nexaas.data.ProductRepository
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.launch
+
+class ProdutcListViewModel(private val repository: ProductRepository) : ViewModel() {
+
+ private val _products = MutableLiveData>()
+ val products: LiveData> = _products
+
+ private val _isLoading = MutableLiveData()
+ val isLoading: LiveData = _isLoading
+
+ private val _onError = MutableLiveData()
+ val onError: LiveData = _onError
+
+ init {
+ getProducts()
+ }
+
+ private fun getProducts() {
+ _isLoading.postValue(true)
+ viewModelScope.launch(Dispatchers.IO) {
+ try {
+ val products = repository.getProducts()
+ _products.postValue(products)
+ } catch (e: Exception) {
+ _onError.postValue(e.localizedMessage)
+ } finally {
+ _isLoading.postValue(false)
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
new file mode 100644
index 00000000..2b068d11
--- /dev/null
+++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_baseline_search_24.xml b/app/src/main/res/drawable/ic_baseline_search_24.xml
new file mode 100644
index 00000000..07b76d62
--- /dev/null
+++ b/app/src/main/res/drawable/ic_baseline_search_24.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 00000000..07d5da9c
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 00000000..8f43bcf2
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml
new file mode 100644
index 00000000..1e401184
--- /dev/null
+++ b/app/src/main/res/layout/content_main.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_product_details.xml b/app/src/main/res/layout/fragment_product_details.xml
new file mode 100644
index 00000000..e7a6075a
--- /dev/null
+++ b/app/src/main/res/layout/fragment_product_details.xml
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_product_list.xml b/app/src/main/res/layout/fragment_product_list.xml
new file mode 100644
index 00000000..78046877
--- /dev/null
+++ b/app/src/main/res/layout/fragment_product_list.xml
@@ -0,0 +1,161 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_product.xml b/app/src/main/res/layout/item_product.xml
new file mode 100644
index 00000000..0b866c65
--- /dev/null
+++ b/app/src/main/res/layout/item_product.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/menu_search.xml b/app/src/main/res/menu/menu_search.xml
new file mode 100644
index 00000000..c50c0bd5
--- /dev/null
+++ b/app/src/main/res/menu/menu_search.xml
@@ -0,0 +1,16 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/menu_settings.xml b/app/src/main/res/menu/menu_settings.xml
new file mode 100644
index 00000000..165ba7f4
--- /dev/null
+++ b/app/src/main/res/menu/menu_settings.xml
@@ -0,0 +1,8 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 00000000..eca70cfe
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 00000000..eca70cfe
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 00000000..a571e600
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 00000000..61da551c
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 00000000..c41dd285
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 00000000..db5080a7
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 00000000..6dba46da
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 00000000..da31a871
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 00000000..15ac6817
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 00000000..b216f2d3
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 00000000..f25a4197
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 00000000..e96783cc
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/navigation/nav_graph.xml b/app/src/main/res/navigation/nav_graph.xml
new file mode 100644
index 00000000..262a3f04
--- /dev/null
+++ b/app/src/main/res/navigation/nav_graph.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 00000000..4faecfa8
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #6200EE
+ #3700B3
+ #03DAC5
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 00000000..08977280
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,5 @@
+
+ Nexaas
+ Search
+ Settings
+
\ No newline at end of file
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 00000000..fd90c2d8
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/test/java/com/challenge/nexaas/CoroutinesTestRule.kt b/app/src/test/java/com/challenge/nexaas/CoroutinesTestRule.kt
new file mode 100644
index 00000000..9c3b5d1c
--- /dev/null
+++ b/app/src/test/java/com/challenge/nexaas/CoroutinesTestRule.kt
@@ -0,0 +1,25 @@
+package com.challenge.nexaas
+
+import kotlinx.coroutines.CoroutineDispatcher
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.test.TestCoroutineScope
+import kotlinx.coroutines.test.resetMain
+import kotlinx.coroutines.test.setMain
+import org.junit.rules.TestWatcher
+import org.junit.runner.Description
+import kotlin.coroutines.ContinuationInterceptor
+
+@ExperimentalCoroutinesApi
+class MainCoroutineRule : TestWatcher(), TestCoroutineScope by TestCoroutineScope() {
+
+ override fun starting(description: Description?) {
+ super.starting(description)
+ Dispatchers.setMain(this.coroutineContext[ContinuationInterceptor] as CoroutineDispatcher)
+ }
+
+ override fun finished(description: Description?) {
+ super.finished(description)
+ Dispatchers.resetMain()
+ }
+}
\ No newline at end of file
diff --git a/app/src/test/java/com/challenge/nexaas/ExampleUnitTest.kt b/app/src/test/java/com/challenge/nexaas/ExampleUnitTest.kt
new file mode 100644
index 00000000..3a1638c6
--- /dev/null
+++ b/app/src/test/java/com/challenge/nexaas/ExampleUnitTest.kt
@@ -0,0 +1,17 @@
+package com.challenge.nexaas
+
+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)
+ }
+}
\ No newline at end of file
diff --git a/app/src/test/java/com/challenge/nexaas/ui/ProdutcListFragmentTest.kt b/app/src/test/java/com/challenge/nexaas/ui/ProdutcListFragmentTest.kt
new file mode 100644
index 00000000..dcded49f
--- /dev/null
+++ b/app/src/test/java/com/challenge/nexaas/ui/ProdutcListFragmentTest.kt
@@ -0,0 +1,69 @@
+package com.challenge.nexaas.ui
+
+import androidx.arch.core.executor.testing.InstantTaskExecutorRule
+import androidx.lifecycle.LiveData
+import com.challenge.nexaas.MainCoroutineRule
+import com.challenge.nexaas.data.Product
+import com.challenge.nexaas.data.ProductRepository
+import com.google.common.truth.Truth.assertThat
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.test.runBlockingTest
+import org.junit.Before
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.Mock
+import org.mockito.Mockito
+import org.mockito.junit.MockitoJUnitRunner
+
+@ExperimentalCoroutinesApi
+@RunWith(MockitoJUnitRunner::class)
+class ProdutcListFragmentTest {
+
+ private lateinit var mViewModel: ProdutcListViewModel
+
+ @Mock
+ lateinit var repository: ProductRepository
+
+ @get:Rule
+ val coroutinesTextRule = MainCoroutineRule()
+
+ @get:Rule
+ val instantExecutorRule = InstantTaskExecutorRule()
+
+ private lateinit var isLoading: LiveData
+ private lateinit var onError: LiveData
+
+ @Before
+ fun before() {
+ repository = Mockito.mock(ProductRepository::class.java)
+ }
+
+ @Test
+ fun `test get products`() = runBlockingTest {
+ //given
+ coroutinesTextRule.pauseDispatcher()
+
+ val type = object : TypeToken>() {}.type
+ val response = Gson().fromJson(productsStringList, type) as List
+ Mockito.`when`(repository.getProducts()).thenReturn(response)
+ //when
+
+ mViewModel = ProdutcListViewModel(repository)
+ isLoading = mViewModel.isLoading
+ onError = mViewModel.onError
+
+ //then
+ assertThat(mViewModel.isLoading.value).isTrue()
+ coroutinesTextRule.resumeDispatcher()
+
+ assertThat(mViewModel.products.value).isEqualTo(response)
+ assertThat(mViewModel.isLoading.value).isFalse()
+ return@runBlockingTest
+ }
+
+
+ private val productsStringList = "[ { \"name\": \"Pencil\", \"quantity\": 1, \"stock\": 5, \"image_url\": \"https://github.com/charleston10/test-android-nexaas/blob/master/assets/pencil.png?raw=true\", \"price\": 150, \"tax\": 162, \"shipping\": 50, \"description\": \"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nunc magna, gravida ut orci non, egestas venenatis libero. Sed luctus, turpis at porta commodo, ipsum orci volutpat sapien, ut scelerisque diam massa lobortis odioc.\" }, { \"name\": \"Rubberbands\", \"quantity\": 1, \"stock\": 8, \"image_url\": \"https://github.com/charleston10/test-android-nexaas/blob/master/assets/rubberbands.png?raw=true\", \"price\": 450, \"tax\": 81, \"shipping\": 0, \"description\": \"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nunc magna, gravida ut orci non, egestas venenatis libero. Sed luctus, turpis at porta commodo, ipsum orci volutpat sapien, ut scelerisque diam massa lobortis odio. Nulla ut tincidunt erat, a mollis tortor. Phasellus vel ligula leo. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nam id semper quam, id efficitur mi. Etiam volutpat eleifend commodo. Duis sed consectetur diam. Morbi mattis justo eget vehicula placerat. Sed commodo, neque a accumsan vehicula, magna libero lacinia dolor, a consectetur turpis odio nec risus. Nullam id dui lacus.\" }, { \"name\": \"Rulers\", \"quantity\": 1, \"stock\": 1, \"image_url\": \"https://github.com/charleston10/test-android-nexaas/blob/master/assets/rulers.png?raw=true\", \"price\": 800, \"tax\": 0, \"shipping\": 100, \"description\": \"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nunc magna, gravida ut orci non, egestas venenatis libero. Sed luctus, turpis at porta commodo, ipsum orci volutpat sapien, ut scelerisque diam massa lobortis odioc.\" }, { \"name\": \"Clock\", \"quantity\": 1, \"stock\": 10, \"image_url\": \"https://github.com/charleston10/test-android-nexaas/blob/master/assets/clock.png?raw=true\", \"price\": 2200, \"tax\": 81, \"shipping\": 50, \"description\": \"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nunc magna, gravida ut orci non, egestas venenatis libero. Sed luctus, turpis at porta commodo, ipsum orci volutpat sapien, ut scelerisque diam massa lobortis odio. Nulla ut tincidunt erat, a mollis tortor. Phasellus vel ligula leo. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nam id semper quam, id efficitur mi. Etiam volutpat eleifend commodo. Duis sed consectetur diam. Morbi mattis justo eget vehicula placerat. Sed commodo, neque a accumsan vehicula, magna libero lacinia dolor, a consectetur turpis odio nec risus. Nullam id dui lacus.\" } ]"
+}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 00000000..84f20266
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,36 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+buildscript {
+ ext {
+ kotlin_version = "1.3.72"
+ nav_version = "2.3.0"
+ koin_version = "2.1.5"
+ coroutine_version = "1.3.7"
+ retrofit_version = "2.6.0"
+ room_version = "2.2.5"
+ arch_testing_version = '2.1.0'
+ truth_version = "0.44"
+ }
+ repositories {
+ google()
+ jcenter()
+ }
+ dependencies {
+ classpath "com.android.tools.build:gradle:4.0.0"
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_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
+}
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 00000000..4d15d015
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,21 @@
+# 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=-Xmx2048m
+# 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
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app"s APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Automatically convert third-party libraries to use AndroidX
+android.enableJetifier=true
+# Kotlin code style for this project: "official" or "obsolete":
+kotlin.code.style=official
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 00000000..f6b961fd
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000..723a7815
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Tue Jul 14 20:09:11 BRT 2020
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
diff --git a/gradlew b/gradlew
new file mode 100755
index 00000000..cccdd3d5
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 00000000..e95643d6
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 00000000..d1aae072
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,2 @@
+include ':app'
+rootProject.name = "Nexaas"
\ No newline at end of file