diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..2b75303a
--- /dev/null
+++ b/.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/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 00000000..15a15b21
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 00000000..5469234c
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 00000000..9fdea7e6
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 00000000..7f68460d
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 00000000..288b36b1
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 0dcb0ff6..bf835f15 100644
--- a/README.md
+++ b/README.md
@@ -1,81 +1,169 @@
-# Show me the code
+# Android App Teste
+> Esta versao possui tela que lista fundos, detalha e tela de contato
+> Telas de alertas personalizadas para todo o aplicativo.
-### # DESAFIO:
+[![ Versao][version-image]][version-image]
+[![ Linguagem][lang-image]][lang-image]
+[![ Grandle][grandle-image]][grandle-image]
-Em uma tela terá um formulário dinâmico com alguns campos predefinidos, conforme o arquivo JSON disponível no link ([https://floating-mountain-50292.herokuapp.com/cells.json](https://floating-mountain-50292.herokuapp.com/cells.json)) que deverá
- ser consumido. Este formulário terá de ser desenhado e exibir uma tela de sucesso quando as informações preenchidas estiverem corretas.
+- Usa uma LIB GmailSender para enviar e-mails.
+- Possui fontes personalizadas de acordo com o Design da empresa.
+- Arquivos XML string com os textos usados por padrao no applicativo.
+- carrega dados externos em json ou das preferencias.
-Na segunda tela terá o detalhe de um ativo financeiro. As informações devem ser consumidas através do link ([https://floating-mountain-50292.herokuapp.com/fund.json](https://floating-mountain-50292.herokuapp.com/fund.json)).
+## Configuracoes
-O visual do aplicativo está em anexo no arquivo telas.png e em um arquivo do [Sketch](https://www.sketchapp.com) (30 dias grátis, caso não tenha a licença).
+- O Aplicativo foi desenovolvido na liguagem Java Nativo.
+- O Padrao de arquitetura MVP Clean Arquitecture.
+- Possui os gerenciadores de layout Constraint Layout e Recyclerview
+- o Nome do package do Aplicativo deve ser:
-
+```sh
+ package 'br.banco.servces'
-### # Avaliação
+```
+
+
+## Grandle
+
+```sh
+
+ grandle 'com.android.support:appcompat-v7:28.0.0'
+ grandle 'com.android.support:recyclerview-v7:28.0.0'
+ grandle 'com.android.support.constraint:constraint-layout:1.1.3'
+ grandle 'com.android.support.constraint:constraint-layout:1.0.3'
+ grandle 'com.google.code.gson:gson:2.7'
-Você será avaliado pela usabilidade, por respeitar o design e pela arquitetura do app. É esperado que você consiga explicar as decisões que tomou durante o desenvolvimento através de commits.
+```
+
+## Testes
+- Apenas os testes no formulario de email foram aplicados
-* Java ou Kotlin
-* ConstraintLayout
-* O app deve funcionar no Android 4.4
-* Testes unitários (De preferência JUnit + Mockito). Mas pode usar o que você tem mais experiência, só nos explique o que ele tem de bom.
-* Arquitetura a ser utilizada: MVP Clean ([https://github.com/googlesamples/android-architecture/tree/todo-mvp-clean/](https://github.com/googlesamples/android-architecture/tree/todo-mvp-clean/)) && ([https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html](https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html)).
-* Uso do git.
+```sh
-### # Dicas para o layout
+ grandle 'com.android.support.test:runner:1.0.2'
+ grandle 'com.android.support.test.espresso:espresso-core:3.0.2'
+ grandle 'junit:junit:4.12'
+ grandle 'org.mockito:mockito-core:2.27.0'
-* O formulário deve respeitar o conteúdo do cells.json ([https://floating-mountain-50292.herokuapp.com/cells.json](https://floating-mountain-50292.herokuapp.com/cells.json)) .
-* Se o texto estiver muito grande, quebre em linhas e exiba por completo.
-* A fonte a ser utilizada está em anexo no repositório.
+```
-### # Como interpretar o cells.json:
+## Libs
+- Usa uma LIB GmailSender para enviar e-mails.
+- Libs: activation.jar, aditional.jar, mail.jar
+
+```sh
+
+ grandle fileTree(dir: 'libs/', include: ['*.jar'])
-```Java
-enum Type {
- field(1)
- text(2),
- image(3),
- checkbox(4),
- send(5)
-}
```
-```Java
-enum TypeField {
- text(1),
- telNumber(2),
- email(3)
-}
+1. Instalar a Library dentro da pasta lib
+2. configurar o arquivo GmailSender.java da forma abaixo:
+3. importear o pacote GMailSender;
+4. Caso use o Gmail para receber os emails ser pedido uma solicitacao de 'Aplicativos de Terceiros'
+
+Abaixo veja o config do GMailSender:
+
+```sh
+ public String Mailhost = "smtp.gmail.com";
+ public String User ="seu-email@gmail.com";
+ public String Password ="sua-senha";
+
+```
+
+## Fonts
+- Foram utilizadas fontes que seguem a identidade visual da empresa: DINPro.
+- As fontes foram copiadas para a pasta fonts dentro do projeto.
+- Abaixo veja os nomes das Fontes:
+
+```sh
+ DINPro-Black
+ DINPro-Bold
+ DINPro-Medium
+ DINPro-Regular
+ DINPro-Light
+
+```
+
+
+
+## Telas
+- O Fluxo de navegacao fica na sequencia da imagem abaixo:
+
+
+
+
+## Fluxo Codigo
+* O Fluxo de navegacao contato por Email:
+
+1. SOLICITACAO: View > Presenter > Model > Interactor > Validator > Rule .
+2. Rule devolve ao Validator... que faz o caminho de volta.
+
+```sh
+ - Validator ou Rule: classe responsavel por validar os dados Recebidos/Enviados antes de fazer a SOLICITACAO.
+ - Exemplo de Validator: classe FromScreen (configura a classe ScreenFundTemplate) responsavel por permitir que a tela de Fundos seja exibida.
+
```
-`"type":` tipo da célula;
-`"message":` mensagem que vai aparecer na label para type = text ou placeholder para field;
+- TELA FLUXO: Fundos de Investimentos -> Tela de detalhe.
+
+
+- TELA FLUXO: Criacao da Tela de Formulario de contato
+
+
+
+- TELA FLUXO: Alertas exibidos em todo o aplicativo usados por todos os pacotes.
+
+
+
+## Historico de Versões
+
+* 0.0.1
+ * ALTERACAO: Envia Emails e carrega Preferencias
+ * Os testes foram feitos apenas nas versoes 5, 6, 7 e 8 do Android e funciona corretamente.
+
+
+## Meta
+
+Adriano Souza – [@adrianosouzai](https://twitter.com/adrianosouzai) – adrianosouza@gmail.com
+
+
+Ainda esta em fase de testes. Nao possui ``LICENSE`` .
+
+URL do Projeto [https://github.com/busqe/TesteAndroid](https://github.com/busqe/testeandroid)
+
+## Contribuição
-`typeField":` tipo do field a ser exibido, para exibir corretamente a validação daquele campo.
+- Este projeto faz parte do pacote Android Teste
-`hidden":` indica se o campo está visível;
+## Nao foram feitos neste teste
-`topSpacing":` espaçamento entre o topo da célula e o topo da label/field/checkbox;
+- BACK-END
-`show":` indica o campo que será exibido quando este campo for selecionado. No caso é o id do campo a ser exibido.
+1. O formulario de contato nao carrega json para configuracoes de design.
+2. Nao foram feitos testes na versao 4.4 em dispositivos reais.
+3. Nao foram feitos checagem de versao de Dispositivo.
+4. Nao foram feitos testes de passagem de parametros para todos os metodos.
-`type":` "send" esse botão irá validar todas informações que foram preenchidas e ir para a tela de sucesso quando tudo tiver ok;
+- FRONT-END: Contato
-`risk":` pode ser um int de 1 a 5
+1. O Botao de checkbox nao foi aplicado o estilo.
+
-O tipo `text` a validação é digitou alguma coisa, já ficou válido.
-Para "telNumber" o campo deve ser formatado `(##) ####-#### || (##) #####-####` e validado de acordo.
-Para "email" o email deve ser válido.
-### # Observações gerais
+## Imagens utilizadas
+ - As imagens de telas sao prints do proprio projeto.
+ - as Imagens de fluxo sao com base no fluxo dos codigos.
+
+[version-image]: https://github.com/busqe/TesteAndroid/blob/master/images/ico-version.svg
+[lang-image]: https://github.com/busqe/TesteAndroid/blob/master/images/ico-lang.svg
+[grandle-image]: https://github.com/busqe/TesteAndroid/blob/master/images/ico-grandle.svg
-Adicione um arquivo [README.md](http://README.md) com os procedimentos para executar o projeto.
-Pedimos que trabalhe sozinho e não divulgue o resultado na internet.
+-- Muito obrigado!
-Faça um fork desse desse repositório em seu Github e nos envie um Pull Request com o resultado, por favor informe por qual empresa você esta se candidatando.
+\o/
-### # Importante: não há prazo de entrega, faça com qualidade!
-# BOA SORTE!
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 00000000..796b96d1
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 00000000..10defbb7
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,66 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 28
+ // buildToolsVersion rootProject.buildToolsVersion
+ defaultConfig {
+ applicationId "br.banco.services"
+ minSdkVersion 19
+ 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'
+ }
+ /*
+ debug {
+ debuggable true
+ }
+ customDebuggableBuildType {
+ debuggable true
+ }
+ */
+ }
+ // dataBinding {enabled = true }
+}
+
+dependencies {
+
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation 'com.android.support:appcompat-v7:28.0.0'
+ implementation 'com.android.support:recyclerview-v7:28.0.0'
+ implementation 'com.android.support.constraint:constraint-layout:1.1.3'
+ //implementation 'com.google.code.gson:gson:.2.7'
+ implementation 'com.google.code.gson:gson:2.8.5'
+
+
+ androidTestImplementation 'com.android.support.test:runner:1.0.2'
+ androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
+ testImplementation 'junit:junit:4.12'
+ testImplementation 'org.mockito:mockito-core:2.27.0'
+ //testImplementation 'org.mockito:mockito-core:' + rootProject.mockitoVersion;
+
+ implementation 'com.android.support:design:28.0.0'
+ //implementation 'com.github.scottyab:showhidepasswordedittext:0.8'
+
+
+ implementation fileTree(dir: 'libs/', include: ['*.jar'])
+
+}
+
+
+/*
+sourceSets {
+ main {
+ res.srcDirs = [
+ file("src/main/res/templates/").listFiles(),
+ "src/main/res/templates",
+ "src/main/res"
+ ]
+ }
+}
+*/
\ No newline at end of file
diff --git a/app/libs/activation.jar b/app/libs/activation.jar
new file mode 100644
index 00000000..614a03cd
Binary files /dev/null and b/app/libs/activation.jar differ
diff --git a/app/libs/additionnal.jar b/app/libs/additionnal.jar
new file mode 100644
index 00000000..aeb9611f
Binary files /dev/null and b/app/libs/additionnal.jar differ
diff --git a/app/libs/mail.jar b/app/libs/mail.jar
new file mode 100644
index 00000000..ea594fdd
Binary files /dev/null and b/app/libs/mail.jar differ
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 00000000..f1b42451
--- /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
diff --git a/app/src/androidTest/java/br/banco/services/ExampleInstrumentedTest.java b/app/src/androidTest/java/br/banco/services/ExampleInstrumentedTest.java
new file mode 100644
index 00000000..43a1049a
--- /dev/null
+++ b/app/src/androidTest/java/br/banco/services/ExampleInstrumentedTest.java
@@ -0,0 +1,26 @@
+package br.banco.services;
+
+import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * @see Testing documentation
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getTargetContext();
+
+ assertEquals("br.banco.services", appContext.getPackageName());
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..af09263d
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,157 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png
new file mode 100644
index 00000000..dcd4d9a8
Binary files /dev/null and b/app/src/main/ic_launcher-web.png differ
diff --git a/app/src/main/java/br/banco/services/Teste.java b/app/src/main/java/br/banco/services/Teste.java
new file mode 100644
index 00000000..4bf1b6a4
--- /dev/null
+++ b/app/src/main/java/br/banco/services/Teste.java
@@ -0,0 +1,313 @@
+package br.banco.services;
+
+
+import android.app.ProgressDialog;
+import android.os.Bundle;
+import android.os.Handler;
+import android.support.v7.app.AppCompatActivity;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonParseException;
+import com.google.gson.reflect.TypeToken;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.lang.reflect.Type;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import br.banco.services.contact.domain.Produto;
+import br.banco.services.contact.domain.ResponseJson;
+
+public class Teste extends AppCompatActivity {
+
+ final String TAG = "LOADR";
+
+ public ExecutorService executor;
+ public String FILE_DATA;
+ Button button;
+ TextView tvTest;
+
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.teste);
+ button = (Button) findViewById(R.id.btTest);
+ tvTest = (TextView) findViewById(R.id.tvTest);
+
+ button.setOnClickListener( new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+
+ userCaseTeste();
+
+ }
+ });
+
+
+
+ userCaseTeste();
+
+ }
+
+
+
+ public void userCaseTeste(){
+
+ String loadDataTest; // 01>
+ List gsonTolistTest = new ArrayList<>(); // 02>
+ HashMap listToMapTest = new HashMap<>(); // 03>
+ Map gsonToMapTest = new HashMap<>(); //03 <
+
+
+ //loadDataTest = loadDataLocal(null);
+ //loadDataFrom = loadData(null);
+ gsonTolistTest = gsonToList(loadDataLocal(null));
+ // listToMapTest = listToMap(gsonTolistTest);
+ gsonToMapTest = gsonToMap(gsonTolistTest);
+
+ // Log.e(TAG,"TESTCASE > listToMapTest=" + (listToMapTest != null));
+
+
+ }
+
+
+
+
+ public void showData(ArrayList produto){
+
+
+
+ String testeItens = "Produto{" +
+ "id='" + produto.get(0).getId() + '\'' +
+ ", type='" + produto.get(0).getType() + '\'' +
+ ", message='" + produto.get(0).getMessage() + '\'' +
+ ", typefield='" + produto.get(0).getTypefield() + '\'' +
+ ", hidden='" + produto.get(0).getTopSpacing() + '\'' +
+ ", topSpacing='" + produto.get(0).getTopSpacing() + '\'' +
+ ", show='" + produto.get(0).getShow() + '\'' +
+ ", required='" + produto.get(0).isRequired() + '\'' +
+ '}';
+
+
+ //tvTest.setText(testeItens);
+
+ Log.d(TAG, "M/TESTE/response/" + (produto.size()));
+
+ }
+
+
+ public String loadData(String area) {
+
+ Log.e("LOADR","M/loadFile/>Carregando json..." + area);
+
+
+ //SERVER_URL = new ConfigServers().getDataServer(area);
+ String SERVER_URL = "http://www.issam.com.br/lab/acento/cels1.txt";
+
+ try {
+ URL url = new URL(SERVER_URL);
+ StringBuilder SB = new StringBuilder();
+ BufferedReader buffer = new BufferedReader(
+ new InputStreamReader(url.openStream()));
+ // Log.d(TAG, "buffer = " + (buffer!=null));
+ String line = null;
+ while ((line = buffer.readLine()) != null) {
+
+ SB.append(line);
+ // Log.d(TAG, "" + line);
+ }
+ buffer.close();
+
+
+ FILE_DATA = SB.toString();
+ // Log.d(TAG, "FILE_DATA = " + FILE_DATA);
+
+ // Log.d(TAG, "M/loadData/listaArray/" + listaArray.size() );
+
+ } catch (Exception e) {
+ // errorData( "", 4);
+ //nextData(area);
+ Log.d(TAG, "Erro ao carregar arquivo!" + (e));
+ }
+
+
+ return FILE_DATA;
+ }
+
+
+ public List gsonToList(String listStr){
+
+ if(listStr==null){return null;}
+ if(listStr.length()< 100 ){return null;}
+ if(listStr.length()> 1000 ){return null;}
+
+ //Log.e(TAG, "M/gsonToList/listStr=" + listStr.length());
+
+ List list = new ArrayList();
+
+ try {
+
+ Gson GS = new Gson();
+ ResponseJson response = new ResponseJson();
+ response = GS.fromJson(listStr, ResponseJson.class);
+ Log.e(TAG, "M/gsonToList/response="+(response.getAndroid().size())+" / " + response.getAndroid().get(0).getMessage() );
+
+ list = response.getAndroid();
+
+ //Log.e(TAG, "M/gsonToList/" + listStr.length());
+
+ }
+ catch (JsonParseException ex) { }
+ catch (IndexOutOfBoundsException ex) { }
+ catch (Exception ex) { }
+
+
+ return list;
+ }
+
+ /**
+ *
+ * 1 - > converte List em String
+ * 2 - > Converte String em Map
+ * 3 - > Salva em Pref
+ *
+ * @param list
+ * @return
+ */
+
+
+ public HashMap gsonToMap(List list) {
+
+ HashMap map = new HashMap<>();
+ if(list==null){return null;}
+ if(!(list.size() == 6)){return null;}
+
+ try {
+
+ Gson gson;
+ Type type;
+ String gsonToStr;
+
+ for(int i=0; i>(){}.getType();
+
+ gsonToStr = gson.toJson(list.get(i));
+ Map strToMap = gson.fromJson(gsonToStr, type);
+
+ //Log.e(TAG, "M/gsonToMap/list=" + gsonToStr);
+ Log.e(TAG, "--- elmento " +i+"--- ");
+
+ for (Map.Entry entry : strToMap.entrySet()) {
+
+ Log.e(TAG, "M/gsonToMap/strToMap=" + entry.getKey() + "=" + entry.getValue());
+ }
+
+ }
+
+
+
+ }
+
+ catch (JsonParseException ep) {
+ Log.e(TAG, "M/gsonToMap/parser=" + ep);
+ }
+ catch (IndexOutOfBoundsException eb) {
+ Log.e(TAG, "M/gsonToMap/bound=" + eb);
+ }
+ catch (Exception ex) {
+ Log.e(TAG, "M/gsonToMap/ecep=" + ex);
+ }
+ return map;
+ }
+
+
+ public HashMap listToMap(List list) {
+ HashMap map = new HashMap<>();
+
+ Log.e(TAG,"M/listToMap/list:" + (list.size()));
+
+ for (Produto produto : list) {
+ // HashMap map = new HashMap<>();
+ //map.put(KEY_VER, conteudo.getId());
+ // Log.d(TAG, "dataToMap:" + produto.getId());
+ Log.d(TAG, "listToMap:" + produto.getMessage());
+ }
+
+ return map;
+ }
+
+
+
+
+
+
+
+
+ public String loadDataLocal(String area){
+
+
+ //FILE_DATA = "{'android':[{'id':1,'type':2,'message':'Olá,primeiro se apresente com o seu nome:','typefield':null,'hidden':false,'topSpacing':60.0,'show':null,'required':false}]}";
+ FILE_DATA = "{'android':[{'id':1,'type':2,'message':'Olá,primeiro se apresente comoseunome:','typefield':null,'hidden':false,'topSpacing':60.0,'show':null,'required':false},{'id':2,'type':1,'message':'Nomecompleto','typefield':1,'hidden':false,'topSpacing':35.0,'show':null,'required':true},{'id':4,'type':1,'message':'Email','typefield':3,'hidden':true,'topSpacing':35.0,'show':null,'required':true},{'id':6,'type':1,'message':'Telefone','typefield':'telnumber','hidden':false,'topSpacing':10.0,'show':null,'required':true},{'id':3,'type':4,'message':'Gostaria de cadastr armeu email','typefield':null,'hidden':false,'topSpacing':35.0,'show':4,'required':false},{'id':7,'type':5,'message':'Enviar','typefield':null,'hidden':false,'topSpacing':10.0,'show':null,'required':true}]}";
+
+
+ return FILE_DATA;
+ }
+
+
+
+
+
+
+
+ String itens = null;
+
+ public void onNext() {
+ itens = null;
+
+ //loadData(null);
+ }
+
+ public void onError() {
+ itens = null;
+ }
+
+ public void onComplete() {
+
+ itens = "1";
+ }
+
+
+
+
+
+ public Object objectToClass(Class c){
+
+ Object object = null;
+
+ try {
+ object = c.newInstance();
+ } catch (InstantiationException ex) {
+ //Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
+ } catch (IllegalAccessException ex) {
+ // Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
+ }
+
+ return object;
+ }
+
+ }
+
diff --git a/app/src/main/java/br/banco/services/app/alert/Alert.java b/app/src/main/java/br/banco/services/app/alert/Alert.java
new file mode 100644
index 00000000..44fe712c
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/alert/Alert.java
@@ -0,0 +1,56 @@
+package br.banco.services.app.alert;
+
+/**
+ *
+ */
+
+public class Alert {
+
+ public String Area;
+ public String Title;
+ public String Message;
+ public String Text;
+ public String Style;
+ public String Teste;
+
+ public String getArea() {
+ return Area;
+ }
+
+ public void setArea(String area) {
+ Area = area;
+ }
+
+ public String getTitle() {
+ return Title;
+ }
+
+ public void setTitle(String title) {
+ Title = title;
+ }
+
+ public String getMessage() {
+ return Message;
+ }
+
+ public void setMessage(String message) {
+ Message = message;
+ }
+
+ public String getText() {
+ return Text;
+ }
+
+ public void setText(String text) {
+ Text = text;
+ }
+
+ public String getStyle() {
+ return Style;
+ }
+
+ public void setStyle(String style) {
+ Style = style;
+ }
+
+}
diff --git a/app/src/main/java/br/banco/services/app/alert/AlertAdapter.java b/app/src/main/java/br/banco/services/app/alert/AlertAdapter.java
new file mode 100644
index 00000000..7ed15cdf
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/alert/AlertAdapter.java
@@ -0,0 +1,71 @@
+package br.banco.services.app.alert;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+
+import br.banco.services.R;
+
+public class AlertAdapter extends BaseAdapter {
+
+ public String[] values;
+ public Context context;
+ public LayoutInflater inflater;
+ public View createView;
+ public ViewHolder holder;
+
+ //public TextView tvLoad;
+
+ public AlertAdapter(Context context, String[] itens) {
+ this.values = itens;
+ this.context = context;
+ this.inflater = inflater;
+ // this.createView = createView;
+ //this.holder = holder;
+ //this.tvLoad = tvLoad;
+
+ }
+
+ public View getView(int posicao, View convertView, ViewGroup parent) {
+
+
+
+ if( convertView == null) {
+ createView = LayoutInflater.from(context)
+ .inflate(R.layout.teste, parent, false);
+
+ } else {
+ createView = convertView;
+ }
+
+ holder = new ViewHolder(createView);
+ // holder.tvLoad.setText("SUCESSO HOLDER");
+
+ return convertView;
+ }
+
+ public int getCount() {
+ return values.length;
+ }
+
+ public Object getItem(int postition) {
+ return values[postition];
+ }
+
+ public long getItemId(int posicao) {
+ return 0;
+ }
+
+
+ public class ViewHolder {
+
+ // final TextView tvLoad;
+
+ public ViewHolder(View view) {
+ // tvLoad = (TextView) view.findViewById(R.id.tvLoading);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/br/banco/services/app/alert/AlertModel.java b/app/src/main/java/br/banco/services/app/alert/AlertModel.java
new file mode 100644
index 00000000..8155805d
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/alert/AlertModel.java
@@ -0,0 +1,18 @@
+package br.banco.services.app.alert;
+// area, titulo, mensagem, botao texto, botao estilo
+
+import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
+
+import br.banco.services.R;
+
+public class AlertModel extends AppCompatActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_alerts);
+
+ }
+
+}
diff --git a/app/src/main/java/br/banco/services/app/alert/AlertPresenter.java b/app/src/main/java/br/banco/services/app/alert/AlertPresenter.java
new file mode 100644
index 00000000..a49ac42b
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/alert/AlertPresenter.java
@@ -0,0 +1,38 @@
+package br.banco.services.app.alert;
+import android.content.Context;
+
+import br.banco.services.app.message.IMessage;
+import br.banco.services.app.message.MessageType;
+
+public class AlertPresenter {
+
+ private Alert alert;
+ private View view;
+
+ public AlertPresenter(View view) {
+ this.alert = new Alert();
+ this.view = view;
+ }
+
+ public void loadAlertView(int msgCode, Context context){
+
+ msgCode = (msgCode >= 0 && msgCode <= 5 ) ? msgCode : 0;
+
+ MessageType type = MessageType.values()[msgCode];
+ IMessage message = type.returnMessage();
+ String[] alertValues = message.configDesign(context);
+
+ view.updateAlertView(alertValues);
+ }
+
+
+ public interface View{
+
+ void drawView();
+ void updateAlertView(String alertValues[]);
+ void showProgressBar();
+ void hideProgressBar();
+
+ }
+
+}
diff --git a/app/src/main/java/br/banco/services/app/alert/AlertView.java b/app/src/main/java/br/banco/services/app/alert/AlertView.java
new file mode 100644
index 00000000..be41355d
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/alert/AlertView.java
@@ -0,0 +1,192 @@
+ /*
+
+ recebe + carrega + mostra = mensagem
+ @FAZER: onResume() checar conexao + abrir home
+ */
+package br.banco.services.app.alert;
+
+ import android.graphics.Color;
+ import android.graphics.PorterDuff;
+ import android.os.Bundle;
+ import android.os.Handler;
+ import android.support.v7.app.AppCompatActivity;
+ import android.util.DisplayMetrics;
+ import android.util.Log;
+ import android.view.KeyEvent;
+ import android.view.View;
+ import android.widget.Button;
+ import android.widget.ProgressBar;
+ import android.widget.RelativeLayout;
+ import android.widget.TextView;
+
+ import br.banco.services.R;
+ import br.banco.services.app.utils.ConnectionChek;
+
+
+ public class AlertView extends AppCompatActivity implements AlertPresenter.View {
+
+ public String TAG = "ALERTA";
+ private AlertPresenter presenter;
+ private int messageCode = 0;
+ private ConnectionChek internet;
+
+
+ public TextView tvArea ;
+ public TextView tvTitle;
+ public TextView tvMessage;
+ public Button btAction;
+
+ private ProgressBar progressBar;
+ //private Toolbar toolbar;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_alerts);
+
+ initProgressBar();
+
+ if(getIntent().getExtras() != null) {
+ messageCode = getIntent().getExtras().getInt("messageCode");
+ }
+
+ drawView();
+ presenter = new AlertPresenter(this);
+
+ Log.d(TAG, "VIEW / "+getClass().getName()+" / onCreate -> START " );
+
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+
+ presenter.loadAlertView(messageCode, getApplicationContext());
+ Log.d(TAG, "VIEW / "+getClass().getName()+" / onResume -> START " );
+ }
+
+ @Override
+ public void updateAlertView(String[] alertValues) {
+
+ tvArea.setText(alertValues[0]);
+ tvTitle.setText(alertValues[1]);
+ tvMessage.setText(alertValues[2]);
+ btAction.setText(alertValues[3]);
+
+ if(alertValues[4].equals("buttonCircleDefault")){
+ btAction.setBackgroundResource( R.drawable.shape_circle_light);
+ btAction.setTextColor(Color.parseColor("#333333"));
+ }
+
+
+ if(messageCode==2){ // internet error
+
+ btAction.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v)
+ {
+ showProgressBar();
+
+ Handler handler = new Handler();
+ handler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+
+ hideProgressBar();
+ if(checkInternet()){
+
+ //message.what.
+
+ Log.d(TAG, " VIEW / "+getClass().getName()+" / -> EXIT ") ;
+ finish();
+ }
+ }
+ }, 3000);
+
+ Log.d(TAG, " VIEW / "+getClass().getName()+" / onClick -> checkInternet") ;
+ }
+ });
+
+ }
+
+ }
+
+ public boolean checkInternet(){
+
+ internet = new ConnectionChek();
+
+ if(internet.isNetworkAvailable(getApplicationContext()) == true){
+ Log.d(TAG, " VIEW / "+getClass().getName()+" / checkInternet -> SUCESS") ;
+ return true;
+ }else{
+ Log.d(TAG, " VIEW / "+getClass().getName()+" / checkInternet -> ERROR") ;
+ return false;
+ }
+
+ }
+
+ @Override
+ public void drawView(){
+
+ tvArea = (TextView) findViewById(R.id.lbArea);
+ tvTitle = (TextView) findViewById(R.id.DT_fd_title);
+ tvMessage = (TextView) findViewById(R.id.DT_fd_fundName);
+ btAction = (Button) findViewById(R.id.btAction3);
+ }
+
+ @Override
+ public void showProgressBar() {
+ progressBar.setVisibility(View.VISIBLE);
+ }
+
+ @Override
+ public void hideProgressBar() {
+ progressBar.setVisibility(View.INVISIBLE);
+ }
+
+ private void initProgressBar() {
+
+ int marginTop = 0;
+ int marginLeft = 0;
+
+ // size
+ DisplayMetrics displayMetrics = new DisplayMetrics();
+ getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
+
+ int width = displayMetrics.widthPixels;
+ int height = displayMetrics.heightPixels;
+
+ marginTop = (height > 0) ? (height / 2) - 80 : 0 ;
+ marginLeft = (width > 0) ? (width / 2) - 80 : 0 ;
+
+ // bar
+ progressBar = new ProgressBar(this, null,
+ android.R.attr.progressBarStyleSmall);
+ progressBar.getIndeterminateDrawable()
+ .setColorFilter(Color.GRAY, PorterDuff.Mode.SRC_IN);
+ progressBar.setIndeterminate(true);
+ progressBar.setBackgroundColor(Color.TRANSPARENT);
+
+ // layout
+ RelativeLayout layout = new RelativeLayout(this);
+
+ // params
+ RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(160, 160);
+ params.setMargins(marginLeft, marginTop, 0, 0);
+
+ this.addContentView(progressBar, params);
+ hideProgressBar();
+ }
+
+ @Override
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
+ if (keyCode == KeyEvent.KEYCODE_BACK) {
+
+ //Toast.makeText(getApplicationContext(), "quer fechar ?" , Toast.LENGTH_LONG).show();
+ finish();
+ overridePendingTransition(R.anim.an_entrar_esquerda, R.anim.an_sair_esquerda);
+ return false;
+ }
+ return super.onKeyDown(keyCode, event);
+ }
+ }
diff --git a/app/src/main/java/br/banco/services/app/config/ConfigServers.java b/app/src/main/java/br/banco/services/app/config/ConfigServers.java
new file mode 100644
index 00000000..7f21bcae
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/config/ConfigServers.java
@@ -0,0 +1,53 @@
+/*
+ Endereços ficaram acessiveis para facilitar a mudança de servidores
+*/
+/**
+ * carrega dados dos servidores json
+ *
+ */
+package br.banco.services.app.config;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+public final class ConfigServers {
+
+
+ /**
+ *
+ * carerga URL dos servidores REST
+ *
+ *
+ */
+
+
+ public ArrayList serverList = new ArrayList();
+ // public String URLserver = "https://floating-mountain-50292.herokuapp.com/";
+ public String URLserver = "http://www.issam.com.br/lab/acento/";
+ String DataServer = null;
+
+ public ConfigServers() {
+
+ serverList.add("cells");
+ serverList.add("fund");
+
+ }
+
+ public String getDataServer(String server) {
+
+ String LoadServer = null;
+ if(serverList.contains(server)){
+ // LoadServer = URLserver + server + ".json";
+ LoadServer = URLserver + server + ".txt";
+ }
+
+ return LoadServer;
+ }
+
+
+
+
+
+}
+
diff --git a/app/src/main/java/br/banco/services/app/design/TemplateForm.java b/app/src/main/java/br/banco/services/app/design/TemplateForm.java
new file mode 100644
index 00000000..33b51047
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/design/TemplateForm.java
@@ -0,0 +1,134 @@
+package br.banco.services.app.design;
+
+import android.os.Bundle;
+import android.os.Handler;
+import android.support.v7.app.AppCompatActivity;
+import android.text.InputType;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.TextView;
+import android.widget.Toast;
+
+
+
+import br.banco.services.R;
+
+public class TemplateForm extends AppCompatActivity {
+
+ final String TAG = "LOADR";
+
+
+
+ private TextView TP_field;
+ private EditText TP_name;
+ private EditText TP_email;
+ private EditText TP_telNumber;
+ private EditText TP_password;
+
+ private Button btnSubmit;
+
+
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.template_form);
+
+ registerViews();
+
+ }
+
+
+
+
+
+ private void registerViews() {
+
+
+
+ TP_field = (TextView) findViewById(R.id.TP_field);
+ TP_field.setText("Titulo da Mensagem aqui");
+
+ TP_password = (EditText) findViewById(R.id.TP_password);
+ //TP_password.setError("Por favor Digite um valor nesse campo");
+ TP_password.setError(null);
+
+ TP_name = (EditText) findViewById(R.id.TP_name);
+ TP_name.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
+
+
+ // TextWatcher would let us check validation error on the fly
+ TP_name.addTextChangedListener(new TextWatcher() {
+ public void afterTextChanged(Editable s) {
+ Validation.hasText(TP_name);
+ }
+ public void beforeTextChanged(CharSequence s, int start, int count, int after){}
+ public void onTextChanged(CharSequence s, int start, int before, int count){}
+ });
+
+ TP_email = (EditText) findViewById(R.id.TP_email);
+ TP_email.addTextChangedListener(new TextWatcher() {
+ // after every change has been made to this editText, we would like to check validity
+ public void afterTextChanged(Editable s) {
+ Validation.isEmailAddress(TP_email, true);
+ }
+ public void beforeTextChanged(CharSequence s, int start, int count, int after){}
+ public void onTextChanged(CharSequence s, int start, int before, int count){}
+ });
+
+ TP_telNumber = (EditText) findViewById(R.id.TP_telNumber);
+ TP_telNumber.addTextChangedListener(new TextWatcher() {
+ public void afterTextChanged(Editable s) {
+ Validation.isPhoneNumber(TP_telNumber, false);
+ }
+ public void beforeTextChanged(CharSequence s, int start, int count, int after){}
+ public void onTextChanged(CharSequence s, int start, int before, int count){}
+ });
+
+ btnSubmit = (Button) findViewById(R.id.TP_buttom);
+ btnSubmit.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ /*
+ Validation class will check the error and display the error on respective fields
+ but it won't resist the form submission, so we need to check again before submit
+ */
+ if ( checkValidation () )
+ submitForm();
+ else
+ Toast.makeText(TemplateForm.this, "Form contains error", Toast.LENGTH_LONG).show();
+ }
+ });
+ }
+
+ private void submitForm() {
+ // Submit your form here. your form is valid
+ Toast.makeText(this, "Submitting form...", Toast.LENGTH_LONG).show();
+ }
+
+ private boolean checkValidation() {
+ boolean ret = true;
+
+ if (!Validation.hasText(TP_name)) ret = false;
+ if (!Validation.isEmailAddress(TP_email, true)) ret = false;
+ if (!Validation.isPhoneNumber(TP_telNumber, false)) ret = false;
+
+ return ret;
+ }
+}
+
+
+
+
+
diff --git a/app/src/main/java/br/banco/services/app/design/Validation.java b/app/src/main/java/br/banco/services/app/design/Validation.java
new file mode 100644
index 00000000..94cb7d9d
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/design/Validation.java
@@ -0,0 +1,63 @@
+package br.banco.services.app.design;
+
+import android.widget.EditText;
+import java.util.regex.Pattern;
+
+public class Validation {
+
+ // Regular Expression
+ // you can change the expression based on your need
+ private static final String EMAIL_REGEX = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
+ private static final String PHONE_REGEX = "\\d{3}-\\d{7}";
+
+ // Error Messages
+ private static final String REQUIRED_MSG = "required";
+ private static final String EMAIL_MSG = "invalid email";
+ private static final String PHONE_MSG = "###-#######";
+
+ // call this method when you need to check email validation
+ public static boolean isEmailAddress(EditText editText, boolean required) {
+ return isValid(editText, EMAIL_REGEX, EMAIL_MSG, required);
+ }
+
+ // call this method when you need to check phone number validation
+ public static boolean isPhoneNumber(EditText editText, boolean required) {
+ return isValid(editText, PHONE_REGEX, PHONE_MSG, required);
+ }
+
+ // return true if the input field is valid, based on the parameter passed
+ public static boolean isValid(EditText editText, String regex, String errMsg, boolean required) {
+
+ String text = editText.getText().toString().trim();
+ // clearing the error, if it was previously set by some other values
+ editText.setError(null);
+
+ // text required and editText is blank, so return false
+ if ( required && !hasText(editText) ) return false;
+
+ // pattern doesn't match so returning false
+ if (required && !Pattern.matches(regex, text)) {
+ editText.setError(errMsg);
+ return false;
+ };
+
+ return true;
+ }
+
+ // check the input field has any text or not
+ // return true if it contains text otherwise false
+ public static boolean hasText(EditText editText) {
+
+ String text = editText.getText().toString().trim();
+ // editText.setError(null);
+ editText.setError("Digite uma senha com no minimo 6 digitos contendo letras e numeros.");
+
+ // length 0 means there is no text
+ if (text.length() == 0) {
+ editText.setError(REQUIRED_MSG);
+ return false;
+ }
+
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/br/banco/services/app/message/IMessage.java b/app/src/main/java/br/banco/services/app/message/IMessage.java
new file mode 100644
index 00000000..1582f178
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/message/IMessage.java
@@ -0,0 +1,16 @@
+package br.banco.services.app.message;
+
+/**
+ * configura mensagens de acordo com o tipo
+ *
+ *
+ */
+
+import android.content.Context;
+
+public interface IMessage {
+
+ public String[] configDesign(Context context);
+
+}
+
diff --git a/app/src/main/java/br/banco/services/app/message/Message.java b/app/src/main/java/br/banco/services/app/message/Message.java
new file mode 100644
index 00000000..fe667bf1
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/message/Message.java
@@ -0,0 +1,26 @@
+package br.banco.services.app.message;
+/**
+ * configura mensagens de acordo com o tipo
+ *
+ *
+ */
+import android.content.Context;
+
+public class Message implements IMessage{
+
+ public Context context;
+ public String[] message;
+ public IMessage imessage;
+
+ public Message(IMessage imessage){
+ this.imessage = imessage;
+ }
+
+ public String[] configDesign(Context context){
+ return message;
+ }
+
+ public String[] configPernalized(Context context){
+ return imessage.configDesign(context);
+ }
+}
diff --git a/app/src/main/java/br/banco/services/app/message/MessageConfig.java b/app/src/main/java/br/banco/services/app/message/MessageConfig.java
new file mode 100644
index 00000000..9c5cc0b8
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/message/MessageConfig.java
@@ -0,0 +1,22 @@
+package br.banco.services.app.message;
+/**
+ * configura mensagens de acordo com o tipo
+ *
+ *
+ */
+import android.content.Context;
+import android.support.v7.app.AppCompatActivity;
+
+import br.banco.services.R;
+
+public class MessageConfig extends AppCompatActivity implements IMessage {
+
+ private Context b;
+
+ public String[] configDesign(Context a) {
+ this.b = a;
+ return b.getResources().getStringArray(R.array.alert_unknown_error);
+ }
+
+}
+
diff --git a/app/src/main/java/br/banco/services/app/message/MessageError.java b/app/src/main/java/br/banco/services/app/message/MessageError.java
new file mode 100644
index 00000000..2b63f207
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/message/MessageError.java
@@ -0,0 +1,21 @@
+package br.banco.services.app.message;
+/**
+ * configura mensagens de acordo com o tipo
+ *
+ *
+ */
+import android.content.Context;
+import android.support.v7.app.AppCompatActivity;
+
+import br.banco.services.R;
+
+public class MessageError extends AppCompatActivity implements IMessage {
+
+ private Context b;
+
+ public String[] configDesign(Context a) {
+ this.b = a;
+ return b.getResources().getStringArray(R.array.alert_unknown_error);
+ }
+
+}
diff --git a/app/src/main/java/br/banco/services/app/message/MessageLoad.java b/app/src/main/java/br/banco/services/app/message/MessageLoad.java
new file mode 100644
index 00000000..9aea7e34
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/message/MessageLoad.java
@@ -0,0 +1,21 @@
+package br.banco.services.app.message;
+/**
+ * configura mensagens de acordo com o tipo
+ *
+ *
+ */
+import android.content.Context;
+import android.support.v7.app.AppCompatActivity;
+
+import br.banco.services.R;
+
+public class MessageLoad extends AppCompatActivity implements IMessage {
+
+ private Context b;
+
+ public String[] configDesign(Context a) {
+ this.b = a;
+ return b.getResources().getStringArray(R.array.alert_loading_app);
+ }
+
+}
diff --git a/app/src/main/java/br/banco/services/app/message/MessageNormal.java b/app/src/main/java/br/banco/services/app/message/MessageNormal.java
new file mode 100644
index 00000000..a07747ee
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/message/MessageNormal.java
@@ -0,0 +1,21 @@
+package br.banco.services.app.message;
+/**
+ * configura mensagens de acordo com o tipo
+ *
+ *
+ */
+import android.content.Context;
+import android.support.v7.app.AppCompatActivity;
+
+import br.banco.services.R;
+
+public class MessageNormal extends AppCompatActivity implements IMessage {
+
+ private Context b;
+
+ public String[] configDesign(Context a) {
+ this.b = a;
+ return b.getResources().getStringArray(R.array.alert_connection_error);
+ }
+
+}
diff --git a/app/src/main/java/br/banco/services/app/message/MessageSend.java b/app/src/main/java/br/banco/services/app/message/MessageSend.java
new file mode 100644
index 00000000..9e433423
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/message/MessageSend.java
@@ -0,0 +1,21 @@
+package br.banco.services.app.message;
+/**
+ * configura mensagens de acordo com o tipo
+ *
+ *
+ */
+import android.content.Context;
+import android.support.v7.app.AppCompatActivity;
+
+import br.banco.services.R;
+
+public class MessageSend extends AppCompatActivity implements IMessage {
+
+ private Context b;
+
+ public String[] configDesign(Context a) {
+ this.b = a;
+ return b.getResources().getStringArray(R.array.alert_sending_app);
+ }
+
+}
diff --git a/app/src/main/java/br/banco/services/app/message/MessageSuccess.java b/app/src/main/java/br/banco/services/app/message/MessageSuccess.java
new file mode 100644
index 00000000..9399d4d1
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/message/MessageSuccess.java
@@ -0,0 +1,21 @@
+package br.banco.services.app.message;
+/**
+ * configura mensagens de acordo com o tipo
+ *
+ *
+ */
+import android.content.Context;
+import android.support.v7.app.AppCompatActivity;
+
+import br.banco.services.R;
+
+public class MessageSuccess extends AppCompatActivity implements IMessage {
+
+ private Context b;
+
+ public String[] configDesign(Context a) {
+ this.b = a;
+ return b.getResources().getStringArray(R.array.alert_connection_sucess);
+ }
+
+}
diff --git a/app/src/main/java/br/banco/services/app/message/MessageType.java b/app/src/main/java/br/banco/services/app/message/MessageType.java
new file mode 100644
index 00000000..26c242ba
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/message/MessageType.java
@@ -0,0 +1,51 @@
+package br.banco.services.app.message;
+/**
+ * configura mensagens de acordo com o tipo
+ *
+ *
+ */
+public enum MessageType {
+
+ LOAD {
+ @Override
+ public IMessage returnMessage() {
+ return new MessageLoad();
+ }
+ },
+ CONFIG {
+ @Override
+ public IMessage returnMessage() {
+ return new MessageConfig();
+ }
+ },
+ NORMAL {
+ @Override
+ public IMessage returnMessage() {
+ return new MessageNormal();
+ }
+ },
+ SUCESS {
+ @Override
+ public IMessage returnMessage() {
+ return new MessageSuccess();
+ }
+ },
+ ERROR {
+ @Override
+ public IMessage returnMessage() {
+ return new MessageError();
+ }
+ }
+ ,
+ SEND {
+ @Override
+ public IMessage returnMessage() {
+ return new MessageSend();
+ }
+ }
+
+ ;
+
+ public abstract IMessage returnMessage();
+
+}
diff --git a/app/src/main/java/br/banco/services/app/utils/CharacterCheck.java b/app/src/main/java/br/banco/services/app/utils/CharacterCheck.java
new file mode 100644
index 00000000..212d8a14
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/utils/CharacterCheck.java
@@ -0,0 +1,55 @@
+package br.banco.services.app.utils;
+
+import android.util.Log;
+
+public final class CharacterCheck {
+
+ public int isNumber;
+ public long isLong;
+ public String Text;
+ public String Simbol;
+
+ public int getIsNumber(String isNumber) {
+ try {
+
+ Integer numberInt = Integer.valueOf(isNumber);
+ return numberInt;
+ }
+ catch (NumberFormatException e) {
+ Log.e("CONTACT", "ERROR = " + e.getMessage());
+ return 0;
+ }
+ }
+
+
+ public long getIsLong(String checkLong) {
+
+ try {
+
+ //Long numberLong = Long.parseLong(checkLong);
+ long numberLong = Long.valueOf(checkLong);
+ // Log.e("CONTACT", "SUCCESS = " + numberLong);
+ return numberLong;
+ }
+ catch (NumberFormatException e) {
+ //Log.e("CONTACT", "ERROR = " + e.getMessage());
+ return 0;
+ }
+ }
+
+ public String getText() {
+ return Text;
+ }
+
+ public void setText(String text) {
+ Text = text;
+ }
+
+ public String getSimbol() {
+ return Simbol;
+ }
+
+ public void setSimbol(String simbol) {
+ Simbol = simbol;
+ }
+}
diff --git a/app/src/main/java/br/banco/services/app/utils/CompareClassAndData.java b/app/src/main/java/br/banco/services/app/utils/CompareClassAndData.java
new file mode 100644
index 00000000..d76fb523
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/utils/CompareClassAndData.java
@@ -0,0 +1,46 @@
+package br.banco.services.app.utils;
+
+import android.util.Log;
+
+import br.banco.services.fund.data.template.FromFund;
+
+import static br.banco.services.fund.domain.Configclass.SCREEN_CLASS;
+
+public class CompareClassAndData {
+
+
+ public boolean compareClassAndData(){
+
+ // comparar se as config da classe sao iguais aos dados
+ FromFund fromFund = new FromFund();
+
+ boolean nameAll = false;
+ boolean sizeAll = false;
+
+ try {
+
+ String fundName = fromFund.LOAD_DATA_NAME;
+ String className = SCREEN_CLASS.Name;
+
+ int fundSize = fromFund.LOAD_DATA_SIZE;
+ int classSize = SCREEN_CLASS.Size;
+
+ //name = SCREEN_CLASS.Name == fromFund.LOAD_DATA_NAME;
+ nameAll = fundName.equals(className);
+ sizeAll = fundSize == classSize;
+
+ // Log.d("FUND", "VIEW / nameAll -> " + className+ "=" + fundName);
+ // Log.d("FUND", "VIEW / sizeAll -> " + classSize+ "=" + fundSize);
+
+ }catch (Exception e){
+ Log.d("FUND", "VIEW / CompareClassAndData -> ERROR! -> " + e.getMessage());
+ }
+
+ return (nameAll && sizeAll) ;
+ }
+
+
+
+
+
+}
diff --git a/app/src/main/java/br/banco/services/app/utils/CompareClassAndJson.java b/app/src/main/java/br/banco/services/app/utils/CompareClassAndJson.java
new file mode 100644
index 00000000..21312dba
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/utils/CompareClassAndJson.java
@@ -0,0 +1,45 @@
+package br.banco.services.app.utils;
+
+import android.util.Log;
+
+import org.json.JSONObject;
+
+import java.lang.reflect.Field;
+
+public class CompareClassAndJson {
+
+
+ public boolean compareIF(JSONObject json, Class> clas){
+
+ boolean compare = false;
+
+ try {
+
+ Field[] fields = clas.getDeclaredFields();
+ int count = 0;
+ String jsonNames = null;
+ String fieldNames = null;
+
+ for(Field fieldName : fields){
+
+ //Class fielType = fieldName.getType();
+ jsonNames = json.names().getString(count);
+
+
+ Log.d("FUND", fieldName.getName() + " / " + jsonNames);
+
+ count++;
+ }
+
+ }catch (Exception e){
+ Log.d("FUND", "compareIF->ERROR->" + e.getMessage());
+ }
+
+ return compare ;
+ }
+
+
+
+
+
+}
diff --git a/app/src/main/java/br/banco/services/app/utils/ConnectionChek.java b/app/src/main/java/br/banco/services/app/utils/ConnectionChek.java
new file mode 100644
index 00000000..47764698
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/utils/ConnectionChek.java
@@ -0,0 +1,45 @@
+ /*
+ @fazer
+ implementar @ import android.net.NetworkCapabilities;
+ cehcar versao do android suporta este
+ */
+
+package br.banco.services.app.utils;
+
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+
+ public class ConnectionChek {
+
+
+ public static boolean isNetworkAvailable(Context context) {
+
+ try {
+ ConnectivityManager connectivityManager = (ConnectivityManager)
+ context.getSystemService(Context.CONNECTIVITY_SERVICE);
+
+ if (connectivityManager != null) {
+ NetworkInfo activeNetwork = connectivityManager.getActiveNetworkInfo();
+ return (activeNetwork != null && activeNetwork.isConnected());
+ } else {
+ return false;
+ }
+
+ }catch (Exception e){
+ return false;
+ }
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+ }
diff --git a/app/src/main/java/br/banco/services/app/utils/JsonConvert.java b/app/src/main/java/br/banco/services/app/utils/JsonConvert.java
new file mode 100644
index 00000000..27c1732a
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/utils/JsonConvert.java
@@ -0,0 +1,449 @@
+package br.banco.services.app.utils;
+import android.util.Log;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+// screen=str, info=array, downInfo=array , moreInfo=str
+
+public class JsonConvert {
+
+ public JSONObject objZero;
+ public JSONObject objOne ;
+ public JSONObject objTwo ;
+ public JSONObject objTree ;
+
+ JSONArray arrayOne;
+ JSONArray arrayTwo;
+
+
+
+ public ReactAplication RX;
+ public JsonConvert(){
+ RX = new ReactAplication();
+
+
+
+ }
+
+ //------------------ BUSCA OBJETOS ----------------
+
+
+ // level 3
+ public JSONObject searchLevelTree(String jsonString,
+ String clssString,
+ String fieldString,
+ int maxSize) {
+
+ String levelZero = clssString;
+ String nameZero = null;
+ String nameOne = null;
+
+ boolean resultOne = false;
+ boolean resultTwo = false;
+
+ try {
+
+ objZero = new JSONObject(jsonString);
+ nameZero = objZero.names().getString(0);
+
+ objOne = objZero.getJSONObject(nameZero);
+ // objTwo = objOne.getJSONArray(nameZero);
+
+ // Log.e("FUND","nameZero = " + nameZero);
+
+ resultOne = (jsonString.length()>0 && jsonString.length()< maxSize);
+ // resultTwo = (jsonString.length()>0 && jsonString.length()< maxSize);
+
+ String msgFlow = ("SEARCH:" +clssString +", " +
+ " RESULT:" + resultOne + "," +
+ " SIZE:"+jsonString.length()+"," +
+ " MAX SIZE:" + maxSize);
+
+ // RX.onNext("objZero.length():" + objZero.length());
+
+ if(resultOne) {
+
+ for (int i = 0; i < objOne.length(); i++) {
+
+ String key = objOne.names().getString(i) +"";
+ String val = objOne.get(objOne.names().getString(i)) + "";
+ // Log.v("FUND", "@KEY: " +key + " @VALUE:" + val);
+
+ if(key.equals(clssString+"")) {
+
+ // objTwo = objOne.getJSONArray(key);
+ objTwo = objOne.getJSONObject(key);
+ // Log.v("FUND", "@objTwo: " +key + " @length:" + objTwo.length());
+
+ for (int i2 = 0; i2 < objTwo.length(); i2++) {
+
+ String key2 = objTwo.names().getString(i2) +"";
+ String val2 = objTwo.get(objTwo.names().getString(i2)) + "";
+ //Log.v("FUND", "@KEY: " +key2 + " @VALUE:" + val2);
+
+ if(key2.equals(fieldString+"")) {
+
+ objTree = objTwo.getJSONObject(key2);
+ Log.v("FUND", "@objTree: " +key + " @length:" + objTree.length());
+
+ for (int i3 = 0; i3 < objTree.length(); i3++) {
+
+ String key3 = objTree.names().getString(i3) +"";
+ String val3 = objTree.get(objTree.names().getString(i3)) + "";
+
+ Log.v("FUND", "@KEY: " +key3 + " @VALUE:" + val3);
+
+ }
+
+ }
+
+
+ }
+
+ //nameOne = objZero.names().getString(0);
+ }
+
+ }
+
+ // RX.onNext(msgFlow);
+ RX.onNext("resultOne:" + resultOne);
+ }else{
+ RX.onNext("resultOne:" + resultOne);
+ }
+
+ }catch(JSONException e){
+ Log.e("FUND", e.getMessage());
+ // RX.onError(e);
+ }catch (Exception e){
+ RX.onError(e);
+ }
+
+ return objZero;
+ }
+
+
+ // level 1
+ public JSONObject searchLevelOne(String jsonString,
+ String clssString,
+ int maxSize) {
+
+ String levelZero = clssString;
+ String nameZero = null;
+ String nameOne = null;
+
+ boolean resultOne = false;
+ boolean resultTwo = false;
+
+ try {
+
+ objZero = new JSONObject(jsonString);
+ nameZero = objZero.names().getString(0);
+
+ objOne = objZero.getJSONObject(nameZero);
+ // objTwo = objOne.getJSONArray(nameZero);
+
+ // Log.e("FUND","nameZero = " + nameZero);
+
+ resultOne = (jsonString.length()>0 && jsonString.length()< maxSize);
+ // resultTwo = (jsonString.length()>0 && jsonString.length()< maxSize);
+
+ String msgFlow = ("SEARCH:" +clssString +", " +
+ " RESULT:" + resultOne + "," +
+ " SIZE:"+jsonString.length()+"," +
+ " MAX SIZE:" + maxSize);
+
+ // RX.onNext("objZero.length():" + objZero.length());
+
+ if(resultOne) {
+
+ for (int i = 0; i < objOne.length(); i++) {
+
+ String key = objOne.names().getString(i) +"";
+ String val = objOne.get(objOne.names().getString(i)) + "";
+ // Log.v("FUND", "@KEY: " +key + " @VALUE:" + val);
+
+ if(key.equals(clssString+"")) {
+
+ // objTwo = objOne.getJSONArray(key);
+ objTwo = objOne.getJSONObject(key);
+ Log.v("FUND", "@objTwo: " +key + " @length:" + objTwo.length());
+
+ for (int i2 = 0; i2 < objTwo.length(); i2++) {
+
+ String key2 = objTwo.names().getString(i2) +"";
+ String val2 = objTwo.get(objTwo.names().getString(i2)) + "";
+ Log.v("FUND", "@KEY: " +key2 + " @VALUE:" + val2);
+
+ }
+
+ //nameOne = objZero.names().getString(0);
+ }
+
+ }
+
+ // RX.onNext(msgFlow);
+ RX.onNext("resultOne:" + resultOne);
+ }else{
+ RX.onNext("resultOne:" + resultOne);
+ }
+
+ }catch(JSONException e){
+ Log.e("FUND", e.getMessage());
+ // RX.onError(e);
+ }catch (Exception e){
+ RX.onError(e);
+ }
+
+ return objZero;
+ }
+
+
+ // level 0
+ public JSONObject searchLevelZero(String jsonString,
+ String clssString,
+ int maxSize) {
+
+ String levelZero = clssString;
+ boolean resultOne = false;
+
+ try {
+
+ objZero = new JSONObject(jsonString);
+ objOne = objZero.getJSONObject(clssString);
+ objOne = objZero.getJSONObject(clssString);
+
+ resultOne = (jsonString.length()>0 && jsonString.length()< maxSize);
+
+ String msgFlow = ("SEARCH:" +clssString +", " +
+ " RESULT:" + resultOne + "," +
+ " SIZE:"+jsonString.length()+"," +
+ " MAX SIZE:" + maxSize);
+
+ if(resultOne) {
+
+ RX.onNext(msgFlow);
+
+ //Log.v("FUND", "" +mapKey + " = " + mapValue);
+
+ for (int i = 0; i < objOne.names().length(); i++) {
+
+ String key = objOne.names().getString(i) +"";
+ String val = objOne.get(objOne.names().getString(i)) + "";
+ Log.v("FUND", "KEY:" +key + " VALUE:" + val);
+
+ }
+
+ RX.onNext("SUCESSO");
+ }else{
+ RX.onNext("resultOne:" + resultOne);
+ }
+
+ }catch(JSONException e){
+ RX.onError(e);
+ }catch (Exception e){
+ RX.onError(e);
+ }
+
+ return objZero;
+ }
+
+
+
+ //------------------ BUSCA ARRAYS ----------------
+
+
+ //level 2
+ public JSONObject searchLevelOneArray(String jsonString,
+ String clssString,
+ int maxSize) {
+
+ String levelZero = clssString;
+ String nameZero = null;
+ String nameOne = null;
+
+ boolean resultOne = false;
+ boolean resultTwo = false;
+ JSONArray arraTwo;
+
+ try {
+
+ objZero = new JSONObject(jsonString);
+ nameZero = objZero.names().getString(0);
+ objOne = objZero.getJSONObject(nameZero);
+ // objTwo = objOne.getJSONArray(nameZero);
+ // Log.d("FUND","nameZero = " + nameZero);
+
+ resultOne = (jsonString.length()>0 && jsonString.length()< maxSize);
+ // resultTwo = (jsonString.length()>0 && jsonString.length()< maxSize);
+
+ String msgFlow = ("SEARCH:" +clssString +", " +
+ " RESULT:" + resultOne + "," +
+ " SIZE:"+jsonString.length()+"," +
+ " MAX SIZE:" + maxSize);
+
+ // RX.onNext("msgFlow:" + msgFlow);
+
+ if(resultOne) {
+
+ for (int i = 0; i < objOne.length(); i++) {
+
+ String key = objOne.names().getString(i) +"";
+ String val = objOne.get(objOne.names().getString(i)) + "";
+ //Log.v("FUND", "@KEY: " +key + " @VALUE:" + val);
+
+ //RX.onNext("msgFlow:" + msgFlow);
+ if(key.equals(clssString+"")) {
+
+ //objTwo = objOne.getJSONArray(key);
+ // objTwo = objOne.getJSONObject(key);
+ arrayOne = objOne.getJSONArray(key);
+ //Log.d("FUND", "@arrayOne: " +arrayOne + " @length:" + arrayOne.length() + "");
+
+ for (int i2 = 0; i2 < arrayOne.length(); i2++) {
+
+
+ // String key2 = objTwo.names().getString(i2) +"";
+ //String key2 = objTwo.names().getString(i2) +"";
+
+ Log.d( "FUND", "OBJ = " + arrayOne.get(i2).toString());
+
+ // String val2 = objTwo.get(objOne.names().getString(i)) + "";
+
+ // Log.v("FUND", "@KEY: " +key2 + " @VALUE:" + key2);
+
+ }
+
+ //nameOne = objZero.names().getString(0);
+ }
+
+ }
+
+ // RX.onNext(msgFlow);
+ RX.onNext("resultOne:" + resultOne);
+ }else{
+ RX.onNext("resultOne:" + resultOne);
+ }
+
+ }catch(JSONException e){
+ RX.onError(e);
+ }catch (Exception e){
+ RX.onError(e);
+ }
+
+ return objZero;
+ }
+
+
+
+
+ //level 3
+ public JSONObject searchLevelTreeArray(String jsonString,
+ String clssString,
+ String fieldString,
+ int maxSize) {
+
+ String levelZero = clssString;
+ String nameZero = null;
+ String nameOne = null;
+
+ boolean resultOne = false;
+ boolean resultTwo = false;
+ JSONArray arraTwo;
+
+ try {
+
+ objZero = new JSONObject(jsonString);
+ nameZero = objZero.names().getString(0);
+ objOne = objZero.getJSONObject(nameZero);
+ // objTwo = objOne.getJSONArray(nameZero);
+ // Log.d("FUND","nameZero = " + nameZero);
+
+ resultOne = (jsonString.length()>0 && jsonString.length()< maxSize);
+ // resultTwo = (jsonString.length()>0 && jsonString.length()< maxSize);
+
+ String msgFlow = ("SEARCH:" +clssString +", " +
+ " RESULT:" + resultOne + "," +
+ " SIZE:"+jsonString.length()+"," +
+ " MAX SIZE:" + maxSize);
+
+ // RX.onNext("msgFlow:" + msgFlow);
+
+ if(resultOne) {
+
+ for (int i = 0; i < objOne.length(); i++) {
+
+ String key = objOne.names().getString(i) +"";
+ String val = objOne.get(objOne.names().getString(i)) + "";
+ //Log.v("FUND", "@KEY: " +key + " @VALUE:" + val);
+
+ //RX.onNext("msgFlow:" + msgFlow);
+ if(key.equals(clssString+"")) {
+
+ //objTwo = objOne.getJSONArray(key);
+ // objTwo = objOne.getJSONObject(key);
+ arrayOne = objOne.getJSONArray(key);
+ //Log.d("FUND", "@arrayOne: " +arrayOne + " @length:" + arrayOne.length() + "");
+
+ for (int i2 = 0; i2 < arrayOne.length(); i2++) {
+
+ // String key2 = objTwo.names().getString(i2) +"";
+ //String key2 = objTwo.names().getString(i2) +"";
+
+ String key2 = arrayOne.get(i2).toString() +"";
+ Log.d( "FUND", "ARRAY = " + key2);
+
+ if(key2.equals(fieldString+"")) {
+
+
+ // nameZero = arrayOne.getString(key2.toS);
+
+ //objTwo = arrayOne.getJSONObject(key2);
+ // arrayTwo = arrayOne.getJSONArray(key2);
+ // JSONArray arrAtores = arrayTwo.getJSONObject();
+
+ //Log.d( "FUND", "objTwo = " + key2.length());
+
+ // for (int i3 = 0; i3< objTwo.length(); i3++) {
+
+ // String key2 = objTwo.names().getString(i3) +"";
+ //String key2 = objTwo.names().getString(i3) +"";
+
+ // Log.v("FUND", "@KEY: " + key2 + " @VALUE:" + key2);
+ // }
+
+ }
+
+ }
+
+ //nameOne = objZero.names().getString(0);
+ }
+
+ }
+
+ // RX.onNext(msgFlow);
+ RX.onNext("resultOne:" + resultOne);
+ }else{
+ RX.onNext("resultOne:" + resultOne);
+ }
+
+ }catch(JSONException e){
+ RX.onError(e);
+ }catch (Exception e){
+ RX.onError(e);
+ }
+
+ return objZero;
+ }
+
+
+
+
+
+
+
+
+
+}
+
diff --git a/app/src/main/java/br/banco/services/app/utils/JsonConvertTypes.java b/app/src/main/java/br/banco/services/app/utils/JsonConvertTypes.java
new file mode 100644
index 00000000..174bbab9
--- /dev/null
+++ b/app/src/main/java/br/banco/services/app/utils/JsonConvertTypes.java
@@ -0,0 +1,261 @@
+package br.banco.services.app.utils;
+
+import android.util.Log;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+public class JsonConvertTypes {
+
+
+ public Map dataToMap = new HashMap();
+
+ public void convertTo(String origin) {
+
+
+
+ String className = "screen";
+ // origin = "xxxx";
+
+ JSONObject jsonObject = convertStringJson( origin, className );
+ // dataToMap = convertToMap(origin);
+
+ // String TES = convertClassName(jsonObject, className);
+
+ }
+
+
+
+ // OK
+
+
+ // OK
+ public JSONObject convertStringJson(String origin, String className) {
+
+ try{
+
+ if( origin.length() > 0 ) {
+
+ Log.d("FUND", "convertStringJson -> SUCESS");
+
+ JSONObject json = new JSONObject(origin);
+ JSONObject parts = json.getJSONObject(className);
+
+ return parts;
+ }
+ else {
+ return null;
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Log.d("FUND", "convertStringJson -> ERROR - >" + e.toString());
+ return null;
+ }
+
+ }
+
+ // OK
+ public String convertClassName(JSONObject json, String className){
+
+ String classFinal = "A";
+ // String ClassConvert = className.substring(0, 1).toUpperCase() + className.substring(1);
+
+ try {
+ JSONObject mainObj = json.getJSONObject("screen");
+
+ if (mainObj.length() == 10) {
+
+ for(int i = 0; i SUCESS" + classFinal );
+
+ } else {
+ Log.d("FUND", "convertClassName -> ERROR" );
+ return null;
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Log.d("FUND", "convertClassName -> ERROR - >" + e.toString());
+ return null;
+ }
+
+
+
+
+
+
+ /*
+
+ try {
+ // Field[] fields = classeTry.getFields();
+ //Object fieldType = field.getType();
+
+
+ Screen screen = new Screen();
+ Class classeTry = screen.getClass();
+
+
+
+ Field nameField = classeTry.getField("title");
+
+ Log.v("FUND", "convertClassName -> SUCESSO " + nameField);
+
+ } catch(NoSuchFieldException e) {
+ Log.v("FUND", "convertClassName -> ERRO -> " +e.toString() + " ");
+ }
+ */
+
+ return classFinal;
+ }
+
+
+ public static Map loadMap(JSONObject json) throws JSONException {
+
+ Map retMap = new HashMap();
+
+ if(json != JSONObject.NULL) {
+ retMap = jsonToMap(json);
+ }
+ return retMap;
+ }
+
+ public Map convertToMap(String origin){
+
+ Map dataToMap = new HashMap();
+ boolean error = false;
+
+ try {
+ JSONObject json = new JSONObject(origin);
+ JSONObject mainObj = json.getJSONObject("screen");
+
+ if (mainObj.length() == 10) {
+
+ for(int i = 0; i SUCESS" );
+
+ } else {
+ Log.d("FUND", "convertToMap -> ERROR < 10" );
+ return null;
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Log.d("FUND", "convertToMap -> ERROR - >" + e.toString());
+ return null;
+ }
+ return dataToMap;
+ }
+
+ public String jsonMapToSring (HashMap mainObj){
+
+ String destiny = null;
+
+ if (mainObj.size() == 10) {
+
+ for(int i = 0; i < mainObj.size(); i++){
+
+ String mapKey = mainObj.get(i) +"";
+ String mapValue = mainObj.get(i) + "";
+
+ dataToMap.put(mapKey, mapValue);
+
+ Log.v("FUND", "" +mapKey + " = " + mapValue);
+ }
+ Log.d("FUND", "convertToMap -> SUCESS" );
+
+ } else {
+ Log.d("FUND", "convertToMap -> ERROR < 10" );
+ return null;
+ }
+
+ return destiny;
+ }
+
+ public static Map jsonToMap(JSONObject object) throws JSONException {
+ Map map = new HashMap();
+
+ Iterator keysItr = object.keys();
+ while(keysItr.hasNext()) {
+ String key = keysItr.next();
+ Object value = object.get(key);
+
+ if(value instanceof JSONArray) {
+ value = jsonToList((JSONArray) value);
+ }
+
+ else if(value instanceof JSONObject) {
+ value = jsonToMap((JSONObject) value);
+ }
+ map.put(key, value);
+ }
+ return map;
+ }
+
+ public static List