Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions .idea/.gitignore

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

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.

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

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

25 changes: 25 additions & 0 deletions .idea/jarRepositories.xml

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

9 changes: 9 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/render.experimental.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.

8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Instalação

Passos para instalação do app:
1 - Clonar do repositório https://github.com/hthenrique/TesteAndroidv2---Accenture-Talent-Acquisition através do git ou no próprio Android Studio.
2 - Se não clonou o repositório pelo Android Studio, abrir o Android Studio e procurar pela pasta do projeto no diretório salvo e abrir o prjeto.
3 - Após o projeto estar aberto no Android Studio executar o Aplicativo em um dispositivo fisíco ou emulador. Para isso vá da Aba "Run" e depois clicar na opção "Run 'App'"


# Show me the code

Esse repositório contem todo o material necessário para realizar o teste:
Expand Down
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
47 changes: 47 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
}

android {
compileSdkVersion 30
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.example.appbanksantander_accenturetalentacquisition"
minSdkVersion 19
targetSdkVersion 30
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'
}
}

dependencies {

implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.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,24 @@
package com.example.appbanksantander_accenturetalentacquisition

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.example.appbanksantander_accenturetalentacquisition", appContext.packageName)
}
}
24 changes: 24 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.appbanksantander_accenturetalentacquisition">

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

<application
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.AppBankSantanderAccentureTalentAcquisition">
<activity android:name=".View.LoginActiviy">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.example.appbanksantander_accenturetalentacquisition.API

import com.google.gson.Gson
import com.google.gson.GsonBuilder
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

class ApiClient {

private var BASE_URL = "https://bank-app-test.herokuapp.com/"
private var retrofit: Retrofit? = null

val gson: Gson = GsonBuilder().create()

fun getClient(): Retrofit{
if (retrofit == null){
retrofit = Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create(gson))
.build()
}
return this.retrofit!!
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.example.appbanksantander_accenturetalentacquisition.API

import android.content.Context
import android.widget.Toast
import com.example.appbanksantander_accenturetalentacquisition.Model.StatementModel
import com.example.appbanksantander_accenturetalentacquisition.Model.StatementResponse
import com.example.appbanksantander_accenturetalentacquisition.Model.UserAccountModel
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response

class RequestApi(private val context: Context?): ServiceApi {
val apiClient: ApiClient = ApiClient()
val retrofitEndPoint = apiClient.getClient().create(RetrofitEndPoint::class.java)
val responseOK: Int = 200

override fun getAccountInfo(callback: ServiceApi.ServiceApiCallbackUser<UserAccountModel>) {
val callLogin = retrofitEndPoint.loginUser()
callLogin.enqueue(object: Callback<UserAccountModel> {
override fun onResponse(call: Call<UserAccountModel>, response: Response<UserAccountModel>) {
if (response.code() == responseOK){
val userAccountModel: UserAccountModel = response.body()!!
callback.loaded(userAccountModel)
}else{
Toast.makeText(context, "Error Account: " + response.code().toString(), Toast.LENGTH_SHORT).show()
}
}
override fun onFailure(call: Call<UserAccountModel>, t: Throwable) {
Toast.makeText(context, "Error Account: " + t.toString(), Toast.LENGTH_SHORT).show()
}
})
}

override fun getStatement(callback: ServiceApi.ServiceApiCallbackStatement<StatementResponse>) {
val callStatement = retrofitEndPoint.getStatements()
callStatement.enqueue(object: Callback<StatementResponse>{
override fun onResponse(call: Call<StatementResponse>, response: Response<StatementResponse>) {
if (response.code() == responseOK){
val statementModel: List<StatementModel> = response.body()!!.statementListResult
callback.loaded(statementModel)
}else{
Toast.makeText(context, "Error Statement: " + response.code().toString(), Toast.LENGTH_SHORT).show()
}
}
override fun onFailure(call: Call<StatementResponse>, t: Throwable) {
Toast.makeText(context, "Error Statement: " + t.toString(), Toast.LENGTH_LONG).show()
}
})
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.example.appbanksantander_accenturetalentacquisition.API


import com.example.appbanksantander_accenturetalentacquisition.Model.StatementResponse
import com.example.appbanksantander_accenturetalentacquisition.Model.UserAccountModel
import retrofit2.Call
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

interface RetrofitEndPoint {

@POST ("api/login")
fun loginUser(): Call<UserAccountModel>

@GET("api/statements/1")
fun getStatements(): Call<StatementResponse>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.example.appbanksantander_accenturetalentacquisition.API

import com.example.appbanksantander_accenturetalentacquisition.Model.StatementModel
import com.example.appbanksantander_accenturetalentacquisition.Model.StatementResponse
import com.example.appbanksantander_accenturetalentacquisition.Model.UserAccountModel

interface ServiceApi {
interface ServiceApiCallbackUser<T>{
fun loaded(userAccount: UserAccountModel)
}
interface ServiceApiCallbackStatement<T>{
fun loaded(statement: List<StatementModel>)
}
fun getAccountInfo(callback: ServiceApiCallbackUser<UserAccountModel>)
fun getStatement(callback: ServiceApiCallbackStatement<StatementResponse>)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.example.appbanksantander_accenturetalentacquisition.Model

import com.google.gson.annotations.SerializedName

class StatementModel {

@SerializedName("title")
var title: String = ""

@SerializedName("desc")
var description: String = ""

@SerializedName("date")
var date: String = ""

@SerializedName("value")
var value: Float = 0.0F



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.example.appbanksantander_accenturetalentacquisition.Model

import com.google.gson.annotations.SerializedName
import retrofit2.http.Field

class StatementResponse {

@field:SerializedName("statementList")
lateinit var statementListResult: List<StatementModel>

}
Loading