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/vcs.xml

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

49 changes: 49 additions & 0 deletions README-PASSO-A-PASSO-MARCOSCAMPOS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@


1º passo:
Desenvolvimento da activity main xml, adicionei 1 image view, 2 edit text e 1 button (conforme layout padrão)

2º passo:

Conforme API , criei o recyclerview:
Criei o xml da segunda tela (onde está o recycler view) e depois criei o xml do detalhamento dos recibos. Com isso criei a classe "Recibos" e o View Holder com os atributos necessários.
Depois criei a classe Adapter e por padrão preciso dar sobrescrever as funções onCreateViewHolder (passando o inflate do layout detalhado do recibo, view holder),
getItemCount (passando o tamanho da mutablelist das informações obtidas através da API), onBindViewHolder (onde indico o local que cada informação deve ficar no layout detalhado).


3º passo:
Criei a activity da segunda tela: "extrato activity"
Nela eu criei a função "montarLista" para finalização do recycler view, finalizei o adapter e o recycler.


4º passo:
No Postman retirei as informações necessárias para montar as classes UserAccountResponse (onde eu trato os dados do usuário) e StatementsResponse (onde eu trato os dados dos recibos).

5º passo:
Criei uma interface API (onde passei as informações do Retrofit e da URL)
Com isso mapeei as duas chamadas.


6º passo:
Criei na Main a função "setarTexto" onde fiz um Bundle para passar as informações para a "ExtratoActivity"
E com o bundle na "ExtratoAcitivity" peguei as informações e passei para o layout.
Fiz também a ação da imagem de retornar para a página inicial e para finalizar o código da "ExtratoActivity" fiz a requisição da segunda chamada através da função fun fazeSegundaChamada.


7º passo:
Na main activity, fiz a função para fazer a verificação dos requisitos da senha: fun "passwordValidation"
Fiz o sharedPreferences para salvar as informações do nome do usuário e a senha para quando abrir o aplicativo essas informações ficarem salvas.
Fiz a função "validacao" que verificar se o nome do usuario e a senha foram preenchidas e caso sim, faz a verificação se a senha atende todos os requisitos (validar
se a senha tem pelo menos uma letra maiuscula, um caracter especial e um caracter alfanumérico) através da função "passwordValidation"
E caso atender todos os requisitos monto o body da minha chamada e faço e primeira chamada. Se der sucesso vai para a segunda tela.











1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
50 changes: 50 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
}

android {
compileSdkVersion 30
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.example.accentureprojectbank"
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'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
// retrofit

implementation 'com.squareup.retrofit2:retrofit:2.5.0'

implementation 'com.squareup.retrofit2:converter-gson:2.5.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.accentureprojectbank

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

<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.AccentureProjectBank">

<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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


<activity android:name=".ExtratoActivity">
</activity>



</application>

</manifest>
33 changes: 33 additions & 0 deletions app/src/main/java/com/example/accentureprojectbank/Adapter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.example.accentureprojectbank

import android.content.Intent
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView

class Adapter(val listaInf: MutableList<Informacoes>) : RecyclerView.Adapter<ViewHolder>() {

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater.from(parent.context).inflate(R.layout.extrato_view_holder, parent, false)
return ViewHolder(view)
}

override fun getItemCount(): Int = listaInf.size


override fun onBindViewHolder(holder: ViewHolder, position: Int) {

val payment = holder.pagamento
payment.text = listaInf[position].titulo

val account = holder.conta
account.text = listaInf[position].descricao

val date = holder.data
date.text = listaInf[position].data

val value = holder.valor
value.text = listaInf[position].valor.toString()
}
}

38 changes: 38 additions & 0 deletions app/src/main/java/com/example/accentureprojectbank/Api.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.example.accentureprojectbank

import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path

interface Api {
companion object ServiceBuilder {
/** Retorna uma Instância do Client Retrofit para Requisições
* @param path Caminho Principal da API
*/
fun getRetrofitInstance(): Retrofit {
return Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build()
}

private const val BASE_URL = "https://bank-app-test.herokuapp.com/api/"
}

@POST("login")
fun fazerLogin(
@Body bodyLog : bodyLogin
) : Call<UserAccountResponse>


@GET("statements/{idUser}")
fun dadosTransacoes(
@Path("idUser") idUsuaro : Int
) : Call<StatementsResponse>


}
Loading