Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tercer entregable #39

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.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
local.properties
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
150 changes: 150 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id("kotlin-kapt")
id("com.google.dagger.hilt.android")
id 'org.jlleitschuh.gradle.ktlint' version "11.0.0"

}

android {
compileSdk 32

defaultConfig {
applicationId "com.wizeline.criptocurrency"
minSdk 21
targetSdk 33
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}

buildFeatures {
viewBinding = true
}

testOptions{
unitTests{
includeAndroidResources= true
}
}

kapt {
correctErrorTypes = true
}
}

ktlint{
android=true
ignoreFailures=false
reporters{
reporter "plain"
reporter "checkstyle"
reporter "sarif"
}
}



dependencies {

implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.fragment:fragment-ktx:1.3.2'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'

//RXJAVA
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxkotlin:2.2.0'
//NAVIGATION
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'

// RETROFIT
implementation 'com.squareup.retrofit2:retrofit:2.9.0'

// GSON
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'

//Hilt
implementation "com.google.dagger:dagger-android-support:2.42"
implementation "com.google.dagger:hilt-android:2.42"
implementation 'com.google.android.mediahome:books:+'
testImplementation 'junit:junit:4.12'

kapt("com.google.dagger:hilt-android-compiler:2.44")
kapt "org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.4.2"
//TEST
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation "androidx.arch.core:core-testing:2.1.0"
testImplementation "androidx.arch.core:core-testing:2.1.0"
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4'
testImplementation 'androidx.test:core:1.4.0' //ApplicationProvider.getApplicationContext()
testImplementation 'org.robolectric:robolectric:4.8'
// AndroidJUnitRunner and JUnit Rules
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'
androidTestImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1")
androidTestImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.1'
//truth
testImplementation 'com.google.truth:truth:1.1.1'
//Mockk
testImplementation 'io.mockk:mockk:1.12.7'
// Kotlin extensions for androidx.test.core
androidTestImplementation("androidx.test:core-ktx:1.4.0")

// To use the androidx.test.espresso
androidTestImplementation("androidx.test:espresso:espresso-core:3.4.0")

// To use the JUnit Extension APIs
androidTestImplementation("androidx.test.ext:junit:1.1.3")
// Kotlin extensions for androidx.test.ext.junit
androidTestImplementation("androidx.test.ext:junit-ktx:1.1.3")

// To use the Truth Extension APIs
androidTestImplementation("androidx.test.ext:truth:1.4.0")

// To use the androidx.test.runner APIs
androidTestImplementation("androidx.test:runner:1.4.0")

// To use android test orchestrator
androidTestUtil("androidx.test:orchestrator:1.4.1")

//ROOM
implementation("androidx.room:room-runtime:2.4.3")
annotationProcessor("androidx.room:room-compiler:2.4.3")

// To use Kotlin annotation processing tool (kapt)
kapt("androidx.room:room-compiler:2.4.3")

// optional - Kotlin Extensions and Coroutines support for Room
implementation("androidx.room:room-ktx:2.4.3")

// optional - RxJava2 support for Room
implementation("androidx.room:room-rxjava2:2.4.3")

// optional - RxJava3 support for Room
implementation("androidx.room:room-rxjava3:2.4.3")

//HTTP Logging Interceptor
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'

}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.wizeline.criptocurrency

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.*
import org.junit.Test
import org.junit.runner.RunWith

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.wizeline.criptomonedas", appContext.packageName)
}
}
28 changes: 28 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wizeline.criptocurrency">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />


<application
android:name=".config.InitApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.WizelineChallenge">
<activity
android:name="com.wizeline.criptocurrency.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
23 changes: 23 additions & 0 deletions app/src/main/java/com/wizeline/criptocurrency/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.wizeline.criptocurrency

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import com.wizeline.criptocurrency.ui.AvailableBooksFragment
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
loadFragment(AvailableBooksFragment())
}

private fun loadFragment(fragment: Fragment) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Con la implementación de navigation component, este método ya no es necesario

val fragmentManager = supportFragmentManager
val fragmentTransaction = fragmentManager.beginTransaction()
fragmentTransaction.add(R.id.fragment_container_view, fragment)
fragmentTransaction.commit()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.wizeline.criptocurrency.common

object Constants {
const val UNDERSCORE = "_"
const val DIAGONAL = "/"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.wizeline.criptocurrency.common.adapters

sealed class RequestState<T>(val data: T? = null, val message: String? = null) {
class Success<T>(data: T) : RequestState<T>(data)
class Error<T>(message: String, data: T? = null) : RequestState<T>(data, message)
class Loading<T>(data: T? = null) : RequestState<T>(data)
}
Loading